26 #include <linux/kernel.h>
27 #include <linux/module.h>
29 #include <linux/types.h>
30 #include <asm/uaccess.h>
35 #define PREFIX "ACPI: "
37 #define ACPI_FAN_CLASS "fan"
38 #define ACPI_FAN_FILE_STATE "state"
40 #define _COMPONENT ACPI_FAN_COMPONENT
47 static int acpi_fan_add(
struct acpi_device *
device);
48 static int acpi_fan_remove(
struct acpi_device *
device,
int type);
56 #ifdef CONFIG_PM_SLEEP
57 static int acpi_fan_suspend(
struct device *
dev);
58 static int acpi_fan_resume(
struct device *
dev);
62 static struct acpi_driver acpi_fan_driver = {
65 .ids = fan_device_ids,
68 .remove = acpi_fan_remove,
70 .drv.pm = &acpi_fan_pm,
104 struct acpi_device *device = cdev->
devdata;
107 if (!device || (state != 0 && state != 1))
117 .get_max_state = fan_get_max_state,
118 .get_cur_state = fan_get_cur_state,
119 .set_cur_state = fan_set_cur_state,
126 static int acpi_fan_add(
struct acpi_device *device)
134 strcpy(acpi_device_name(device),
"Fan");
146 result = PTR_ERR(cdev);
150 dev_dbg(&device->dev,
"registered as cooling_device%d\n", cdev->
id);
152 device->driver_data =
cdev;
157 dev_err(&device->dev,
"Failed to create sysfs link "
158 "'thermal_cooling'\n");
164 dev_err(&device->dev,
"Failed to create sysfs link "
168 acpi_device_name(device), acpi_device_bid(device),
169 !device->power.state ?
"on" :
"off");
175 static int acpi_fan_remove(
struct acpi_device *device,
int type)
179 if (!device || !cdev)
189 #ifdef CONFIG_PM_SLEEP
190 static int acpi_fan_suspend(
struct device *
dev)
200 static int acpi_fan_resume(
struct device *dev)