aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/pnp
diff options
context:
space:
mode:
authorZhang Rui <rui.zhang@intel.com>2013-09-02 20:32:08 -0400
committerRafael J. Wysocki <rafael.j.wysocki@intel.com>2013-09-23 19:37:56 -0400
commit0e77e2c416e8fa110fa0e749db0ae1e9344b6050 (patch)
tree75f4ec35d67529188439dd6aee320c5df66e55a9 /drivers/pnp
parent54f14c277d78cd4fee860f5daf391a5759f8596f (diff)
pnpacpi: convert acpi_get_handle() to acpi_has_method()
acpi_has_method() is a new ACPI API introduced to check the existence of an ACPI control method. It can be used to replace acpi_get_handle() in the case that 1. the calling function doesn't need the ACPI handle of the control method. and 2. the calling function doesn't care the reason why the method is unavailable. Convert acpi_get_handle() to acpi_has_method() in drivers/pnp/pnpacpi/core.c in this patch. Signed-off-by: Zhang Rui <rui.zhang@intel.com> CC: Bjorn Helgaas <bhelgaas@google.com> Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Diffstat (limited to 'drivers/pnp')
-rw-r--r--drivers/pnp/pnpacpi/core.c11
1 files changed, 3 insertions, 8 deletions
diff --git a/drivers/pnp/pnpacpi/core.c b/drivers/pnp/pnpacpi/core.c
index 34049b0b4c73..747826d99059 100644
--- a/drivers/pnp/pnpacpi/core.c
+++ b/drivers/pnp/pnpacpi/core.c
@@ -239,8 +239,6 @@ static char *__init pnpacpi_get_id(struct acpi_device *device)
239 239
240static int __init pnpacpi_add_device(struct acpi_device *device) 240static int __init pnpacpi_add_device(struct acpi_device *device)
241{ 241{
242 acpi_handle temp = NULL;
243 acpi_status status;
244 struct pnp_dev *dev; 242 struct pnp_dev *dev;
245 char *pnpid; 243 char *pnpid;
246 struct acpi_hardware_id *id; 244 struct acpi_hardware_id *id;
@@ -253,8 +251,7 @@ static int __init pnpacpi_add_device(struct acpi_device *device)
253 * If a PnPacpi device is not present , the device 251 * If a PnPacpi device is not present , the device
254 * driver should not be loaded. 252 * driver should not be loaded.
255 */ 253 */
256 status = acpi_get_handle(device->handle, "_CRS", &temp); 254 if (!acpi_has_method(device->handle, "_CRS"))
257 if (ACPI_FAILURE(status))
258 return 0; 255 return 0;
259 256
260 pnpid = pnpacpi_get_id(device); 257 pnpid = pnpacpi_get_id(device);
@@ -271,16 +268,14 @@ static int __init pnpacpi_add_device(struct acpi_device *device)
271 dev->data = device; 268 dev->data = device;
272 /* .enabled means the device can decode the resources */ 269 /* .enabled means the device can decode the resources */
273 dev->active = device->status.enabled; 270 dev->active = device->status.enabled;
274 status = acpi_get_handle(device->handle, "_SRS", &temp); 271 if (acpi_has_method(device->handle, "_SRS"))
275 if (ACPI_SUCCESS(status))
276 dev->capabilities |= PNP_CONFIGURABLE; 272 dev->capabilities |= PNP_CONFIGURABLE;
277 dev->capabilities |= PNP_READ; 273 dev->capabilities |= PNP_READ;
278 if (device->flags.dynamic_status && (dev->capabilities & PNP_CONFIGURABLE)) 274 if (device->flags.dynamic_status && (dev->capabilities & PNP_CONFIGURABLE))
279 dev->capabilities |= PNP_WRITE; 275 dev->capabilities |= PNP_WRITE;
280 if (device->flags.removable) 276 if (device->flags.removable)
281 dev->capabilities |= PNP_REMOVABLE; 277 dev->capabilities |= PNP_REMOVABLE;
282 status = acpi_get_handle(device->handle, "_DIS", &temp); 278 if (acpi_has_method(device->handle, "_DIS"))
283 if (ACPI_SUCCESS(status))
284 dev->capabilities |= PNP_DISABLE; 279 dev->capabilities |= PNP_DISABLE;
285 280
286 if (strlen(acpi_device_name(device))) 281 if (strlen(acpi_device_name(device)))