Skip to content

Commit

Permalink
PNP: Switch from __check_region() to __request_region()
Browse files Browse the repository at this point in the history
PNP core is the last user of the __check_region() which has been
deprecated for almost 12 years (since v2.5.54). Replace it with a combo
of __request_region() followed by __release_region().

pnp_check_port() and pnp_check_mem() remain racy after this change.

Signed-off-by: Jakub Sitnicki <jsitnicki@gmail.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
  • Loading branch information
Jakub Sitnicki authored and Rafael J. Wysocki committed Jan 22, 2015
1 parent ec6f34e commit eeeb98b
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions drivers/pnp/resource.c
Original file line number Diff line number Diff line change
Expand Up @@ -179,8 +179,9 @@ int pnp_check_port(struct pnp_dev *dev, struct resource *res)
/* check if the resource is already in use, skip if the
* device is active because it itself may be in use */
if (!dev->active) {
if (__check_region(&ioport_resource, *port, length(port, end)))
if (!request_region(*port, length(port, end), "pnp"))
return 0;
release_region(*port, length(port, end));
}

/* check if the resource is reserved */
Expand Down Expand Up @@ -241,8 +242,9 @@ int pnp_check_mem(struct pnp_dev *dev, struct resource *res)
/* check if the resource is already in use, skip if the
* device is active because it itself may be in use */
if (!dev->active) {
if (check_mem_region(*addr, length(addr, end)))
if (!request_mem_region(*addr, length(addr, end), "pnp"))
return 0;
release_mem_region(*addr, length(addr, end));
}

/* check if the resource is reserved */
Expand Down

0 comments on commit eeeb98b

Please sign in to comment.