aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/acpi/event.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/acpi/event.c')
-rw-r--r--drivers/acpi/event.c106
1 files changed, 0 insertions, 106 deletions
diff --git a/drivers/acpi/event.c b/drivers/acpi/event.c
index 1442737cedec..8247fcdde079 100644
--- a/drivers/acpi/event.c
+++ b/drivers/acpi/event.c
@@ -21,100 +21,6 @@
21#define _COMPONENT ACPI_SYSTEM_COMPONENT 21#define _COMPONENT ACPI_SYSTEM_COMPONENT
22ACPI_MODULE_NAME("event"); 22ACPI_MODULE_NAME("event");
23 23
24#ifdef CONFIG_ACPI_PROC_EVENT
25/* Global vars for handling event proc entry */
26static DEFINE_SPINLOCK(acpi_system_event_lock);
27int event_is_open = 0;
28extern struct list_head acpi_bus_event_list;
29extern wait_queue_head_t acpi_bus_event_queue;
30
31static int acpi_system_open_event(struct inode *inode, struct file *file)
32{
33 spin_lock_irq(&acpi_system_event_lock);
34
35 if (event_is_open)
36 goto out_busy;
37
38 event_is_open = 1;
39
40 spin_unlock_irq(&acpi_system_event_lock);
41 return 0;
42
43 out_busy:
44 spin_unlock_irq(&acpi_system_event_lock);
45 return -EBUSY;
46}
47
48static ssize_t
49acpi_system_read_event(struct file *file, char __user * buffer, size_t count,
50 loff_t * ppos)
51{
52 int result = 0;
53 struct acpi_bus_event event;
54 static char str[ACPI_MAX_STRING];
55 static int chars_remaining = 0;
56 static char *ptr;
57
58 if (!chars_remaining) {
59 memset(&event, 0, sizeof(struct acpi_bus_event));
60
61 if ((file->f_flags & O_NONBLOCK)
62 && (list_empty(&acpi_bus_event_list)))
63 return -EAGAIN;
64
65 result = acpi_bus_receive_event(&event);
66 if (result)
67 return result;
68
69 chars_remaining = sprintf(str, "%s %s %08x %08x\n",
70 event.device_class ? event.
71 device_class : "<unknown>",
72 event.bus_id ? event.
73 bus_id : "<unknown>", event.type,
74 event.data);
75 ptr = str;
76 }
77
78 if (chars_remaining < count) {
79 count = chars_remaining;
80 }
81
82 if (copy_to_user(buffer, ptr, count))
83 return -EFAULT;
84
85 *ppos += count;
86 chars_remaining -= count;
87 ptr += count;
88
89 return count;
90}
91
92static int acpi_system_close_event(struct inode *inode, struct file *file)
93{
94 spin_lock_irq(&acpi_system_event_lock);
95 event_is_open = 0;
96 spin_unlock_irq(&acpi_system_event_lock);
97 return 0;
98}
99
100static unsigned int acpi_system_poll_event(struct file *file, poll_table * wait)
101{
102 poll_wait(file, &acpi_bus_event_queue, wait);
103 if (!list_empty(&acpi_bus_event_list))
104 return POLLIN | POLLRDNORM;
105 return 0;
106}
107
108static const struct file_operations acpi_system_event_ops = {
109 .owner = THIS_MODULE,
110 .open = acpi_system_open_event,
111 .read = acpi_system_read_event,
112 .release = acpi_system_close_event,
113 .poll = acpi_system_poll_event,
114 .llseek = default_llseek,
115};
116#endif /* CONFIG_ACPI_PROC_EVENT */
117
118/* ACPI notifier chain */ 24/* ACPI notifier chain */
119static BLOCKING_NOTIFIER_HEAD(acpi_chain_head); 25static BLOCKING_NOTIFIER_HEAD(acpi_chain_head);
120 26
@@ -280,9 +186,6 @@ static int acpi_event_genetlink_init(void)
280 186
281static int __init acpi_event_init(void) 187static int __init acpi_event_init(void)
282{ 188{
283#ifdef CONFIG_ACPI_PROC_EVENT
284 struct proc_dir_entry *entry;
285#endif
286 int error = 0; 189 int error = 0;
287 190
288 if (acpi_disabled) 191 if (acpi_disabled)
@@ -293,15 +196,6 @@ static int __init acpi_event_init(void)
293 if (error) 196 if (error)
294 printk(KERN_WARNING PREFIX 197 printk(KERN_WARNING PREFIX
295 "Failed to create genetlink family for ACPI event\n"); 198 "Failed to create genetlink family for ACPI event\n");
296
297#ifdef CONFIG_ACPI_PROC_EVENT
298 /* 'event' [R] */
299 entry = proc_create("event", S_IRUSR, acpi_root_dir,
300 &acpi_system_event_ops);
301 if (!entry)
302 return -ENODEV;
303#endif
304
305 return 0; 199 return 0;
306} 200}
307 201