aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRafael J. Wysocki <rafael.j.wysocki@intel.com>2012-12-20 18:36:48 -0500
committerRafael J. Wysocki <rafael.j.wysocki@intel.com>2013-01-03 07:09:40 -0500
commit209d3b1743c8187c67cc75dbe9fefbcd3121fba0 (patch)
tree2be44cbd0a71a498defbd3fbcd8a834e919ca8a9
parente3863094c6f9b2f980d6e7a5cad6b4d03a4dd579 (diff)
ACPI: Replace ACPI device add_type field with a match_driver flag
After the removal of the second argument of acpi_bus_scan() there is no difference between the ACPI_BUS_ADD_MATCH and ACPI_BUS_ADD_START add types, so the add_type field in struct acpi_device may be replaced with a single flag. Do that calling the flag match_driver. Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com> Acked-by: Yinghai Lu <yinghai@kernel.org> Acked-by: Toshi Kani <toshi.kani@hp.com>
-rw-r--r--drivers/acpi/scan.c21
-rw-r--r--include/acpi/acpi_bus.h11
2 files changed, 11 insertions, 21 deletions
diff --git a/drivers/acpi/scan.c b/drivers/acpi/scan.c
index eb54f98bb728..e3aed481aed2 100644
--- a/drivers/acpi/scan.c
+++ b/drivers/acpi/scan.c
@@ -494,7 +494,7 @@ static int acpi_bus_match(struct device *dev, struct device_driver *drv)
494 struct acpi_device *acpi_dev = to_acpi_device(dev); 494 struct acpi_device *acpi_dev = to_acpi_device(dev);
495 struct acpi_driver *acpi_drv = to_acpi_driver(drv); 495 struct acpi_driver *acpi_drv = to_acpi_driver(drv);
496 496
497 return acpi_dev->add_type >= ACPI_BUS_ADD_MATCH 497 return acpi_dev->flags.match_driver
498 && !acpi_match_device_ids(acpi_dev, acpi_drv->ids); 498 && !acpi_match_device_ids(acpi_dev, acpi_drv->ids);
499} 499}
500 500
@@ -1410,8 +1410,7 @@ static void acpi_hot_add_bind(struct acpi_device *device)
1410 1410
1411static int acpi_add_single_object(struct acpi_device **child, 1411static int acpi_add_single_object(struct acpi_device **child,
1412 acpi_handle handle, int type, 1412 acpi_handle handle, int type,
1413 unsigned long long sta, 1413 unsigned long long sta, bool match_driver)
1414 enum acpi_bus_add_type add_type)
1415{ 1414{
1416 int result; 1415 int result;
1417 struct acpi_device *device; 1416 struct acpi_device *device;
@@ -1427,7 +1426,6 @@ static int acpi_add_single_object(struct acpi_device **child,
1427 device->device_type = type; 1426 device->device_type = type;
1428 device->handle = handle; 1427 device->handle = handle;
1429 device->parent = acpi_bus_get_parent(handle); 1428 device->parent = acpi_bus_get_parent(handle);
1430 device->add_type = add_type;
1431 STRUCT_TO_INT(device->status) = sta; 1429 STRUCT_TO_INT(device->status) = sta;
1432 1430
1433 acpi_device_get_busid(device); 1431 acpi_device_get_busid(device);
@@ -1478,9 +1476,10 @@ static int acpi_add_single_object(struct acpi_device **child,
1478 if ((result = acpi_device_set_context(device))) 1476 if ((result = acpi_device_set_context(device)))
1479 goto end; 1477 goto end;
1480 1478
1479 device->flags.match_driver = match_driver;
1481 result = acpi_device_register(device); 1480 result = acpi_device_register(device);
1482 1481
1483 if (device->add_type >= ACPI_BUS_ADD_MATCH) 1482 if (device->flags.match_driver)
1484 acpi_hot_add_bind(device); 1483 acpi_hot_add_bind(device);
1485 1484
1486end: 1485end:
@@ -1509,7 +1508,7 @@ static void acpi_bus_add_power_resource(acpi_handle handle)
1509 acpi_bus_get_device(handle, &device); 1508 acpi_bus_get_device(handle, &device);
1510 if (!device) 1509 if (!device)
1511 acpi_add_single_object(&device, handle, ACPI_BUS_TYPE_POWER, 1510 acpi_add_single_object(&device, handle, ACPI_BUS_TYPE_POWER,
1512 ACPI_STA_DEFAULT, ACPI_BUS_ADD_START); 1511 ACPI_STA_DEFAULT, true);
1513} 1512}
1514 1513
1515static int acpi_bus_type_and_status(acpi_handle handle, int *type, 1514static int acpi_bus_type_and_status(acpi_handle handle, int *type,
@@ -1580,11 +1579,11 @@ static acpi_status acpi_bus_check_add(acpi_handle handle, u32 lvl_not_used,
1580 return AE_CTRL_DEPTH; 1579 return AE_CTRL_DEPTH;
1581 } 1580 }
1582 1581
1583 acpi_add_single_object(&device, handle, type, sta, ACPI_BUS_ADD_BASIC); 1582 acpi_add_single_object(&device, handle, type, sta, false);
1584 if (!device) 1583 if (!device)
1585 return AE_CTRL_DEPTH; 1584 return AE_CTRL_DEPTH;
1586 1585
1587 device->add_type = ACPI_BUS_ADD_START; 1586 device->flags.match_driver = true;
1588 acpi_hot_add_bind(device); 1587 acpi_hot_add_bind(device);
1589 1588
1590 out: 1589 out:
@@ -1749,16 +1748,14 @@ static int acpi_bus_scan_fixed(void)
1749 if ((acpi_gbl_FADT.flags & ACPI_FADT_POWER_BUTTON) == 0) { 1748 if ((acpi_gbl_FADT.flags & ACPI_FADT_POWER_BUTTON) == 0) {
1750 result = acpi_add_single_object(&device, NULL, 1749 result = acpi_add_single_object(&device, NULL,
1751 ACPI_BUS_TYPE_POWER_BUTTON, 1750 ACPI_BUS_TYPE_POWER_BUTTON,
1752 ACPI_STA_DEFAULT, 1751 ACPI_STA_DEFAULT, true);
1753 ACPI_BUS_ADD_START);
1754 device_init_wakeup(&device->dev, true); 1752 device_init_wakeup(&device->dev, true);
1755 } 1753 }
1756 1754
1757 if ((acpi_gbl_FADT.flags & ACPI_FADT_SLEEP_BUTTON) == 0) { 1755 if ((acpi_gbl_FADT.flags & ACPI_FADT_SLEEP_BUTTON) == 0) {
1758 result = acpi_add_single_object(&device, NULL, 1756 result = acpi_add_single_object(&device, NULL,
1759 ACPI_BUS_TYPE_SLEEP_BUTTON, 1757 ACPI_BUS_TYPE_SLEEP_BUTTON,
1760 ACPI_STA_DEFAULT, 1758 ACPI_STA_DEFAULT, true);
1761 ACPI_BUS_ADD_START);
1762 } 1759 }
1763 1760
1764 return result; 1761 return result;
diff --git a/include/acpi/acpi_bus.h b/include/acpi/acpi_bus.h
index 75c6b3f2250d..056cb0cd8eff 100644
--- a/include/acpi/acpi_bus.h
+++ b/include/acpi/acpi_bus.h
@@ -63,13 +63,6 @@ acpi_get_physical_device_location(acpi_handle handle, struct acpi_pld_info **pld
63#define ACPI_BUS_FILE_ROOT "acpi" 63#define ACPI_BUS_FILE_ROOT "acpi"
64extern struct proc_dir_entry *acpi_root_dir; 64extern struct proc_dir_entry *acpi_root_dir;
65 65
66enum acpi_bus_add_type {
67 ACPI_BUS_ADD_BASIC = 0,
68 ACPI_BUS_ADD_MATCH,
69 ACPI_BUS_ADD_START,
70 ACPI_BUS_ADD_TYPE_COUNT
71};
72
73enum acpi_bus_removal_type { 66enum acpi_bus_removal_type {
74 ACPI_BUS_REMOVAL_NORMAL = 0, 67 ACPI_BUS_REMOVAL_NORMAL = 0,
75 ACPI_BUS_REMOVAL_EJECT, 68 ACPI_BUS_REMOVAL_EJECT,
@@ -150,7 +143,8 @@ struct acpi_device_flags {
150 u32 power_manageable:1; 143 u32 power_manageable:1;
151 u32 performance_manageable:1; 144 u32 performance_manageable:1;
152 u32 eject_pending:1; 145 u32 eject_pending:1;
153 u32 reserved:24; 146 u32 match_driver:1;
147 u32 reserved:23;
154}; 148};
155 149
156/* File System */ 150/* File System */
@@ -285,7 +279,6 @@ struct acpi_device {
285 struct acpi_driver *driver; 279 struct acpi_driver *driver;
286 void *driver_data; 280 void *driver_data;
287 struct device dev; 281 struct device dev;
288 enum acpi_bus_add_type add_type; /* how to handle adding */
289 enum acpi_bus_removal_type removal_type; /* indicate for different removal type */ 282 enum acpi_bus_removal_type removal_type; /* indicate for different removal type */
290 u8 physical_node_count; 283 u8 physical_node_count;
291 struct list_head physical_node_list; 284 struct list_head physical_node_list;