Commit | Line | Data |
---|---|---|
1da177e4 LT |
1 | /* |
2 | * acpi_button.c - ACPI Button Driver ($Revision: 30 $) | |
3 | * | |
4 | * Copyright (C) 2001, 2002 Andy Grover <andrew.grover@intel.com> | |
5 | * Copyright (C) 2001, 2002 Paul Diefenbaugh <paul.s.diefenbaugh@intel.com> | |
6 | * | |
7 | * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | |
8 | * | |
9 | * This program is free software; you can redistribute it and/or modify | |
10 | * it under the terms of the GNU General Public License as published by | |
11 | * the Free Software Foundation; either version 2 of the License, or (at | |
12 | * your option) any later version. | |
13 | * | |
14 | * This program is distributed in the hope that it will be useful, but | |
15 | * WITHOUT ANY WARRANTY; without even the implied warranty of | |
16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
17 | * General Public License for more details. | |
18 | * | |
19 | * You should have received a copy of the GNU General Public License along | |
20 | * with this program; if not, write to the Free Software Foundation, Inc., | |
21 | * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. | |
22 | * | |
23 | * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | |
24 | */ | |
25 | ||
26 | #include <linux/kernel.h> | |
27 | #include <linux/module.h> | |
28 | #include <linux/init.h> | |
b34a8030 AS |
29 | #include <linux/types.h> |
30 | #include <linux/proc_fs.h> | |
31 | #include <linux/seq_file.h> | |
1da177e4 LT |
32 | #include <acpi/acpi_bus.h> |
33 | #include <acpi/acpi_drivers.h> | |
34 | ||
1da177e4 LT |
35 | #define ACPI_BUTTON_COMPONENT 0x00080000 |
36 | #define ACPI_BUTTON_DRIVER_NAME "ACPI Button Driver" | |
37 | #define ACPI_BUTTON_CLASS "button" | |
b34a8030 AS |
38 | #define ACPI_BUTTON_FILE_INFO "info" |
39 | #define ACPI_BUTTON_FILE_STATE "state" | |
40 | #define ACPI_BUTTON_TYPE_UNKNOWN 0x00 | |
1da177e4 LT |
41 | #define ACPI_BUTTON_NOTIFY_STATUS 0x80 |
42 | ||
43 | #define ACPI_BUTTON_SUBCLASS_POWER "power" | |
4be44fcd | 44 | #define ACPI_BUTTON_HID_POWER "PNP0C0C" |
1da177e4 LT |
45 | #define ACPI_BUTTON_DEVICE_NAME_POWER "Power Button (CM)" |
46 | #define ACPI_BUTTON_DEVICE_NAME_POWERF "Power Button (FF)" | |
47 | #define ACPI_BUTTON_TYPE_POWER 0x01 | |
48 | #define ACPI_BUTTON_TYPE_POWERF 0x02 | |
49 | ||
50 | #define ACPI_BUTTON_SUBCLASS_SLEEP "sleep" | |
51 | #define ACPI_BUTTON_HID_SLEEP "PNP0C0E" | |
52 | #define ACPI_BUTTON_DEVICE_NAME_SLEEP "Sleep Button (CM)" | |
53 | #define ACPI_BUTTON_DEVICE_NAME_SLEEPF "Sleep Button (FF)" | |
54 | #define ACPI_BUTTON_TYPE_SLEEP 0x03 | |
55 | #define ACPI_BUTTON_TYPE_SLEEPF 0x04 | |
56 | ||
57 | #define ACPI_BUTTON_SUBCLASS_LID "lid" | |
58 | #define ACPI_BUTTON_HID_LID "PNP0C0D" | |
59 | #define ACPI_BUTTON_DEVICE_NAME_LID "Lid Switch" | |
60 | #define ACPI_BUTTON_TYPE_LID 0x05 | |
61 | ||
62 | #define _COMPONENT ACPI_BUTTON_COMPONENT | |
4be44fcd | 63 | ACPI_MODULE_NAME("acpi_button") |
1da177e4 | 64 | |
4be44fcd | 65 | MODULE_AUTHOR("Paul Diefenbaugh"); |
1da177e4 LT |
66 | MODULE_DESCRIPTION(ACPI_BUTTON_DRIVER_NAME); |
67 | MODULE_LICENSE("GPL"); | |
68 | ||
4be44fcd LB |
69 | static int acpi_button_add(struct acpi_device *device); |
70 | static int acpi_button_remove(struct acpi_device *device, int type); | |
b34a8030 AS |
71 | static int acpi_button_info_open_fs(struct inode *inode, struct file *file); |
72 | static int acpi_button_state_open_fs(struct inode *inode, struct file *file); | |
1da177e4 LT |
73 | |
74 | static struct acpi_driver acpi_button_driver = { | |
4be44fcd LB |
75 | .name = ACPI_BUTTON_DRIVER_NAME, |
76 | .class = ACPI_BUTTON_CLASS, | |
77 | .ids = "ACPI_FPB,ACPI_FSB,PNP0C0D,PNP0C0C,PNP0C0E", | |
78 | .ops = { | |
79 | .add = acpi_button_add, | |
80 | .remove = acpi_button_remove, | |
81 | }, | |
1da177e4 LT |
82 | }; |
83 | ||
84 | struct acpi_button { | |
4be44fcd LB |
85 | acpi_handle handle; |
86 | struct acpi_device *device; /* Fixed button kludge */ | |
87 | u8 type; | |
88 | unsigned long pushed; | |
1da177e4 LT |
89 | }; |
90 | ||
b34a8030 | 91 | static struct file_operations acpi_button_info_fops = { |
4be44fcd LB |
92 | .open = acpi_button_info_open_fs, |
93 | .read = seq_read, | |
94 | .llseek = seq_lseek, | |
95 | .release = single_release, | |
b34a8030 AS |
96 | }; |
97 | ||
98 | static struct file_operations acpi_button_state_fops = { | |
4be44fcd LB |
99 | .open = acpi_button_state_open_fs, |
100 | .read = seq_read, | |
101 | .llseek = seq_lseek, | |
102 | .release = single_release, | |
b34a8030 | 103 | }; |
4be44fcd | 104 | |
b34a8030 AS |
105 | /* -------------------------------------------------------------------------- |
106 | FS Interface (/proc) | |
107 | -------------------------------------------------------------------------- */ | |
108 | ||
4be44fcd | 109 | static struct proc_dir_entry *acpi_button_dir; |
b34a8030 AS |
110 | |
111 | static int acpi_button_info_seq_show(struct seq_file *seq, void *offset) | |
112 | { | |
4be44fcd | 113 | struct acpi_button *button = (struct acpi_button *)seq->private; |
b34a8030 | 114 | |
b34a8030 AS |
115 | |
116 | if (!button || !button->device) | |
d550d98d | 117 | return 0; |
b34a8030 | 118 | |
4be44fcd LB |
119 | seq_printf(seq, "type: %s\n", |
120 | acpi_device_name(button->device)); | |
b34a8030 | 121 | |
d550d98d | 122 | return 0; |
b34a8030 AS |
123 | } |
124 | ||
125 | static int acpi_button_info_open_fs(struct inode *inode, struct file *file) | |
126 | { | |
127 | return single_open(file, acpi_button_info_seq_show, PDE(inode)->data); | |
128 | } | |
4be44fcd | 129 | |
b34a8030 AS |
130 | static int acpi_button_state_seq_show(struct seq_file *seq, void *offset) |
131 | { | |
4be44fcd LB |
132 | struct acpi_button *button = (struct acpi_button *)seq->private; |
133 | acpi_status status; | |
134 | unsigned long state; | |
b34a8030 | 135 | |
b34a8030 AS |
136 | |
137 | if (!button || !button->device) | |
d550d98d | 138 | return 0; |
b34a8030 | 139 | |
4be44fcd | 140 | status = acpi_evaluate_integer(button->handle, "_LID", NULL, &state); |
b34a8030 AS |
141 | if (ACPI_FAILURE(status)) { |
142 | seq_printf(seq, "state: unsupported\n"); | |
4be44fcd LB |
143 | } else { |
144 | seq_printf(seq, "state: %s\n", | |
145 | (state ? "open" : "closed")); | |
b34a8030 AS |
146 | } |
147 | ||
d550d98d | 148 | return 0; |
b34a8030 AS |
149 | } |
150 | ||
151 | static int acpi_button_state_open_fs(struct inode *inode, struct file *file) | |
152 | { | |
153 | return single_open(file, acpi_button_state_seq_show, PDE(inode)->data); | |
154 | } | |
155 | ||
156 | static struct proc_dir_entry *acpi_power_dir; | |
157 | static struct proc_dir_entry *acpi_sleep_dir; | |
158 | static struct proc_dir_entry *acpi_lid_dir; | |
159 | ||
4be44fcd | 160 | static int acpi_button_add_fs(struct acpi_device *device) |
b34a8030 | 161 | { |
4be44fcd LB |
162 | struct proc_dir_entry *entry = NULL; |
163 | struct acpi_button *button = NULL; | |
b34a8030 | 164 | |
b34a8030 AS |
165 | |
166 | if (!device || !acpi_driver_data(device)) | |
d550d98d | 167 | return -EINVAL; |
b34a8030 AS |
168 | |
169 | button = acpi_driver_data(device); | |
170 | ||
171 | switch (button->type) { | |
172 | case ACPI_BUTTON_TYPE_POWER: | |
173 | case ACPI_BUTTON_TYPE_POWERF: | |
174 | if (!acpi_power_dir) | |
4be44fcd LB |
175 | acpi_power_dir = proc_mkdir(ACPI_BUTTON_SUBCLASS_POWER, |
176 | acpi_button_dir); | |
b34a8030 AS |
177 | entry = acpi_power_dir; |
178 | break; | |
179 | case ACPI_BUTTON_TYPE_SLEEP: | |
180 | case ACPI_BUTTON_TYPE_SLEEPF: | |
181 | if (!acpi_sleep_dir) | |
4be44fcd LB |
182 | acpi_sleep_dir = proc_mkdir(ACPI_BUTTON_SUBCLASS_SLEEP, |
183 | acpi_button_dir); | |
b34a8030 AS |
184 | entry = acpi_sleep_dir; |
185 | break; | |
186 | case ACPI_BUTTON_TYPE_LID: | |
187 | if (!acpi_lid_dir) | |
4be44fcd LB |
188 | acpi_lid_dir = proc_mkdir(ACPI_BUTTON_SUBCLASS_LID, |
189 | acpi_button_dir); | |
b34a8030 AS |
190 | entry = acpi_lid_dir; |
191 | break; | |
192 | } | |
193 | ||
194 | if (!entry) | |
d550d98d | 195 | return -ENODEV; |
b34a8030 AS |
196 | entry->owner = THIS_MODULE; |
197 | ||
198 | acpi_device_dir(device) = proc_mkdir(acpi_device_bid(device), entry); | |
199 | if (!acpi_device_dir(device)) | |
d550d98d | 200 | return -ENODEV; |
b34a8030 AS |
201 | acpi_device_dir(device)->owner = THIS_MODULE; |
202 | ||
203 | /* 'info' [R] */ | |
204 | entry = create_proc_entry(ACPI_BUTTON_FILE_INFO, | |
4be44fcd | 205 | S_IRUGO, acpi_device_dir(device)); |
b34a8030 | 206 | if (!entry) |
d550d98d | 207 | return -ENODEV; |
b34a8030 AS |
208 | else { |
209 | entry->proc_fops = &acpi_button_info_fops; | |
210 | entry->data = acpi_driver_data(device); | |
211 | entry->owner = THIS_MODULE; | |
212 | } | |
213 | ||
214 | /* show lid state [R] */ | |
215 | if (button->type == ACPI_BUTTON_TYPE_LID) { | |
216 | entry = create_proc_entry(ACPI_BUTTON_FILE_STATE, | |
4be44fcd | 217 | S_IRUGO, acpi_device_dir(device)); |
b34a8030 | 218 | if (!entry) |
a6fc6720 | 219 | return -ENODEV; |
b34a8030 AS |
220 | else { |
221 | entry->proc_fops = &acpi_button_state_fops; | |
222 | entry->data = acpi_driver_data(device); | |
223 | entry->owner = THIS_MODULE; | |
224 | } | |
225 | } | |
226 | ||
d550d98d | 227 | return 0; |
b34a8030 AS |
228 | } |
229 | ||
4be44fcd | 230 | static int acpi_button_remove_fs(struct acpi_device *device) |
b34a8030 | 231 | { |
4be44fcd | 232 | struct acpi_button *button = NULL; |
b34a8030 | 233 | |
b34a8030 AS |
234 | |
235 | button = acpi_driver_data(device); | |
236 | if (acpi_device_dir(device)) { | |
237 | if (button->type == ACPI_BUTTON_TYPE_LID) | |
238 | remove_proc_entry(ACPI_BUTTON_FILE_STATE, | |
4be44fcd | 239 | acpi_device_dir(device)); |
b34a8030 | 240 | remove_proc_entry(ACPI_BUTTON_FILE_INFO, |
4be44fcd | 241 | acpi_device_dir(device)); |
b34a8030 AS |
242 | |
243 | remove_proc_entry(acpi_device_bid(device), | |
4be44fcd | 244 | acpi_device_dir(device)->parent); |
b34a8030 AS |
245 | acpi_device_dir(device) = NULL; |
246 | } | |
247 | ||
d550d98d | 248 | return 0; |
b34a8030 AS |
249 | } |
250 | ||
1da177e4 LT |
251 | /* -------------------------------------------------------------------------- |
252 | Driver Interface | |
253 | -------------------------------------------------------------------------- */ | |
254 | ||
4be44fcd | 255 | static void acpi_button_notify(acpi_handle handle, u32 event, void *data) |
1da177e4 | 256 | { |
4be44fcd | 257 | struct acpi_button *button = (struct acpi_button *)data; |
1da177e4 | 258 | |
1da177e4 LT |
259 | |
260 | if (!button || !button->device) | |
d550d98d | 261 | return; |
1da177e4 LT |
262 | |
263 | switch (event) { | |
264 | case ACPI_BUTTON_NOTIFY_STATUS: | |
4be44fcd LB |
265 | acpi_bus_generate_event(button->device, event, |
266 | ++button->pushed); | |
1da177e4 LT |
267 | break; |
268 | default: | |
269 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, | |
4be44fcd | 270 | "Unsupported event [0x%x]\n", event)); |
1da177e4 LT |
271 | break; |
272 | } | |
273 | ||
d550d98d | 274 | return; |
1da177e4 LT |
275 | } |
276 | ||
4be44fcd | 277 | static acpi_status acpi_button_notify_fixed(void *data) |
1da177e4 | 278 | { |
4be44fcd LB |
279 | struct acpi_button *button = (struct acpi_button *)data; |
280 | ||
1da177e4 | 281 | |
b34a8030 | 282 | if (!button) |
d550d98d | 283 | return AE_BAD_PARAMETER; |
1da177e4 LT |
284 | |
285 | acpi_button_notify(button->handle, ACPI_BUTTON_NOTIFY_STATUS, button); | |
286 | ||
d550d98d | 287 | return AE_OK; |
1da177e4 LT |
288 | } |
289 | ||
4be44fcd | 290 | static int acpi_button_add(struct acpi_device *device) |
1da177e4 | 291 | { |
4be44fcd LB |
292 | int result = 0; |
293 | acpi_status status = AE_OK; | |
294 | struct acpi_button *button = NULL; | |
1da177e4 | 295 | |
1da177e4 LT |
296 | |
297 | if (!device) | |
d550d98d | 298 | return -EINVAL; |
1da177e4 LT |
299 | |
300 | button = kmalloc(sizeof(struct acpi_button), GFP_KERNEL); | |
301 | if (!button) | |
d550d98d | 302 | return -ENOMEM; |
1da177e4 LT |
303 | memset(button, 0, sizeof(struct acpi_button)); |
304 | ||
305 | button->device = device; | |
306 | button->handle = device->handle; | |
307 | acpi_driver_data(device) = button; | |
308 | ||
309 | /* | |
310 | * Determine the button type (via hid), as fixed-feature buttons | |
311 | * need to be handled a bit differently than generic-space. | |
312 | */ | |
313 | if (!strcmp(acpi_device_hid(device), ACPI_BUTTON_HID_POWER)) { | |
314 | button->type = ACPI_BUTTON_TYPE_POWER; | |
4be44fcd LB |
315 | strcpy(acpi_device_name(device), ACPI_BUTTON_DEVICE_NAME_POWER); |
316 | sprintf(acpi_device_class(device), "%s/%s", | |
1da177e4 | 317 | ACPI_BUTTON_CLASS, ACPI_BUTTON_SUBCLASS_POWER); |
4be44fcd | 318 | } else if (!strcmp(acpi_device_hid(device), ACPI_BUTTON_HID_POWERF)) { |
1da177e4 LT |
319 | button->type = ACPI_BUTTON_TYPE_POWERF; |
320 | strcpy(acpi_device_name(device), | |
4be44fcd LB |
321 | ACPI_BUTTON_DEVICE_NAME_POWERF); |
322 | sprintf(acpi_device_class(device), "%s/%s", | |
1da177e4 | 323 | ACPI_BUTTON_CLASS, ACPI_BUTTON_SUBCLASS_POWER); |
4be44fcd | 324 | } else if (!strcmp(acpi_device_hid(device), ACPI_BUTTON_HID_SLEEP)) { |
1da177e4 | 325 | button->type = ACPI_BUTTON_TYPE_SLEEP; |
4be44fcd LB |
326 | strcpy(acpi_device_name(device), ACPI_BUTTON_DEVICE_NAME_SLEEP); |
327 | sprintf(acpi_device_class(device), "%s/%s", | |
1da177e4 | 328 | ACPI_BUTTON_CLASS, ACPI_BUTTON_SUBCLASS_SLEEP); |
4be44fcd | 329 | } else if (!strcmp(acpi_device_hid(device), ACPI_BUTTON_HID_SLEEPF)) { |
1da177e4 LT |
330 | button->type = ACPI_BUTTON_TYPE_SLEEPF; |
331 | strcpy(acpi_device_name(device), | |
4be44fcd LB |
332 | ACPI_BUTTON_DEVICE_NAME_SLEEPF); |
333 | sprintf(acpi_device_class(device), "%s/%s", | |
1da177e4 | 334 | ACPI_BUTTON_CLASS, ACPI_BUTTON_SUBCLASS_SLEEP); |
4be44fcd | 335 | } else if (!strcmp(acpi_device_hid(device), ACPI_BUTTON_HID_LID)) { |
1da177e4 | 336 | button->type = ACPI_BUTTON_TYPE_LID; |
4be44fcd LB |
337 | strcpy(acpi_device_name(device), ACPI_BUTTON_DEVICE_NAME_LID); |
338 | sprintf(acpi_device_class(device), "%s/%s", | |
1da177e4 | 339 | ACPI_BUTTON_CLASS, ACPI_BUTTON_SUBCLASS_LID); |
4be44fcd | 340 | } else { |
6468463a LB |
341 | printk(KERN_ERR PREFIX "Unsupported hid [%s]\n", |
342 | acpi_device_hid(device)); | |
1da177e4 LT |
343 | result = -ENODEV; |
344 | goto end; | |
345 | } | |
346 | ||
b34a8030 AS |
347 | result = acpi_button_add_fs(device); |
348 | if (result) | |
349 | goto end; | |
350 | ||
1da177e4 LT |
351 | switch (button->type) { |
352 | case ACPI_BUTTON_TYPE_POWERF: | |
4be44fcd LB |
353 | status = |
354 | acpi_install_fixed_event_handler(ACPI_EVENT_POWER_BUTTON, | |
355 | acpi_button_notify_fixed, | |
356 | button); | |
1da177e4 LT |
357 | break; |
358 | case ACPI_BUTTON_TYPE_SLEEPF: | |
4be44fcd LB |
359 | status = |
360 | acpi_install_fixed_event_handler(ACPI_EVENT_SLEEP_BUTTON, | |
361 | acpi_button_notify_fixed, | |
362 | button); | |
1da177e4 LT |
363 | break; |
364 | default: | |
4be44fcd LB |
365 | status = acpi_install_notify_handler(button->handle, |
366 | ACPI_DEVICE_NOTIFY, | |
367 | acpi_button_notify, | |
368 | button); | |
1da177e4 LT |
369 | break; |
370 | } | |
371 | ||
372 | if (ACPI_FAILURE(status)) { | |
1da177e4 LT |
373 | result = -ENODEV; |
374 | goto end; | |
375 | } | |
376 | ||
377 | if (device->wakeup.flags.valid) { | |
378 | /* Button's GPE is run-wake GPE */ | |
4be44fcd LB |
379 | acpi_set_gpe_type(device->wakeup.gpe_device, |
380 | device->wakeup.gpe_number, | |
381 | ACPI_GPE_TYPE_WAKE_RUN); | |
382 | acpi_enable_gpe(device->wakeup.gpe_device, | |
383 | device->wakeup.gpe_number, ACPI_NOT_ISR); | |
1da177e4 LT |
384 | device->wakeup.state.enabled = 1; |
385 | } | |
386 | ||
4be44fcd LB |
387 | printk(KERN_INFO PREFIX "%s [%s]\n", |
388 | acpi_device_name(device), acpi_device_bid(device)); | |
1da177e4 | 389 | |
4be44fcd | 390 | end: |
1da177e4 | 391 | if (result) { |
b34a8030 | 392 | acpi_button_remove_fs(device); |
1da177e4 LT |
393 | kfree(button); |
394 | } | |
395 | ||
d550d98d | 396 | return result; |
1da177e4 LT |
397 | } |
398 | ||
4be44fcd | 399 | static int acpi_button_remove(struct acpi_device *device, int type) |
1da177e4 | 400 | { |
4be44fcd LB |
401 | acpi_status status = 0; |
402 | struct acpi_button *button = NULL; | |
1da177e4 | 403 | |
1da177e4 LT |
404 | |
405 | if (!device || !acpi_driver_data(device)) | |
d550d98d | 406 | return -EINVAL; |
1da177e4 LT |
407 | |
408 | button = acpi_driver_data(device); | |
409 | ||
410 | /* Unregister for device notifications. */ | |
411 | switch (button->type) { | |
412 | case ACPI_BUTTON_TYPE_POWERF: | |
4be44fcd LB |
413 | status = |
414 | acpi_remove_fixed_event_handler(ACPI_EVENT_POWER_BUTTON, | |
415 | acpi_button_notify_fixed); | |
1da177e4 LT |
416 | break; |
417 | case ACPI_BUTTON_TYPE_SLEEPF: | |
4be44fcd LB |
418 | status = |
419 | acpi_remove_fixed_event_handler(ACPI_EVENT_SLEEP_BUTTON, | |
420 | acpi_button_notify_fixed); | |
1da177e4 LT |
421 | break; |
422 | default: | |
423 | status = acpi_remove_notify_handler(button->handle, | |
4be44fcd LB |
424 | ACPI_DEVICE_NOTIFY, |
425 | acpi_button_notify); | |
1da177e4 LT |
426 | break; |
427 | } | |
428 | ||
4be44fcd | 429 | acpi_button_remove_fs(device); |
b34a8030 | 430 | |
1da177e4 LT |
431 | kfree(button); |
432 | ||
d550d98d | 433 | return 0; |
1da177e4 LT |
434 | } |
435 | ||
4be44fcd | 436 | static int __init acpi_button_init(void) |
1da177e4 | 437 | { |
4be44fcd | 438 | int result = 0; |
1da177e4 | 439 | |
1da177e4 | 440 | |
b34a8030 AS |
441 | acpi_button_dir = proc_mkdir(ACPI_BUTTON_CLASS, acpi_root_dir); |
442 | if (!acpi_button_dir) | |
d550d98d | 443 | return -ENODEV; |
b34a8030 | 444 | acpi_button_dir->owner = THIS_MODULE; |
1da177e4 LT |
445 | result = acpi_bus_register_driver(&acpi_button_driver); |
446 | if (result < 0) { | |
b34a8030 | 447 | remove_proc_entry(ACPI_BUTTON_CLASS, acpi_root_dir); |
d550d98d | 448 | return -ENODEV; |
1da177e4 LT |
449 | } |
450 | ||
d550d98d | 451 | return 0; |
1da177e4 LT |
452 | } |
453 | ||
4be44fcd | 454 | static void __exit acpi_button_exit(void) |
1da177e4 | 455 | { |
1da177e4 LT |
456 | |
457 | acpi_bus_unregister_driver(&acpi_button_driver); | |
458 | ||
4be44fcd | 459 | if (acpi_power_dir) |
b34a8030 AS |
460 | remove_proc_entry(ACPI_BUTTON_SUBCLASS_POWER, acpi_button_dir); |
461 | if (acpi_sleep_dir) | |
462 | remove_proc_entry(ACPI_BUTTON_SUBCLASS_SLEEP, acpi_button_dir); | |
463 | if (acpi_lid_dir) | |
464 | remove_proc_entry(ACPI_BUTTON_SUBCLASS_LID, acpi_button_dir); | |
465 | remove_proc_entry(ACPI_BUTTON_CLASS, acpi_root_dir); | |
466 | ||
d550d98d | 467 | return; |
1da177e4 LT |
468 | } |
469 | ||
1da177e4 LT |
470 | module_init(acpi_button_init); |
471 | module_exit(acpi_button_exit); |