aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/acpi/glue.c12
-rw-r--r--drivers/acpi/scan.c9
-rw-r--r--include/acpi/acpi_bus.h2
3 files changed, 19 insertions, 4 deletions
diff --git a/drivers/acpi/glue.c b/drivers/acpi/glue.c
index 0c789224d40d..f774c65ecb8b 100644
--- a/drivers/acpi/glue.c
+++ b/drivers/acpi/glue.c
@@ -287,6 +287,7 @@ EXPORT_SYMBOL_GPL(acpi_unbind_one);
287static int acpi_platform_notify(struct device *dev) 287static int acpi_platform_notify(struct device *dev)
288{ 288{
289 struct acpi_bus_type *type = acpi_get_bus_type(dev); 289 struct acpi_bus_type *type = acpi_get_bus_type(dev);
290 struct acpi_device *adev;
290 int ret; 291 int ret;
291 292
292 ret = acpi_bind_one(dev, NULL); 293 ret = acpi_bind_one(dev, NULL);
@@ -303,9 +304,14 @@ static int acpi_platform_notify(struct device *dev)
303 if (ret) 304 if (ret)
304 goto out; 305 goto out;
305 } 306 }
307 adev = ACPI_COMPANION(dev);
308 if (!adev)
309 goto out;
306 310
307 if (type && type->setup) 311 if (type && type->setup)
308 type->setup(dev); 312 type->setup(dev);
313 else if (adev->handler && adev->handler->bind)
314 adev->handler->bind(dev);
309 315
310 out: 316 out:
311#if ACPI_GLUE_DEBUG 317#if ACPI_GLUE_DEBUG
@@ -324,11 +330,17 @@ static int acpi_platform_notify(struct device *dev)
324 330
325static int acpi_platform_notify_remove(struct device *dev) 331static int acpi_platform_notify_remove(struct device *dev)
326{ 332{
333 struct acpi_device *adev = ACPI_COMPANION(dev);
327 struct acpi_bus_type *type; 334 struct acpi_bus_type *type;
328 335
336 if (!adev)
337 return 0;
338
329 type = acpi_get_bus_type(dev); 339 type = acpi_get_bus_type(dev);
330 if (type && type->cleanup) 340 if (type && type->cleanup)
331 type->cleanup(dev); 341 type->cleanup(dev);
342 else if (adev->handler && adev->handler->unbind)
343 adev->handler->unbind(dev);
332 344
333 acpi_unbind_one(dev); 345 acpi_unbind_one(dev);
334 return 0; 346 return 0;
diff --git a/drivers/acpi/scan.c b/drivers/acpi/scan.c
index 57b053f424d1..9c4581fd5827 100644
--- a/drivers/acpi/scan.c
+++ b/drivers/acpi/scan.c
@@ -2015,13 +2015,14 @@ static int acpi_scan_attach_handler(struct acpi_device *device)
2015 2015
2016 handler = acpi_scan_match_handler(hwid->id, &devid); 2016 handler = acpi_scan_match_handler(hwid->id, &devid);
2017 if (handler) { 2017 if (handler) {
2018 device->handler = handler;
2018 ret = handler->attach(device, devid); 2019 ret = handler->attach(device, devid);
2019 if (ret > 0) { 2020 if (ret > 0)
2020 device->handler = handler;
2021 break; 2021 break;
2022 } else if (ret < 0) { 2022
2023 device->handler = NULL;
2024 if (ret < 0)
2023 break; 2025 break;
2024 }
2025 } 2026 }
2026 } 2027 }
2027 return ret; 2028 return ret;
diff --git a/include/acpi/acpi_bus.h b/include/acpi/acpi_bus.h
index 8256eb4ad057..c93bce469492 100644
--- a/include/acpi/acpi_bus.h
+++ b/include/acpi/acpi_bus.h
@@ -133,6 +133,8 @@ struct acpi_scan_handler {
133 struct list_head list_node; 133 struct list_head list_node;
134 int (*attach)(struct acpi_device *dev, const struct acpi_device_id *id); 134 int (*attach)(struct acpi_device *dev, const struct acpi_device_id *id);
135 void (*detach)(struct acpi_device *dev); 135 void (*detach)(struct acpi_device *dev);
136 void (*bind)(struct device *phys_dev);
137 void (*unbind)(struct device *phys_dev);
136 struct acpi_hotplug_profile hotplug; 138 struct acpi_hotplug_profile hotplug;
137}; 139};
138 140