diff options
Diffstat (limited to 'drivers/acpi/system.c')
-rw-r--r-- | drivers/acpi/system.c | 76 |
1 files changed, 32 insertions, 44 deletions
diff --git a/drivers/acpi/system.c b/drivers/acpi/system.c index 8925a6ca5f87..e4308c7a6743 100644 --- a/drivers/acpi/system.c +++ b/drivers/acpi/system.c | |||
@@ -30,10 +30,8 @@ | |||
30 | 30 | ||
31 | #include <acpi/acpi_drivers.h> | 31 | #include <acpi/acpi_drivers.h> |
32 | 32 | ||
33 | |||
34 | #define _COMPONENT ACPI_SYSTEM_COMPONENT | 33 | #define _COMPONENT ACPI_SYSTEM_COMPONENT |
35 | ACPI_MODULE_NAME ("acpi_system") | 34 | ACPI_MODULE_NAME("acpi_system") |
36 | |||
37 | #define ACPI_SYSTEM_CLASS "system" | 35 | #define ACPI_SYSTEM_CLASS "system" |
38 | #define ACPI_SYSTEM_DRIVER_NAME "ACPI System Driver" | 36 | #define ACPI_SYSTEM_DRIVER_NAME "ACPI System Driver" |
39 | #define ACPI_SYSTEM_DEVICE_NAME "System" | 37 | #define ACPI_SYSTEM_DEVICE_NAME "System" |
@@ -41,15 +39,13 @@ ACPI_MODULE_NAME ("acpi_system") | |||
41 | #define ACPI_SYSTEM_FILE_EVENT "event" | 39 | #define ACPI_SYSTEM_FILE_EVENT "event" |
42 | #define ACPI_SYSTEM_FILE_DSDT "dsdt" | 40 | #define ACPI_SYSTEM_FILE_DSDT "dsdt" |
43 | #define ACPI_SYSTEM_FILE_FADT "fadt" | 41 | #define ACPI_SYSTEM_FILE_FADT "fadt" |
44 | 42 | extern FADT_DESCRIPTOR acpi_fadt; | |
45 | extern FADT_DESCRIPTOR acpi_fadt; | ||
46 | 43 | ||
47 | /* -------------------------------------------------------------------------- | 44 | /* -------------------------------------------------------------------------- |
48 | FS Interface (/proc) | 45 | FS Interface (/proc) |
49 | -------------------------------------------------------------------------- */ | 46 | -------------------------------------------------------------------------- */ |
50 | 47 | ||
51 | static int | 48 | static int acpi_system_read_info(struct seq_file *seq, void *offset) |
52 | acpi_system_read_info (struct seq_file *seq, void *offset) | ||
53 | { | 49 | { |
54 | ACPI_FUNCTION_TRACE("acpi_system_read_info"); | 50 | ACPI_FUNCTION_TRACE("acpi_system_read_info"); |
55 | 51 | ||
@@ -63,28 +59,26 @@ static int acpi_system_info_open_fs(struct inode *inode, struct file *file) | |||
63 | } | 59 | } |
64 | 60 | ||
65 | static struct file_operations acpi_system_info_ops = { | 61 | static struct file_operations acpi_system_info_ops = { |
66 | .open = acpi_system_info_open_fs, | 62 | .open = acpi_system_info_open_fs, |
67 | .read = seq_read, | 63 | .read = seq_read, |
68 | .llseek = seq_lseek, | 64 | .llseek = seq_lseek, |
69 | .release = single_release, | 65 | .release = single_release, |
70 | }; | 66 | }; |
71 | 67 | ||
72 | static ssize_t acpi_system_read_dsdt (struct file*, char __user *, size_t, loff_t*); | 68 | static ssize_t acpi_system_read_dsdt(struct file *, char __user *, size_t, |
69 | loff_t *); | ||
73 | 70 | ||
74 | static struct file_operations acpi_system_dsdt_ops = { | 71 | static struct file_operations acpi_system_dsdt_ops = { |
75 | .read = acpi_system_read_dsdt, | 72 | .read = acpi_system_read_dsdt, |
76 | }; | 73 | }; |
77 | 74 | ||
78 | static ssize_t | 75 | static ssize_t |
79 | acpi_system_read_dsdt ( | 76 | acpi_system_read_dsdt(struct file *file, |
80 | struct file *file, | 77 | char __user * buffer, size_t count, loff_t * ppos) |
81 | char __user *buffer, | ||
82 | size_t count, | ||
83 | loff_t *ppos) | ||
84 | { | 78 | { |
85 | acpi_status status = AE_OK; | 79 | acpi_status status = AE_OK; |
86 | struct acpi_buffer dsdt = {ACPI_ALLOCATE_BUFFER, NULL}; | 80 | struct acpi_buffer dsdt = { ACPI_ALLOCATE_BUFFER, NULL }; |
87 | ssize_t res; | 81 | ssize_t res; |
88 | 82 | ||
89 | ACPI_FUNCTION_TRACE("acpi_system_read_dsdt"); | 83 | ACPI_FUNCTION_TRACE("acpi_system_read_dsdt"); |
90 | 84 | ||
@@ -99,23 +93,20 @@ acpi_system_read_dsdt ( | |||
99 | return_VALUE(res); | 93 | return_VALUE(res); |
100 | } | 94 | } |
101 | 95 | ||
102 | 96 | static ssize_t acpi_system_read_fadt(struct file *, char __user *, size_t, | |
103 | static ssize_t acpi_system_read_fadt (struct file*, char __user *, size_t, loff_t*); | 97 | loff_t *); |
104 | 98 | ||
105 | static struct file_operations acpi_system_fadt_ops = { | 99 | static struct file_operations acpi_system_fadt_ops = { |
106 | .read = acpi_system_read_fadt, | 100 | .read = acpi_system_read_fadt, |
107 | }; | 101 | }; |
108 | 102 | ||
109 | static ssize_t | 103 | static ssize_t |
110 | acpi_system_read_fadt ( | 104 | acpi_system_read_fadt(struct file *file, |
111 | struct file *file, | 105 | char __user * buffer, size_t count, loff_t * ppos) |
112 | char __user *buffer, | ||
113 | size_t count, | ||
114 | loff_t *ppos) | ||
115 | { | 106 | { |
116 | acpi_status status = AE_OK; | 107 | acpi_status status = AE_OK; |
117 | struct acpi_buffer fadt = {ACPI_ALLOCATE_BUFFER, NULL}; | 108 | struct acpi_buffer fadt = { ACPI_ALLOCATE_BUFFER, NULL }; |
118 | ssize_t res; | 109 | ssize_t res; |
119 | 110 | ||
120 | ACPI_FUNCTION_TRACE("acpi_system_read_fadt"); | 111 | ACPI_FUNCTION_TRACE("acpi_system_read_fadt"); |
121 | 112 | ||
@@ -130,12 +121,11 @@ acpi_system_read_fadt ( | |||
130 | return_VALUE(res); | 121 | return_VALUE(res); |
131 | } | 122 | } |
132 | 123 | ||
133 | 124 | static int __init acpi_system_init(void) | |
134 | static int __init acpi_system_init (void) | ||
135 | { | 125 | { |
136 | struct proc_dir_entry *entry; | 126 | struct proc_dir_entry *entry; |
137 | int error = 0; | 127 | int error = 0; |
138 | char * name; | 128 | char *name; |
139 | 129 | ||
140 | ACPI_FUNCTION_TRACE("acpi_system_init"); | 130 | ACPI_FUNCTION_TRACE("acpi_system_init"); |
141 | 131 | ||
@@ -144,8 +134,7 @@ static int __init acpi_system_init (void) | |||
144 | 134 | ||
145 | /* 'info' [R] */ | 135 | /* 'info' [R] */ |
146 | name = ACPI_SYSTEM_FILE_INFO; | 136 | name = ACPI_SYSTEM_FILE_INFO; |
147 | entry = create_proc_entry(name, | 137 | entry = create_proc_entry(name, S_IRUGO, acpi_root_dir); |
148 | S_IRUGO, acpi_root_dir); | ||
149 | if (!entry) | 138 | if (!entry) |
150 | goto Error; | 139 | goto Error; |
151 | else { | 140 | else { |
@@ -157,7 +146,7 @@ static int __init acpi_system_init (void) | |||
157 | entry = create_proc_entry(name, S_IRUSR, acpi_root_dir); | 146 | entry = create_proc_entry(name, S_IRUSR, acpi_root_dir); |
158 | if (entry) | 147 | if (entry) |
159 | entry->proc_fops = &acpi_system_dsdt_ops; | 148 | entry->proc_fops = &acpi_system_dsdt_ops; |
160 | else | 149 | else |
161 | goto Error; | 150 | goto Error; |
162 | 151 | ||
163 | /* 'fadt' [R] */ | 152 | /* 'fadt' [R] */ |
@@ -168,12 +157,12 @@ static int __init acpi_system_init (void) | |||
168 | else | 157 | else |
169 | goto Error; | 158 | goto Error; |
170 | 159 | ||
171 | Done: | 160 | Done: |
172 | return_VALUE(error); | 161 | return_VALUE(error); |
173 | 162 | ||
174 | Error: | 163 | Error: |
175 | ACPI_DEBUG_PRINT((ACPI_DB_ERROR, | 164 | ACPI_DEBUG_PRINT((ACPI_DB_ERROR, |
176 | "Unable to create '%s' proc fs entry\n", name)); | 165 | "Unable to create '%s' proc fs entry\n", name)); |
177 | 166 | ||
178 | remove_proc_entry(ACPI_SYSTEM_FILE_FADT, acpi_root_dir); | 167 | remove_proc_entry(ACPI_SYSTEM_FILE_FADT, acpi_root_dir); |
179 | remove_proc_entry(ACPI_SYSTEM_FILE_DSDT, acpi_root_dir); | 168 | remove_proc_entry(ACPI_SYSTEM_FILE_DSDT, acpi_root_dir); |
@@ -183,5 +172,4 @@ static int __init acpi_system_init (void) | |||
183 | goto Done; | 172 | goto Done; |
184 | } | 173 | } |
185 | 174 | ||
186 | |||
187 | subsys_initcall(acpi_system_init); | 175 | subsys_initcall(acpi_system_init); |