]> git.proxmox.com Git - mirror_ubuntu-bionic-kernel.git/blame - drivers/acpi/button.c
ACPI: support acpi_device_ops .notify methods
[mirror_ubuntu-bionic-kernel.git] / drivers / acpi / button.c
CommitLineData
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>
c0968f0e 32#include <linux/input.h>
1da177e4
LT
33#include <acpi/acpi_bus.h>
34#include <acpi/acpi_drivers.h>
35
1da177e4 36#define ACPI_BUTTON_CLASS "button"
b34a8030
AS
37#define ACPI_BUTTON_FILE_INFO "info"
38#define ACPI_BUTTON_FILE_STATE "state"
39#define ACPI_BUTTON_TYPE_UNKNOWN 0x00
1da177e4
LT
40#define ACPI_BUTTON_NOTIFY_STATUS 0x80
41
42#define ACPI_BUTTON_SUBCLASS_POWER "power"
4be44fcd 43#define ACPI_BUTTON_HID_POWER "PNP0C0C"
1da177e4
LT
44#define ACPI_BUTTON_DEVICE_NAME_POWER "Power Button (CM)"
45#define ACPI_BUTTON_DEVICE_NAME_POWERF "Power Button (FF)"
46#define ACPI_BUTTON_TYPE_POWER 0x01
47#define ACPI_BUTTON_TYPE_POWERF 0x02
48
49#define ACPI_BUTTON_SUBCLASS_SLEEP "sleep"
50#define ACPI_BUTTON_HID_SLEEP "PNP0C0E"
51#define ACPI_BUTTON_DEVICE_NAME_SLEEP "Sleep Button (CM)"
52#define ACPI_BUTTON_DEVICE_NAME_SLEEPF "Sleep Button (FF)"
53#define ACPI_BUTTON_TYPE_SLEEP 0x03
54#define ACPI_BUTTON_TYPE_SLEEPF 0x04
55
56#define ACPI_BUTTON_SUBCLASS_LID "lid"
57#define ACPI_BUTTON_HID_LID "PNP0C0D"
58#define ACPI_BUTTON_DEVICE_NAME_LID "Lid Switch"
59#define ACPI_BUTTON_TYPE_LID 0x05
60
61#define _COMPONENT ACPI_BUTTON_COMPONENT
f52fd66d 62ACPI_MODULE_NAME("button");
1da177e4 63
c0968f0e 64MODULE_AUTHOR("Paul Diefenbaugh");
7cda93e0 65MODULE_DESCRIPTION("ACPI Button Driver");
1da177e4
LT
66MODULE_LICENSE("GPL");
67
1ba90e3a
TR
68static const struct acpi_device_id button_device_ids[] = {
69 {ACPI_BUTTON_HID_LID, 0},
70 {ACPI_BUTTON_HID_SLEEP, 0},
71 {ACPI_BUTTON_HID_SLEEPF, 0},
72 {ACPI_BUTTON_HID_POWER, 0},
73 {ACPI_BUTTON_HID_POWERF, 0},
74 {"", 0},
75};
76MODULE_DEVICE_TABLE(acpi, button_device_ids);
77
4be44fcd
LB
78static int acpi_button_add(struct acpi_device *device);
79static int acpi_button_remove(struct acpi_device *device, int type);
23de5d9e 80static int acpi_button_resume(struct acpi_device *device);
b34a8030
AS
81static int acpi_button_info_open_fs(struct inode *inode, struct file *file);
82static int acpi_button_state_open_fs(struct inode *inode, struct file *file);
1da177e4
LT
83
84static struct acpi_driver acpi_button_driver = {
c2b6705b 85 .name = "button",
4be44fcd 86 .class = ACPI_BUTTON_CLASS,
1ba90e3a 87 .ids = button_device_ids,
4be44fcd
LB
88 .ops = {
89 .add = acpi_button_add,
23de5d9e 90 .resume = acpi_button_resume,
4be44fcd 91 .remove = acpi_button_remove,
c0968f0e 92 },
1da177e4
LT
93};
94
95struct acpi_button {
4be44fcd 96 struct acpi_device *device; /* Fixed button kludge */
c0968f0e
DT
97 unsigned int type;
98 struct input_dev *input;
99 char phys[32]; /* for input device */
4be44fcd 100 unsigned long pushed;
1da177e4
LT
101};
102
d7508032 103static const struct file_operations acpi_button_info_fops = {
cf7acfab 104 .owner = THIS_MODULE,
4be44fcd
LB
105 .open = acpi_button_info_open_fs,
106 .read = seq_read,
107 .llseek = seq_lseek,
108 .release = single_release,
b34a8030
AS
109};
110
d7508032 111static const struct file_operations acpi_button_state_fops = {
cf7acfab 112 .owner = THIS_MODULE,
4be44fcd
LB
113 .open = acpi_button_state_open_fs,
114 .read = seq_read,
115 .llseek = seq_lseek,
116 .release = single_release,
b34a8030 117};
4be44fcd 118
b34a8030
AS
119/* --------------------------------------------------------------------------
120 FS Interface (/proc)
121 -------------------------------------------------------------------------- */
122
4be44fcd 123static struct proc_dir_entry *acpi_button_dir;
b34a8030
AS
124
125static int acpi_button_info_seq_show(struct seq_file *seq, void *offset)
126{
c0968f0e 127 struct acpi_button *button = seq->private;
b34a8030
AS
128
129 if (!button || !button->device)
d550d98d 130 return 0;
b34a8030 131
4be44fcd
LB
132 seq_printf(seq, "type: %s\n",
133 acpi_device_name(button->device));
b34a8030 134
d550d98d 135 return 0;
b34a8030
AS
136}
137
138static int acpi_button_info_open_fs(struct inode *inode, struct file *file)
139{
140 return single_open(file, acpi_button_info_seq_show, PDE(inode)->data);
141}
4be44fcd 142
b34a8030
AS
143static int acpi_button_state_seq_show(struct seq_file *seq, void *offset)
144{
c0968f0e 145 struct acpi_button *button = seq->private;
4be44fcd 146 acpi_status status;
27663c58 147 unsigned long long state;
b34a8030 148
b34a8030 149 if (!button || !button->device)
d550d98d 150 return 0;
b34a8030 151
27b1d3e8 152 status = acpi_evaluate_integer(button->device->handle, "_LID", NULL, &state);
c0968f0e
DT
153 seq_printf(seq, "state: %s\n",
154 ACPI_FAILURE(status) ? "unsupported" :
155 (state ? "open" : "closed"));
d550d98d 156 return 0;
b34a8030
AS
157}
158
159static int acpi_button_state_open_fs(struct inode *inode, struct file *file)
160{
161 return single_open(file, acpi_button_state_seq_show, PDE(inode)->data);
162}
163
164static struct proc_dir_entry *acpi_power_dir;
165static struct proc_dir_entry *acpi_sleep_dir;
166static struct proc_dir_entry *acpi_lid_dir;
167
4be44fcd 168static int acpi_button_add_fs(struct acpi_device *device)
b34a8030 169{
4be44fcd 170 struct proc_dir_entry *entry = NULL;
c0968f0e 171 struct acpi_button *button;
b34a8030
AS
172
173 if (!device || !acpi_driver_data(device))
d550d98d 174 return -EINVAL;
b34a8030
AS
175
176 button = acpi_driver_data(device);
177
178 switch (button->type) {
179 case ACPI_BUTTON_TYPE_POWER:
180 case ACPI_BUTTON_TYPE_POWERF:
181 if (!acpi_power_dir)
4be44fcd
LB
182 acpi_power_dir = proc_mkdir(ACPI_BUTTON_SUBCLASS_POWER,
183 acpi_button_dir);
b34a8030
AS
184 entry = acpi_power_dir;
185 break;
186 case ACPI_BUTTON_TYPE_SLEEP:
187 case ACPI_BUTTON_TYPE_SLEEPF:
188 if (!acpi_sleep_dir)
4be44fcd
LB
189 acpi_sleep_dir = proc_mkdir(ACPI_BUTTON_SUBCLASS_SLEEP,
190 acpi_button_dir);
b34a8030
AS
191 entry = acpi_sleep_dir;
192 break;
193 case ACPI_BUTTON_TYPE_LID:
194 if (!acpi_lid_dir)
4be44fcd
LB
195 acpi_lid_dir = proc_mkdir(ACPI_BUTTON_SUBCLASS_LID,
196 acpi_button_dir);
b34a8030
AS
197 entry = acpi_lid_dir;
198 break;
199 }
200
201 if (!entry)
d550d98d 202 return -ENODEV;
b34a8030
AS
203
204 acpi_device_dir(device) = proc_mkdir(acpi_device_bid(device), entry);
205 if (!acpi_device_dir(device))
d550d98d 206 return -ENODEV;
b34a8030
AS
207
208 /* 'info' [R] */
cf7acfab
DL
209 entry = proc_create_data(ACPI_BUTTON_FILE_INFO,
210 S_IRUGO, acpi_device_dir(device),
211 &acpi_button_info_fops,
212 acpi_driver_data(device));
b34a8030 213 if (!entry)
d550d98d 214 return -ENODEV;
b34a8030
AS
215
216 /* show lid state [R] */
217 if (button->type == ACPI_BUTTON_TYPE_LID) {
cf7acfab
DL
218 entry = proc_create_data(ACPI_BUTTON_FILE_STATE,
219 S_IRUGO, acpi_device_dir(device),
220 &acpi_button_state_fops,
221 acpi_driver_data(device));
b34a8030 222 if (!entry)
a6fc6720 223 return -ENODEV;
b34a8030
AS
224 }
225
d550d98d 226 return 0;
b34a8030
AS
227}
228
4be44fcd 229static int acpi_button_remove_fs(struct acpi_device *device)
b34a8030 230{
c0968f0e 231 struct acpi_button *button = acpi_driver_data(device);
b34a8030 232
b34a8030
AS
233 if (acpi_device_dir(device)) {
234 if (button->type == ACPI_BUTTON_TYPE_LID)
235 remove_proc_entry(ACPI_BUTTON_FILE_STATE,
4be44fcd 236 acpi_device_dir(device));
b34a8030 237 remove_proc_entry(ACPI_BUTTON_FILE_INFO,
4be44fcd 238 acpi_device_dir(device));
b34a8030
AS
239
240 remove_proc_entry(acpi_device_bid(device),
4be44fcd 241 acpi_device_dir(device)->parent);
b34a8030
AS
242 acpi_device_dir(device) = NULL;
243 }
244
d550d98d 245 return 0;
b34a8030
AS
246}
247
1da177e4
LT
248/* --------------------------------------------------------------------------
249 Driver Interface
250 -------------------------------------------------------------------------- */
23de5d9e
AS
251static int acpi_lid_send_state(struct acpi_button *button)
252{
27663c58 253 unsigned long long state;
23de5d9e
AS
254 acpi_status status;
255
256 status = acpi_evaluate_integer(button->device->handle, "_LID", NULL,
257 &state);
258 if (ACPI_FAILURE(status))
259 return -ENODEV;
260 /* input layer checks if event is redundant */
261 input_report_switch(button->input, SW_LID, !state);
df316e93 262 input_sync(button->input);
23de5d9e
AS
263 return 0;
264}
1da177e4 265
4be44fcd 266static void acpi_button_notify(acpi_handle handle, u32 event, void *data)
1da177e4 267{
c0968f0e
DT
268 struct acpi_button *button = data;
269 struct input_dev *input;
1da177e4
LT
270
271 if (!button || !button->device)
d550d98d 272 return;
1da177e4
LT
273
274 switch (event) {
275 case ACPI_BUTTON_NOTIFY_STATUS:
c0968f0e 276 input = button->input;
c0968f0e 277 if (button->type == ACPI_BUTTON_TYPE_LID) {
23de5d9e 278 acpi_lid_send_state(button);
c0968f0e
DT
279 } else {
280 int keycode = test_bit(KEY_SLEEP, input->keybit) ?
281 KEY_SLEEP : KEY_POWER;
282
283 input_report_key(input, keycode, 1);
284 input_sync(input);
285 input_report_key(input, keycode, 0);
df316e93 286 input_sync(input);
c0968f0e 287 }
c0968f0e 288
14e04fb3 289 acpi_bus_generate_proc_event(button->device, event,
4be44fcd 290 ++button->pushed);
1da177e4
LT
291 break;
292 default:
293 ACPI_DEBUG_PRINT((ACPI_DB_INFO,
4be44fcd 294 "Unsupported event [0x%x]\n", event));
1da177e4
LT
295 break;
296 }
297
d550d98d 298 return;
1da177e4
LT
299}
300
4be44fcd 301static acpi_status acpi_button_notify_fixed(void *data)
1da177e4 302{
c0968f0e 303 struct acpi_button *button = data;
1da177e4 304
b34a8030 305 if (!button)
d550d98d 306 return AE_BAD_PARAMETER;
1da177e4 307
27b1d3e8 308 acpi_button_notify(button->device->handle, ACPI_BUTTON_NOTIFY_STATUS, button);
1da177e4 309
d550d98d 310 return AE_OK;
1da177e4
LT
311}
312
c0968f0e 313static int acpi_button_install_notify_handlers(struct acpi_button *button)
1da177e4 314{
c0968f0e 315 acpi_status status;
1da177e4 316
c0968f0e
DT
317 switch (button->type) {
318 case ACPI_BUTTON_TYPE_POWERF:
319 status =
320 acpi_install_fixed_event_handler(ACPI_EVENT_POWER_BUTTON,
321 acpi_button_notify_fixed,
322 button);
323 break;
324 case ACPI_BUTTON_TYPE_SLEEPF:
325 status =
326 acpi_install_fixed_event_handler(ACPI_EVENT_SLEEP_BUTTON,
327 acpi_button_notify_fixed,
328 button);
329 break;
330 default:
331 status = acpi_install_notify_handler(button->device->handle,
332 ACPI_DEVICE_NOTIFY,
333 acpi_button_notify,
334 button);
335 break;
336 }
337
338 return ACPI_FAILURE(status) ? -ENODEV : 0;
339}
340
23de5d9e
AS
341static int acpi_button_resume(struct acpi_device *device)
342{
343 struct acpi_button *button;
344 if (!device)
345 return -EINVAL;
346 button = acpi_driver_data(device);
347 if (button && button->type == ACPI_BUTTON_TYPE_LID)
348 return acpi_lid_send_state(button);
349 return 0;
350}
351
c0968f0e
DT
352static void acpi_button_remove_notify_handlers(struct acpi_button *button)
353{
354 switch (button->type) {
355 case ACPI_BUTTON_TYPE_POWERF:
356 acpi_remove_fixed_event_handler(ACPI_EVENT_POWER_BUTTON,
357 acpi_button_notify_fixed);
358 break;
359 case ACPI_BUTTON_TYPE_SLEEPF:
360 acpi_remove_fixed_event_handler(ACPI_EVENT_SLEEP_BUTTON,
361 acpi_button_notify_fixed);
362 break;
363 default:
364 acpi_remove_notify_handler(button->device->handle,
365 ACPI_DEVICE_NOTIFY,
366 acpi_button_notify);
367 break;
368 }
369}
370
371static int acpi_button_add(struct acpi_device *device)
372{
373 int error;
374 struct acpi_button *button;
375 struct input_dev *input;
1da177e4
LT
376
377 if (!device)
d550d98d 378 return -EINVAL;
1da177e4 379
c0968f0e 380 button = kzalloc(sizeof(struct acpi_button), GFP_KERNEL);
1da177e4 381 if (!button)
d550d98d 382 return -ENOMEM;
1da177e4
LT
383
384 button->device = device;
db89b4f0 385 device->driver_data = button;
1da177e4 386
c0968f0e
DT
387 button->input = input = input_allocate_device();
388 if (!input) {
389 error = -ENOMEM;
390 goto err_free_button;
391 }
392
1da177e4
LT
393 /*
394 * Determine the button type (via hid), as fixed-feature buttons
395 * need to be handled a bit differently than generic-space.
396 */
397 if (!strcmp(acpi_device_hid(device), ACPI_BUTTON_HID_POWER)) {
398 button->type = ACPI_BUTTON_TYPE_POWER;
4be44fcd
LB
399 strcpy(acpi_device_name(device), ACPI_BUTTON_DEVICE_NAME_POWER);
400 sprintf(acpi_device_class(device), "%s/%s",
1da177e4 401 ACPI_BUTTON_CLASS, ACPI_BUTTON_SUBCLASS_POWER);
4be44fcd 402 } else if (!strcmp(acpi_device_hid(device), ACPI_BUTTON_HID_POWERF)) {
1da177e4
LT
403 button->type = ACPI_BUTTON_TYPE_POWERF;
404 strcpy(acpi_device_name(device),
4be44fcd
LB
405 ACPI_BUTTON_DEVICE_NAME_POWERF);
406 sprintf(acpi_device_class(device), "%s/%s",
1da177e4 407 ACPI_BUTTON_CLASS, ACPI_BUTTON_SUBCLASS_POWER);
4be44fcd 408 } else if (!strcmp(acpi_device_hid(device), ACPI_BUTTON_HID_SLEEP)) {
1da177e4 409 button->type = ACPI_BUTTON_TYPE_SLEEP;
4be44fcd
LB
410 strcpy(acpi_device_name(device), ACPI_BUTTON_DEVICE_NAME_SLEEP);
411 sprintf(acpi_device_class(device), "%s/%s",
1da177e4 412 ACPI_BUTTON_CLASS, ACPI_BUTTON_SUBCLASS_SLEEP);
4be44fcd 413 } else if (!strcmp(acpi_device_hid(device), ACPI_BUTTON_HID_SLEEPF)) {
1da177e4
LT
414 button->type = ACPI_BUTTON_TYPE_SLEEPF;
415 strcpy(acpi_device_name(device),
4be44fcd
LB
416 ACPI_BUTTON_DEVICE_NAME_SLEEPF);
417 sprintf(acpi_device_class(device), "%s/%s",
1da177e4 418 ACPI_BUTTON_CLASS, ACPI_BUTTON_SUBCLASS_SLEEP);
4be44fcd 419 } else if (!strcmp(acpi_device_hid(device), ACPI_BUTTON_HID_LID)) {
1da177e4 420 button->type = ACPI_BUTTON_TYPE_LID;
4be44fcd
LB
421 strcpy(acpi_device_name(device), ACPI_BUTTON_DEVICE_NAME_LID);
422 sprintf(acpi_device_class(device), "%s/%s",
1da177e4 423 ACPI_BUTTON_CLASS, ACPI_BUTTON_SUBCLASS_LID);
4be44fcd 424 } else {
6468463a
LB
425 printk(KERN_ERR PREFIX "Unsupported hid [%s]\n",
426 acpi_device_hid(device));
c0968f0e
DT
427 error = -ENODEV;
428 goto err_free_input;
1da177e4
LT
429 }
430
c0968f0e
DT
431 error = acpi_button_add_fs(device);
432 if (error)
433 goto err_free_input;
434
435 error = acpi_button_install_notify_handlers(button);
436 if (error)
437 goto err_remove_fs;
438
439 snprintf(button->phys, sizeof(button->phys),
440 "%s/button/input0", acpi_device_hid(device));
441
442 input->name = acpi_device_name(device);
443 input->phys = button->phys;
444 input->id.bustype = BUS_HOST;
445 input->id.product = button->type;
3b34e523 446 input->dev.parent = &device->dev;
b34a8030 447
1da177e4 448 switch (button->type) {
c0968f0e 449 case ACPI_BUTTON_TYPE_POWER:
1da177e4 450 case ACPI_BUTTON_TYPE_POWERF:
7b19ada2 451 input->evbit[0] = BIT_MASK(EV_KEY);
c0968f0e 452 set_bit(KEY_POWER, input->keybit);
1da177e4 453 break;
c0968f0e
DT
454
455 case ACPI_BUTTON_TYPE_SLEEP:
1da177e4 456 case ACPI_BUTTON_TYPE_SLEEPF:
7b19ada2 457 input->evbit[0] = BIT_MASK(EV_KEY);
c0968f0e 458 set_bit(KEY_SLEEP, input->keybit);
1da177e4 459 break;
c0968f0e
DT
460
461 case ACPI_BUTTON_TYPE_LID:
7b19ada2 462 input->evbit[0] = BIT_MASK(EV_SW);
c0968f0e 463 set_bit(SW_LID, input->swbit);
1da177e4
LT
464 break;
465 }
466
c0968f0e
DT
467 error = input_register_device(input);
468 if (error)
469 goto err_remove_handlers;
23de5d9e
AS
470 if (button->type == ACPI_BUTTON_TYPE_LID)
471 acpi_lid_send_state(button);
1da177e4
LT
472
473 if (device->wakeup.flags.valid) {
474 /* Button's GPE is run-wake GPE */
4be44fcd
LB
475 acpi_set_gpe_type(device->wakeup.gpe_device,
476 device->wakeup.gpe_number,
477 ACPI_GPE_TYPE_WAKE_RUN);
478 acpi_enable_gpe(device->wakeup.gpe_device,
0b7084ac 479 device->wakeup.gpe_number);
1da177e4
LT
480 device->wakeup.state.enabled = 1;
481 }
482
4be44fcd
LB
483 printk(KERN_INFO PREFIX "%s [%s]\n",
484 acpi_device_name(device), acpi_device_bid(device));
1da177e4 485
c0968f0e 486 return 0;
1da177e4 487
c0968f0e
DT
488 err_remove_handlers:
489 acpi_button_remove_notify_handlers(button);
490 err_remove_fs:
491 acpi_button_remove_fs(device);
492 err_free_input:
493 input_free_device(input);
494 err_free_button:
495 kfree(button);
496 return error;
1da177e4
LT
497}
498
4be44fcd 499static int acpi_button_remove(struct acpi_device *device, int type)
1da177e4 500{
c0968f0e 501 struct acpi_button *button;
1da177e4
LT
502
503 if (!device || !acpi_driver_data(device))
d550d98d 504 return -EINVAL;
1da177e4
LT
505
506 button = acpi_driver_data(device);
507
c0968f0e 508 acpi_button_remove_notify_handlers(button);
4be44fcd 509 acpi_button_remove_fs(device);
c0968f0e 510 input_unregister_device(button->input);
1da177e4
LT
511 kfree(button);
512
d550d98d 513 return 0;
1da177e4
LT
514}
515
4be44fcd 516static int __init acpi_button_init(void)
1da177e4 517{
c0968f0e 518 int result;
1da177e4 519
b34a8030
AS
520 acpi_button_dir = proc_mkdir(ACPI_BUTTON_CLASS, acpi_root_dir);
521 if (!acpi_button_dir)
d550d98d 522 return -ENODEV;
1da177e4
LT
523 result = acpi_bus_register_driver(&acpi_button_driver);
524 if (result < 0) {
b34a8030 525 remove_proc_entry(ACPI_BUTTON_CLASS, acpi_root_dir);
d550d98d 526 return -ENODEV;
1da177e4
LT
527 }
528
d550d98d 529 return 0;
1da177e4
LT
530}
531
4be44fcd 532static void __exit acpi_button_exit(void)
1da177e4 533{
1da177e4
LT
534 acpi_bus_unregister_driver(&acpi_button_driver);
535
4be44fcd 536 if (acpi_power_dir)
b34a8030
AS
537 remove_proc_entry(ACPI_BUTTON_SUBCLASS_POWER, acpi_button_dir);
538 if (acpi_sleep_dir)
539 remove_proc_entry(ACPI_BUTTON_SUBCLASS_SLEEP, acpi_button_dir);
540 if (acpi_lid_dir)
541 remove_proc_entry(ACPI_BUTTON_SUBCLASS_LID, acpi_button_dir);
542 remove_proc_entry(ACPI_BUTTON_CLASS, acpi_root_dir);
1da177e4
LT
543}
544
1da177e4
LT
545module_init(acpi_button_init);
546module_exit(acpi_button_exit);