ACPI: add device_driver and hepler functions
authorPatrick Mochel <mochel@linux.intel.com>
Thu, 7 Dec 2006 12:56:23 +0000 (20:56 +0800)
committerLen Brown <len.brown@intel.com>
Sat, 16 Dec 2006 04:38:34 +0000 (23:38 -0500)
Add device_driver into acpi_driver for driver model.
Add helper functions 'to_acpi_device' and 'to_acpi_driver'
to get structure acpi_device/acpi_driver by device/device_driver.

Signed-off-by: Zhang Rui <rui.zhang@intel.com>
Signed-off-by: Len Brown <len.brown@intel.com>
drivers/acpi/scan.c
include/acpi/acpi_bus.h

index 1f75ba6afae6d66203f0ffe77ce96143b5e69c93..5b42948ea97f4419ba317269c2d3d37e1e5f9adc 100644 (file)
@@ -222,11 +222,6 @@ acpi_eject_store(struct acpi_device *device, const char *buf, size_t count)
 /* --------------------------------------------------------------------------
                        ACPI Bus operations
    -------------------------------------------------------------------------- */
-static inline struct acpi_device * to_acpi_device(struct device * dev)
-{
-       return container_of(dev, struct acpi_device, dev);
-}
-
 static int root_suspend(struct acpi_device * acpi_dev, pm_message_t state)
 {
        struct acpi_device * dev, * next;
index fdd10953b2b6503760c91b8035b85d54243770bd..a09538eb61e74a8820502ff9f78793b9201a13e8 100644 (file)
@@ -136,6 +136,7 @@ struct acpi_driver {
        atomic_t references;
        char *ids;              /* Supported Hardware IDs */
        struct acpi_device_ops ops;
+       struct device_driver drv;
 };
 
 /*
@@ -301,6 +302,8 @@ struct acpi_device {
 };
 
 #define acpi_driver_data(d)    ((d)->driver_data)
+#define to_acpi_device(d)      container_of(d, struct acpi_device, dev)
+#define to_acpi_driver(d)      container_of(d, struct acpi_driver, drv)
 
 /*
  * Events