aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/acpi
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/acpi
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/acpi')
-rw-r--r--drivers/acpi/glue.c12
1 files changed, 7 insertions, 5 deletions
diff --git a/drivers/acpi/glue.c b/drivers/acpi/glue.c
index c0d18b2145c1..7608d66f289b 100644
--- a/drivers/acpi/glue.c
+++ b/drivers/acpi/glue.c
@@ -37,7 +37,7 @@ int register_acpi_bus_type(struct acpi_bus_type *type)
37{ 37{
38 if (acpi_disabled) 38 if (acpi_disabled)
39 return -ENODEV; 39 return -ENODEV;
40 if (type && type->match && type->find_device) { 40 if (type && type->match && type->find_companion) {
41 down_write(&bus_type_sem); 41 down_write(&bus_type_sem);
42 list_add_tail(&type->list, &bus_type_list); 42 list_add_tail(&type->list, &bus_type_list);
43 up_write(&bus_type_sem); 43 up_write(&bus_type_sem);
@@ -302,17 +302,19 @@ EXPORT_SYMBOL_GPL(acpi_unbind_one);
302static int acpi_platform_notify(struct device *dev) 302static int acpi_platform_notify(struct device *dev)
303{ 303{
304 struct acpi_bus_type *type = acpi_get_bus_type(dev); 304 struct acpi_bus_type *type = acpi_get_bus_type(dev);
305 acpi_handle handle;
306 int ret; 305 int ret;
307 306
308 ret = acpi_bind_one(dev, NULL); 307 ret = acpi_bind_one(dev, NULL);
309 if (ret && type) { 308 if (ret && type) {
310 ret = type->find_device(dev, &handle); 309 struct acpi_device *adev;
311 if (ret) { 310
311 adev = type->find_companion(dev);
312 if (!adev) {
312 DBG("Unable to get handle for %s\n", dev_name(dev)); 313 DBG("Unable to get handle for %s\n", dev_name(dev));
314 ret = -ENODEV;
313 goto out; 315 goto out;
314 } 316 }
315 ret = acpi_bind_one(dev, handle); 317 ret = acpi_bind_one(dev, adev->handle);
316 if (ret) 318 if (ret)
317 goto out; 319 goto out;
318 } 320 }