ACPI: add ACPI bus_type for driver model
Subsystems (3)
Zhang Rui
reviewerPATCH 4/14 ACPI: add ACPI bus_type for driver model
From: Patrick Mochel <[email protected]>
Add ACPI bus_type for Linux driver model.
1. .shutdown method is added into acpi_driver.ops
needed by bus_type operations.
2. remove useless parameter 'int state' in .resume method.
3. change parameter 'int state'
to 'pm_message_t state' in .suspend method.
Note: The new .uevent method mark ACPI drivers by PNPID instead of by name.
Udev script needs to look for "HWID=" or "COMPTID=" to load ACPI drivers as a result.
Signed-off-by Li Shaohua <[email protected]>
Signed-off-by Zhang Rui <[email protected]>
Signed-off-by Len Brown <[email protected]>
--- drivers/acpi/battery.c | 4 - drivers/acpi/fan.c | 8 +- drivers/acpi/scan.c | 158 +++++++++++++++++++++++++++--------------------- drivers/acpi/thermal.c | 4 - include/acpi/acpi_bus.h | 9 +- 5 files changed, 105 insertions(+), 78 deletions(-)
drivers/acpi/fan.c +4 -4
@@ -48,8 +48,8 @@ MODULE_LICENSE("GPL");static int acpi_fan_add (struct acpi_device *device);static int acpi_fan_remove (struct acpi_device *device,int type); -static int acpi_fan_suspend (struct acpi_device *device,int state); -static int acpi_fan_resume (struct acpi_device *device,int state); +static int acpi_fan_suspend (struct acpi_device *device,pm_message_t state); +static int acpi_fan_resume (struct acpi_device *device);static struct acpi_driver acpi_fan_driver = { .name =ACPI_FAN_DRIVER_NAME ,
@@ -238,7 +238,7 @@ static int acpi_fan_remove(struct acpi_dreturn 0 ; } -static int acpi_fan_suspend (struct acpi_device *device,int state) +static int acpi_fan_suspend (struct acpi_device *device,pm_message_t state) {if (!device)return -EINVAL ;
@@ -248,7 +248,7 @@ static int acpi_fan_suspend(struct acpi_return AE_OK ; } -static int acpi_fan_resume (struct acpi_device *device,int state) +static int acpi_fan_resume (struct acpi_device *device) {int result =0 ;int power_state =0 ;
drivers/acpi/scan.c +91 -67
205 lines not on this page · raw message
drivers/acpi/thermal.c +2 -2
@@ -82,7 +82,7 @@ MODULE_PARM_DESC(tzp, "Thermal zone pollstatic int acpi_thermal_add (struct acpi_device *device);static int acpi_thermal_remove (struct acpi_device *device,int type); -static int acpi_thermal_resume (struct acpi_device *device,int state); +static int acpi_thermal_resume (struct acpi_device *device);static int acpi_thermal_state_open_fs (struct inode *inode,struct file *file);static int acpi_thermal_temp_open_fs (struct inode *inode,struct file *file);static int acpi_thermal_trip_open_fs (struct inode *inode,struct file *file);
@@ -1356,7 +1356,7 @@ static int acpi_thermal_remove(struct acreturn 0 ; } -static int acpi_thermal_resume (struct acpi_device *device,int state) +static int acpi_thermal_resume (struct acpi_device *device) {struct acpi_thermal *tz =NULL ;int i;
include/acpi/acpi_bus.h +6 -3
@@ -92,13 +92,14 @@ typedef int (*acpi_op_remove) (struct actypedef int (*acpi_op_lock ) (struct acpi_device * device,int type);typedef int (*acpi_op_start ) (struct acpi_device * device);typedef int (*acpi_op_stop ) (struct acpi_device * device,int type); -typedef int (*acpi_op_suspend ) (struct acpi_device * device,int state); -typedef int (*acpi_op_resume ) (struct acpi_device * device,int state); +typedef int (*acpi_op_suspend ) (struct acpi_device * device,pm_message_t state); +typedef int (*acpi_op_resume ) (struct acpi_device * device);typedef int (*acpi_op_scan ) (struct acpi_device * device);typedef int (*acpi_op_bind ) (struct acpi_device * device);typedef int (*acpi_op_unbind ) (struct acpi_device * device);typedef int (*acpi_op_match ) (struct acpi_device * device,struct acpi_driver * driver); +typedef int (*acpi_op_shutdown ) (struct acpi_device * device);struct acpi_bus_ops {u32 acpi_op_add:1 ;
@@ -112,7 +113,8 @@ struct acpi_bus_ops { u32 acpi_op_bind:1; u32 acpi_op_unbind:1; u32 acpi_op_match:1; - u32 reserved:21; + u32 acpi_op_shutdown:1; + u32 reserved:20; };struct acpi_device_ops {
@@ -127,6 +129,7 @@ struct acpi_device_ops {acpi_op_bind bind;acpi_op_unbind unbind;acpi_op_match match; +acpi_op_shutdown shutdown; };struct acpi_driver {
drivers/acpi/battery.c +2 -2
@@ -64,7 +64,7 @@ extern void *acpi_unlock_battery_dir(strstatic int acpi_battery_add (struct acpi_device *device);static int acpi_battery_remove (struct acpi_device *device,int type); -static int acpi_battery_resume (struct acpi_device *device,int status); +static int acpi_battery_resume (struct acpi_device *device);static struct acpi_driver acpi_battery_driver = { .name =ACPI_BATTERY_DRIVER_NAME ,
@@ -756,7 +756,7 @@ static int acpi_battery_remove(struct ac }/* this is needed to learn about changes made in suspended state */ -static int acpi_battery_resume (struct acpi_device *device,int state) +static int acpi_battery_resume (struct acpi_device *device) {struct acpi_battery *battery;