aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRafael J. Wysocki <rafael.j.wysocki@intel.com>2012-12-20 18:36:46 -0500
committerRafael J. Wysocki <rafael.j.wysocki@intel.com>2013-01-03 07:09:39 -0500
commit02f57c67a8677ae55dcdd256a2a7abaf41e4cc1f (patch)
treede2b6f73409a459119641fd8359694f0367f8f50
parent47525cda88f5cc4dbe24de1cc05617c08e2d7c4a (diff)
ACPI: Remove acpi_start_single_object() and acpi_bus_start()
The ACPI PCI root bridge driver was the only ACPI driver implementing the .start() callback, which isn't used by any ACPI drivers any more now. For this reason, acpi_start_single_object() has no purpose any more, so remove it and all references to it. Also remove acpi_bus_start_device(), whose only purpose was to call acpi_start_single_object(). Moreover, since after the removal of acpi_bus_start_device() the only purpose of acpi_bus_start() remains to call acpi_update_all_gpes(), move that into acpi_bus_add() and drop acpi_bus_start() too, remove its header from acpi_bus.h and update all of its former users accordingly. This change was previously proposed in a different from by Yinghai Lu. 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/container.c16
-rw-r--r--drivers/acpi/scan.c66
-rw-r--r--drivers/pci/hotplug/acpiphp_glue.c4
-rw-r--r--drivers/pci/hotplug/sgi_hotplug.c2
-rw-r--r--include/acpi/acpi_bus.h1
5 files changed, 12 insertions, 77 deletions
diff --git a/drivers/acpi/container.c b/drivers/acpi/container.c
index 811910b50b75..98b85e3e4781 100644
--- a/drivers/acpi/container.c
+++ b/drivers/acpi/container.c
@@ -139,24 +139,14 @@ static int container_device_add(struct acpi_device **device, acpi_handle handle)
139{ 139{
140 acpi_handle phandle; 140 acpi_handle phandle;
141 struct acpi_device *pdev; 141 struct acpi_device *pdev;
142 int result;
143
144
145 if (acpi_get_parent(handle, &phandle)) {
146 return -ENODEV;
147 }
148 142
149 if (acpi_bus_get_device(phandle, &pdev)) { 143 if (acpi_get_parent(handle, &phandle))
150 return -ENODEV; 144 return -ENODEV;
151 }
152 145
153 if (acpi_bus_add(device, pdev, handle, ACPI_BUS_TYPE_DEVICE)) { 146 if (acpi_bus_get_device(phandle, &pdev))
154 return -ENODEV; 147 return -ENODEV;
155 }
156
157 result = acpi_bus_start(*device);
158 148
159 return result; 149 return acpi_bus_add(device, pdev, handle, ACPI_BUS_TYPE_DEVICE);
160} 150}
161 151
162static void container_notify_cb(acpi_handle handle, u32 type, void *context) 152static void container_notify_cb(acpi_handle handle, u32 type, void *context)
diff --git a/drivers/acpi/scan.c b/drivers/acpi/scan.c
index eb7ecb1f2032..6321cab4e5ff 100644
--- a/drivers/acpi/scan.c
+++ b/drivers/acpi/scan.c
@@ -571,7 +571,6 @@ static void acpi_device_remove_notify_handler(struct acpi_device *device)
571} 571}
572 572
573static int acpi_bus_driver_init(struct acpi_device *, struct acpi_driver *); 573static int acpi_bus_driver_init(struct acpi_device *, struct acpi_driver *);
574static int acpi_start_single_object(struct acpi_device *);
575static int acpi_device_probe(struct device * dev) 574static int acpi_device_probe(struct device * dev)
576{ 575{
577 struct acpi_device *acpi_dev = to_acpi_device(dev); 576 struct acpi_device *acpi_dev = to_acpi_device(dev);
@@ -580,9 +579,6 @@ static int acpi_device_probe(struct device * dev)
580 579
581 ret = acpi_bus_driver_init(acpi_dev, acpi_drv); 580 ret = acpi_bus_driver_init(acpi_dev, acpi_drv);
582 if (!ret) { 581 if (!ret) {
583 if (acpi_dev->add_type == ACPI_BUS_ADD_START)
584 acpi_start_single_object(acpi_dev);
585
586 if (acpi_drv->ops.notify) { 582 if (acpi_drv->ops.notify) {
587 ret = acpi_device_install_notify_handler(acpi_dev); 583 ret = acpi_device_install_notify_handler(acpi_dev);
588 if (ret) { 584 if (ret) {
@@ -761,24 +757,6 @@ acpi_bus_driver_init(struct acpi_device *device, struct acpi_driver *driver)
761 return 0; 757 return 0;
762} 758}
763 759
764static int acpi_start_single_object(struct acpi_device *device)
765{
766 int result = 0;
767 struct acpi_driver *driver;
768
769
770 if (!(driver = device->driver))
771 return 0;
772
773 if (driver->ops.start) {
774 result = driver->ops.start(device);
775 if (result && driver->ops.remove)
776 driver->ops.remove(device, ACPI_BUS_REMOVAL_NORMAL);
777 }
778
779 return result;
780}
781
782/** 760/**
783 * acpi_bus_register_driver - register a driver with the ACPI bus 761 * acpi_bus_register_driver - register a driver with the ACPI bus
784 * @driver: driver being registered 762 * @driver: driver being registered
@@ -1673,59 +1651,31 @@ static int acpi_bus_scan(acpi_handle handle, bool start,
1673} 1651}
1674 1652
1675/* 1653/*
1676 * acpi_bus_add and acpi_bus_start 1654 * acpi_bus_add
1677 * 1655 *
1678 * scan a given ACPI tree and (probably recently hot-plugged) 1656 * scan a given ACPI tree and (probably recently hot-plugged)
1679 * create and add or starts found devices. 1657 * create and add found devices.
1680 * 1658 *
1681 * If no devices were found -ENODEV is returned which does not 1659 * If no devices were found -ENODEV is returned which does not
1682 * mean that this is a real error, there just have been no suitable 1660 * mean that this is a real error, there just have been no suitable
1683 * ACPI objects in the table trunk from which the kernel could create 1661 * ACPI objects in the table trunk from which the kernel could create
1684 * a device and add/start an appropriate driver. 1662 * a device and add an appropriate driver.
1685 */ 1663 */
1686 1664
1687int 1665int
1688acpi_bus_add(struct acpi_device **child, 1666acpi_bus_add(struct acpi_device **child,
1689 struct acpi_device *parent, acpi_handle handle, int type) 1667 struct acpi_device *parent, acpi_handle handle, int type)
1690{ 1668{
1691 return acpi_bus_scan(handle, false, child); 1669 int err;
1692}
1693EXPORT_SYMBOL(acpi_bus_add);
1694
1695static acpi_status acpi_bus_start_device(acpi_handle handle, u32 lvl,
1696 void *not_used, void **ret_not_used)
1697{
1698 struct acpi_device *device;
1699 unsigned long long sta_not_used;
1700 int type_not_used;
1701
1702 /*
1703 * Ignore errors ignored by acpi_bus_check_add() to avoid terminating
1704 * namespace walks prematurely.
1705 */
1706 if (acpi_bus_type_and_status(handle, &type_not_used, &sta_not_used))
1707 return AE_OK;
1708
1709 if (acpi_bus_get_device(handle, &device))
1710 return AE_CTRL_DEPTH;
1711
1712 return acpi_start_single_object(device);
1713}
1714
1715int acpi_bus_start(struct acpi_device *device)
1716{
1717 if (!device)
1718 return -EINVAL;
1719 1670
1720 if (ACPI_SUCCESS(acpi_start_single_object(device))) 1671 err = acpi_bus_scan(handle, false, child);
1721 acpi_walk_namespace(ACPI_TYPE_ANY, device->handle, 1672 if (err)
1722 ACPI_UINT32_MAX, acpi_bus_start_device, 1673 return err;
1723 NULL, NULL, NULL);
1724 1674
1725 acpi_update_all_gpes(); 1675 acpi_update_all_gpes();
1726 return 0; 1676 return 0;
1727} 1677}
1728EXPORT_SYMBOL(acpi_bus_start); 1678EXPORT_SYMBOL(acpi_bus_add);
1729 1679
1730int acpi_bus_trim(struct acpi_device *start, int rmdevice) 1680int acpi_bus_trim(struct acpi_device *start, int rmdevice)
1731{ 1681{
diff --git a/drivers/pci/hotplug/acpiphp_glue.c b/drivers/pci/hotplug/acpiphp_glue.c
index 3d6d4fd1e3c5..7e2bad4c2fcc 100644
--- a/drivers/pci/hotplug/acpiphp_glue.c
+++ b/drivers/pci/hotplug/acpiphp_glue.c
@@ -759,7 +759,6 @@ static int acpiphp_bus_add(struct acpiphp_func *func)
759 -ret_val); 759 -ret_val);
760 goto acpiphp_bus_add_out; 760 goto acpiphp_bus_add_out;
761 } 761 }
762 ret_val = acpi_bus_start(device);
763 762
764acpiphp_bus_add_out: 763acpiphp_bus_add_out:
765 return ret_val; 764 return ret_val;
@@ -1148,8 +1147,7 @@ static void handle_bridge_insertion(acpi_handle handle, u32 type)
1148 err("cannot add bridge to acpi list\n"); 1147 err("cannot add bridge to acpi list\n");
1149 return; 1148 return;
1150 } 1149 }
1151 if (!acpiphp_configure_bridge(handle) && 1150 if (!acpiphp_configure_bridge(handle))
1152 !acpi_bus_start(device))
1153 add_bridge(handle); 1151 add_bridge(handle);
1154 else 1152 else
1155 err("cannot configure and start bridge\n"); 1153 err("cannot configure and start bridge\n");
diff --git a/drivers/pci/hotplug/sgi_hotplug.c b/drivers/pci/hotplug/sgi_hotplug.c
index f64ca92253da..20c960d5317d 100644
--- a/drivers/pci/hotplug/sgi_hotplug.c
+++ b/drivers/pci/hotplug/sgi_hotplug.c
@@ -457,8 +457,6 @@ static int enable_slot(struct hotplug_slot *bss_hotplug_slot)
457 ret, (int)(adr>>16), 457 ret, (int)(adr>>16),
458 (int)(adr&0xffff)); 458 (int)(adr&0xffff));
459 /* try to continue on */ 459 /* try to continue on */
460 } else {
461 acpi_bus_start(device);
462 } 460 }
463 } 461 }
464 } 462 }
diff --git a/include/acpi/acpi_bus.h b/include/acpi/acpi_bus.h
index d5294798fdda..6d47a584c0bc 100644
--- a/include/acpi/acpi_bus.h
+++ b/include/acpi/acpi_bus.h
@@ -362,7 +362,6 @@ int acpi_bus_add(struct acpi_device **child, struct acpi_device *parent,
362 acpi_handle handle, int type); 362 acpi_handle handle, int type);
363void acpi_bus_hot_remove_device(void *context); 363void acpi_bus_hot_remove_device(void *context);
364int acpi_bus_trim(struct acpi_device *start, int rmdevice); 364int acpi_bus_trim(struct acpi_device *start, int rmdevice);
365int acpi_bus_start(struct acpi_device *device);
366acpi_status acpi_bus_get_ejd(acpi_handle handle, acpi_handle * ejd); 365acpi_status acpi_bus_get_ejd(acpi_handle handle, acpi_handle * ejd);
367int acpi_match_device_ids(struct acpi_device *device, 366int acpi_match_device_ids(struct acpi_device *device,
368 const struct acpi_device_id *ids); 367 const struct acpi_device_id *ids);