Blame view
drivers/acpi/button.c
13.1 KB
1da177e4c
|
1 |
/* |
50a4da890
|
2 |
* button.c - ACPI Button Driver |
1da177e4c
|
3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 |
* * Copyright (C) 2001, 2002 Andy Grover <andrew.grover@intel.com> * Copyright (C) 2001, 2002 Paul Diefenbaugh <paul.s.diefenbaugh@intel.com> * * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or (at * your option) any later version. * * This program is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * General Public License for more details. * * You should have received a copy of the GNU General Public License along * with this program; if not, write to the Free Software Foundation, Inc., * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. * * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */ #include <linux/kernel.h> #include <linux/module.h> #include <linux/init.h> |
b34a8030e
|
29 30 31 |
#include <linux/types.h> #include <linux/proc_fs.h> #include <linux/seq_file.h> |
c0968f0ea
|
32 |
#include <linux/input.h> |
5a0e3ad6a
|
33 |
#include <linux/slab.h> |
1da177e4c
|
34 35 |
#include <acpi/acpi_bus.h> #include <acpi/acpi_drivers.h> |
a192a9580
|
36 |
#define PREFIX "ACPI: " |
1da177e4c
|
37 |
#define ACPI_BUTTON_CLASS "button" |
b34a8030e
|
38 39 40 |
#define ACPI_BUTTON_FILE_INFO "info" #define ACPI_BUTTON_FILE_STATE "state" #define ACPI_BUTTON_TYPE_UNKNOWN 0x00 |
1da177e4c
|
41 42 43 |
#define ACPI_BUTTON_NOTIFY_STATUS 0x80 #define ACPI_BUTTON_SUBCLASS_POWER "power" |
4be44fcd3
|
44 |
#define ACPI_BUTTON_HID_POWER "PNP0C0C" |
d68b597c8
|
45 |
#define ACPI_BUTTON_DEVICE_NAME_POWER "Power Button" |
1da177e4c
|
46 |
#define ACPI_BUTTON_TYPE_POWER 0x01 |
1da177e4c
|
47 48 49 |
#define ACPI_BUTTON_SUBCLASS_SLEEP "sleep" #define ACPI_BUTTON_HID_SLEEP "PNP0C0E" |
d68b597c8
|
50 |
#define ACPI_BUTTON_DEVICE_NAME_SLEEP "Sleep Button" |
1da177e4c
|
51 |
#define ACPI_BUTTON_TYPE_SLEEP 0x03 |
1da177e4c
|
52 53 54 55 56 57 58 |
#define ACPI_BUTTON_SUBCLASS_LID "lid" #define ACPI_BUTTON_HID_LID "PNP0C0D" #define ACPI_BUTTON_DEVICE_NAME_LID "Lid Switch" #define ACPI_BUTTON_TYPE_LID 0x05 #define _COMPONENT ACPI_BUTTON_COMPONENT |
f52fd66d2
|
59 |
ACPI_MODULE_NAME("button"); |
1da177e4c
|
60 |
|
c0968f0ea
|
61 |
MODULE_AUTHOR("Paul Diefenbaugh"); |
7cda93e00
|
62 |
MODULE_DESCRIPTION("ACPI Button Driver"); |
1da177e4c
|
63 |
MODULE_LICENSE("GPL"); |
1ba90e3a8
|
64 65 66 67 68 69 70 71 72 |
static const struct acpi_device_id button_device_ids[] = { {ACPI_BUTTON_HID_LID, 0}, {ACPI_BUTTON_HID_SLEEP, 0}, {ACPI_BUTTON_HID_SLEEPF, 0}, {ACPI_BUTTON_HID_POWER, 0}, {ACPI_BUTTON_HID_POWERF, 0}, {"", 0}, }; MODULE_DEVICE_TABLE(acpi, button_device_ids); |
4be44fcd3
|
73 74 |
static int acpi_button_add(struct acpi_device *device); static int acpi_button_remove(struct acpi_device *device, int type); |
23de5d9ef
|
75 |
static int acpi_button_resume(struct acpi_device *device); |
373cfc360
|
76 |
static void acpi_button_notify(struct acpi_device *device, u32 event); |
b34a8030e
|
77 78 |
static int acpi_button_info_open_fs(struct inode *inode, struct file *file); static int acpi_button_state_open_fs(struct inode *inode, struct file *file); |
1da177e4c
|
79 80 |
static struct acpi_driver acpi_button_driver = { |
c2b6705b7
|
81 |
.name = "button", |
4be44fcd3
|
82 |
.class = ACPI_BUTTON_CLASS, |
1ba90e3a8
|
83 |
.ids = button_device_ids, |
4be44fcd3
|
84 85 |
.ops = { .add = acpi_button_add, |
23de5d9ef
|
86 |
.resume = acpi_button_resume, |
4be44fcd3
|
87 |
.remove = acpi_button_remove, |
373cfc360
|
88 |
.notify = acpi_button_notify, |
c0968f0ea
|
89 |
}, |
1da177e4c
|
90 91 92 |
}; struct acpi_button { |
c0968f0ea
|
93 94 95 |
unsigned int type; struct input_dev *input; char phys[32]; /* for input device */ |
4be44fcd3
|
96 |
unsigned long pushed; |
1da177e4c
|
97 |
}; |
d75080328
|
98 |
static const struct file_operations acpi_button_info_fops = { |
cf7acfab0
|
99 |
.owner = THIS_MODULE, |
4be44fcd3
|
100 101 102 103 |
.open = acpi_button_info_open_fs, .read = seq_read, .llseek = seq_lseek, .release = single_release, |
b34a8030e
|
104 |
}; |
d75080328
|
105 |
static const struct file_operations acpi_button_state_fops = { |
cf7acfab0
|
106 |
.owner = THIS_MODULE, |
4be44fcd3
|
107 108 109 110 |
.open = acpi_button_state_open_fs, .read = seq_read, .llseek = seq_lseek, .release = single_release, |
b34a8030e
|
111 |
}; |
4be44fcd3
|
112 |
|
7e12715ec
|
113 114 |
static BLOCKING_NOTIFIER_HEAD(acpi_lid_notifier); static struct acpi_device *lid_device; |
b34a8030e
|
115 116 117 |
/* -------------------------------------------------------------------------- FS Interface (/proc) -------------------------------------------------------------------------- */ |
4be44fcd3
|
118 |
static struct proc_dir_entry *acpi_button_dir; |
b34a8030e
|
119 120 121 |
static int acpi_button_info_seq_show(struct seq_file *seq, void *offset) { |
106c19e7b
|
122 |
struct acpi_device *device = seq->private; |
b34a8030e
|
123 |
|
4be44fcd3
|
124 125 |
seq_printf(seq, "type: %s ", |
106c19e7b
|
126 |
acpi_device_name(device)); |
d550d98d3
|
127 |
return 0; |
b34a8030e
|
128 129 130 131 132 133 |
} static int acpi_button_info_open_fs(struct inode *inode, struct file *file) { return single_open(file, acpi_button_info_seq_show, PDE(inode)->data); } |
4be44fcd3
|
134 |
|
b34a8030e
|
135 136 |
static int acpi_button_state_seq_show(struct seq_file *seq, void *offset) { |
106c19e7b
|
137 |
struct acpi_device *device = seq->private; |
4be44fcd3
|
138 |
acpi_status status; |
27663c585
|
139 |
unsigned long long state; |
b34a8030e
|
140 |
|
106c19e7b
|
141 |
status = acpi_evaluate_integer(device->handle, "_LID", NULL, &state); |
c0968f0ea
|
142 143 144 145 |
seq_printf(seq, "state: %s ", ACPI_FAILURE(status) ? "unsupported" : (state ? "open" : "closed")); |
d550d98d3
|
146 |
return 0; |
b34a8030e
|
147 148 149 150 151 152 153 154 155 156 |
} static int acpi_button_state_open_fs(struct inode *inode, struct file *file) { return single_open(file, acpi_button_state_seq_show, PDE(inode)->data); } static struct proc_dir_entry *acpi_power_dir; static struct proc_dir_entry *acpi_sleep_dir; static struct proc_dir_entry *acpi_lid_dir; |
4be44fcd3
|
157 |
static int acpi_button_add_fs(struct acpi_device *device) |
b34a8030e
|
158 |
{ |
1bce81131
|
159 |
struct acpi_button *button = acpi_driver_data(device); |
4be44fcd3
|
160 |
struct proc_dir_entry *entry = NULL; |
b34a8030e
|
161 162 163 |
switch (button->type) { case ACPI_BUTTON_TYPE_POWER: |
b34a8030e
|
164 |
if (!acpi_power_dir) |
4be44fcd3
|
165 166 |
acpi_power_dir = proc_mkdir(ACPI_BUTTON_SUBCLASS_POWER, acpi_button_dir); |
b34a8030e
|
167 168 169 |
entry = acpi_power_dir; break; case ACPI_BUTTON_TYPE_SLEEP: |
b34a8030e
|
170 |
if (!acpi_sleep_dir) |
4be44fcd3
|
171 172 |
acpi_sleep_dir = proc_mkdir(ACPI_BUTTON_SUBCLASS_SLEEP, acpi_button_dir); |
b34a8030e
|
173 174 175 176 |
entry = acpi_sleep_dir; break; case ACPI_BUTTON_TYPE_LID: if (!acpi_lid_dir) |
4be44fcd3
|
177 178 |
acpi_lid_dir = proc_mkdir(ACPI_BUTTON_SUBCLASS_LID, acpi_button_dir); |
b34a8030e
|
179 180 181 182 183 |
entry = acpi_lid_dir; break; } if (!entry) |
d550d98d3
|
184 |
return -ENODEV; |
b34a8030e
|
185 186 187 |
acpi_device_dir(device) = proc_mkdir(acpi_device_bid(device), entry); if (!acpi_device_dir(device)) |
d550d98d3
|
188 |
return -ENODEV; |
b34a8030e
|
189 190 |
/* 'info' [R] */ |
cf7acfab0
|
191 192 |
entry = proc_create_data(ACPI_BUTTON_FILE_INFO, S_IRUGO, acpi_device_dir(device), |
106c19e7b
|
193 |
&acpi_button_info_fops, device); |
b34a8030e
|
194 |
if (!entry) |
d550d98d3
|
195 |
return -ENODEV; |
b34a8030e
|
196 197 198 |
/* show lid state [R] */ if (button->type == ACPI_BUTTON_TYPE_LID) { |
cf7acfab0
|
199 200 |
entry = proc_create_data(ACPI_BUTTON_FILE_STATE, S_IRUGO, acpi_device_dir(device), |
106c19e7b
|
201 |
&acpi_button_state_fops, device); |
b34a8030e
|
202 |
if (!entry) |
a6fc67202
|
203 |
return -ENODEV; |
b34a8030e
|
204 |
} |
d550d98d3
|
205 |
return 0; |
b34a8030e
|
206 |
} |
4be44fcd3
|
207 |
static int acpi_button_remove_fs(struct acpi_device *device) |
b34a8030e
|
208 |
{ |
c0968f0ea
|
209 |
struct acpi_button *button = acpi_driver_data(device); |
b34a8030e
|
210 |
|
b34a8030e
|
211 212 213 |
if (acpi_device_dir(device)) { if (button->type == ACPI_BUTTON_TYPE_LID) remove_proc_entry(ACPI_BUTTON_FILE_STATE, |
4be44fcd3
|
214 |
acpi_device_dir(device)); |
b34a8030e
|
215 |
remove_proc_entry(ACPI_BUTTON_FILE_INFO, |
4be44fcd3
|
216 |
acpi_device_dir(device)); |
b34a8030e
|
217 218 |
remove_proc_entry(acpi_device_bid(device), |
4be44fcd3
|
219 |
acpi_device_dir(device)->parent); |
b34a8030e
|
220 221 |
acpi_device_dir(device) = NULL; } |
d550d98d3
|
222 |
return 0; |
b34a8030e
|
223 |
} |
1da177e4c
|
224 225 226 |
/* -------------------------------------------------------------------------- Driver Interface -------------------------------------------------------------------------- */ |
7e12715ec
|
227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 |
int acpi_lid_notifier_register(struct notifier_block *nb) { return blocking_notifier_chain_register(&acpi_lid_notifier, nb); } EXPORT_SYMBOL(acpi_lid_notifier_register); int acpi_lid_notifier_unregister(struct notifier_block *nb) { return blocking_notifier_chain_unregister(&acpi_lid_notifier, nb); } EXPORT_SYMBOL(acpi_lid_notifier_unregister); int acpi_lid_open(void) { acpi_status status; unsigned long long state; |
2c907b72d
|
243 244 |
if (!lid_device) return -ENODEV; |
7e12715ec
|
245 246 247 248 249 250 251 252 |
status = acpi_evaluate_integer(lid_device->handle, "_LID", NULL, &state); if (ACPI_FAILURE(status)) return -ENODEV; return !!state; } EXPORT_SYMBOL(acpi_lid_open); |
106c19e7b
|
253 |
static int acpi_lid_send_state(struct acpi_device *device) |
23de5d9ef
|
254 |
{ |
106c19e7b
|
255 |
struct acpi_button *button = acpi_driver_data(device); |
27663c585
|
256 |
unsigned long long state; |
23de5d9ef
|
257 |
acpi_status status; |
7e12715ec
|
258 |
int ret; |
23de5d9ef
|
259 |
|
106c19e7b
|
260 |
status = acpi_evaluate_integer(device->handle, "_LID", NULL, &state); |
23de5d9ef
|
261 262 |
if (ACPI_FAILURE(status)) return -ENODEV; |
50a4da890
|
263 |
|
23de5d9ef
|
264 265 |
/* input layer checks if event is redundant */ input_report_switch(button->input, SW_LID, !state); |
df316e939
|
266 |
input_sync(button->input); |
7e12715ec
|
267 268 269 270 271 |
ret = blocking_notifier_call_chain(&acpi_lid_notifier, state, device); if (ret == NOTIFY_DONE) ret = blocking_notifier_call_chain(&acpi_lid_notifier, state, device); |
13c199c0d
|
272 273 274 275 276 277 278 |
if (ret == NOTIFY_DONE || ret == NOTIFY_OK) { /* * It is also regarded as success if the notifier_chain * returns NOTIFY_OK or NOTIFY_DONE. */ ret = 0; } |
7e12715ec
|
279 |
return ret; |
23de5d9ef
|
280 |
} |
1da177e4c
|
281 |
|
373cfc360
|
282 |
static void acpi_button_notify(struct acpi_device *device, u32 event) |
1da177e4c
|
283 |
{ |
373cfc360
|
284 |
struct acpi_button *button = acpi_driver_data(device); |
c0968f0ea
|
285 |
struct input_dev *input; |
1da177e4c
|
286 |
|
1da177e4c
|
287 |
switch (event) { |
373cfc360
|
288 289 290 |
case ACPI_FIXED_HARDWARE_EVENT: event = ACPI_BUTTON_NOTIFY_STATUS; /* fall through */ |
1da177e4c
|
291 |
case ACPI_BUTTON_NOTIFY_STATUS: |
c0968f0ea
|
292 |
input = button->input; |
c0968f0ea
|
293 |
if (button->type == ACPI_BUTTON_TYPE_LID) { |
106c19e7b
|
294 |
acpi_lid_send_state(device); |
c0968f0ea
|
295 296 297 298 299 300 301 |
} else { int keycode = test_bit(KEY_SLEEP, input->keybit) ? KEY_SLEEP : KEY_POWER; input_report_key(input, keycode, 1); input_sync(input); input_report_key(input, keycode, 0); |
df316e939
|
302 |
input_sync(input); |
c0968f0ea
|
303 |
} |
c0968f0ea
|
304 |
|
106c19e7b
|
305 |
acpi_bus_generate_proc_event(device, event, ++button->pushed); |
1da177e4c
|
306 307 308 |
break; default: ACPI_DEBUG_PRINT((ACPI_DB_INFO, |
4be44fcd3
|
309 310 |
"Unsupported event [0x%x] ", event)); |
1da177e4c
|
311 312 |
break; } |
1da177e4c
|
313 |
} |
23de5d9ef
|
314 315 |
static int acpi_button_resume(struct acpi_device *device) { |
1bce81131
|
316 |
struct acpi_button *button = acpi_driver_data(device); |
50a4da890
|
317 |
|
e2fb9754d
|
318 |
if (button->type == ACPI_BUTTON_TYPE_LID) |
106c19e7b
|
319 |
return acpi_lid_send_state(device); |
23de5d9ef
|
320 321 |
return 0; } |
c0968f0ea
|
322 323 |
static int acpi_button_add(struct acpi_device *device) { |
c0968f0ea
|
324 325 |
struct acpi_button *button; struct input_dev *input; |
bf04a7722
|
326 |
char *hid, *name, *class; |
1bce81131
|
327 |
int error; |
1da177e4c
|
328 |
|
c0968f0ea
|
329 |
button = kzalloc(sizeof(struct acpi_button), GFP_KERNEL); |
1da177e4c
|
330 |
if (!button) |
d550d98d3
|
331 |
return -ENOMEM; |
1da177e4c
|
332 |
|
db89b4f0d
|
333 |
device->driver_data = button; |
1da177e4c
|
334 |
|
c0968f0ea
|
335 336 337 338 339 |
button->input = input = input_allocate_device(); if (!input) { error = -ENOMEM; goto err_free_button; } |
bf04a7722
|
340 341 342 |
hid = acpi_device_hid(device); name = acpi_device_name(device); class = acpi_device_class(device); |
d68b597c8
|
343 344 |
if (!strcmp(hid, ACPI_BUTTON_HID_POWER) || !strcmp(hid, ACPI_BUTTON_HID_POWERF)) { |
1da177e4c
|
345 |
button->type = ACPI_BUTTON_TYPE_POWER; |
bf04a7722
|
346 347 |
strcpy(name, ACPI_BUTTON_DEVICE_NAME_POWER); sprintf(class, "%s/%s", |
1da177e4c
|
348 |
ACPI_BUTTON_CLASS, ACPI_BUTTON_SUBCLASS_POWER); |
d68b597c8
|
349 350 |
} else if (!strcmp(hid, ACPI_BUTTON_HID_SLEEP) || !strcmp(hid, ACPI_BUTTON_HID_SLEEPF)) { |
1da177e4c
|
351 |
button->type = ACPI_BUTTON_TYPE_SLEEP; |
bf04a7722
|
352 353 |
strcpy(name, ACPI_BUTTON_DEVICE_NAME_SLEEP); sprintf(class, "%s/%s", |
1da177e4c
|
354 |
ACPI_BUTTON_CLASS, ACPI_BUTTON_SUBCLASS_SLEEP); |
bf04a7722
|
355 |
} else if (!strcmp(hid, ACPI_BUTTON_HID_LID)) { |
1da177e4c
|
356 |
button->type = ACPI_BUTTON_TYPE_LID; |
bf04a7722
|
357 358 |
strcpy(name, ACPI_BUTTON_DEVICE_NAME_LID); sprintf(class, "%s/%s", |
1da177e4c
|
359 |
ACPI_BUTTON_CLASS, ACPI_BUTTON_SUBCLASS_LID); |
4be44fcd3
|
360 |
} else { |
bf04a7722
|
361 362 |
printk(KERN_ERR PREFIX "Unsupported hid [%s] ", hid); |
c0968f0ea
|
363 364 |
error = -ENODEV; goto err_free_input; |
1da177e4c
|
365 |
} |
c0968f0ea
|
366 367 368 |
error = acpi_button_add_fs(device); if (error) goto err_free_input; |
bf04a7722
|
369 |
snprintf(button->phys, sizeof(button->phys), "%s/button/input0", hid); |
c0968f0ea
|
370 |
|
bf04a7722
|
371 |
input->name = name; |
c0968f0ea
|
372 373 374 |
input->phys = button->phys; input->id.bustype = BUS_HOST; input->id.product = button->type; |
3b34e5232
|
375 |
input->dev.parent = &device->dev; |
b34a8030e
|
376 |
|
1da177e4c
|
377 |
switch (button->type) { |
c0968f0ea
|
378 |
case ACPI_BUTTON_TYPE_POWER: |
7b19ada2e
|
379 |
input->evbit[0] = BIT_MASK(EV_KEY); |
c0968f0ea
|
380 |
set_bit(KEY_POWER, input->keybit); |
1da177e4c
|
381 |
break; |
c0968f0ea
|
382 383 |
case ACPI_BUTTON_TYPE_SLEEP: |
7b19ada2e
|
384 |
input->evbit[0] = BIT_MASK(EV_KEY); |
c0968f0ea
|
385 |
set_bit(KEY_SLEEP, input->keybit); |
1da177e4c
|
386 |
break; |
c0968f0ea
|
387 388 |
case ACPI_BUTTON_TYPE_LID: |
7b19ada2e
|
389 |
input->evbit[0] = BIT_MASK(EV_SW); |
c0968f0ea
|
390 |
set_bit(SW_LID, input->swbit); |
1da177e4c
|
391 392 |
break; } |
c0968f0ea
|
393 394 |
error = input_register_device(input); if (error) |
373cfc360
|
395 |
goto err_remove_fs; |
7e12715ec
|
396 |
if (button->type == ACPI_BUTTON_TYPE_LID) { |
106c19e7b
|
397 |
acpi_lid_send_state(device); |
7e12715ec
|
398 399 400 401 402 403 |
/* * This assumes there's only one lid device, or if there are * more we only care about the last one... */ lid_device = device; } |
1da177e4c
|
404 405 406 |
if (device->wakeup.flags.valid) { /* Button's GPE is run-wake GPE */ |
4be44fcd3
|
407 |
acpi_enable_gpe(device->wakeup.gpe_device, |
a44061aa8
|
408 |
device->wakeup.gpe_number); |
f517709d6
|
409 |
device->wakeup.run_wake_count++; |
1da177e4c
|
410 411 |
device->wakeup.state.enabled = 1; } |
bf04a7722
|
412 413 |
printk(KERN_INFO PREFIX "%s [%s] ", name, acpi_device_bid(device)); |
c0968f0ea
|
414 |
return 0; |
1da177e4c
|
415 |
|
c0968f0ea
|
416 417 418 419 420 421 422 |
err_remove_fs: acpi_button_remove_fs(device); err_free_input: input_free_device(input); err_free_button: kfree(button); return error; |
1da177e4c
|
423 |
} |
4be44fcd3
|
424 |
static int acpi_button_remove(struct acpi_device *device, int type) |
1da177e4c
|
425 |
{ |
1bce81131
|
426 |
struct acpi_button *button = acpi_driver_data(device); |
1da177e4c
|
427 |
|
9630bdd9b
|
428 429 |
if (device->wakeup.flags.valid) { acpi_disable_gpe(device->wakeup.gpe_device, |
a44061aa8
|
430 |
device->wakeup.gpe_number); |
f517709d6
|
431 |
device->wakeup.run_wake_count--; |
9630bdd9b
|
432 433 |
device->wakeup.state.enabled = 0; } |
4be44fcd3
|
434 |
acpi_button_remove_fs(device); |
c0968f0ea
|
435 |
input_unregister_device(button->input); |
1da177e4c
|
436 |
kfree(button); |
d550d98d3
|
437 |
return 0; |
1da177e4c
|
438 |
} |
4be44fcd3
|
439 |
static int __init acpi_button_init(void) |
1da177e4c
|
440 |
{ |
c0968f0ea
|
441 |
int result; |
1da177e4c
|
442 |
|
b34a8030e
|
443 444 |
acpi_button_dir = proc_mkdir(ACPI_BUTTON_CLASS, acpi_root_dir); if (!acpi_button_dir) |
d550d98d3
|
445 |
return -ENODEV; |
50a4da890
|
446 |
|
1da177e4c
|
447 448 |
result = acpi_bus_register_driver(&acpi_button_driver); if (result < 0) { |
b34a8030e
|
449 |
remove_proc_entry(ACPI_BUTTON_CLASS, acpi_root_dir); |
d550d98d3
|
450 |
return -ENODEV; |
1da177e4c
|
451 |
} |
d550d98d3
|
452 |
return 0; |
1da177e4c
|
453 |
} |
4be44fcd3
|
454 |
static void __exit acpi_button_exit(void) |
1da177e4c
|
455 |
{ |
1da177e4c
|
456 |
acpi_bus_unregister_driver(&acpi_button_driver); |
4be44fcd3
|
457 |
if (acpi_power_dir) |
b34a8030e
|
458 459 460 461 462 463 |
remove_proc_entry(ACPI_BUTTON_SUBCLASS_POWER, acpi_button_dir); if (acpi_sleep_dir) remove_proc_entry(ACPI_BUTTON_SUBCLASS_SLEEP, acpi_button_dir); if (acpi_lid_dir) remove_proc_entry(ACPI_BUTTON_SUBCLASS_LID, acpi_button_dir); remove_proc_entry(ACPI_BUTTON_CLASS, acpi_root_dir); |
1da177e4c
|
464 |
} |
1da177e4c
|
465 466 |
module_init(acpi_button_init); module_exit(acpi_button_exit); |