21
21
#define _COMPONENT ACPI_SYSTEM_COMPONENT
22
22
ACPI_MODULE_NAME ("event" );
23
23
24
- #ifdef CONFIG_ACPI_PROC_EVENT
25
- /* Global vars for handling event proc entry */
26
- static DEFINE_SPINLOCK (acpi_system_event_lock );
27
- int event_is_open = 0 ;
28
- extern struct list_head acpi_bus_event_list ;
29
- extern wait_queue_head_t acpi_bus_event_queue ;
30
-
31
- static 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
-
48
- static ssize_t
49
- acpi_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
-
92
- static 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
-
100
- static 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
-
108
- static 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
24
/* ACPI notifier chain */
119
25
static BLOCKING_NOTIFIER_HEAD (acpi_chain_head );
120
26
@@ -280,9 +186,6 @@ static int acpi_event_genetlink_init(void)
280
186
281
187
static int __init acpi_event_init (void )
282
188
{
283
- #ifdef CONFIG_ACPI_PROC_EVENT
284
- struct proc_dir_entry * entry ;
285
- #endif
286
189
int error = 0 ;
287
190
288
191
if (acpi_disabled )
@@ -293,15 +196,6 @@ static int __init acpi_event_init(void)
293
196
if (error )
294
197
printk (KERN_WARNING PREFIX
295
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
199
return 0 ;
306
200
}
307
201
0 commit comments