aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
Diffstat (limited to 'drivers')
-rw-r--r--drivers/acpi/internal.h5
-rw-r--r--drivers/acpi/power.c3
-rw-r--r--drivers/acpi/scan.c20
3 files changed, 20 insertions, 8 deletions
diff --git a/drivers/acpi/internal.h b/drivers/acpi/internal.h
index 1f004f35bc67..c5a61cd6c1a5 100644
--- a/drivers/acpi/internal.h
+++ b/drivers/acpi/internal.h
@@ -40,10 +40,11 @@ static inline void acpi_debugfs_init(void) { return; }
40#define ACPI_STA_DEFAULT (ACPI_STA_DEVICE_PRESENT | ACPI_STA_DEVICE_ENABLED | \ 40#define ACPI_STA_DEFAULT (ACPI_STA_DEVICE_PRESENT | ACPI_STA_DEVICE_ENABLED | \
41 ACPI_STA_DEVICE_UI | ACPI_STA_DEVICE_FUNCTIONING) 41 ACPI_STA_DEVICE_UI | ACPI_STA_DEVICE_FUNCTIONING)
42 42
43int acpi_device_register(struct acpi_device *device, 43int acpi_device_add(struct acpi_device *device,
44 void (*release)(struct device *)); 44 void (*release)(struct device *));
45void acpi_init_device_object(struct acpi_device *device, acpi_handle handle, 45void acpi_init_device_object(struct acpi_device *device, acpi_handle handle,
46 int type, unsigned long long sta); 46 int type, unsigned long long sta);
47void acpi_device_add_finalize(struct acpi_device *device);
47void acpi_free_ids(struct acpi_device *device); 48void acpi_free_ids(struct acpi_device *device);
48 49
49/* -------------------------------------------------------------------------- 50/* --------------------------------------------------------------------------
diff --git a/drivers/acpi/power.c b/drivers/acpi/power.c
index 6db261c237d4..3f16dd4db23e 100644
--- a/drivers/acpi/power.c
+++ b/drivers/acpi/power.c
@@ -721,13 +721,14 @@ int acpi_add_power_resource(acpi_handle handle)
721 acpi_device_bid(device), state ? "on" : "off"); 721 acpi_device_bid(device), state ? "on" : "off");
722 722
723 device->flags.match_driver = true; 723 device->flags.match_driver = true;
724 result = acpi_device_register(device, acpi_release_power_resource); 724 result = acpi_device_add(device, acpi_release_power_resource);
725 if (result) 725 if (result)
726 goto err; 726 goto err;
727 727
728 mutex_lock(&power_resource_list_lock); 728 mutex_lock(&power_resource_list_lock);
729 list_add(&resource->list_node, &acpi_power_resource_list); 729 list_add(&resource->list_node, &acpi_power_resource_list);
730 mutex_unlock(&power_resource_list_lock); 730 mutex_unlock(&power_resource_list_lock);
731 acpi_device_add_finalize(device);
731 return 0; 732 return 0;
732 733
733 err: 734 err:
diff --git a/drivers/acpi/scan.c b/drivers/acpi/scan.c
index 1fc57a349a3c..8b3b18846c8c 100644
--- a/drivers/acpi/scan.c
+++ b/drivers/acpi/scan.c
@@ -634,8 +634,8 @@ struct bus_type acpi_bus_type = {
634 .uevent = acpi_device_uevent, 634 .uevent = acpi_device_uevent,
635}; 635};
636 636
637int acpi_device_register(struct acpi_device *device, 637int acpi_device_add(struct acpi_device *device,
638 void (*release)(struct device *)) 638 void (*release)(struct device *))
639{ 639{
640 int result; 640 int result;
641 struct acpi_device_bus_id *acpi_device_bus_id, *new_bus_id; 641 struct acpi_device_bus_id *acpi_device_bus_id, *new_bus_id;
@@ -705,7 +705,7 @@ int acpi_device_register(struct acpi_device *device,
705 device->dev.parent = &device->parent->dev; 705 device->dev.parent = &device->parent->dev;
706 device->dev.bus = &acpi_bus_type; 706 device->dev.bus = &acpi_bus_type;
707 device->dev.release = release; 707 device->dev.release = release;
708 result = device_register(&device->dev); 708 result = device_add(&device->dev);
709 if (result) { 709 if (result) {
710 dev_err(&device->dev, "Error registering device\n"); 710 dev_err(&device->dev, "Error registering device\n");
711 goto err; 711 goto err;
@@ -744,12 +744,13 @@ static void acpi_device_unregister(struct acpi_device *device)
744 744
745 acpi_power_add_remove_device(device, false); 745 acpi_power_add_remove_device(device, false);
746 acpi_device_remove_files(device); 746 acpi_device_remove_files(device);
747 device_unregister(&device->dev); 747 device_del(&device->dev);
748 /* 748 /*
749 * Drop the reference counts of all power resources the device depends 749 * Drop the reference counts of all power resources the device depends
750 * on and turn off the ones that have no more references. 750 * on and turn off the ones that have no more references.
751 */ 751 */
752 acpi_power_transition(device, ACPI_STATE_D3_COLD); 752 acpi_power_transition(device, ACPI_STATE_D3_COLD);
753 put_device(&device->dev);
753} 754}
754 755
755/* -------------------------------------------------------------------------- 756/* --------------------------------------------------------------------------
@@ -1391,6 +1392,14 @@ void acpi_init_device_object(struct acpi_device *device, acpi_handle handle,
1391 acpi_device_get_busid(device); 1392 acpi_device_get_busid(device);
1392 acpi_device_set_id(device); 1393 acpi_device_set_id(device);
1393 acpi_bus_get_flags(device); 1394 acpi_bus_get_flags(device);
1395 device_initialize(&device->dev);
1396 dev_set_uevent_suppress(&device->dev, true);
1397}
1398
1399void acpi_device_add_finalize(struct acpi_device *device)
1400{
1401 dev_set_uevent_suppress(&device->dev, false);
1402 kobject_uevent(&device->dev.kobj, KOBJ_ADD);
1394} 1403}
1395 1404
1396static int acpi_add_single_object(struct acpi_device **child, 1405static int acpi_add_single_object(struct acpi_device **child,
@@ -1412,13 +1421,14 @@ static int acpi_add_single_object(struct acpi_device **child,
1412 acpi_bus_get_wakeup_device_flags(device); 1421 acpi_bus_get_wakeup_device_flags(device);
1413 1422
1414 device->flags.match_driver = match_driver; 1423 device->flags.match_driver = match_driver;
1415 result = acpi_device_register(device, acpi_device_release); 1424 result = acpi_device_add(device, acpi_device_release);
1416 if (result) { 1425 if (result) {
1417 acpi_device_release(&device->dev); 1426 acpi_device_release(&device->dev);
1418 return result; 1427 return result;
1419 } 1428 }
1420 1429
1421 acpi_power_add_remove_device(device, true); 1430 acpi_power_add_remove_device(device, true);
1431 acpi_device_add_finalize(device);
1422 acpi_get_name(handle, ACPI_FULL_PATHNAME, &buffer); 1432 acpi_get_name(handle, ACPI_FULL_PATHNAME, &buffer);
1423 ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Added %s [%s] parent %s\n", 1433 ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Added %s [%s] parent %s\n",
1424 dev_name(&device->dev), (char *) buffer.pointer, 1434 dev_name(&device->dev), (char *) buffer.pointer,