diff options
author | Rafael J. Wysocki <rafael.j.wysocki@intel.com> | 2013-06-28 12:58:21 +0200 |
---|---|---|
committer | Rafael J. Wysocki <rafael.j.wysocki@intel.com> | 2013-06-28 12:58:21 +0200 |
commit | 8e9914d5efe460600f5948da7ae4c1b6c038a4c0 (patch) | |
tree | 2a6ed5d7ba447f2288f05f9b8d54db92b8b28139 /drivers/acpi | |
parent | 80338681bbc5786fa1342d3b7f021c1d8974ac62 (diff) | |
parent | 24071f472d813fccacc1ef7356b1f41422a1b968 (diff) | |
download | blackbird-op-linux-8e9914d5efe460600f5948da7ae4c1b6c038a4c0.tar.gz blackbird-op-linux-8e9914d5efe460600f5948da7ae4c1b6c038a4c0.zip |
Merge branch 'acpi-scan'
* acpi-scan:
ACPI / scan: Do not bind ACPI drivers to objects with scan handlers
ACPI / ia64 / sba_iommu: Use ACPI scan handler for device discovery
ACPI / scan: Simplify ACPI driver probing
Diffstat (limited to 'drivers/acpi')
-rw-r--r-- | drivers/acpi/scan.c | 84 | ||||
-rw-r--r-- | drivers/acpi/video.c | 3 |
2 files changed, 30 insertions, 57 deletions
diff --git a/drivers/acpi/scan.c b/drivers/acpi/scan.c index db118b1ad3e8..e0db2dc42370 100644 --- a/drivers/acpi/scan.c +++ b/drivers/acpi/scan.c @@ -933,32 +933,43 @@ static void acpi_device_remove_notify_handler(struct acpi_device *device) acpi_device_notify); } -static int acpi_bus_driver_init(struct acpi_device *, struct acpi_driver *); -static int acpi_device_probe(struct device * dev) +static int acpi_device_probe(struct device *dev) { struct acpi_device *acpi_dev = to_acpi_device(dev); struct acpi_driver *acpi_drv = to_acpi_driver(dev->driver); int ret; - ret = acpi_bus_driver_init(acpi_dev, acpi_drv); - if (!ret) { - if (acpi_drv->ops.notify) { - ret = acpi_device_install_notify_handler(acpi_dev); - if (ret) { - if (acpi_drv->ops.remove) - acpi_drv->ops.remove(acpi_dev); - acpi_dev->driver = NULL; - acpi_dev->driver_data = NULL; - return ret; - } - } + if (acpi_dev->handler) + return -EINVAL; - ACPI_DEBUG_PRINT((ACPI_DB_INFO, - "Found driver [%s] for device [%s]\n", - acpi_drv->name, acpi_dev->pnp.bus_id)); - get_device(dev); + if (!acpi_drv->ops.add) + return -ENOSYS; + + ret = acpi_drv->ops.add(acpi_dev); + if (ret) + return ret; + + acpi_dev->driver = acpi_drv; + ACPI_DEBUG_PRINT((ACPI_DB_INFO, + "Driver [%s] successfully bound to device [%s]\n", + acpi_drv->name, acpi_dev->pnp.bus_id)); + + if (acpi_drv->ops.notify) { + ret = acpi_device_install_notify_handler(acpi_dev); + if (ret) { + if (acpi_drv->ops.remove) + acpi_drv->ops.remove(acpi_dev); + + acpi_dev->driver = NULL; + acpi_dev->driver_data = NULL; + return ret; + } } - return ret; + + ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Found driver [%s] for device [%s]\n", + acpi_drv->name, acpi_dev->pnp.bus_id)); + get_device(dev); + return 0; } static int acpi_device_remove(struct device * dev) @@ -1114,41 +1125,6 @@ static void acpi_device_unregister(struct acpi_device *device) Driver Management -------------------------------------------------------------------------- */ /** - * acpi_bus_driver_init - add a device to a driver - * @device: the device to add and initialize - * @driver: driver for the device - * - * Used to initialize a device via its device driver. Called whenever a - * driver is bound to a device. Invokes the driver's add() ops. - */ -static int -acpi_bus_driver_init(struct acpi_device *device, struct acpi_driver *driver) -{ - int result = 0; - - if (!device || !driver) - return -EINVAL; - - if (!driver->ops.add) - return -ENOSYS; - - result = driver->ops.add(device); - if (result) - return result; - - device->driver = driver; - - /* - * TBD - Configuration Management: Assign resources to device based - * upon possible configuration and currently allocated resources. - */ - - ACPI_DEBUG_PRINT((ACPI_DB_INFO, - "Driver successfully bound to device\n")); - return 0; -} - -/** * acpi_bus_register_driver - register a driver with the ACPI bus * @driver: driver being registered * diff --git a/drivers/acpi/video.c b/drivers/acpi/video.c index 440eadf2d32c..5d7075d25700 100644 --- a/drivers/acpi/video.c +++ b/drivers/acpi/video.c @@ -1722,9 +1722,6 @@ static int acpi_video_bus_add(struct acpi_device *device) int error; acpi_status status; - if (device->handler) - return -EINVAL; - status = acpi_walk_namespace(ACPI_TYPE_DEVICE, device->parent->handle, 1, acpi_video_bus_match, NULL, |