Commit d6fb6ee1 authored by Uwe Kleine-König's avatar Uwe Kleine-König Committed by Rafael J. Wysocki

ACPI: bus: Drop driver member of struct acpi_device

struct acpi_device::driver tracks the same information as the driver
member of struct acpi_device::dev.

Fix all users of the former to use the latter and drop the redundant
data from struct acpi_device.
Signed-off-by: default avatarUwe Kleine-König <u.kleine-koenig@pengutronix.de>
Signed-off-by: default avatarRafael J. Wysocki <rafael.j.wysocki@intel.com>
parent e5ed878d
...@@ -465,7 +465,6 @@ static void acpi_bus_osc_negotiate_usb_control(void) ...@@ -465,7 +465,6 @@ static void acpi_bus_osc_negotiate_usb_control(void)
static void acpi_bus_notify(acpi_handle handle, u32 type, void *data) static void acpi_bus_notify(acpi_handle handle, u32 type, void *data)
{ {
struct acpi_device *adev; struct acpi_device *adev;
struct acpi_driver *driver;
u32 ost_code = ACPI_OST_SC_NON_SPECIFIC_FAILURE; u32 ost_code = ACPI_OST_SC_NON_SPECIFIC_FAILURE;
bool hotplug_event = false; bool hotplug_event = false;
...@@ -517,10 +516,13 @@ static void acpi_bus_notify(acpi_handle handle, u32 type, void *data) ...@@ -517,10 +516,13 @@ static void acpi_bus_notify(acpi_handle handle, u32 type, void *data)
if (!adev) if (!adev)
goto err; goto err;
driver = adev->driver; if (adev->dev.driver) {
if (driver && driver->ops.notify && struct acpi_driver *driver = to_acpi_driver(adev->dev.driver);
(driver->flags & ACPI_DRIVER_ALL_NOTIFY_EVENTS))
driver->ops.notify(adev, type); if (driver && driver->ops.notify &&
(driver->flags & ACPI_DRIVER_ALL_NOTIFY_EVENTS))
driver->ops.notify(adev, type);
}
if (!hotplug_event) { if (!hotplug_event) {
acpi_bus_put_acpi_device(adev); acpi_bus_put_acpi_device(adev);
...@@ -539,8 +541,9 @@ static void acpi_bus_notify(acpi_handle handle, u32 type, void *data) ...@@ -539,8 +541,9 @@ static void acpi_bus_notify(acpi_handle handle, u32 type, void *data)
static void acpi_notify_device(acpi_handle handle, u32 event, void *data) static void acpi_notify_device(acpi_handle handle, u32 event, void *data)
{ {
struct acpi_device *device = data; struct acpi_device *device = data;
struct acpi_driver *acpi_drv = to_acpi_driver(device->dev.driver);
device->driver->ops.notify(device, event); acpi_drv->ops.notify(device, event);
} }
static void acpi_notify_device_fixed(void *data) static void acpi_notify_device_fixed(void *data)
...@@ -1033,8 +1036,6 @@ static int acpi_device_probe(struct device *dev) ...@@ -1033,8 +1036,6 @@ static int acpi_device_probe(struct device *dev)
if (ret) if (ret)
return ret; return ret;
acpi_dev->driver = acpi_drv;
pr_debug("Driver [%s] successfully bound to device [%s]\n", pr_debug("Driver [%s] successfully bound to device [%s]\n",
acpi_drv->name, acpi_dev->pnp.bus_id); acpi_drv->name, acpi_dev->pnp.bus_id);
...@@ -1044,7 +1045,6 @@ static int acpi_device_probe(struct device *dev) ...@@ -1044,7 +1045,6 @@ static int acpi_device_probe(struct device *dev)
if (acpi_drv->ops.remove) if (acpi_drv->ops.remove)
acpi_drv->ops.remove(acpi_dev); acpi_drv->ops.remove(acpi_dev);
acpi_dev->driver = NULL;
acpi_dev->driver_data = NULL; acpi_dev->driver_data = NULL;
return ret; return ret;
} }
...@@ -1060,7 +1060,7 @@ static int acpi_device_probe(struct device *dev) ...@@ -1060,7 +1060,7 @@ static int acpi_device_probe(struct device *dev)
static void acpi_device_remove(struct device *dev) static void acpi_device_remove(struct device *dev)
{ {
struct acpi_device *acpi_dev = to_acpi_device(dev); struct acpi_device *acpi_dev = to_acpi_device(dev);
struct acpi_driver *acpi_drv = acpi_dev->driver; struct acpi_driver *acpi_drv = to_acpi_driver(dev->driver);
if (acpi_drv->ops.notify) if (acpi_drv->ops.notify)
acpi_device_remove_notify_handler(acpi_dev); acpi_device_remove_notify_handler(acpi_dev);
...@@ -1068,7 +1068,6 @@ static void acpi_device_remove(struct device *dev) ...@@ -1068,7 +1068,6 @@ static void acpi_device_remove(struct device *dev)
if (acpi_drv->ops.remove) if (acpi_drv->ops.remove)
acpi_drv->ops.remove(acpi_dev); acpi_drv->ops.remove(acpi_dev);
acpi_dev->driver = NULL;
acpi_dev->driver_data = NULL; acpi_dev->driver_data = NULL;
put_device(dev); put_device(dev);
......
...@@ -376,7 +376,7 @@ eject_store(struct device *d, struct device_attribute *attr, ...@@ -376,7 +376,7 @@ eject_store(struct device *d, struct device_attribute *attr,
return -EINVAL; return -EINVAL;
if ((!acpi_device->handler || !acpi_device->handler->hotplug.enabled) if ((!acpi_device->handler || !acpi_device->handler->hotplug.enabled)
&& !acpi_device->driver) && !d->driver)
return -ENODEV; return -ENODEV;
status = acpi_get_type(acpi_device->handle, &not_used); status = acpi_get_type(acpi_device->handle, &not_used);
......
...@@ -379,7 +379,6 @@ struct acpi_device { ...@@ -379,7 +379,6 @@ struct acpi_device {
struct acpi_device_data data; struct acpi_device_data data;
struct acpi_scan_handler *handler; struct acpi_scan_handler *handler;
struct acpi_hotplug_context *hp; struct acpi_hotplug_context *hp;
struct acpi_driver *driver;
const struct acpi_gpio_mapping *driver_gpios; const struct acpi_gpio_mapping *driver_gpios;
void *driver_data; void *driver_data;
struct device dev; struct device dev;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment