Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

PNP: Switch from __check_region() to __request_region()

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>

authored by

Jakub Sitnicki and committed by
Rafael J. Wysocki
eeeb98bf ec6f34e5

+4 -2
+4 -2
drivers/pnp/resource.c
··· 179 179 /* check if the resource is already in use, skip if the 180 180 * device is active because it itself may be in use */ 181 181 if (!dev->active) { 182 - if (__check_region(&ioport_resource, *port, length(port, end))) 182 + if (!request_region(*port, length(port, end), "pnp")) 183 183 return 0; 184 + release_region(*port, length(port, end)); 184 185 } 185 186 186 187 /* check if the resource is reserved */ ··· 242 241 /* check if the resource is already in use, skip if the 243 242 * device is active because it itself may be in use */ 244 243 if (!dev->active) { 245 - if (check_mem_region(*addr, length(addr, end))) 244 + if (!request_mem_region(*addr, length(addr, end), "pnp")) 246 245 return 0; 246 + release_mem_region(*addr, length(addr, end)); 247 247 } 248 248 249 249 /* check if the resource is reserved */