diff options
author | Zhang Rui <rui.zhang@intel.com> | 2010-07-14 22:46:44 -0400 |
---|---|---|
committer | Len Brown <len.brown@intel.com> | 2010-08-15 00:37:33 -0400 |
commit | 43d9f87b79804f2d75d9d8a81c862b179f055a15 (patch) | |
tree | b3e6368c641d7999832f5b06b04639d41aa9f485 /drivers/acpi | |
parent | 6e37c658aefa57c472b2dbf1de88dbd3c67cdb52 (diff) |
ACPI thermal: make procfs I/F depend on CONFIG_ACPI_PROCFS
Mark the ACPI thermal procfs I/F deprecated, because /sys/class/thermal/
is already available and has been working for years w/o any problem.
The ACPI thermal procfs I/F will be removed in 2.6.37.
Signed-off-by: Zhang Rui <rui.zhang@intel.com>
Signed-off-by: Len Brown <len.brown@intel.com>
Diffstat (limited to 'drivers/acpi')
-rw-r--r-- | drivers/acpi/Kconfig | 1 | ||||
-rw-r--r-- | drivers/acpi/thermal.c | 86 |
2 files changed, 54 insertions, 33 deletions
diff --git a/drivers/acpi/Kconfig b/drivers/acpi/Kconfig index 354e613f3ca4..5ed51b3d7522 100644 --- a/drivers/acpi/Kconfig +++ b/drivers/acpi/Kconfig | |||
@@ -57,6 +57,7 @@ config ACPI_PROCFS | |||
57 | /proc/acpi/processor/*/throttling (/sys/class/thermal/ | 57 | /proc/acpi/processor/*/throttling (/sys/class/thermal/ |
58 | cooling_device*/*) | 58 | cooling_device*/*) |
59 | /proc/acpi/video/*/brightness (/sys/class/backlight/) | 59 | /proc/acpi/video/*/brightness (/sys/class/backlight/) |
60 | /proc/acpi/thermal_zone/*/* (/sys/class/thermal/) | ||
60 | This option has no effect on /proc/acpi/ files | 61 | This option has no effect on /proc/acpi/ files |
61 | and functions which do not yet exist in /sys. | 62 | and functions which do not yet exist in /sys. |
62 | 63 | ||
diff --git a/drivers/acpi/thermal.c b/drivers/acpi/thermal.c index efad1f33aeb5..2f8f17131d9f 100644 --- a/drivers/acpi/thermal.c +++ b/drivers/acpi/thermal.c | |||
@@ -37,10 +37,14 @@ | |||
37 | #include <linux/init.h> | 37 | #include <linux/init.h> |
38 | #include <linux/slab.h> | 38 | #include <linux/slab.h> |
39 | #include <linux/types.h> | 39 | #include <linux/types.h> |
40 | |||
41 | #ifdef CONFIG_ACPI_PROCFS | ||
40 | #include <linux/proc_fs.h> | 42 | #include <linux/proc_fs.h> |
43 | #include <linux/seq_file.h> | ||
44 | #endif | ||
45 | |||
41 | #include <linux/jiffies.h> | 46 | #include <linux/jiffies.h> |
42 | #include <linux/kmod.h> | 47 | #include <linux/kmod.h> |
43 | #include <linux/seq_file.h> | ||
44 | #include <linux/reboot.h> | 48 | #include <linux/reboot.h> |
45 | #include <linux/device.h> | 49 | #include <linux/device.h> |
46 | #include <asm/uaccess.h> | 50 | #include <asm/uaccess.h> |
@@ -102,16 +106,6 @@ static int acpi_thermal_add(struct acpi_device *device); | |||
102 | static int acpi_thermal_remove(struct acpi_device *device, int type); | 106 | static int acpi_thermal_remove(struct acpi_device *device, int type); |
103 | static int acpi_thermal_resume(struct acpi_device *device); | 107 | static int acpi_thermal_resume(struct acpi_device *device); |
104 | static void acpi_thermal_notify(struct acpi_device *device, u32 event); | 108 | static void acpi_thermal_notify(struct acpi_device *device, u32 event); |
105 | static int acpi_thermal_state_open_fs(struct inode *inode, struct file *file); | ||
106 | static int acpi_thermal_temp_open_fs(struct inode *inode, struct file *file); | ||
107 | static int acpi_thermal_trip_open_fs(struct inode *inode, struct file *file); | ||
108 | static int acpi_thermal_cooling_open_fs(struct inode *inode, struct file *file); | ||
109 | static ssize_t acpi_thermal_write_cooling_mode(struct file *, | ||
110 | const char __user *, size_t, | ||
111 | loff_t *); | ||
112 | static int acpi_thermal_polling_open_fs(struct inode *inode, struct file *file); | ||
113 | static ssize_t acpi_thermal_write_polling(struct file *, const char __user *, | ||
114 | size_t, loff_t *); | ||
115 | 109 | ||
116 | static const struct acpi_device_id thermal_device_ids[] = { | 110 | static const struct acpi_device_id thermal_device_ids[] = { |
117 | {ACPI_THERMAL_HID, 0}, | 111 | {ACPI_THERMAL_HID, 0}, |
@@ -201,6 +195,18 @@ struct acpi_thermal { | |||
201 | struct mutex lock; | 195 | struct mutex lock; |
202 | }; | 196 | }; |
203 | 197 | ||
198 | #ifdef CONFIG_ACPI_PROCFS | ||
199 | static int acpi_thermal_state_open_fs(struct inode *inode, struct file *file); | ||
200 | static int acpi_thermal_temp_open_fs(struct inode *inode, struct file *file); | ||
201 | static int acpi_thermal_trip_open_fs(struct inode *inode, struct file *file); | ||
202 | static int acpi_thermal_cooling_open_fs(struct inode *inode, struct file *file); | ||
203 | static ssize_t acpi_thermal_write_cooling_mode(struct file *, | ||
204 | const char __user *, size_t, | ||
205 | loff_t *); | ||
206 | static int acpi_thermal_polling_open_fs(struct inode *inode, struct file *file); | ||
207 | static ssize_t acpi_thermal_write_polling(struct file *, const char __user *, | ||
208 | size_t, loff_t *); | ||
209 | |||
204 | static const struct file_operations acpi_thermal_state_fops = { | 210 | static const struct file_operations acpi_thermal_state_fops = { |
205 | .owner = THIS_MODULE, | 211 | .owner = THIS_MODULE, |
206 | .open = acpi_thermal_state_open_fs, | 212 | .open = acpi_thermal_state_open_fs, |
@@ -242,6 +248,7 @@ static const struct file_operations acpi_thermal_polling_fops = { | |||
242 | .llseek = seq_lseek, | 248 | .llseek = seq_lseek, |
243 | .release = single_release, | 249 | .release = single_release, |
244 | }; | 250 | }; |
251 | #endif /* CONFIG_ACPI_PROCFS*/ | ||
245 | 252 | ||
246 | /* -------------------------------------------------------------------------- | 253 | /* -------------------------------------------------------------------------- |
247 | Thermal Zone Management | 254 | Thermal Zone Management |
@@ -287,26 +294,6 @@ static int acpi_thermal_get_polling_frequency(struct acpi_thermal *tz) | |||
287 | return 0; | 294 | return 0; |
288 | } | 295 | } |
289 | 296 | ||
290 | static int acpi_thermal_set_polling(struct acpi_thermal *tz, int seconds) | ||
291 | { | ||
292 | |||
293 | if (!tz) | ||
294 | return -EINVAL; | ||
295 | |||
296 | tz->polling_frequency = seconds * 10; /* Convert value to deci-seconds */ | ||
297 | |||
298 | tz->thermal_zone->polling_delay = seconds * 1000; | ||
299 | |||
300 | if (tz->tz_enabled) | ||
301 | thermal_zone_device_update(tz->thermal_zone); | ||
302 | |||
303 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, | ||
304 | "Polling frequency set to %lu seconds\n", | ||
305 | tz->polling_frequency/10)); | ||
306 | |||
307 | return 0; | ||
308 | } | ||
309 | |||
310 | static int acpi_thermal_set_cooling_mode(struct acpi_thermal *tz, int mode) | 297 | static int acpi_thermal_set_cooling_mode(struct acpi_thermal *tz, int mode) |
311 | { | 298 | { |
312 | acpi_status status = AE_OK; | 299 | acpi_status status = AE_OK; |
@@ -973,7 +960,7 @@ static void acpi_thermal_unregister_thermal_zone(struct acpi_thermal *tz) | |||
973 | /* -------------------------------------------------------------------------- | 960 | /* -------------------------------------------------------------------------- |
974 | FS Interface (/proc) | 961 | FS Interface (/proc) |
975 | -------------------------------------------------------------------------- */ | 962 | -------------------------------------------------------------------------- */ |
976 | 963 | #ifdef CONFIG_ACPI_PROCFS | |
977 | static struct proc_dir_entry *acpi_thermal_dir; | 964 | static struct proc_dir_entry *acpi_thermal_dir; |
978 | 965 | ||
979 | static int acpi_thermal_state_seq_show(struct seq_file *seq, void *offset) | 966 | static int acpi_thermal_state_seq_show(struct seq_file *seq, void *offset) |
@@ -1187,6 +1174,26 @@ static int acpi_thermal_polling_open_fs(struct inode *inode, struct file *file) | |||
1187 | PDE(inode)->data); | 1174 | PDE(inode)->data); |
1188 | } | 1175 | } |
1189 | 1176 | ||
1177 | static int acpi_thermal_set_polling(struct acpi_thermal *tz, int seconds) | ||
1178 | { | ||
1179 | if (!tz) | ||
1180 | return -EINVAL; | ||
1181 | |||
1182 | /* Convert value to deci-seconds */ | ||
1183 | tz->polling_frequency = seconds * 10; | ||
1184 | |||
1185 | tz->thermal_zone->polling_delay = seconds * 1000; | ||
1186 | |||
1187 | if (tz->tz_enabled) | ||
1188 | thermal_zone_device_update(tz->thermal_zone); | ||
1189 | |||
1190 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, | ||
1191 | "Polling frequency set to %lu seconds\n", | ||
1192 | tz->polling_frequency/10)); | ||
1193 | |||
1194 | return 0; | ||
1195 | } | ||
1196 | |||
1190 | static ssize_t | 1197 | static ssize_t |
1191 | acpi_thermal_write_polling(struct file *file, | 1198 | acpi_thermal_write_polling(struct file *file, |
1192 | const char __user * buffer, | 1199 | const char __user * buffer, |
@@ -1295,7 +1302,13 @@ static int acpi_thermal_remove_fs(struct acpi_device *device) | |||
1295 | 1302 | ||
1296 | return 0; | 1303 | return 0; |
1297 | } | 1304 | } |
1298 | 1305 | #else | |
1306 | static inline int acpi_thermal_add_fs(struct acpi_device *device) { return 0; } | ||
1307 | static inline int acpi_thermal_remove_fs(struct acpi_device *device) | ||
1308 | { | ||
1309 | return 0; | ||
1310 | } | ||
1311 | #endif /* CONFIG_ACPI_PROCFS */ | ||
1299 | /* -------------------------------------------------------------------------- | 1312 | /* -------------------------------------------------------------------------- |
1300 | Driver Interface | 1313 | Driver Interface |
1301 | -------------------------------------------------------------------------- */ | 1314 | -------------------------------------------------------------------------- */ |
@@ -1566,13 +1579,18 @@ static int __init acpi_thermal_init(void) | |||
1566 | printk(KERN_NOTICE "ACPI: thermal control disabled\n"); | 1579 | printk(KERN_NOTICE "ACPI: thermal control disabled\n"); |
1567 | return -ENODEV; | 1580 | return -ENODEV; |
1568 | } | 1581 | } |
1582 | |||
1583 | #ifdef CONFIG_ACPI_PROCFS | ||
1569 | acpi_thermal_dir = proc_mkdir(ACPI_THERMAL_CLASS, acpi_root_dir); | 1584 | acpi_thermal_dir = proc_mkdir(ACPI_THERMAL_CLASS, acpi_root_dir); |
1570 | if (!acpi_thermal_dir) | 1585 | if (!acpi_thermal_dir) |
1571 | return -ENODEV; | 1586 | return -ENODEV; |
1587 | #endif | ||
1572 | 1588 | ||
1573 | result = acpi_bus_register_driver(&acpi_thermal_driver); | 1589 | result = acpi_bus_register_driver(&acpi_thermal_driver); |
1574 | if (result < 0) { | 1590 | if (result < 0) { |
1591 | #ifdef CONFIG_ACPI_PROCFS | ||
1575 | remove_proc_entry(ACPI_THERMAL_CLASS, acpi_root_dir); | 1592 | remove_proc_entry(ACPI_THERMAL_CLASS, acpi_root_dir); |
1593 | #endif | ||
1576 | return -ENODEV; | 1594 | return -ENODEV; |
1577 | } | 1595 | } |
1578 | 1596 | ||
@@ -1584,7 +1602,9 @@ static void __exit acpi_thermal_exit(void) | |||
1584 | 1602 | ||
1585 | acpi_bus_unregister_driver(&acpi_thermal_driver); | 1603 | acpi_bus_unregister_driver(&acpi_thermal_driver); |
1586 | 1604 | ||
1605 | #ifdef CONFIG_ACPI_PROCFS | ||
1587 | remove_proc_entry(ACPI_THERMAL_CLASS, acpi_root_dir); | 1606 | remove_proc_entry(ACPI_THERMAL_CLASS, acpi_root_dir); |
1607 | #endif | ||
1588 | 1608 | ||
1589 | return; | 1609 | return; |
1590 | } | 1610 | } |