X-Git-Url: http://ftp.safe.ca/?a=blobdiff_plain;f=drivers%2Facpi%2Ffan.c;h=c81f6bdb68b8a8271e5a3d525effe39ea8b3ae18;hb=63f0edfc0b7f8058f9d3f9b572615ec97ae011ba;hp=8abf5ac17f671e48bd3323275383450b483e02e2;hpb=74b142e0fe039fcde42030c064763577e11ca004;p=safe%2Fjmp%2Flinux-2.6 diff --git a/drivers/acpi/fan.c b/drivers/acpi/fan.c index 8abf5ac..c81f6bd 100644 --- a/drivers/acpi/fan.c +++ b/drivers/acpi/fan.c @@ -36,25 +36,30 @@ #define ACPI_FAN_COMPONENT 0x00200000 #define ACPI_FAN_CLASS "fan" -#define ACPI_FAN_DRIVER_NAME "ACPI Fan Driver" #define ACPI_FAN_FILE_STATE "state" #define _COMPONENT ACPI_FAN_COMPONENT -ACPI_MODULE_NAME("acpi_fan") +ACPI_MODULE_NAME("fan"); - MODULE_AUTHOR("Paul Diefenbaugh"); -MODULE_DESCRIPTION(ACPI_FAN_DRIVER_NAME); +MODULE_AUTHOR("Paul Diefenbaugh"); +MODULE_DESCRIPTION("ACPI Fan Driver"); 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 const struct acpi_device_id fan_device_ids[] = { + {"PNP0C0B", 0}, + {"", 0}, +}; +MODULE_DEVICE_TABLE(acpi, fan_device_ids); static struct acpi_driver acpi_fan_driver = { - .name = ACPI_FAN_DRIVER_NAME, + .name = "fan", .class = ACPI_FAN_CLASS, - .ids = "PNP0C0B", + .ids = fan_device_ids, .ops = { .add = acpi_fan_add, .remove = acpi_fan_remove, @@ -64,7 +69,6 @@ static struct acpi_driver acpi_fan_driver = { }; struct acpi_fan { - acpi_handle handle; struct acpi_device * device; }; @@ -81,7 +85,7 @@ static int acpi_fan_read_state(struct seq_file *seq, void *offset) if (fan) { - if (acpi_bus_get_power(fan->handle, &state)) + if (acpi_bus_get_power(fan->device->handle, &state)) seq_printf(seq, "status: ERROR\n"); else seq_printf(seq, "status: %s\n", @@ -100,8 +104,8 @@ acpi_fan_write_state(struct file *file, const char __user * buffer, size_t count, loff_t * ppos) { int result = 0; - struct seq_file *m = (struct seq_file *)file->private_data; - struct acpi_fan *fan = (struct acpi_fan *)m->private; + struct seq_file *m = file->private_data; + struct acpi_fan *fan = m->private; char state_string[12] = { '\0' }; @@ -113,7 +117,7 @@ acpi_fan_write_state(struct file *file, const char __user * buffer, state_string[count] = '\0'; - result = acpi_bus_set_power(fan->handle, + result = acpi_bus_set_power(fan->device->handle, simple_strtoul(state_string, NULL, 0)); if (result) return result; @@ -121,7 +125,7 @@ acpi_fan_write_state(struct file *file, const char __user * buffer, return count; } -static struct file_operations acpi_fan_state_ops = { +static const struct file_operations acpi_fan_state_ops = { .open = acpi_fan_state_open_fs, .read = seq_read, .write = acpi_fan_write_state, @@ -187,18 +191,16 @@ static int acpi_fan_add(struct acpi_device *device) if (!device) return -EINVAL; - fan = kmalloc(sizeof(struct acpi_fan), GFP_KERNEL); + fan = kzalloc(sizeof(struct acpi_fan), GFP_KERNEL); if (!fan) return -ENOMEM; - memset(fan, 0, sizeof(struct acpi_fan)); - fan->handle = device->handle; fan->device = device; strcpy(acpi_device_name(device), "Fan"); strcpy(acpi_device_class(device), ACPI_FAN_CLASS); acpi_driver_data(device) = fan; - result = acpi_bus_get_power(fan->handle, &state); + result = acpi_bus_get_power(device->handle, &state); if (result) { printk(KERN_ERR PREFIX "Reading power state\n"); goto end; @@ -231,7 +233,7 @@ static int acpi_fan_remove(struct acpi_device *device, int type) if (!device || !acpi_driver_data(device)) return -EINVAL; - fan = (struct acpi_fan *)acpi_driver_data(device); + fan = acpi_driver_data(device); acpi_fan_remove_fs(device); @@ -240,7 +242,7 @@ static int acpi_fan_remove(struct acpi_device *device, int type) return 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; @@ -250,7 +252,7 @@ static int acpi_fan_suspend(struct acpi_device *device, int state) 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;