diff options
author | Lan Tianyu <tianyu.lan@intel.com> | 2013-10-12 09:04:48 -0400 |
---|---|---|
committer | Rafael J. Wysocki <rafael.j.wysocki@intel.com> | 2013-10-15 19:23:15 -0400 |
commit | ab0fd674d6cef0904baa511f22613ef6474f8169 (patch) | |
tree | fba4ee2b6189825087b11343625904b58dc1a22d /drivers/acpi/ac.c | |
parent | b5c37b798f2d29b9b2926e0abf008a13ce6c91fe (diff) |
ACPI / AC: Remove AC's proc directory.
AC's proc directory is not used and so remove it. Prepare for removing
/proc/acpi directory.
Signed-off-by: Lan Tianyu <tianyu.lan@intel.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Diffstat (limited to 'drivers/acpi/ac.c')
-rw-r--r-- | drivers/acpi/ac.c | 129 |
1 files changed, 3 insertions, 126 deletions
diff --git a/drivers/acpi/ac.c b/drivers/acpi/ac.c index 324b5a096eff..b9f0d5f4bba5 100644 --- a/drivers/acpi/ac.c +++ b/drivers/acpi/ac.c | |||
@@ -30,10 +30,6 @@ | |||
30 | #include <linux/types.h> | 30 | #include <linux/types.h> |
31 | #include <linux/dmi.h> | 31 | #include <linux/dmi.h> |
32 | #include <linux/delay.h> | 32 | #include <linux/delay.h> |
33 | #ifdef CONFIG_ACPI_PROCFS_POWER | ||
34 | #include <linux/proc_fs.h> | ||
35 | #include <linux/seq_file.h> | ||
36 | #endif | ||
37 | #include <linux/platform_device.h> | 33 | #include <linux/platform_device.h> |
38 | #include <linux/power_supply.h> | 34 | #include <linux/power_supply.h> |
39 | #include <acpi/acpi_bus.h> | 35 | #include <acpi/acpi_bus.h> |
@@ -56,12 +52,6 @@ MODULE_AUTHOR("Paul Diefenbaugh"); | |||
56 | MODULE_DESCRIPTION("ACPI AC Adapter Driver"); | 52 | MODULE_DESCRIPTION("ACPI AC Adapter Driver"); |
57 | MODULE_LICENSE("GPL"); | 53 | MODULE_LICENSE("GPL"); |
58 | 54 | ||
59 | #ifdef CONFIG_ACPI_PROCFS_POWER | ||
60 | extern struct proc_dir_entry *acpi_lock_ac_dir(void); | ||
61 | extern void *acpi_unlock_ac_dir(struct proc_dir_entry *acpi_ac_dir); | ||
62 | static int acpi_ac_open_fs(struct inode *inode, struct file *file); | ||
63 | #endif | ||
64 | |||
65 | static int ac_sleep_before_get_state_ms; | 55 | static int ac_sleep_before_get_state_ms; |
66 | 56 | ||
67 | struct acpi_ac { | 57 | struct acpi_ac { |
@@ -73,16 +63,6 @@ struct acpi_ac { | |||
73 | 63 | ||
74 | #define to_acpi_ac(x) container_of(x, struct acpi_ac, charger) | 64 | #define to_acpi_ac(x) container_of(x, struct acpi_ac, charger) |
75 | 65 | ||
76 | #ifdef CONFIG_ACPI_PROCFS_POWER | ||
77 | static const struct file_operations acpi_ac_fops = { | ||
78 | .owner = THIS_MODULE, | ||
79 | .open = acpi_ac_open_fs, | ||
80 | .read = seq_read, | ||
81 | .llseek = seq_lseek, | ||
82 | .release = single_release, | ||
83 | }; | ||
84 | #endif | ||
85 | |||
86 | /* -------------------------------------------------------------------------- | 66 | /* -------------------------------------------------------------------------- |
87 | AC Adapter Management | 67 | AC Adapter Management |
88 | -------------------------------------------------------------------------- */ | 68 | -------------------------------------------------------------------------- */ |
@@ -132,83 +112,6 @@ static enum power_supply_property ac_props[] = { | |||
132 | POWER_SUPPLY_PROP_ONLINE, | 112 | POWER_SUPPLY_PROP_ONLINE, |
133 | }; | 113 | }; |
134 | 114 | ||
135 | #ifdef CONFIG_ACPI_PROCFS_POWER | ||
136 | /* -------------------------------------------------------------------------- | ||
137 | FS Interface (/proc) | ||
138 | -------------------------------------------------------------------------- */ | ||
139 | |||
140 | static struct proc_dir_entry *acpi_ac_dir; | ||
141 | |||
142 | static int acpi_ac_seq_show(struct seq_file *seq, void *offset) | ||
143 | { | ||
144 | struct acpi_ac *ac = seq->private; | ||
145 | |||
146 | |||
147 | if (!ac) | ||
148 | return 0; | ||
149 | |||
150 | if (acpi_ac_get_state(ac)) { | ||
151 | seq_puts(seq, "ERROR: Unable to read AC Adapter state\n"); | ||
152 | return 0; | ||
153 | } | ||
154 | |||
155 | seq_puts(seq, "state: "); | ||
156 | switch (ac->state) { | ||
157 | case ACPI_AC_STATUS_OFFLINE: | ||
158 | seq_puts(seq, "off-line\n"); | ||
159 | break; | ||
160 | case ACPI_AC_STATUS_ONLINE: | ||
161 | seq_puts(seq, "on-line\n"); | ||
162 | break; | ||
163 | default: | ||
164 | seq_puts(seq, "unknown\n"); | ||
165 | break; | ||
166 | } | ||
167 | |||
168 | return 0; | ||
169 | } | ||
170 | |||
171 | static int acpi_ac_open_fs(struct inode *inode, struct file *file) | ||
172 | { | ||
173 | return single_open(file, acpi_ac_seq_show, PDE_DATA(inode)); | ||
174 | } | ||
175 | |||
176 | static int acpi_ac_add_fs(struct acpi_ac *ac) | ||
177 | { | ||
178 | struct proc_dir_entry *entry = NULL; | ||
179 | |||
180 | printk(KERN_WARNING PREFIX "Deprecated procfs I/F for AC is loaded," | ||
181 | " please retry with CONFIG_ACPI_PROCFS_POWER cleared\n"); | ||
182 | if (!acpi_device_dir(ac->adev)) { | ||
183 | acpi_device_dir(ac->adev) = | ||
184 | proc_mkdir(acpi_device_bid(ac->adev), acpi_ac_dir); | ||
185 | if (!acpi_device_dir(ac->adev)) | ||
186 | return -ENODEV; | ||
187 | } | ||
188 | |||
189 | /* 'state' [R] */ | ||
190 | entry = proc_create_data(ACPI_AC_FILE_STATE, | ||
191 | S_IRUGO, acpi_device_dir(ac->adev), | ||
192 | &acpi_ac_fops, ac); | ||
193 | if (!entry) | ||
194 | return -ENODEV; | ||
195 | return 0; | ||
196 | } | ||
197 | |||
198 | static int acpi_ac_remove_fs(struct acpi_ac *ac) | ||
199 | { | ||
200 | |||
201 | if (acpi_device_dir(ac->adev)) { | ||
202 | remove_proc_entry(ACPI_AC_FILE_STATE, | ||
203 | acpi_device_dir(ac->adev)); | ||
204 | remove_proc_entry(acpi_device_bid(ac->adev), acpi_ac_dir); | ||
205 | acpi_device_dir(ac->adev) = NULL; | ||
206 | } | ||
207 | |||
208 | return 0; | ||
209 | } | ||
210 | #endif | ||
211 | |||
212 | /* -------------------------------------------------------------------------- | 115 | /* -------------------------------------------------------------------------- |
213 | Driver Model | 116 | Driver Model |
214 | -------------------------------------------------------------------------- */ | 117 | -------------------------------------------------------------------------- */ |
@@ -293,11 +196,6 @@ static int acpi_ac_probe(struct platform_device *pdev) | |||
293 | if (result) | 196 | if (result) |
294 | goto end; | 197 | goto end; |
295 | 198 | ||
296 | #ifdef CONFIG_ACPI_PROCFS_POWER | ||
297 | result = acpi_ac_add_fs(ac); | ||
298 | if (result) | ||
299 | goto end; | ||
300 | #endif | ||
301 | ac->charger.name = acpi_device_bid(adev); | 199 | ac->charger.name = acpi_device_bid(adev); |
302 | ac->charger.type = POWER_SUPPLY_TYPE_MAINS; | 200 | ac->charger.type = POWER_SUPPLY_TYPE_MAINS; |
303 | ac->charger.properties = ac_props; | 201 | ac->charger.properties = ac_props; |
@@ -317,13 +215,9 @@ static int acpi_ac_probe(struct platform_device *pdev) | |||
317 | acpi_device_name(adev), acpi_device_bid(adev), | 215 | acpi_device_name(adev), acpi_device_bid(adev), |
318 | ac->state ? "on-line" : "off-line"); | 216 | ac->state ? "on-line" : "off-line"); |
319 | 217 | ||
320 | end: | 218 | end: |
321 | if (result) { | 219 | if (result) |
322 | #ifdef CONFIG_ACPI_PROCFS_POWER | ||
323 | acpi_ac_remove_fs(ac); | ||
324 | #endif | ||
325 | kfree(ac); | 220 | kfree(ac); |
326 | } | ||
327 | 221 | ||
328 | dmi_check_system(ac_dmi_table); | 222 | dmi_check_system(ac_dmi_table); |
329 | return result; | 223 | return result; |
@@ -366,10 +260,6 @@ static int acpi_ac_remove(struct platform_device *pdev) | |||
366 | if (ac->charger.dev) | 260 | if (ac->charger.dev) |
367 | power_supply_unregister(&ac->charger); | 261 | power_supply_unregister(&ac->charger); |
368 | 262 | ||
369 | #ifdef CONFIG_ACPI_PROCFS_POWER | ||
370 | acpi_ac_remove_fs(ac); | ||
371 | #endif | ||
372 | |||
373 | kfree(ac); | 263 | kfree(ac); |
374 | 264 | ||
375 | return 0; | 265 | return 0; |
@@ -399,19 +289,9 @@ static int __init acpi_ac_init(void) | |||
399 | if (acpi_disabled) | 289 | if (acpi_disabled) |
400 | return -ENODEV; | 290 | return -ENODEV; |
401 | 291 | ||
402 | #ifdef CONFIG_ACPI_PROCFS_POWER | ||
403 | acpi_ac_dir = acpi_lock_ac_dir(); | ||
404 | if (!acpi_ac_dir) | ||
405 | return -ENODEV; | ||
406 | #endif | ||
407 | |||
408 | result = platform_driver_register(&acpi_ac_driver); | 292 | result = platform_driver_register(&acpi_ac_driver); |
409 | if (result < 0) { | 293 | if (result < 0) |
410 | #ifdef CONFIG_ACPI_PROCFS_POWER | ||
411 | acpi_unlock_ac_dir(acpi_ac_dir); | ||
412 | #endif | ||
413 | return -ENODEV; | 294 | return -ENODEV; |
414 | } | ||
415 | 295 | ||
416 | return 0; | 296 | return 0; |
417 | } | 297 | } |
@@ -419,9 +299,6 @@ static int __init acpi_ac_init(void) | |||
419 | static void __exit acpi_ac_exit(void) | 299 | static void __exit acpi_ac_exit(void) |
420 | { | 300 | { |
421 | platform_driver_unregister(&acpi_ac_driver); | 301 | platform_driver_unregister(&acpi_ac_driver); |
422 | #ifdef CONFIG_ACPI_PROCFS_POWER | ||
423 | acpi_unlock_ac_dir(acpi_ac_dir); | ||
424 | #endif | ||
425 | } | 302 | } |
426 | module_init(acpi_ac_init); | 303 | module_init(acpi_ac_init); |
427 | module_exit(acpi_ac_exit); | 304 | module_exit(acpi_ac_exit); |