aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/pnp
diff options
context:
space:
mode:
authorRafael J. Wysocki <rafael.j.wysocki@intel.com>2013-11-29 10:27:34 -0500
committerRafael J. Wysocki <rafael.j.wysocki@intel.com>2013-12-06 19:05:50 -0500
commite3f02c5228c4b600abf6ca243301176f25553bd5 (patch)
treea3b5372f137fb8396ffe036e4c0c3cabea06b838 /drivers/pnp
parent9c5ad36d987a1b06f6b0b9dc7bc61a45d277455d (diff)
ACPI / bind: Rework struct acpi_bus_type
Replace the .find_device function pointer in struct acpi_bus_type with a new one, .find_companion, that is supposed to point to a function returning struct acpi_device pointer (instead of an int) and takes one argument (instead of two). This way the role of this callback is more clear and the implementation of it can be more straightforward. Update all of the users of struct acpi_bus_type (PCI, PNP/ACPI and USB) to reflect the structure change. Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com> Tested-by: Lan Tianyu <tianyu.lan@intel.com> # for USB/ACPI
Diffstat (limited to 'drivers/pnp')
-rw-r--r--drivers/pnp/pnpacpi/core.c21
1 files changed, 8 insertions, 13 deletions
diff --git a/drivers/pnp/pnpacpi/core.c b/drivers/pnp/pnpacpi/core.c
index e869ba698ac0..156d14e2587e 100644
--- a/drivers/pnp/pnpacpi/core.c
+++ b/drivers/pnp/pnpacpi/core.c
@@ -328,20 +328,15 @@ static int __init acpi_pnp_match(struct device *dev, void *_pnp)
328 && compare_pnp_id(pnp->id, acpi_device_hid(acpi)); 328 && compare_pnp_id(pnp->id, acpi_device_hid(acpi));
329} 329}
330 330
331static int __init acpi_pnp_find_device(struct device *dev, acpi_handle * handle) 331static struct acpi_device * __init acpi_pnp_find_companion(struct device *dev)
332{ 332{
333 struct device *adev; 333 dev = bus_find_device(&acpi_bus_type, NULL, to_pnp_dev(dev),
334 struct acpi_device *acpi; 334 acpi_pnp_match);
335 335 if (!dev)
336 adev = bus_find_device(&acpi_bus_type, NULL, 336 return NULL;
337 to_pnp_dev(dev), acpi_pnp_match);
338 if (!adev)
339 return -ENODEV;
340 337
341 acpi = to_acpi_device(adev); 338 put_device(dev);
342 *handle = acpi->handle; 339 return to_acpi_device(dev);
343 put_device(adev);
344 return 0;
345} 340}
346 341
347/* complete initialization of a PNPACPI device includes having 342/* complete initialization of a PNPACPI device includes having
@@ -355,7 +350,7 @@ static bool acpi_pnp_bus_match(struct device *dev)
355static struct acpi_bus_type __initdata acpi_pnp_bus = { 350static struct acpi_bus_type __initdata acpi_pnp_bus = {
356 .name = "PNP", 351 .name = "PNP",
357 .match = acpi_pnp_bus_match, 352 .match = acpi_pnp_bus_match,
358 .find_device = acpi_pnp_find_device, 353 .find_companion = acpi_pnp_find_companion,
359}; 354};
360 355
361int pnpacpi_disabled __initdata; 356int pnpacpi_disabled __initdata;