diff options
Diffstat (limited to 'drivers/acpi/video.c')
-rw-r--r-- | drivers/acpi/video.c | 1070 |
1 files changed, 493 insertions, 577 deletions
diff --git a/drivers/acpi/video.c b/drivers/acpi/video.c index 7b10a7b070c9..b9132b5ac0f0 100644 --- a/drivers/acpi/video.c +++ b/drivers/acpi/video.c | |||
@@ -53,21 +53,20 @@ | |||
53 | #define ACPI_VIDEO_NOTIFY_ZERO_BRIGHTNESS 0x85 | 53 | #define ACPI_VIDEO_NOTIFY_ZERO_BRIGHTNESS 0x85 |
54 | #define ACPI_VIDEO_NOTIFY_DISPLAY_OFF 0x86 | 54 | #define ACPI_VIDEO_NOTIFY_DISPLAY_OFF 0x86 |
55 | 55 | ||
56 | |||
57 | #define ACPI_VIDEO_HEAD_INVALID (~0u - 1) | 56 | #define ACPI_VIDEO_HEAD_INVALID (~0u - 1) |
58 | #define ACPI_VIDEO_HEAD_END (~0u) | 57 | #define ACPI_VIDEO_HEAD_END (~0u) |
59 | 58 | ||
60 | |||
61 | #define _COMPONENT ACPI_VIDEO_COMPONENT | 59 | #define _COMPONENT ACPI_VIDEO_COMPONENT |
62 | ACPI_MODULE_NAME ("acpi_video") | 60 | ACPI_MODULE_NAME("acpi_video") |
63 | 61 | ||
64 | MODULE_AUTHOR("Bruno Ducrot"); | 62 | MODULE_AUTHOR("Bruno Ducrot"); |
65 | MODULE_DESCRIPTION(ACPI_VIDEO_DRIVER_NAME); | 63 | MODULE_DESCRIPTION(ACPI_VIDEO_DRIVER_NAME); |
66 | MODULE_LICENSE("GPL"); | 64 | MODULE_LICENSE("GPL"); |
67 | 65 | ||
68 | static int acpi_video_bus_add (struct acpi_device *device); | 66 | static int acpi_video_bus_add(struct acpi_device *device); |
69 | static int acpi_video_bus_remove (struct acpi_device *device, int type); | 67 | static int acpi_video_bus_remove(struct acpi_device *device, int type); |
70 | static int acpi_video_bus_match (struct acpi_device *device, struct acpi_driver *driver); | 68 | static int acpi_video_bus_match(struct acpi_device *device, |
69 | struct acpi_driver *driver); | ||
71 | 70 | ||
72 | static struct acpi_driver acpi_video_bus = { | 71 | static struct acpi_driver acpi_video_bus = { |
73 | .name = ACPI_VIDEO_DRIVER_NAME, | 72 | .name = ACPI_VIDEO_DRIVER_NAME, |
@@ -76,187 +75,192 @@ static struct acpi_driver acpi_video_bus = { | |||
76 | .add = acpi_video_bus_add, | 75 | .add = acpi_video_bus_add, |
77 | .remove = acpi_video_bus_remove, | 76 | .remove = acpi_video_bus_remove, |
78 | .match = acpi_video_bus_match, | 77 | .match = acpi_video_bus_match, |
79 | }, | 78 | }, |
80 | }; | 79 | }; |
81 | 80 | ||
82 | struct acpi_video_bus_flags { | 81 | struct acpi_video_bus_flags { |
83 | u8 multihead:1; /* can switch video heads */ | 82 | u8 multihead:1; /* can switch video heads */ |
84 | u8 rom:1; /* can retrieve a video rom */ | 83 | u8 rom:1; /* can retrieve a video rom */ |
85 | u8 post:1; /* can configure the head to */ | 84 | u8 post:1; /* can configure the head to */ |
86 | u8 reserved:5; | 85 | u8 reserved:5; |
87 | }; | 86 | }; |
88 | 87 | ||
89 | struct acpi_video_bus_cap { | 88 | struct acpi_video_bus_cap { |
90 | u8 _DOS:1; /*Enable/Disable output switching*/ | 89 | u8 _DOS:1; /*Enable/Disable output switching */ |
91 | u8 _DOD:1; /*Enumerate all devices attached to display adapter*/ | 90 | u8 _DOD:1; /*Enumerate all devices attached to display adapter */ |
92 | u8 _ROM:1; /*Get ROM Data*/ | 91 | u8 _ROM:1; /*Get ROM Data */ |
93 | u8 _GPD:1; /*Get POST Device*/ | 92 | u8 _GPD:1; /*Get POST Device */ |
94 | u8 _SPD:1; /*Set POST Device*/ | 93 | u8 _SPD:1; /*Set POST Device */ |
95 | u8 _VPO:1; /*Video POST Options*/ | 94 | u8 _VPO:1; /*Video POST Options */ |
96 | u8 reserved:2; | 95 | u8 reserved:2; |
97 | }; | 96 | }; |
98 | 97 | ||
99 | struct acpi_video_device_attrib{ | 98 | struct acpi_video_device_attrib { |
100 | u32 display_index:4; /* A zero-based instance of the Display*/ | 99 | u32 display_index:4; /* A zero-based instance of the Display */ |
101 | u32 display_port_attachment:4; /*This field differenates displays type*/ | 100 | u32 display_port_attachment:4; /*This field differenates displays type */ |
102 | u32 display_type:4; /*Describe the specific type in use*/ | 101 | u32 display_type:4; /*Describe the specific type in use */ |
103 | u32 vendor_specific:4; /*Chipset Vendor Specifi*/ | 102 | u32 vendor_specific:4; /*Chipset Vendor Specifi */ |
104 | u32 bios_can_detect:1; /*BIOS can detect the device*/ | 103 | u32 bios_can_detect:1; /*BIOS can detect the device */ |
105 | u32 depend_on_vga:1; /*Non-VGA output device whose power is related to | 104 | u32 depend_on_vga:1; /*Non-VGA output device whose power is related to |
106 | the VGA device.*/ | 105 | the VGA device. */ |
107 | u32 pipe_id:3; /*For VGA multiple-head devices.*/ | 106 | u32 pipe_id:3; /*For VGA multiple-head devices. */ |
108 | u32 reserved:10; /*Must be 0*/ | 107 | u32 reserved:10; /*Must be 0 */ |
109 | u32 device_id_scheme:1; /*Device ID Scheme*/ | 108 | u32 device_id_scheme:1; /*Device ID Scheme */ |
110 | }; | 109 | }; |
111 | 110 | ||
112 | struct acpi_video_enumerated_device { | 111 | struct acpi_video_enumerated_device { |
113 | union { | 112 | union { |
114 | u32 int_val; | 113 | u32 int_val; |
115 | struct acpi_video_device_attrib attrib; | 114 | struct acpi_video_device_attrib attrib; |
116 | } value; | 115 | } value; |
117 | struct acpi_video_device *bind_info; | 116 | struct acpi_video_device *bind_info; |
118 | }; | 117 | }; |
119 | 118 | ||
120 | struct acpi_video_bus { | 119 | struct acpi_video_bus { |
121 | acpi_handle handle; | 120 | acpi_handle handle; |
122 | u8 dos_setting; | 121 | u8 dos_setting; |
123 | struct acpi_video_enumerated_device *attached_array; | 122 | struct acpi_video_enumerated_device *attached_array; |
124 | u8 attached_count; | 123 | u8 attached_count; |
125 | struct acpi_video_bus_cap cap; | 124 | struct acpi_video_bus_cap cap; |
126 | struct acpi_video_bus_flags flags; | 125 | struct acpi_video_bus_flags flags; |
127 | struct semaphore sem; | 126 | struct semaphore sem; |
128 | struct list_head video_device_list; | 127 | struct list_head video_device_list; |
129 | struct proc_dir_entry *dir; | 128 | struct proc_dir_entry *dir; |
130 | }; | 129 | }; |
131 | 130 | ||
132 | struct acpi_video_device_flags { | 131 | struct acpi_video_device_flags { |
133 | u8 crt:1; | 132 | u8 crt:1; |
134 | u8 lcd:1; | 133 | u8 lcd:1; |
135 | u8 tvout:1; | 134 | u8 tvout:1; |
136 | u8 bios:1; | 135 | u8 bios:1; |
137 | u8 unknown:1; | 136 | u8 unknown:1; |
138 | u8 reserved:3; | 137 | u8 reserved:3; |
139 | }; | 138 | }; |
140 | 139 | ||
141 | struct acpi_video_device_cap { | 140 | struct acpi_video_device_cap { |
142 | u8 _ADR:1; /*Return the unique ID */ | 141 | u8 _ADR:1; /*Return the unique ID */ |
143 | u8 _BCL:1; /*Query list of brightness control levels supported*/ | 142 | u8 _BCL:1; /*Query list of brightness control levels supported */ |
144 | u8 _BCM:1; /*Set the brightness level*/ | 143 | u8 _BCM:1; /*Set the brightness level */ |
145 | u8 _DDC:1; /*Return the EDID for this device*/ | 144 | u8 _DDC:1; /*Return the EDID for this device */ |
146 | u8 _DCS:1; /*Return status of output device*/ | 145 | u8 _DCS:1; /*Return status of output device */ |
147 | u8 _DGS:1; /*Query graphics state*/ | 146 | u8 _DGS:1; /*Query graphics state */ |
148 | u8 _DSS:1; /*Device state set*/ | 147 | u8 _DSS:1; /*Device state set */ |
149 | u8 _reserved:1; | 148 | u8 _reserved:1; |
150 | }; | 149 | }; |
151 | 150 | ||
152 | struct acpi_video_device_brightness { | 151 | struct acpi_video_device_brightness { |
153 | int curr; | 152 | int curr; |
154 | int count; | 153 | int count; |
155 | int *levels; | 154 | int *levels; |
156 | }; | 155 | }; |
157 | 156 | ||
158 | struct acpi_video_device { | 157 | struct acpi_video_device { |
159 | acpi_handle handle; | 158 | acpi_handle handle; |
160 | unsigned long device_id; | 159 | unsigned long device_id; |
161 | struct acpi_video_device_flags flags; | 160 | struct acpi_video_device_flags flags; |
162 | struct acpi_video_device_cap cap; | 161 | struct acpi_video_device_cap cap; |
163 | struct list_head entry; | 162 | struct list_head entry; |
164 | struct acpi_video_bus *video; | 163 | struct acpi_video_bus *video; |
165 | struct acpi_device *dev; | 164 | struct acpi_device *dev; |
166 | struct acpi_video_device_brightness *brightness; | 165 | struct acpi_video_device_brightness *brightness; |
167 | }; | 166 | }; |
168 | 167 | ||
169 | |||
170 | /* bus */ | 168 | /* bus */ |
171 | static int acpi_video_bus_info_open_fs(struct inode *inode, struct file *file); | 169 | static int acpi_video_bus_info_open_fs(struct inode *inode, struct file *file); |
172 | static struct file_operations acpi_video_bus_info_fops = { | 170 | static struct file_operations acpi_video_bus_info_fops = { |
173 | .open = acpi_video_bus_info_open_fs, | 171 | .open = acpi_video_bus_info_open_fs, |
174 | .read = seq_read, | 172 | .read = seq_read, |
175 | .llseek = seq_lseek, | 173 | .llseek = seq_lseek, |
176 | .release = single_release, | 174 | .release = single_release, |
177 | }; | 175 | }; |
178 | 176 | ||
179 | static int acpi_video_bus_ROM_open_fs(struct inode *inode, struct file *file); | 177 | static int acpi_video_bus_ROM_open_fs(struct inode *inode, struct file *file); |
180 | static struct file_operations acpi_video_bus_ROM_fops = { | 178 | static struct file_operations acpi_video_bus_ROM_fops = { |
181 | .open = acpi_video_bus_ROM_open_fs, | 179 | .open = acpi_video_bus_ROM_open_fs, |
182 | .read = seq_read, | 180 | .read = seq_read, |
183 | .llseek = seq_lseek, | 181 | .llseek = seq_lseek, |
184 | .release = single_release, | 182 | .release = single_release, |
185 | }; | 183 | }; |
186 | 184 | ||
187 | static int acpi_video_bus_POST_info_open_fs(struct inode *inode, struct file *file); | 185 | static int acpi_video_bus_POST_info_open_fs(struct inode *inode, |
186 | struct file *file); | ||
188 | static struct file_operations acpi_video_bus_POST_info_fops = { | 187 | static struct file_operations acpi_video_bus_POST_info_fops = { |
189 | .open = acpi_video_bus_POST_info_open_fs, | 188 | .open = acpi_video_bus_POST_info_open_fs, |
190 | .read = seq_read, | 189 | .read = seq_read, |
191 | .llseek = seq_lseek, | 190 | .llseek = seq_lseek, |
192 | .release = single_release, | 191 | .release = single_release, |
193 | }; | 192 | }; |
194 | 193 | ||
195 | static int acpi_video_bus_POST_open_fs(struct inode *inode, struct file *file); | 194 | static int acpi_video_bus_POST_open_fs(struct inode *inode, struct file *file); |
196 | static struct file_operations acpi_video_bus_POST_fops = { | 195 | static struct file_operations acpi_video_bus_POST_fops = { |
197 | .open = acpi_video_bus_POST_open_fs, | 196 | .open = acpi_video_bus_POST_open_fs, |
198 | .read = seq_read, | 197 | .read = seq_read, |
199 | .llseek = seq_lseek, | 198 | .llseek = seq_lseek, |
200 | .release = single_release, | 199 | .release = single_release, |
201 | }; | 200 | }; |
202 | 201 | ||
203 | |||
204 | static int acpi_video_bus_DOS_open_fs(struct inode *inode, struct file *file); | 202 | static int acpi_video_bus_DOS_open_fs(struct inode *inode, struct file *file); |
205 | static struct file_operations acpi_video_bus_DOS_fops = { | 203 | static struct file_operations acpi_video_bus_DOS_fops = { |
206 | .open = acpi_video_bus_DOS_open_fs, | 204 | .open = acpi_video_bus_DOS_open_fs, |
207 | .read = seq_read, | 205 | .read = seq_read, |
208 | .llseek = seq_lseek, | 206 | .llseek = seq_lseek, |
209 | .release = single_release, | 207 | .release = single_release, |
210 | }; | 208 | }; |
211 | 209 | ||
212 | /* device */ | 210 | /* device */ |
213 | static int acpi_video_device_info_open_fs(struct inode *inode, struct file *file); | 211 | static int acpi_video_device_info_open_fs(struct inode *inode, |
212 | struct file *file); | ||
214 | static struct file_operations acpi_video_device_info_fops = { | 213 | static struct file_operations acpi_video_device_info_fops = { |
215 | .open = acpi_video_device_info_open_fs, | 214 | .open = acpi_video_device_info_open_fs, |
216 | .read = seq_read, | 215 | .read = seq_read, |
217 | .llseek = seq_lseek, | 216 | .llseek = seq_lseek, |
218 | .release = single_release, | 217 | .release = single_release, |
219 | }; | 218 | }; |
220 | 219 | ||
221 | static int acpi_video_device_state_open_fs(struct inode *inode, struct file *file); | 220 | static int acpi_video_device_state_open_fs(struct inode *inode, |
221 | struct file *file); | ||
222 | static struct file_operations acpi_video_device_state_fops = { | 222 | static struct file_operations acpi_video_device_state_fops = { |
223 | .open = acpi_video_device_state_open_fs, | 223 | .open = acpi_video_device_state_open_fs, |
224 | .read = seq_read, | 224 | .read = seq_read, |
225 | .llseek = seq_lseek, | 225 | .llseek = seq_lseek, |
226 | .release = single_release, | 226 | .release = single_release, |
227 | }; | 227 | }; |
228 | 228 | ||
229 | static int acpi_video_device_brightness_open_fs(struct inode *inode, struct file *file); | 229 | static int acpi_video_device_brightness_open_fs(struct inode *inode, |
230 | struct file *file); | ||
230 | static struct file_operations acpi_video_device_brightness_fops = { | 231 | static struct file_operations acpi_video_device_brightness_fops = { |
231 | .open = acpi_video_device_brightness_open_fs, | 232 | .open = acpi_video_device_brightness_open_fs, |
232 | .read = seq_read, | 233 | .read = seq_read, |
233 | .llseek = seq_lseek, | 234 | .llseek = seq_lseek, |
234 | .release = single_release, | 235 | .release = single_release, |
235 | }; | 236 | }; |
236 | 237 | ||
237 | static int acpi_video_device_EDID_open_fs(struct inode *inode, struct file *file); | 238 | static int acpi_video_device_EDID_open_fs(struct inode *inode, |
239 | struct file *file); | ||
238 | static struct file_operations acpi_video_device_EDID_fops = { | 240 | static struct file_operations acpi_video_device_EDID_fops = { |
239 | .open = acpi_video_device_EDID_open_fs, | 241 | .open = acpi_video_device_EDID_open_fs, |
240 | .read = seq_read, | 242 | .read = seq_read, |
241 | .llseek = seq_lseek, | 243 | .llseek = seq_lseek, |
242 | .release = single_release, | 244 | .release = single_release, |
243 | }; | 245 | }; |
244 | 246 | ||
245 | static char device_decode[][30] = { | 247 | static char device_decode[][30] = { |
246 | "motherboard VGA device", | 248 | "motherboard VGA device", |
247 | "PCI VGA device", | 249 | "PCI VGA device", |
248 | "AGP VGA device", | 250 | "AGP VGA device", |
249 | "UNKNOWN", | 251 | "UNKNOWN", |
250 | }; | 252 | }; |
251 | 253 | ||
252 | static void acpi_video_device_notify ( acpi_handle handle, u32 event, void *data); | 254 | static void acpi_video_device_notify(acpi_handle handle, u32 event, void *data); |
253 | static void acpi_video_device_rebind( struct acpi_video_bus *video); | 255 | static void acpi_video_device_rebind(struct acpi_video_bus *video); |
254 | static void acpi_video_device_bind( struct acpi_video_bus *video, struct acpi_video_device *device); | 256 | static void acpi_video_device_bind(struct acpi_video_bus *video, |
257 | struct acpi_video_device *device); | ||
255 | static int acpi_video_device_enumerate(struct acpi_video_bus *video); | 258 | static int acpi_video_device_enumerate(struct acpi_video_bus *video); |
256 | static int acpi_video_switch_output( struct acpi_video_bus *video, int event); | 259 | static int acpi_video_switch_output(struct acpi_video_bus *video, int event); |
257 | static int acpi_video_get_next_level( struct acpi_video_device *device, u32 level_current,u32 event); | 260 | static int acpi_video_get_next_level(struct acpi_video_device *device, |
258 | static void acpi_video_switch_brightness ( struct acpi_video_device *device, int event); | 261 | u32 level_current, u32 event); |
259 | 262 | static void acpi_video_switch_brightness(struct acpi_video_device *device, | |
263 | int event); | ||
260 | 264 | ||
261 | /* -------------------------------------------------------------------------- | 265 | /* -------------------------------------------------------------------------- |
262 | Video Management | 266 | Video Management |
@@ -265,11 +269,9 @@ static void acpi_video_switch_brightness ( struct acpi_video_device *device, int | |||
265 | /* device */ | 269 | /* device */ |
266 | 270 | ||
267 | static int | 271 | static int |
268 | acpi_video_device_query ( | 272 | acpi_video_device_query(struct acpi_video_device *device, unsigned long *state) |
269 | struct acpi_video_device *device, | ||
270 | unsigned long *state) | ||
271 | { | 273 | { |
272 | int status; | 274 | int status; |
273 | ACPI_FUNCTION_TRACE("acpi_video_device_query"); | 275 | ACPI_FUNCTION_TRACE("acpi_video_device_query"); |
274 | status = acpi_evaluate_integer(device->handle, "_DGS", NULL, state); | 276 | status = acpi_evaluate_integer(device->handle, "_DGS", NULL, state); |
275 | 277 | ||
@@ -277,11 +279,10 @@ acpi_video_device_query ( | |||
277 | } | 279 | } |
278 | 280 | ||
279 | static int | 281 | static int |
280 | acpi_video_device_get_state ( | 282 | acpi_video_device_get_state(struct acpi_video_device *device, |
281 | struct acpi_video_device *device, | 283 | unsigned long *state) |
282 | unsigned long *state) | ||
283 | { | 284 | { |
284 | int status; | 285 | int status; |
285 | 286 | ||
286 | ACPI_FUNCTION_TRACE("acpi_video_device_get_state"); | 287 | ACPI_FUNCTION_TRACE("acpi_video_device_get_state"); |
287 | 288 | ||
@@ -291,13 +292,11 @@ acpi_video_device_get_state ( | |||
291 | } | 292 | } |
292 | 293 | ||
293 | static int | 294 | static int |
294 | acpi_video_device_set_state ( | 295 | acpi_video_device_set_state(struct acpi_video_device *device, int state) |
295 | struct acpi_video_device *device, | ||
296 | int state) | ||
297 | { | 296 | { |
298 | int status; | 297 | int status; |
299 | union acpi_object arg0 = {ACPI_TYPE_INTEGER}; | 298 | union acpi_object arg0 = { ACPI_TYPE_INTEGER }; |
300 | struct acpi_object_list args = {1, &arg0}; | 299 | struct acpi_object_list args = { 1, &arg0 }; |
301 | 300 | ||
302 | ACPI_FUNCTION_TRACE("acpi_video_device_set_state"); | 301 | ACPI_FUNCTION_TRACE("acpi_video_device_set_state"); |
303 | 302 | ||
@@ -308,14 +307,12 @@ acpi_video_device_set_state ( | |||
308 | } | 307 | } |
309 | 308 | ||
310 | static int | 309 | static int |
311 | acpi_video_device_lcd_query_levels ( | 310 | acpi_video_device_lcd_query_levels(struct acpi_video_device *device, |
312 | struct acpi_video_device *device, | 311 | union acpi_object **levels) |
313 | union acpi_object **levels) | ||
314 | { | 312 | { |
315 | int status; | 313 | int status; |
316 | struct acpi_buffer buffer = {ACPI_ALLOCATE_BUFFER, NULL}; | 314 | struct acpi_buffer buffer = { ACPI_ALLOCATE_BUFFER, NULL }; |
317 | union acpi_object *obj; | 315 | union acpi_object *obj; |
318 | |||
319 | 316 | ||
320 | ACPI_FUNCTION_TRACE("acpi_video_device_lcd_query_levels"); | 317 | ACPI_FUNCTION_TRACE("acpi_video_device_lcd_query_levels"); |
321 | 318 | ||
@@ -324,7 +321,7 @@ acpi_video_device_lcd_query_levels ( | |||
324 | status = acpi_evaluate_object(device->handle, "_BCL", NULL, &buffer); | 321 | status = acpi_evaluate_object(device->handle, "_BCL", NULL, &buffer); |
325 | if (!ACPI_SUCCESS(status)) | 322 | if (!ACPI_SUCCESS(status)) |
326 | return_VALUE(status); | 323 | return_VALUE(status); |
327 | obj = (union acpi_object *) buffer.pointer; | 324 | obj = (union acpi_object *)buffer.pointer; |
328 | if (!obj && (obj->type != ACPI_TYPE_PACKAGE)) { | 325 | if (!obj && (obj->type != ACPI_TYPE_PACKAGE)) { |
329 | ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Invalid _BCL data\n")); | 326 | ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Invalid _BCL data\n")); |
330 | status = -EFAULT; | 327 | status = -EFAULT; |
@@ -335,7 +332,7 @@ acpi_video_device_lcd_query_levels ( | |||
335 | 332 | ||
336 | return_VALUE(0); | 333 | return_VALUE(0); |
337 | 334 | ||
338 | err: | 335 | err: |
339 | if (buffer.pointer) | 336 | if (buffer.pointer) |
340 | kfree(buffer.pointer); | 337 | kfree(buffer.pointer); |
341 | 338 | ||
@@ -343,13 +340,11 @@ err: | |||
343 | } | 340 | } |
344 | 341 | ||
345 | static int | 342 | static int |
346 | acpi_video_device_lcd_set_level ( | 343 | acpi_video_device_lcd_set_level(struct acpi_video_device *device, int level) |
347 | struct acpi_video_device *device, | ||
348 | int level) | ||
349 | { | 344 | { |
350 | int status; | 345 | int status; |
351 | union acpi_object arg0 = {ACPI_TYPE_INTEGER}; | 346 | union acpi_object arg0 = { ACPI_TYPE_INTEGER }; |
352 | struct acpi_object_list args = {1, &arg0}; | 347 | struct acpi_object_list args = { 1, &arg0 }; |
353 | 348 | ||
354 | ACPI_FUNCTION_TRACE("acpi_video_device_lcd_set_level"); | 349 | ACPI_FUNCTION_TRACE("acpi_video_device_lcd_set_level"); |
355 | 350 | ||
@@ -361,11 +356,10 @@ acpi_video_device_lcd_set_level ( | |||
361 | } | 356 | } |
362 | 357 | ||
363 | static int | 358 | static int |
364 | acpi_video_device_lcd_get_level_current ( | 359 | acpi_video_device_lcd_get_level_current(struct acpi_video_device *device, |
365 | struct acpi_video_device *device, | 360 | unsigned long *level) |
366 | unsigned long *level) | ||
367 | { | 361 | { |
368 | int status; | 362 | int status; |
369 | ACPI_FUNCTION_TRACE("acpi_video_device_lcd_get_level_current"); | 363 | ACPI_FUNCTION_TRACE("acpi_video_device_lcd_get_level_current"); |
370 | 364 | ||
371 | status = acpi_evaluate_integer(device->handle, "_BQC", NULL, level); | 365 | status = acpi_evaluate_integer(device->handle, "_BQC", NULL, level); |
@@ -374,16 +368,14 @@ acpi_video_device_lcd_get_level_current ( | |||
374 | } | 368 | } |
375 | 369 | ||
376 | static int | 370 | static int |
377 | acpi_video_device_EDID ( | 371 | acpi_video_device_EDID(struct acpi_video_device *device, |
378 | struct acpi_video_device *device, | 372 | union acpi_object **edid, ssize_t length) |
379 | union acpi_object **edid, | ||
380 | ssize_t length) | ||
381 | { | 373 | { |
382 | int status; | 374 | int status; |
383 | struct acpi_buffer buffer = {ACPI_ALLOCATE_BUFFER, NULL}; | 375 | struct acpi_buffer buffer = { ACPI_ALLOCATE_BUFFER, NULL }; |
384 | union acpi_object *obj; | 376 | union acpi_object *obj; |
385 | union acpi_object arg0 = {ACPI_TYPE_INTEGER}; | 377 | union acpi_object arg0 = { ACPI_TYPE_INTEGER }; |
386 | struct acpi_object_list args = {1, &arg0}; | 378 | struct acpi_object_list args = { 1, &arg0 }; |
387 | 379 | ||
388 | ACPI_FUNCTION_TRACE("acpi_video_device_get_EDID"); | 380 | ACPI_FUNCTION_TRACE("acpi_video_device_get_EDID"); |
389 | 381 | ||
@@ -402,7 +394,7 @@ acpi_video_device_EDID ( | |||
402 | if (ACPI_FAILURE(status)) | 394 | if (ACPI_FAILURE(status)) |
403 | return_VALUE(-ENODEV); | 395 | return_VALUE(-ENODEV); |
404 | 396 | ||
405 | obj = (union acpi_object *) buffer.pointer; | 397 | obj = (union acpi_object *)buffer.pointer; |
406 | 398 | ||
407 | if (obj && obj->type == ACPI_TYPE_BUFFER) | 399 | if (obj && obj->type == ACPI_TYPE_BUFFER) |
408 | *edid = obj; | 400 | *edid = obj; |
@@ -415,18 +407,15 @@ acpi_video_device_EDID ( | |||
415 | return_VALUE(status); | 407 | return_VALUE(status); |
416 | } | 408 | } |
417 | 409 | ||
418 | |||
419 | /* bus */ | 410 | /* bus */ |
420 | 411 | ||
421 | static int | 412 | static int |
422 | acpi_video_bus_set_POST ( | 413 | acpi_video_bus_set_POST(struct acpi_video_bus *video, unsigned long option) |
423 | struct acpi_video_bus *video, | ||
424 | unsigned long option) | ||
425 | { | 414 | { |
426 | int status; | 415 | int status; |
427 | unsigned long tmp; | 416 | unsigned long tmp; |
428 | union acpi_object arg0 = {ACPI_TYPE_INTEGER}; | 417 | union acpi_object arg0 = { ACPI_TYPE_INTEGER }; |
429 | struct acpi_object_list args = {1, &arg0}; | 418 | struct acpi_object_list args = { 1, &arg0 }; |
430 | 419 | ||
431 | ACPI_FUNCTION_TRACE("acpi_video_bus_set_POST"); | 420 | ACPI_FUNCTION_TRACE("acpi_video_bus_set_POST"); |
432 | 421 | ||
@@ -434,15 +423,13 @@ acpi_video_bus_set_POST ( | |||
434 | 423 | ||
435 | status = acpi_evaluate_integer(video->handle, "_SPD", &args, &tmp); | 424 | status = acpi_evaluate_integer(video->handle, "_SPD", &args, &tmp); |
436 | if (ACPI_SUCCESS(status)) | 425 | if (ACPI_SUCCESS(status)) |
437 | status = tmp ? (-EINVAL):(AE_OK); | 426 | status = tmp ? (-EINVAL) : (AE_OK); |
438 | 427 | ||
439 | return_VALUE(status); | 428 | return_VALUE(status); |
440 | } | 429 | } |
441 | 430 | ||
442 | static int | 431 | static int |
443 | acpi_video_bus_get_POST ( | 432 | acpi_video_bus_get_POST(struct acpi_video_bus *video, unsigned long *id) |
444 | struct acpi_video_bus *video, | ||
445 | unsigned long *id) | ||
446 | { | 433 | { |
447 | int status; | 434 | int status; |
448 | 435 | ||
@@ -454,11 +441,10 @@ acpi_video_bus_get_POST ( | |||
454 | } | 441 | } |
455 | 442 | ||
456 | static int | 443 | static int |
457 | acpi_video_bus_POST_options ( | 444 | acpi_video_bus_POST_options(struct acpi_video_bus *video, |
458 | struct acpi_video_bus *video, | 445 | unsigned long *options) |
459 | unsigned long *options) | ||
460 | { | 446 | { |
461 | int status; | 447 | int status; |
462 | ACPI_FUNCTION_TRACE("acpi_video_bus_POST_options"); | 448 | ACPI_FUNCTION_TRACE("acpi_video_bus_POST_options"); |
463 | 449 | ||
464 | status = acpi_evaluate_integer(video->handle, "_VPO", NULL, options); | 450 | status = acpi_evaluate_integer(video->handle, "_VPO", NULL, options); |
@@ -489,18 +475,15 @@ acpi_video_bus_POST_options ( | |||
489 | */ | 475 | */ |
490 | 476 | ||
491 | static int | 477 | static int |
492 | acpi_video_bus_DOS( | 478 | acpi_video_bus_DOS(struct acpi_video_bus *video, int bios_flag, int lcd_flag) |
493 | struct acpi_video_bus *video, | ||
494 | int bios_flag, | ||
495 | int lcd_flag) | ||
496 | { | 479 | { |
497 | acpi_integer status = 0; | 480 | acpi_integer status = 0; |
498 | union acpi_object arg0 = {ACPI_TYPE_INTEGER}; | 481 | union acpi_object arg0 = { ACPI_TYPE_INTEGER }; |
499 | struct acpi_object_list args = {1, &arg0}; | 482 | struct acpi_object_list args = { 1, &arg0 }; |
500 | 483 | ||
501 | ACPI_FUNCTION_TRACE("acpi_video_bus_DOS"); | 484 | ACPI_FUNCTION_TRACE("acpi_video_bus_DOS"); |
502 | 485 | ||
503 | if (bios_flag < 0 || bios_flag >3 || lcd_flag < 0 || lcd_flag > 1){ | 486 | if (bios_flag < 0 || bios_flag > 3 || lcd_flag < 0 || lcd_flag > 1) { |
504 | status = -1; | 487 | status = -1; |
505 | goto Failed; | 488 | goto Failed; |
506 | } | 489 | } |
@@ -508,7 +491,7 @@ acpi_video_bus_DOS( | |||
508 | video->dos_setting = arg0.integer.value; | 491 | video->dos_setting = arg0.integer.value; |
509 | acpi_evaluate_object(video->handle, "_DOS", &args, NULL); | 492 | acpi_evaluate_object(video->handle, "_DOS", &args, NULL); |
510 | 493 | ||
511 | Failed: | 494 | Failed: |
512 | return_VALUE(status); | 495 | return_VALUE(status); |
513 | } | 496 | } |
514 | 497 | ||
@@ -523,10 +506,9 @@ Failed: | |||
523 | * device. | 506 | * device. |
524 | */ | 507 | */ |
525 | 508 | ||
526 | static void | 509 | static void acpi_video_device_find_cap(struct acpi_video_device *device) |
527 | acpi_video_device_find_cap (struct acpi_video_device *device) | ||
528 | { | 510 | { |
529 | acpi_integer status; | 511 | acpi_integer status; |
530 | acpi_handle h_dummy1; | 512 | acpi_handle h_dummy1; |
531 | int i; | 513 | int i; |
532 | union acpi_object *obj = NULL; | 514 | union acpi_object *obj = NULL; |
@@ -534,27 +516,27 @@ acpi_video_device_find_cap (struct acpi_video_device *device) | |||
534 | 516 | ||
535 | ACPI_FUNCTION_TRACE("acpi_video_device_find_cap"); | 517 | ACPI_FUNCTION_TRACE("acpi_video_device_find_cap"); |
536 | 518 | ||
537 | memset( &device->cap, 0, 4); | 519 | memset(&device->cap, 0, 4); |
538 | 520 | ||
539 | if( ACPI_SUCCESS(acpi_get_handle(device->handle, "_ADR", &h_dummy1))) { | 521 | if (ACPI_SUCCESS(acpi_get_handle(device->handle, "_ADR", &h_dummy1))) { |
540 | device->cap._ADR = 1; | 522 | device->cap._ADR = 1; |
541 | } | 523 | } |
542 | if( ACPI_SUCCESS(acpi_get_handle(device->handle, "_BCL", &h_dummy1))) { | 524 | if (ACPI_SUCCESS(acpi_get_handle(device->handle, "_BCL", &h_dummy1))) { |
543 | device->cap._BCL= 1; | 525 | device->cap._BCL = 1; |
544 | } | 526 | } |
545 | if( ACPI_SUCCESS(acpi_get_handle(device->handle, "_BCM", &h_dummy1))) { | 527 | if (ACPI_SUCCESS(acpi_get_handle(device->handle, "_BCM", &h_dummy1))) { |
546 | device->cap._BCM= 1; | 528 | device->cap._BCM = 1; |
547 | } | 529 | } |
548 | if( ACPI_SUCCESS(acpi_get_handle(device->handle, "_DDC", &h_dummy1))) { | 530 | if (ACPI_SUCCESS(acpi_get_handle(device->handle, "_DDC", &h_dummy1))) { |
549 | device->cap._DDC= 1; | 531 | device->cap._DDC = 1; |
550 | } | 532 | } |
551 | if( ACPI_SUCCESS(acpi_get_handle(device->handle, "_DCS", &h_dummy1))) { | 533 | if (ACPI_SUCCESS(acpi_get_handle(device->handle, "_DCS", &h_dummy1))) { |
552 | device->cap._DCS = 1; | 534 | device->cap._DCS = 1; |
553 | } | 535 | } |
554 | if( ACPI_SUCCESS(acpi_get_handle(device->handle, "_DGS", &h_dummy1))) { | 536 | if (ACPI_SUCCESS(acpi_get_handle(device->handle, "_DGS", &h_dummy1))) { |
555 | device->cap._DGS = 1; | 537 | device->cap._DGS = 1; |
556 | } | 538 | } |
557 | if( ACPI_SUCCESS(acpi_get_handle(device->handle, "_DSS", &h_dummy1))) { | 539 | if (ACPI_SUCCESS(acpi_get_handle(device->handle, "_DSS", &h_dummy1))) { |
558 | device->cap._DSS = 1; | 540 | device->cap._DSS = 1; |
559 | } | 541 | } |
560 | 542 | ||
@@ -563,34 +545,38 @@ acpi_video_device_find_cap (struct acpi_video_device *device) | |||
563 | if (obj && obj->type == ACPI_TYPE_PACKAGE && obj->package.count >= 2) { | 545 | if (obj && obj->type == ACPI_TYPE_PACKAGE && obj->package.count >= 2) { |
564 | int count = 0; | 546 | int count = 0; |
565 | union acpi_object *o; | 547 | union acpi_object *o; |
566 | 548 | ||
567 | br = kmalloc(sizeof(*br), GFP_KERNEL); | 549 | br = kmalloc(sizeof(*br), GFP_KERNEL); |
568 | if (!br) { | 550 | if (!br) { |
569 | printk(KERN_ERR "can't allocate memory\n"); | 551 | printk(KERN_ERR "can't allocate memory\n"); |
570 | } else { | 552 | } else { |
571 | memset(br, 0, sizeof(*br)); | 553 | memset(br, 0, sizeof(*br)); |
572 | br->levels = kmalloc(obj->package.count * | 554 | br->levels = kmalloc(obj->package.count * |
573 | sizeof *(br->levels), GFP_KERNEL); | 555 | sizeof *(br->levels), GFP_KERNEL); |
574 | if (!br->levels) | 556 | if (!br->levels) |
575 | goto out; | 557 | goto out; |
576 | 558 | ||
577 | for (i = 0; i < obj->package.count; i++) { | 559 | for (i = 0; i < obj->package.count; i++) { |
578 | o = (union acpi_object *) &obj->package.elements[i]; | 560 | o = (union acpi_object *)&obj->package. |
561 | elements[i]; | ||
579 | if (o->type != ACPI_TYPE_INTEGER) { | 562 | if (o->type != ACPI_TYPE_INTEGER) { |
580 | ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Invalid data\n")); | 563 | ACPI_DEBUG_PRINT((ACPI_DB_ERROR, |
564 | "Invalid data\n")); | ||
581 | continue; | 565 | continue; |
582 | } | 566 | } |
583 | br->levels[count] = (u32) o->integer.value; | 567 | br->levels[count] = (u32) o->integer.value; |
584 | count++; | 568 | count++; |
585 | } | 569 | } |
586 | out: | 570 | out: |
587 | if (count < 2) { | 571 | if (count < 2) { |
588 | kfree(br->levels); | 572 | kfree(br->levels); |
589 | kfree(br); | 573 | kfree(br); |
590 | } else { | 574 | } else { |
591 | br->count = count; | 575 | br->count = count; |
592 | device->brightness = br; | 576 | device->brightness = br; |
593 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, "found %d brightness levels\n", count)); | 577 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, |
578 | "found %d brightness levels\n", | ||
579 | count)); | ||
594 | } | 580 | } |
595 | } | 581 | } |
596 | } | 582 | } |
@@ -610,28 +596,27 @@ out: | |||
610 | * Find out all required AML method defined under the video bus device. | 596 | * Find out all required AML method defined under the video bus device. |
611 | */ | 597 | */ |
612 | 598 | ||
613 | static void | 599 | static void acpi_video_bus_find_cap(struct acpi_video_bus *video) |
614 | acpi_video_bus_find_cap (struct acpi_video_bus *video) | ||
615 | { | 600 | { |
616 | acpi_handle h_dummy1; | 601 | acpi_handle h_dummy1; |
617 | 602 | ||
618 | memset(&video->cap ,0, 4); | 603 | memset(&video->cap, 0, 4); |
619 | if( ACPI_SUCCESS(acpi_get_handle(video->handle, "_DOS", &h_dummy1))) { | 604 | if (ACPI_SUCCESS(acpi_get_handle(video->handle, "_DOS", &h_dummy1))) { |
620 | video->cap._DOS = 1; | 605 | video->cap._DOS = 1; |
621 | } | 606 | } |
622 | if( ACPI_SUCCESS(acpi_get_handle(video->handle, "_DOD", &h_dummy1))) { | 607 | if (ACPI_SUCCESS(acpi_get_handle(video->handle, "_DOD", &h_dummy1))) { |
623 | video->cap._DOD = 1; | 608 | video->cap._DOD = 1; |
624 | } | 609 | } |
625 | if( ACPI_SUCCESS(acpi_get_handle(video->handle, "_ROM", &h_dummy1))) { | 610 | if (ACPI_SUCCESS(acpi_get_handle(video->handle, "_ROM", &h_dummy1))) { |
626 | video->cap._ROM = 1; | 611 | video->cap._ROM = 1; |
627 | } | 612 | } |
628 | if( ACPI_SUCCESS(acpi_get_handle(video->handle, "_GPD", &h_dummy1))) { | 613 | if (ACPI_SUCCESS(acpi_get_handle(video->handle, "_GPD", &h_dummy1))) { |
629 | video->cap._GPD = 1; | 614 | video->cap._GPD = 1; |
630 | } | 615 | } |
631 | if( ACPI_SUCCESS(acpi_get_handle(video->handle, "_SPD", &h_dummy1))) { | 616 | if (ACPI_SUCCESS(acpi_get_handle(video->handle, "_SPD", &h_dummy1))) { |
632 | video->cap._SPD = 1; | 617 | video->cap._SPD = 1; |
633 | } | 618 | } |
634 | if( ACPI_SUCCESS(acpi_get_handle(video->handle, "_VPO", &h_dummy1))) { | 619 | if (ACPI_SUCCESS(acpi_get_handle(video->handle, "_VPO", &h_dummy1))) { |
635 | video->cap._VPO = 1; | 620 | video->cap._VPO = 1; |
636 | } | 621 | } |
637 | } | 622 | } |
@@ -641,12 +626,9 @@ acpi_video_bus_find_cap (struct acpi_video_bus *video) | |||
641 | * support the desired features | 626 | * support the desired features |
642 | */ | 627 | */ |
643 | 628 | ||
644 | static int | 629 | static int acpi_video_bus_check(struct acpi_video_bus *video) |
645 | acpi_video_bus_check ( | ||
646 | struct acpi_video_bus *video) | ||
647 | { | 630 | { |
648 | acpi_status status = -ENOENT; | 631 | acpi_status status = -ENOENT; |
649 | |||
650 | 632 | ||
651 | ACPI_FUNCTION_TRACE("acpi_video_bus_check"); | 633 | ACPI_FUNCTION_TRACE("acpi_video_bus_check"); |
652 | 634 | ||
@@ -658,19 +640,19 @@ acpi_video_bus_check ( | |||
658 | */ | 640 | */ |
659 | 641 | ||
660 | /* Does this device able to support video switching ? */ | 642 | /* Does this device able to support video switching ? */ |
661 | if(video->cap._DOS){ | 643 | if (video->cap._DOS) { |
662 | video->flags.multihead = 1; | 644 | video->flags.multihead = 1; |
663 | status = 0; | 645 | status = 0; |
664 | } | 646 | } |
665 | 647 | ||
666 | /* Does this device able to retrieve a retrieve a video ROM ? */ | 648 | /* Does this device able to retrieve a retrieve a video ROM ? */ |
667 | if(video->cap._ROM){ | 649 | if (video->cap._ROM) { |
668 | video->flags.rom = 1; | 650 | video->flags.rom = 1; |
669 | status = 0; | 651 | status = 0; |
670 | } | 652 | } |
671 | 653 | ||
672 | /* Does this device able to configure which video device to POST ? */ | 654 | /* Does this device able to configure which video device to POST ? */ |
673 | if(video->cap._GPD && video->cap._SPD && video->cap._VPO){ | 655 | if (video->cap._GPD && video->cap._SPD && video->cap._VPO) { |
674 | video->flags.post = 1; | 656 | video->flags.post = 1; |
675 | status = 0; | 657 | status = 0; |
676 | } | 658 | } |
@@ -682,16 +664,14 @@ acpi_video_bus_check ( | |||
682 | FS Interface (/proc) | 664 | FS Interface (/proc) |
683 | -------------------------------------------------------------------------- */ | 665 | -------------------------------------------------------------------------- */ |
684 | 666 | ||
685 | static struct proc_dir_entry *acpi_video_dir; | 667 | static struct proc_dir_entry *acpi_video_dir; |
686 | 668 | ||
687 | /* video devices */ | 669 | /* video devices */ |
688 | 670 | ||
689 | static int | 671 | static int acpi_video_device_info_seq_show(struct seq_file *seq, void *offset) |
690 | acpi_video_device_info_seq_show ( | ||
691 | struct seq_file *seq, | ||
692 | void *offset) | ||
693 | { | 672 | { |
694 | struct acpi_video_device *dev = (struct acpi_video_device *) seq->private; | 673 | struct acpi_video_device *dev = |
674 | (struct acpi_video_device *)seq->private; | ||
695 | 675 | ||
696 | ACPI_FUNCTION_TRACE("acpi_video_device_info_seq_show"); | 676 | ACPI_FUNCTION_TRACE("acpi_video_device_info_seq_show"); |
697 | 677 | ||
@@ -709,30 +689,25 @@ acpi_video_device_info_seq_show ( | |||
709 | else | 689 | else |
710 | seq_printf(seq, "UNKNOWN\n"); | 690 | seq_printf(seq, "UNKNOWN\n"); |
711 | 691 | ||
712 | seq_printf(seq,"known by bios: %s\n", | 692 | seq_printf(seq, "known by bios: %s\n", dev->flags.bios ? "yes" : "no"); |
713 | dev->flags.bios ? "yes":"no"); | ||
714 | 693 | ||
715 | end: | 694 | end: |
716 | return_VALUE(0); | 695 | return_VALUE(0); |
717 | } | 696 | } |
718 | 697 | ||
719 | static int | 698 | static int |
720 | acpi_video_device_info_open_fs ( | 699 | acpi_video_device_info_open_fs(struct inode *inode, struct file *file) |
721 | struct inode *inode, | ||
722 | struct file *file) | ||
723 | { | 700 | { |
724 | return single_open(file, acpi_video_device_info_seq_show, | 701 | return single_open(file, acpi_video_device_info_seq_show, |
725 | PDE(inode)->data); | 702 | PDE(inode)->data); |
726 | } | 703 | } |
727 | 704 | ||
728 | static int | 705 | static int acpi_video_device_state_seq_show(struct seq_file *seq, void *offset) |
729 | acpi_video_device_state_seq_show ( | ||
730 | struct seq_file *seq, | ||
731 | void *offset) | ||
732 | { | 706 | { |
733 | int status; | 707 | int status; |
734 | struct acpi_video_device *dev = (struct acpi_video_device *) seq->private; | 708 | struct acpi_video_device *dev = |
735 | unsigned long state; | 709 | (struct acpi_video_device *)seq->private; |
710 | unsigned long state; | ||
736 | 711 | ||
737 | ACPI_FUNCTION_TRACE("acpi_video_device_state_seq_show"); | 712 | ACPI_FUNCTION_TRACE("acpi_video_device_state_seq_show"); |
738 | 713 | ||
@@ -753,31 +728,27 @@ acpi_video_device_state_seq_show ( | |||
753 | else | 728 | else |
754 | seq_printf(seq, "<not supported>\n"); | 729 | seq_printf(seq, "<not supported>\n"); |
755 | 730 | ||
756 | end: | 731 | end: |
757 | return_VALUE(0); | 732 | return_VALUE(0); |
758 | } | 733 | } |
759 | 734 | ||
760 | static int | 735 | static int |
761 | acpi_video_device_state_open_fs ( | 736 | acpi_video_device_state_open_fs(struct inode *inode, struct file *file) |
762 | struct inode *inode, | ||
763 | struct file *file) | ||
764 | { | 737 | { |
765 | return single_open(file, acpi_video_device_state_seq_show, | 738 | return single_open(file, acpi_video_device_state_seq_show, |
766 | PDE(inode)->data); | 739 | PDE(inode)->data); |
767 | } | 740 | } |
768 | 741 | ||
769 | static ssize_t | 742 | static ssize_t |
770 | acpi_video_device_write_state ( | 743 | acpi_video_device_write_state(struct file *file, |
771 | struct file *file, | 744 | const char __user * buffer, |
772 | const char __user *buffer, | 745 | size_t count, loff_t * data) |
773 | size_t count, | ||
774 | loff_t *data) | ||
775 | { | 746 | { |
776 | int status; | 747 | int status; |
777 | struct seq_file *m = (struct seq_file *) file->private_data; | 748 | struct seq_file *m = (struct seq_file *)file->private_data; |
778 | struct acpi_video_device *dev = (struct acpi_video_device *) m->private; | 749 | struct acpi_video_device *dev = (struct acpi_video_device *)m->private; |
779 | char str[12] = {0}; | 750 | char str[12] = { 0 }; |
780 | u32 state = 0; | 751 | u32 state = 0; |
781 | 752 | ||
782 | ACPI_FUNCTION_TRACE("acpi_video_device_write_state"); | 753 | ACPI_FUNCTION_TRACE("acpi_video_device_write_state"); |
783 | 754 | ||
@@ -789,7 +760,7 @@ acpi_video_device_write_state ( | |||
789 | 760 | ||
790 | str[count] = 0; | 761 | str[count] = 0; |
791 | state = simple_strtoul(str, NULL, 0); | 762 | state = simple_strtoul(str, NULL, 0); |
792 | state &= ((1ul<<31) | (1ul<<30) | (1ul<<0)); | 763 | state &= ((1ul << 31) | (1ul << 30) | (1ul << 0)); |
793 | 764 | ||
794 | status = acpi_video_device_set_state(dev, state); | 765 | status = acpi_video_device_set_state(dev, state); |
795 | 766 | ||
@@ -800,12 +771,11 @@ acpi_video_device_write_state ( | |||
800 | } | 771 | } |
801 | 772 | ||
802 | static int | 773 | static int |
803 | acpi_video_device_brightness_seq_show ( | 774 | acpi_video_device_brightness_seq_show(struct seq_file *seq, void *offset) |
804 | struct seq_file *seq, | ||
805 | void *offset) | ||
806 | { | 775 | { |
807 | struct acpi_video_device *dev = (struct acpi_video_device *) seq->private; | 776 | struct acpi_video_device *dev = |
808 | int i; | 777 | (struct acpi_video_device *)seq->private; |
778 | int i; | ||
809 | 779 | ||
810 | ACPI_FUNCTION_TRACE("acpi_video_device_brightness_seq_show"); | 780 | ACPI_FUNCTION_TRACE("acpi_video_device_brightness_seq_show"); |
811 | 781 | ||
@@ -823,26 +793,22 @@ acpi_video_device_brightness_seq_show ( | |||
823 | } | 793 | } |
824 | 794 | ||
825 | static int | 795 | static int |
826 | acpi_video_device_brightness_open_fs ( | 796 | acpi_video_device_brightness_open_fs(struct inode *inode, struct file *file) |
827 | struct inode *inode, | ||
828 | struct file *file) | ||
829 | { | 797 | { |
830 | return single_open(file, acpi_video_device_brightness_seq_show, | 798 | return single_open(file, acpi_video_device_brightness_seq_show, |
831 | PDE(inode)->data); | 799 | PDE(inode)->data); |
832 | } | 800 | } |
833 | 801 | ||
834 | static ssize_t | 802 | static ssize_t |
835 | acpi_video_device_write_brightness ( | 803 | acpi_video_device_write_brightness(struct file *file, |
836 | struct file *file, | 804 | const char __user * buffer, |
837 | const char __user *buffer, | 805 | size_t count, loff_t * data) |
838 | size_t count, | ||
839 | loff_t *data) | ||
840 | { | 806 | { |
841 | struct seq_file *m = (struct seq_file *) file->private_data; | 807 | struct seq_file *m = (struct seq_file *)file->private_data; |
842 | struct acpi_video_device *dev = (struct acpi_video_device *) m->private; | 808 | struct acpi_video_device *dev = (struct acpi_video_device *)m->private; |
843 | char str[4] = {0}; | 809 | char str[4] = { 0 }; |
844 | unsigned int level = 0; | 810 | unsigned int level = 0; |
845 | int i; | 811 | int i; |
846 | 812 | ||
847 | ACPI_FUNCTION_TRACE("acpi_video_device_write_brightness"); | 813 | ACPI_FUNCTION_TRACE("acpi_video_device_write_brightness"); |
848 | 814 | ||
@@ -854,14 +820,15 @@ acpi_video_device_write_brightness ( | |||
854 | 820 | ||
855 | str[count] = 0; | 821 | str[count] = 0; |
856 | level = simple_strtoul(str, NULL, 0); | 822 | level = simple_strtoul(str, NULL, 0); |
857 | 823 | ||
858 | if (level > 100) | 824 | if (level > 100) |
859 | return_VALUE(-EFAULT); | 825 | return_VALUE(-EFAULT); |
860 | 826 | ||
861 | /* validate though the list of available levels */ | 827 | /* validate though the list of available levels */ |
862 | for (i = 0; i < dev->brightness->count; i++) | 828 | for (i = 0; i < dev->brightness->count; i++) |
863 | if (level == dev->brightness->levels[i]) { | 829 | if (level == dev->brightness->levels[i]) { |
864 | if (ACPI_SUCCESS(acpi_video_device_lcd_set_level(dev, level))) | 830 | if (ACPI_SUCCESS |
831 | (acpi_video_device_lcd_set_level(dev, level))) | ||
865 | dev->brightness->curr = level; | 832 | dev->brightness->curr = level; |
866 | break; | 833 | break; |
867 | } | 834 | } |
@@ -869,24 +836,22 @@ acpi_video_device_write_brightness ( | |||
869 | return_VALUE(count); | 836 | return_VALUE(count); |
870 | } | 837 | } |
871 | 838 | ||
872 | static int | 839 | static int acpi_video_device_EDID_seq_show(struct seq_file *seq, void *offset) |
873 | acpi_video_device_EDID_seq_show ( | ||
874 | struct seq_file *seq, | ||
875 | void *offset) | ||
876 | { | 840 | { |
877 | struct acpi_video_device *dev = (struct acpi_video_device *) seq->private; | 841 | struct acpi_video_device *dev = |
878 | int status; | 842 | (struct acpi_video_device *)seq->private; |
879 | int i; | 843 | int status; |
880 | union acpi_object *edid = NULL; | 844 | int i; |
845 | union acpi_object *edid = NULL; | ||
881 | 846 | ||
882 | ACPI_FUNCTION_TRACE("acpi_video_device_EDID_seq_show"); | 847 | ACPI_FUNCTION_TRACE("acpi_video_device_EDID_seq_show"); |
883 | 848 | ||
884 | if (!dev) | 849 | if (!dev) |
885 | goto out; | 850 | goto out; |
886 | 851 | ||
887 | status = acpi_video_device_EDID (dev, &edid, 128); | 852 | status = acpi_video_device_EDID(dev, &edid, 128); |
888 | if (ACPI_FAILURE(status)) { | 853 | if (ACPI_FAILURE(status)) { |
889 | status = acpi_video_device_EDID (dev, &edid, 256); | 854 | status = acpi_video_device_EDID(dev, &edid, 256); |
890 | } | 855 | } |
891 | 856 | ||
892 | if (ACPI_FAILURE(status)) { | 857 | if (ACPI_FAILURE(status)) { |
@@ -898,7 +863,7 @@ acpi_video_device_EDID_seq_show ( | |||
898 | seq_putc(seq, edid->buffer.pointer[i]); | 863 | seq_putc(seq, edid->buffer.pointer[i]); |
899 | } | 864 | } |
900 | 865 | ||
901 | out: | 866 | out: |
902 | if (!edid) | 867 | if (!edid) |
903 | seq_printf(seq, "<not supported>\n"); | 868 | seq_printf(seq, "<not supported>\n"); |
904 | else | 869 | else |
@@ -908,20 +873,15 @@ out: | |||
908 | } | 873 | } |
909 | 874 | ||
910 | static int | 875 | static int |
911 | acpi_video_device_EDID_open_fs ( | 876 | acpi_video_device_EDID_open_fs(struct inode *inode, struct file *file) |
912 | struct inode *inode, | ||
913 | struct file *file) | ||
914 | { | 877 | { |
915 | return single_open(file, acpi_video_device_EDID_seq_show, | 878 | return single_open(file, acpi_video_device_EDID_seq_show, |
916 | PDE(inode)->data); | 879 | PDE(inode)->data); |
917 | } | 880 | } |
918 | 881 | ||
919 | 882 | static int acpi_video_device_add_fs(struct acpi_device *device) | |
920 | static int | ||
921 | acpi_video_device_add_fs ( | ||
922 | struct acpi_device *device) | ||
923 | { | 883 | { |
924 | struct proc_dir_entry *entry = NULL; | 884 | struct proc_dir_entry *entry = NULL; |
925 | struct acpi_video_device *vid_dev; | 885 | struct acpi_video_device *vid_dev; |
926 | 886 | ||
927 | ACPI_FUNCTION_TRACE("acpi_video_device_add_fs"); | 887 | ACPI_FUNCTION_TRACE("acpi_video_device_add_fs"); |
@@ -929,13 +889,13 @@ acpi_video_device_add_fs ( | |||
929 | if (!device) | 889 | if (!device) |
930 | return_VALUE(-ENODEV); | 890 | return_VALUE(-ENODEV); |
931 | 891 | ||
932 | vid_dev = (struct acpi_video_device *) acpi_driver_data(device); | 892 | vid_dev = (struct acpi_video_device *)acpi_driver_data(device); |
933 | if (!vid_dev) | 893 | if (!vid_dev) |
934 | return_VALUE(-ENODEV); | 894 | return_VALUE(-ENODEV); |
935 | 895 | ||
936 | if (!acpi_device_dir(device)) { | 896 | if (!acpi_device_dir(device)) { |
937 | acpi_device_dir(device) = proc_mkdir(acpi_device_bid(device), | 897 | acpi_device_dir(device) = proc_mkdir(acpi_device_bid(device), |
938 | vid_dev->video->dir); | 898 | vid_dev->video->dir); |
939 | if (!acpi_device_dir(device)) | 899 | if (!acpi_device_dir(device)) |
940 | return_VALUE(-ENODEV); | 900 | return_VALUE(-ENODEV); |
941 | acpi_device_dir(device)->owner = THIS_MODULE; | 901 | acpi_device_dir(device)->owner = THIS_MODULE; |
@@ -945,7 +905,7 @@ acpi_video_device_add_fs ( | |||
945 | entry = create_proc_entry("info", S_IRUGO, acpi_device_dir(device)); | 905 | entry = create_proc_entry("info", S_IRUGO, acpi_device_dir(device)); |
946 | if (!entry) | 906 | if (!entry) |
947 | ACPI_DEBUG_PRINT((ACPI_DB_ERROR, | 907 | ACPI_DEBUG_PRINT((ACPI_DB_ERROR, |
948 | "Unable to create 'info' fs entry\n")); | 908 | "Unable to create 'info' fs entry\n")); |
949 | else { | 909 | else { |
950 | entry->proc_fops = &acpi_video_device_info_fops; | 910 | entry->proc_fops = &acpi_video_device_info_fops; |
951 | entry->data = acpi_driver_data(device); | 911 | entry->data = acpi_driver_data(device); |
@@ -953,10 +913,12 @@ acpi_video_device_add_fs ( | |||
953 | } | 913 | } |
954 | 914 | ||
955 | /* 'state' [R/W] */ | 915 | /* 'state' [R/W] */ |
956 | entry = create_proc_entry("state", S_IFREG|S_IRUGO|S_IWUSR, acpi_device_dir(device)); | 916 | entry = |
917 | create_proc_entry("state", S_IFREG | S_IRUGO | S_IWUSR, | ||
918 | acpi_device_dir(device)); | ||
957 | if (!entry) | 919 | if (!entry) |
958 | ACPI_DEBUG_PRINT((ACPI_DB_ERROR, | 920 | ACPI_DEBUG_PRINT((ACPI_DB_ERROR, |
959 | "Unable to create 'state' fs entry\n")); | 921 | "Unable to create 'state' fs entry\n")); |
960 | else { | 922 | else { |
961 | entry->proc_fops = &acpi_video_device_state_fops; | 923 | entry->proc_fops = &acpi_video_device_state_fops; |
962 | entry->proc_fops->write = acpi_video_device_write_state; | 924 | entry->proc_fops->write = acpi_video_device_write_state; |
@@ -965,10 +927,12 @@ acpi_video_device_add_fs ( | |||
965 | } | 927 | } |
966 | 928 | ||
967 | /* 'brightness' [R/W] */ | 929 | /* 'brightness' [R/W] */ |
968 | entry = create_proc_entry("brightness", S_IFREG|S_IRUGO|S_IWUSR, acpi_device_dir(device)); | 930 | entry = |
931 | create_proc_entry("brightness", S_IFREG | S_IRUGO | S_IWUSR, | ||
932 | acpi_device_dir(device)); | ||
969 | if (!entry) | 933 | if (!entry) |
970 | ACPI_DEBUG_PRINT((ACPI_DB_ERROR, | 934 | ACPI_DEBUG_PRINT((ACPI_DB_ERROR, |
971 | "Unable to create 'brightness' fs entry\n")); | 935 | "Unable to create 'brightness' fs entry\n")); |
972 | else { | 936 | else { |
973 | entry->proc_fops = &acpi_video_device_brightness_fops; | 937 | entry->proc_fops = &acpi_video_device_brightness_fops; |
974 | entry->proc_fops->write = acpi_video_device_write_brightness; | 938 | entry->proc_fops->write = acpi_video_device_write_brightness; |
@@ -980,7 +944,7 @@ acpi_video_device_add_fs ( | |||
980 | entry = create_proc_entry("EDID", S_IRUGO, acpi_device_dir(device)); | 944 | entry = create_proc_entry("EDID", S_IRUGO, acpi_device_dir(device)); |
981 | if (!entry) | 945 | if (!entry) |
982 | ACPI_DEBUG_PRINT((ACPI_DB_ERROR, | 946 | ACPI_DEBUG_PRINT((ACPI_DB_ERROR, |
983 | "Unable to create 'brightness' fs entry\n")); | 947 | "Unable to create 'brightness' fs entry\n")); |
984 | else { | 948 | else { |
985 | entry->proc_fops = &acpi_video_device_EDID_fops; | 949 | entry->proc_fops = &acpi_video_device_EDID_fops; |
986 | entry->data = acpi_driver_data(device); | 950 | entry->data = acpi_driver_data(device); |
@@ -990,14 +954,12 @@ acpi_video_device_add_fs ( | |||
990 | return_VALUE(0); | 954 | return_VALUE(0); |
991 | } | 955 | } |
992 | 956 | ||
993 | static int | 957 | static int acpi_video_device_remove_fs(struct acpi_device *device) |
994 | acpi_video_device_remove_fs ( | ||
995 | struct acpi_device *device) | ||
996 | { | 958 | { |
997 | struct acpi_video_device *vid_dev; | 959 | struct acpi_video_device *vid_dev; |
998 | ACPI_FUNCTION_TRACE("acpi_video_device_remove_fs"); | 960 | ACPI_FUNCTION_TRACE("acpi_video_device_remove_fs"); |
999 | 961 | ||
1000 | vid_dev = (struct acpi_video_device *) acpi_driver_data(device); | 962 | vid_dev = (struct acpi_video_device *)acpi_driver_data(device); |
1001 | if (!vid_dev || !vid_dev->video || !vid_dev->video->dir) | 963 | if (!vid_dev || !vid_dev->video || !vid_dev->video->dir) |
1002 | return_VALUE(-ENODEV); | 964 | return_VALUE(-ENODEV); |
1003 | 965 | ||
@@ -1006,22 +968,17 @@ acpi_video_device_remove_fs ( | |||
1006 | remove_proc_entry("state", acpi_device_dir(device)); | 968 | remove_proc_entry("state", acpi_device_dir(device)); |
1007 | remove_proc_entry("brightness", acpi_device_dir(device)); | 969 | remove_proc_entry("brightness", acpi_device_dir(device)); |
1008 | remove_proc_entry("EDID", acpi_device_dir(device)); | 970 | remove_proc_entry("EDID", acpi_device_dir(device)); |
1009 | remove_proc_entry(acpi_device_bid(device), | 971 | remove_proc_entry(acpi_device_bid(device), vid_dev->video->dir); |
1010 | vid_dev->video->dir); | ||
1011 | acpi_device_dir(device) = NULL; | 972 | acpi_device_dir(device) = NULL; |
1012 | } | 973 | } |
1013 | 974 | ||
1014 | return_VALUE(0); | 975 | return_VALUE(0); |
1015 | } | 976 | } |
1016 | 977 | ||
1017 | |||
1018 | /* video bus */ | 978 | /* video bus */ |
1019 | static int | 979 | static int acpi_video_bus_info_seq_show(struct seq_file *seq, void *offset) |
1020 | acpi_video_bus_info_seq_show ( | ||
1021 | struct seq_file *seq, | ||
1022 | void *offset) | ||
1023 | { | 980 | { |
1024 | struct acpi_video_bus *video = (struct acpi_video_bus *) seq->private; | 981 | struct acpi_video_bus *video = (struct acpi_video_bus *)seq->private; |
1025 | 982 | ||
1026 | ACPI_FUNCTION_TRACE("acpi_video_bus_info_seq_show"); | 983 | ACPI_FUNCTION_TRACE("acpi_video_bus_info_seq_show"); |
1027 | 984 | ||
@@ -1029,30 +986,25 @@ acpi_video_bus_info_seq_show ( | |||
1029 | goto end; | 986 | goto end; |
1030 | 987 | ||
1031 | seq_printf(seq, "Switching heads: %s\n", | 988 | seq_printf(seq, "Switching heads: %s\n", |
1032 | video->flags.multihead ? "yes":"no"); | 989 | video->flags.multihead ? "yes" : "no"); |
1033 | seq_printf(seq, "Video ROM: %s\n", | 990 | seq_printf(seq, "Video ROM: %s\n", |
1034 | video->flags.rom ? "yes":"no"); | 991 | video->flags.rom ? "yes" : "no"); |
1035 | seq_printf(seq, "Device to be POSTed on boot: %s\n", | 992 | seq_printf(seq, "Device to be POSTed on boot: %s\n", |
1036 | video->flags.post ? "yes":"no"); | 993 | video->flags.post ? "yes" : "no"); |
1037 | 994 | ||
1038 | end: | 995 | end: |
1039 | return_VALUE(0); | 996 | return_VALUE(0); |
1040 | } | 997 | } |
1041 | 998 | ||
1042 | static int | 999 | static int acpi_video_bus_info_open_fs(struct inode *inode, struct file *file) |
1043 | acpi_video_bus_info_open_fs ( | ||
1044 | struct inode *inode, | ||
1045 | struct file *file) | ||
1046 | { | 1000 | { |
1047 | return single_open(file, acpi_video_bus_info_seq_show, PDE(inode)->data); | 1001 | return single_open(file, acpi_video_bus_info_seq_show, |
1002 | PDE(inode)->data); | ||
1048 | } | 1003 | } |
1049 | 1004 | ||
1050 | static int | 1005 | static int acpi_video_bus_ROM_seq_show(struct seq_file *seq, void *offset) |
1051 | acpi_video_bus_ROM_seq_show ( | ||
1052 | struct seq_file *seq, | ||
1053 | void *offset) | ||
1054 | { | 1006 | { |
1055 | struct acpi_video_bus *video = (struct acpi_video_bus *) seq->private; | 1007 | struct acpi_video_bus *video = (struct acpi_video_bus *)seq->private; |
1056 | 1008 | ||
1057 | ACPI_FUNCTION_TRACE("acpi_video_bus_ROM_seq_show"); | 1009 | ACPI_FUNCTION_TRACE("acpi_video_bus_ROM_seq_show"); |
1058 | 1010 | ||
@@ -1062,26 +1014,20 @@ acpi_video_bus_ROM_seq_show ( | |||
1062 | printk(KERN_INFO PREFIX "Please implement %s\n", __FUNCTION__); | 1014 | printk(KERN_INFO PREFIX "Please implement %s\n", __FUNCTION__); |
1063 | seq_printf(seq, "<TODO>\n"); | 1015 | seq_printf(seq, "<TODO>\n"); |
1064 | 1016 | ||
1065 | end: | 1017 | end: |
1066 | return_VALUE(0); | 1018 | return_VALUE(0); |
1067 | } | 1019 | } |
1068 | 1020 | ||
1069 | static int | 1021 | static int acpi_video_bus_ROM_open_fs(struct inode *inode, struct file *file) |
1070 | acpi_video_bus_ROM_open_fs ( | ||
1071 | struct inode *inode, | ||
1072 | struct file *file) | ||
1073 | { | 1022 | { |
1074 | return single_open(file, acpi_video_bus_ROM_seq_show, PDE(inode)->data); | 1023 | return single_open(file, acpi_video_bus_ROM_seq_show, PDE(inode)->data); |
1075 | } | 1024 | } |
1076 | 1025 | ||
1077 | static int | 1026 | static int acpi_video_bus_POST_info_seq_show(struct seq_file *seq, void *offset) |
1078 | acpi_video_bus_POST_info_seq_show ( | ||
1079 | struct seq_file *seq, | ||
1080 | void *offset) | ||
1081 | { | 1027 | { |
1082 | struct acpi_video_bus *video = (struct acpi_video_bus *) seq->private; | 1028 | struct acpi_video_bus *video = (struct acpi_video_bus *)seq->private; |
1083 | unsigned long options; | 1029 | unsigned long options; |
1084 | int status; | 1030 | int status; |
1085 | 1031 | ||
1086 | ACPI_FUNCTION_TRACE("acpi_video_bus_POST_info_seq_show"); | 1032 | ACPI_FUNCTION_TRACE("acpi_video_bus_POST_info_seq_show"); |
1087 | 1033 | ||
@@ -1091,8 +1037,10 @@ acpi_video_bus_POST_info_seq_show ( | |||
1091 | status = acpi_video_bus_POST_options(video, &options); | 1037 | status = acpi_video_bus_POST_options(video, &options); |
1092 | if (ACPI_SUCCESS(status)) { | 1038 | if (ACPI_SUCCESS(status)) { |
1093 | if (!(options & 1)) { | 1039 | if (!(options & 1)) { |
1094 | printk(KERN_WARNING PREFIX "The motherboard VGA device is not listed as a possible POST device.\n"); | 1040 | printk(KERN_WARNING PREFIX |
1095 | printk(KERN_WARNING PREFIX "This indicate a BIOS bug. Please contact the manufacturer.\n"); | 1041 | "The motherboard VGA device is not listed as a possible POST device.\n"); |
1042 | printk(KERN_WARNING PREFIX | ||
1043 | "This indicate a BIOS bug. Please contact the manufacturer.\n"); | ||
1096 | } | 1044 | } |
1097 | printk("%lx\n", options); | 1045 | printk("%lx\n", options); |
1098 | seq_printf(seq, "can POST: <intgrated video>"); | 1046 | seq_printf(seq, "can POST: <intgrated video>"); |
@@ -1103,89 +1051,74 @@ acpi_video_bus_POST_info_seq_show ( | |||
1103 | seq_putc(seq, '\n'); | 1051 | seq_putc(seq, '\n'); |
1104 | } else | 1052 | } else |
1105 | seq_printf(seq, "<not supported>\n"); | 1053 | seq_printf(seq, "<not supported>\n"); |
1106 | end: | 1054 | end: |
1107 | return_VALUE(0); | 1055 | return_VALUE(0); |
1108 | } | 1056 | } |
1109 | 1057 | ||
1110 | static int | 1058 | static int |
1111 | acpi_video_bus_POST_info_open_fs ( | 1059 | acpi_video_bus_POST_info_open_fs(struct inode *inode, struct file *file) |
1112 | struct inode *inode, | ||
1113 | struct file *file) | ||
1114 | { | 1060 | { |
1115 | return single_open(file, acpi_video_bus_POST_info_seq_show, PDE(inode)->data); | 1061 | return single_open(file, acpi_video_bus_POST_info_seq_show, |
1062 | PDE(inode)->data); | ||
1116 | } | 1063 | } |
1117 | 1064 | ||
1118 | static int | 1065 | static int acpi_video_bus_POST_seq_show(struct seq_file *seq, void *offset) |
1119 | acpi_video_bus_POST_seq_show ( | ||
1120 | struct seq_file *seq, | ||
1121 | void *offset) | ||
1122 | { | 1066 | { |
1123 | struct acpi_video_bus *video = (struct acpi_video_bus *) seq->private; | 1067 | struct acpi_video_bus *video = (struct acpi_video_bus *)seq->private; |
1124 | int status; | 1068 | int status; |
1125 | unsigned long id; | 1069 | unsigned long id; |
1126 | 1070 | ||
1127 | ACPI_FUNCTION_TRACE("acpi_video_bus_POST_seq_show"); | 1071 | ACPI_FUNCTION_TRACE("acpi_video_bus_POST_seq_show"); |
1128 | 1072 | ||
1129 | if (!video) | 1073 | if (!video) |
1130 | goto end; | 1074 | goto end; |
1131 | 1075 | ||
1132 | status = acpi_video_bus_get_POST (video, &id); | 1076 | status = acpi_video_bus_get_POST(video, &id); |
1133 | if (!ACPI_SUCCESS(status)) { | 1077 | if (!ACPI_SUCCESS(status)) { |
1134 | seq_printf(seq, "<not supported>\n"); | 1078 | seq_printf(seq, "<not supported>\n"); |
1135 | goto end; | 1079 | goto end; |
1136 | } | 1080 | } |
1137 | seq_printf(seq, "device posted is <%s>\n", device_decode[id & 3]); | 1081 | seq_printf(seq, "device posted is <%s>\n", device_decode[id & 3]); |
1138 | 1082 | ||
1139 | end: | 1083 | end: |
1140 | return_VALUE(0); | 1084 | return_VALUE(0); |
1141 | } | 1085 | } |
1142 | 1086 | ||
1143 | static int | 1087 | static int acpi_video_bus_DOS_seq_show(struct seq_file *seq, void *offset) |
1144 | acpi_video_bus_DOS_seq_show ( | ||
1145 | struct seq_file *seq, | ||
1146 | void *offset) | ||
1147 | { | 1088 | { |
1148 | struct acpi_video_bus *video = (struct acpi_video_bus *) seq->private; | 1089 | struct acpi_video_bus *video = (struct acpi_video_bus *)seq->private; |
1149 | 1090 | ||
1150 | ACPI_FUNCTION_TRACE("acpi_video_bus_DOS_seq_show"); | 1091 | ACPI_FUNCTION_TRACE("acpi_video_bus_DOS_seq_show"); |
1151 | 1092 | ||
1152 | seq_printf(seq, "DOS setting: <%d>\n", video->dos_setting ); | 1093 | seq_printf(seq, "DOS setting: <%d>\n", video->dos_setting); |
1153 | 1094 | ||
1154 | return_VALUE(0); | 1095 | return_VALUE(0); |
1155 | } | 1096 | } |
1156 | 1097 | ||
1157 | static int | 1098 | static int acpi_video_bus_POST_open_fs(struct inode *inode, struct file *file) |
1158 | acpi_video_bus_POST_open_fs ( | ||
1159 | struct inode *inode, | ||
1160 | struct file *file) | ||
1161 | { | 1099 | { |
1162 | return single_open(file, acpi_video_bus_POST_seq_show, PDE(inode)->data); | 1100 | return single_open(file, acpi_video_bus_POST_seq_show, |
1101 | PDE(inode)->data); | ||
1163 | } | 1102 | } |
1164 | 1103 | ||
1165 | static int | 1104 | static int acpi_video_bus_DOS_open_fs(struct inode *inode, struct file *file) |
1166 | acpi_video_bus_DOS_open_fs ( | ||
1167 | struct inode *inode, | ||
1168 | struct file *file) | ||
1169 | { | 1105 | { |
1170 | return single_open(file, acpi_video_bus_DOS_seq_show, PDE(inode)->data); | 1106 | return single_open(file, acpi_video_bus_DOS_seq_show, PDE(inode)->data); |
1171 | } | 1107 | } |
1172 | 1108 | ||
1173 | static ssize_t | 1109 | static ssize_t |
1174 | acpi_video_bus_write_POST ( | 1110 | acpi_video_bus_write_POST(struct file *file, |
1175 | struct file *file, | 1111 | const char __user * buffer, |
1176 | const char __user *buffer, | 1112 | size_t count, loff_t * data) |
1177 | size_t count, | ||
1178 | loff_t *data) | ||
1179 | { | 1113 | { |
1180 | int status; | 1114 | int status; |
1181 | struct seq_file *m = (struct seq_file *) file->private_data; | 1115 | struct seq_file *m = (struct seq_file *)file->private_data; |
1182 | struct acpi_video_bus *video = (struct acpi_video_bus *) m->private; | 1116 | struct acpi_video_bus *video = (struct acpi_video_bus *)m->private; |
1183 | char str[12] = {0}; | 1117 | char str[12] = { 0 }; |
1184 | unsigned long opt, options; | 1118 | unsigned long opt, options; |
1185 | 1119 | ||
1186 | ACPI_FUNCTION_TRACE("acpi_video_bus_write_POST"); | 1120 | ACPI_FUNCTION_TRACE("acpi_video_bus_write_POST"); |
1187 | 1121 | ||
1188 | |||
1189 | if (!video || count + 1 > sizeof str) | 1122 | if (!video || count + 1 > sizeof str) |
1190 | return_VALUE(-EINVAL); | 1123 | return_VALUE(-EINVAL); |
1191 | 1124 | ||
@@ -1205,32 +1138,28 @@ acpi_video_bus_write_POST ( | |||
1205 | options |= 1; | 1138 | options |= 1; |
1206 | 1139 | ||
1207 | if (options & (1ul << opt)) { | 1140 | if (options & (1ul << opt)) { |
1208 | status = acpi_video_bus_set_POST (video, opt); | 1141 | status = acpi_video_bus_set_POST(video, opt); |
1209 | if (!ACPI_SUCCESS(status)) | 1142 | if (!ACPI_SUCCESS(status)) |
1210 | return_VALUE(-EFAULT); | 1143 | return_VALUE(-EFAULT); |
1211 | 1144 | ||
1212 | } | 1145 | } |
1213 | 1146 | ||
1214 | |||
1215 | return_VALUE(count); | 1147 | return_VALUE(count); |
1216 | } | 1148 | } |
1217 | 1149 | ||
1218 | static ssize_t | 1150 | static ssize_t |
1219 | acpi_video_bus_write_DOS ( | 1151 | acpi_video_bus_write_DOS(struct file *file, |
1220 | struct file *file, | 1152 | const char __user * buffer, |
1221 | const char __user *buffer, | 1153 | size_t count, loff_t * data) |
1222 | size_t count, | ||
1223 | loff_t *data) | ||
1224 | { | 1154 | { |
1225 | int status; | 1155 | int status; |
1226 | struct seq_file *m = (struct seq_file *) file->private_data; | 1156 | struct seq_file *m = (struct seq_file *)file->private_data; |
1227 | struct acpi_video_bus *video = (struct acpi_video_bus *) m->private; | 1157 | struct acpi_video_bus *video = (struct acpi_video_bus *)m->private; |
1228 | char str[12] = {0}; | 1158 | char str[12] = { 0 }; |
1229 | unsigned long opt; | 1159 | unsigned long opt; |
1230 | 1160 | ||
1231 | ACPI_FUNCTION_TRACE("acpi_video_bus_write_DOS"); | 1161 | ACPI_FUNCTION_TRACE("acpi_video_bus_write_DOS"); |
1232 | 1162 | ||
1233 | |||
1234 | if (!video || count + 1 > sizeof str) | 1163 | if (!video || count + 1 > sizeof str) |
1235 | return_VALUE(-EINVAL); | 1164 | return_VALUE(-EINVAL); |
1236 | 1165 | ||
@@ -1242,7 +1171,7 @@ acpi_video_bus_write_DOS ( | |||
1242 | if (opt > 7) | 1171 | if (opt > 7) |
1243 | return_VALUE(-EFAULT); | 1172 | return_VALUE(-EFAULT); |
1244 | 1173 | ||
1245 | status = acpi_video_bus_DOS (video, opt & 0x3, (opt & 0x4)>>2); | 1174 | status = acpi_video_bus_DOS(video, opt & 0x3, (opt & 0x4) >> 2); |
1246 | 1175 | ||
1247 | if (!ACPI_SUCCESS(status)) | 1176 | if (!ACPI_SUCCESS(status)) |
1248 | return_VALUE(-EFAULT); | 1177 | return_VALUE(-EFAULT); |
@@ -1250,20 +1179,18 @@ acpi_video_bus_write_DOS ( | |||
1250 | return_VALUE(count); | 1179 | return_VALUE(count); |
1251 | } | 1180 | } |
1252 | 1181 | ||
1253 | static int | 1182 | static int acpi_video_bus_add_fs(struct acpi_device *device) |
1254 | acpi_video_bus_add_fs ( | ||
1255 | struct acpi_device *device) | ||
1256 | { | 1183 | { |
1257 | struct proc_dir_entry *entry = NULL; | 1184 | struct proc_dir_entry *entry = NULL; |
1258 | struct acpi_video_bus *video; | 1185 | struct acpi_video_bus *video; |
1259 | 1186 | ||
1260 | ACPI_FUNCTION_TRACE("acpi_video_bus_add_fs"); | 1187 | ACPI_FUNCTION_TRACE("acpi_video_bus_add_fs"); |
1261 | 1188 | ||
1262 | video = (struct acpi_video_bus *) acpi_driver_data(device); | 1189 | video = (struct acpi_video_bus *)acpi_driver_data(device); |
1263 | 1190 | ||
1264 | if (!acpi_device_dir(device)) { | 1191 | if (!acpi_device_dir(device)) { |
1265 | acpi_device_dir(device) = proc_mkdir(acpi_device_bid(device), | 1192 | acpi_device_dir(device) = proc_mkdir(acpi_device_bid(device), |
1266 | acpi_video_dir); | 1193 | acpi_video_dir); |
1267 | if (!acpi_device_dir(device)) | 1194 | if (!acpi_device_dir(device)) |
1268 | return_VALUE(-ENODEV); | 1195 | return_VALUE(-ENODEV); |
1269 | video->dir = acpi_device_dir(device); | 1196 | video->dir = acpi_device_dir(device); |
@@ -1273,7 +1200,8 @@ acpi_video_bus_add_fs ( | |||
1273 | /* 'info' [R] */ | 1200 | /* 'info' [R] */ |
1274 | entry = create_proc_entry("info", S_IRUGO, acpi_device_dir(device)); | 1201 | entry = create_proc_entry("info", S_IRUGO, acpi_device_dir(device)); |
1275 | if (!entry) | 1202 | if (!entry) |
1276 | ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Unable to create 'info' fs entry\n")); | 1203 | ACPI_DEBUG_PRINT((ACPI_DB_ERROR, |
1204 | "Unable to create 'info' fs entry\n")); | ||
1277 | else { | 1205 | else { |
1278 | entry->proc_fops = &acpi_video_bus_info_fops; | 1206 | entry->proc_fops = &acpi_video_bus_info_fops; |
1279 | entry->data = acpi_driver_data(device); | 1207 | entry->data = acpi_driver_data(device); |
@@ -1283,7 +1211,8 @@ acpi_video_bus_add_fs ( | |||
1283 | /* 'ROM' [R] */ | 1211 | /* 'ROM' [R] */ |
1284 | entry = create_proc_entry("ROM", S_IRUGO, acpi_device_dir(device)); | 1212 | entry = create_proc_entry("ROM", S_IRUGO, acpi_device_dir(device)); |
1285 | if (!entry) | 1213 | if (!entry) |
1286 | ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Unable to create 'ROM' fs entry\n")); | 1214 | ACPI_DEBUG_PRINT((ACPI_DB_ERROR, |
1215 | "Unable to create 'ROM' fs entry\n")); | ||
1287 | else { | 1216 | else { |
1288 | entry->proc_fops = &acpi_video_bus_ROM_fops; | 1217 | entry->proc_fops = &acpi_video_bus_ROM_fops; |
1289 | entry->data = acpi_driver_data(device); | 1218 | entry->data = acpi_driver_data(device); |
@@ -1291,9 +1220,11 @@ acpi_video_bus_add_fs ( | |||
1291 | } | 1220 | } |
1292 | 1221 | ||
1293 | /* 'POST_info' [R] */ | 1222 | /* 'POST_info' [R] */ |
1294 | entry = create_proc_entry("POST_info", S_IRUGO, acpi_device_dir(device)); | 1223 | entry = |
1224 | create_proc_entry("POST_info", S_IRUGO, acpi_device_dir(device)); | ||
1295 | if (!entry) | 1225 | if (!entry) |
1296 | ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Unable to create 'POST_info' fs entry\n")); | 1226 | ACPI_DEBUG_PRINT((ACPI_DB_ERROR, |
1227 | "Unable to create 'POST_info' fs entry\n")); | ||
1297 | else { | 1228 | else { |
1298 | entry->proc_fops = &acpi_video_bus_POST_info_fops; | 1229 | entry->proc_fops = &acpi_video_bus_POST_info_fops; |
1299 | entry->data = acpi_driver_data(device); | 1230 | entry->data = acpi_driver_data(device); |
@@ -1301,9 +1232,12 @@ acpi_video_bus_add_fs ( | |||
1301 | } | 1232 | } |
1302 | 1233 | ||
1303 | /* 'POST' [R/W] */ | 1234 | /* 'POST' [R/W] */ |
1304 | entry = create_proc_entry("POST", S_IFREG|S_IRUGO|S_IRUSR, acpi_device_dir(device)); | 1235 | entry = |
1236 | create_proc_entry("POST", S_IFREG | S_IRUGO | S_IRUSR, | ||
1237 | acpi_device_dir(device)); | ||
1305 | if (!entry) | 1238 | if (!entry) |
1306 | ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Unable to create 'POST' fs entry\n")); | 1239 | ACPI_DEBUG_PRINT((ACPI_DB_ERROR, |
1240 | "Unable to create 'POST' fs entry\n")); | ||
1307 | else { | 1241 | else { |
1308 | entry->proc_fops = &acpi_video_bus_POST_fops; | 1242 | entry->proc_fops = &acpi_video_bus_POST_fops; |
1309 | entry->proc_fops->write = acpi_video_bus_write_POST; | 1243 | entry->proc_fops->write = acpi_video_bus_write_POST; |
@@ -1312,9 +1246,12 @@ acpi_video_bus_add_fs ( | |||
1312 | } | 1246 | } |
1313 | 1247 | ||
1314 | /* 'DOS' [R/W] */ | 1248 | /* 'DOS' [R/W] */ |
1315 | entry = create_proc_entry("DOS", S_IFREG|S_IRUGO|S_IRUSR, acpi_device_dir(device)); | 1249 | entry = |
1250 | create_proc_entry("DOS", S_IFREG | S_IRUGO | S_IRUSR, | ||
1251 | acpi_device_dir(device)); | ||
1316 | if (!entry) | 1252 | if (!entry) |
1317 | ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Unable to create 'DOS' fs entry\n")); | 1253 | ACPI_DEBUG_PRINT((ACPI_DB_ERROR, |
1254 | "Unable to create 'DOS' fs entry\n")); | ||
1318 | else { | 1255 | else { |
1319 | entry->proc_fops = &acpi_video_bus_DOS_fops; | 1256 | entry->proc_fops = &acpi_video_bus_DOS_fops; |
1320 | entry->proc_fops->write = acpi_video_bus_write_DOS; | 1257 | entry->proc_fops->write = acpi_video_bus_write_DOS; |
@@ -1325,15 +1262,13 @@ acpi_video_bus_add_fs ( | |||
1325 | return_VALUE(0); | 1262 | return_VALUE(0); |
1326 | } | 1263 | } |
1327 | 1264 | ||
1328 | static int | 1265 | static int acpi_video_bus_remove_fs(struct acpi_device *device) |
1329 | acpi_video_bus_remove_fs ( | ||
1330 | struct acpi_device *device) | ||
1331 | { | 1266 | { |
1332 | struct acpi_video_bus *video; | 1267 | struct acpi_video_bus *video; |
1333 | 1268 | ||
1334 | ACPI_FUNCTION_TRACE("acpi_video_bus_remove_fs"); | 1269 | ACPI_FUNCTION_TRACE("acpi_video_bus_remove_fs"); |
1335 | 1270 | ||
1336 | video = (struct acpi_video_bus *) acpi_driver_data(device); | 1271 | video = (struct acpi_video_bus *)acpi_driver_data(device); |
1337 | 1272 | ||
1338 | if (acpi_device_dir(device)) { | 1273 | if (acpi_device_dir(device)) { |
1339 | remove_proc_entry("info", acpi_device_dir(device)); | 1274 | remove_proc_entry("info", acpi_device_dir(device)); |
@@ -1341,8 +1276,7 @@ acpi_video_bus_remove_fs ( | |||
1341 | remove_proc_entry("POST_info", acpi_device_dir(device)); | 1276 | remove_proc_entry("POST_info", acpi_device_dir(device)); |
1342 | remove_proc_entry("POST", acpi_device_dir(device)); | 1277 | remove_proc_entry("POST", acpi_device_dir(device)); |
1343 | remove_proc_entry("DOS", acpi_device_dir(device)); | 1278 | remove_proc_entry("DOS", acpi_device_dir(device)); |
1344 | remove_proc_entry(acpi_device_bid(device), | 1279 | remove_proc_entry(acpi_device_bid(device), acpi_video_dir); |
1345 | acpi_video_dir); | ||
1346 | acpi_device_dir(device) = NULL; | 1280 | acpi_device_dir(device) = NULL; |
1347 | } | 1281 | } |
1348 | 1282 | ||
@@ -1356,20 +1290,20 @@ acpi_video_bus_remove_fs ( | |||
1356 | /* device interface */ | 1290 | /* device interface */ |
1357 | 1291 | ||
1358 | static int | 1292 | static int |
1359 | acpi_video_bus_get_one_device ( | 1293 | acpi_video_bus_get_one_device(struct acpi_device *device, |
1360 | struct acpi_device *device, | 1294 | struct acpi_video_bus *video) |
1361 | struct acpi_video_bus *video) | ||
1362 | { | 1295 | { |
1363 | unsigned long device_id; | 1296 | unsigned long device_id; |
1364 | int status, result; | 1297 | int status, result; |
1365 | struct acpi_video_device *data; | 1298 | struct acpi_video_device *data; |
1366 | 1299 | ||
1367 | ACPI_FUNCTION_TRACE("acpi_video_bus_get_one_device"); | 1300 | ACPI_FUNCTION_TRACE("acpi_video_bus_get_one_device"); |
1368 | 1301 | ||
1369 | if (!device || !video) | 1302 | if (!device || !video) |
1370 | return_VALUE(-EINVAL); | 1303 | return_VALUE(-EINVAL); |
1371 | 1304 | ||
1372 | status = acpi_evaluate_integer(device->handle, "_ADR", NULL, &device_id); | 1305 | status = |
1306 | acpi_evaluate_integer(device->handle, "_ADR", NULL, &device_id); | ||
1373 | if (ACPI_SUCCESS(status)) { | 1307 | if (ACPI_SUCCESS(status)) { |
1374 | 1308 | ||
1375 | data = kmalloc(sizeof(struct acpi_video_device), GFP_KERNEL); | 1309 | data = kmalloc(sizeof(struct acpi_video_device), GFP_KERNEL); |
@@ -1401,15 +1335,17 @@ acpi_video_bus_get_one_device ( | |||
1401 | data->flags.unknown = 1; | 1335 | data->flags.unknown = 1; |
1402 | break; | 1336 | break; |
1403 | } | 1337 | } |
1404 | 1338 | ||
1405 | acpi_video_device_bind(video, data); | 1339 | acpi_video_device_bind(video, data); |
1406 | acpi_video_device_find_cap(data); | 1340 | acpi_video_device_find_cap(data); |
1407 | 1341 | ||
1408 | status = acpi_install_notify_handler(data->handle, | 1342 | status = acpi_install_notify_handler(data->handle, |
1409 | ACPI_DEVICE_NOTIFY, acpi_video_device_notify, data); | 1343 | ACPI_DEVICE_NOTIFY, |
1344 | acpi_video_device_notify, | ||
1345 | data); | ||
1410 | if (ACPI_FAILURE(status)) { | 1346 | if (ACPI_FAILURE(status)) { |
1411 | ACPI_DEBUG_PRINT((ACPI_DB_ERROR, | 1347 | ACPI_DEBUG_PRINT((ACPI_DB_ERROR, |
1412 | "Error installing notify handler\n")); | 1348 | "Error installing notify handler\n")); |
1413 | result = -ENODEV; | 1349 | result = -ENODEV; |
1414 | goto end; | 1350 | goto end; |
1415 | } | 1351 | } |
@@ -1423,7 +1359,7 @@ acpi_video_bus_get_one_device ( | |||
1423 | return_VALUE(0); | 1359 | return_VALUE(0); |
1424 | } | 1360 | } |
1425 | 1361 | ||
1426 | end: | 1362 | end: |
1427 | return_VALUE(-ENOENT); | 1363 | return_VALUE(-ENOENT); |
1428 | } | 1364 | } |
1429 | 1365 | ||
@@ -1437,15 +1373,15 @@ end: | |||
1437 | * Enumerate the video device list of the video bus, | 1373 | * Enumerate the video device list of the video bus, |
1438 | * bind the ids with the corresponding video devices | 1374 | * bind the ids with the corresponding video devices |
1439 | * under the video bus. | 1375 | * under the video bus. |
1440 | */ | 1376 | */ |
1441 | 1377 | ||
1442 | static void | 1378 | static void acpi_video_device_rebind(struct acpi_video_bus *video) |
1443 | acpi_video_device_rebind( struct acpi_video_bus *video) | ||
1444 | { | 1379 | { |
1445 | struct list_head * node, * next; | 1380 | struct list_head *node, *next; |
1446 | list_for_each_safe(node, next, &video->video_device_list) { | 1381 | list_for_each_safe(node, next, &video->video_device_list) { |
1447 | struct acpi_video_device * dev = container_of(node, struct acpi_video_device, entry); | 1382 | struct acpi_video_device *dev = |
1448 | acpi_video_device_bind( video, dev); | 1383 | container_of(node, struct acpi_video_device, entry); |
1384 | acpi_video_device_bind(video, dev); | ||
1449 | } | 1385 | } |
1450 | } | 1386 | } |
1451 | 1387 | ||
@@ -1460,21 +1396,21 @@ acpi_video_device_rebind( struct acpi_video_bus *video) | |||
1460 | * | 1396 | * |
1461 | * Bind the ids with the corresponding video devices | 1397 | * Bind the ids with the corresponding video devices |
1462 | * under the video bus. | 1398 | * under the video bus. |
1463 | */ | 1399 | */ |
1464 | 1400 | ||
1465 | static void | 1401 | static void |
1466 | acpi_video_device_bind( struct acpi_video_bus *video, | 1402 | acpi_video_device_bind(struct acpi_video_bus *video, |
1467 | struct acpi_video_device *device) | 1403 | struct acpi_video_device *device) |
1468 | { | 1404 | { |
1469 | int i; | 1405 | int i; |
1470 | ACPI_FUNCTION_TRACE("acpi_video_device_bind"); | 1406 | ACPI_FUNCTION_TRACE("acpi_video_device_bind"); |
1471 | 1407 | ||
1472 | #define IDS_VAL(i) video->attached_array[i].value.int_val | 1408 | #define IDS_VAL(i) video->attached_array[i].value.int_val |
1473 | #define IDS_BIND(i) video->attached_array[i].bind_info | 1409 | #define IDS_BIND(i) video->attached_array[i].bind_info |
1474 | 1410 | ||
1475 | for (i = 0; IDS_VAL(i) != ACPI_VIDEO_HEAD_INVALID && | 1411 | for (i = 0; IDS_VAL(i) != ACPI_VIDEO_HEAD_INVALID && |
1476 | i < video->attached_count; i++) { | 1412 | i < video->attached_count; i++) { |
1477 | if (device->device_id == (IDS_VAL(i)& 0xffff)) { | 1413 | if (device->device_id == (IDS_VAL(i) & 0xffff)) { |
1478 | IDS_BIND(i) = device; | 1414 | IDS_BIND(i) = device; |
1479 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, "device_bind %d\n", i)); | 1415 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, "device_bind %d\n", i)); |
1480 | } | 1416 | } |
@@ -1492,17 +1428,17 @@ acpi_video_device_bind( struct acpi_video_bus *video, | |||
1492 | * | 1428 | * |
1493 | * Call _DOD to enumerate all devices attached to display adapter | 1429 | * Call _DOD to enumerate all devices attached to display adapter |
1494 | * | 1430 | * |
1495 | */ | 1431 | */ |
1496 | 1432 | ||
1497 | static int acpi_video_device_enumerate(struct acpi_video_bus *video) | 1433 | static int acpi_video_device_enumerate(struct acpi_video_bus *video) |
1498 | { | 1434 | { |
1499 | int status; | 1435 | int status; |
1500 | int count; | 1436 | int count; |
1501 | int i; | 1437 | int i; |
1502 | struct acpi_video_enumerated_device *active_device_list; | 1438 | struct acpi_video_enumerated_device *active_device_list; |
1503 | struct acpi_buffer buffer = {ACPI_ALLOCATE_BUFFER, NULL}; | 1439 | struct acpi_buffer buffer = { ACPI_ALLOCATE_BUFFER, NULL }; |
1504 | union acpi_object *dod = NULL; | 1440 | union acpi_object *dod = NULL; |
1505 | union acpi_object *obj; | 1441 | union acpi_object *obj; |
1506 | 1442 | ||
1507 | ACPI_FUNCTION_TRACE("acpi_video_device_enumerate"); | 1443 | ACPI_FUNCTION_TRACE("acpi_video_device_enumerate"); |
1508 | 1444 | ||
@@ -1512,7 +1448,7 @@ static int acpi_video_device_enumerate(struct acpi_video_bus *video) | |||
1512 | return_VALUE(status); | 1448 | return_VALUE(status); |
1513 | } | 1449 | } |
1514 | 1450 | ||
1515 | dod = (union acpi_object *) buffer.pointer; | 1451 | dod = (union acpi_object *)buffer.pointer; |
1516 | if (!dod || (dod->type != ACPI_TYPE_PACKAGE)) { | 1452 | if (!dod || (dod->type != ACPI_TYPE_PACKAGE)) { |
1517 | ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Invalid _DOD data\n")); | 1453 | ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Invalid _DOD data\n")); |
1518 | status = -EFAULT; | 1454 | status = -EFAULT; |
@@ -1520,11 +1456,13 @@ static int acpi_video_device_enumerate(struct acpi_video_bus *video) | |||
1520 | } | 1456 | } |
1521 | 1457 | ||
1522 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Found %d video heads in _DOD\n", | 1458 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Found %d video heads in _DOD\n", |
1523 | dod->package.count)); | 1459 | dod->package.count)); |
1524 | 1460 | ||
1525 | active_device_list= kmalloc( | 1461 | active_device_list = kmalloc((1 + |
1526 | (1+dod->package.count)*sizeof(struct acpi_video_enumerated_device), | 1462 | dod->package.count) * |
1527 | GFP_KERNEL); | 1463 | sizeof(struct |
1464 | acpi_video_enumerated_device), | ||
1465 | GFP_KERNEL); | ||
1528 | 1466 | ||
1529 | if (!active_device_list) { | 1467 | if (!active_device_list) { |
1530 | status = -ENOMEM; | 1468 | status = -ENOMEM; |
@@ -1533,25 +1471,28 @@ static int acpi_video_device_enumerate(struct acpi_video_bus *video) | |||
1533 | 1471 | ||
1534 | count = 0; | 1472 | count = 0; |
1535 | for (i = 0; i < dod->package.count; i++) { | 1473 | for (i = 0; i < dod->package.count; i++) { |
1536 | obj = (union acpi_object *) &dod->package.elements[i]; | 1474 | obj = (union acpi_object *)&dod->package.elements[i]; |
1537 | 1475 | ||
1538 | if (obj->type != ACPI_TYPE_INTEGER) { | 1476 | if (obj->type != ACPI_TYPE_INTEGER) { |
1539 | ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Invalid _DOD data\n")); | 1477 | ACPI_DEBUG_PRINT((ACPI_DB_ERROR, |
1540 | active_device_list[i].value.int_val = ACPI_VIDEO_HEAD_INVALID; | 1478 | "Invalid _DOD data\n")); |
1479 | active_device_list[i].value.int_val = | ||
1480 | ACPI_VIDEO_HEAD_INVALID; | ||
1541 | } | 1481 | } |
1542 | active_device_list[i].value.int_val = obj->integer.value; | 1482 | active_device_list[i].value.int_val = obj->integer.value; |
1543 | active_device_list[i].bind_info = NULL; | 1483 | active_device_list[i].bind_info = NULL; |
1544 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, "dod element[%d] = %d\n", i, (int) obj->integer.value)); | 1484 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, "dod element[%d] = %d\n", i, |
1485 | (int)obj->integer.value)); | ||
1545 | count++; | 1486 | count++; |
1546 | } | 1487 | } |
1547 | active_device_list[count].value.int_val = ACPI_VIDEO_HEAD_END; | 1488 | active_device_list[count].value.int_val = ACPI_VIDEO_HEAD_END; |
1548 | 1489 | ||
1549 | if(video->attached_array) | 1490 | if (video->attached_array) |
1550 | kfree(video->attached_array); | 1491 | kfree(video->attached_array); |
1551 | 1492 | ||
1552 | video->attached_array = active_device_list; | 1493 | video->attached_array = active_device_list; |
1553 | video->attached_count = count; | 1494 | video->attached_count = count; |
1554 | out: | 1495 | out: |
1555 | acpi_os_free(buffer.pointer); | 1496 | acpi_os_free(buffer.pointer); |
1556 | return_VALUE(status); | 1497 | return_VALUE(status); |
1557 | } | 1498 | } |
@@ -1567,17 +1508,14 @@ out: | |||
1567 | * 1. Find out the current active output device. | 1508 | * 1. Find out the current active output device. |
1568 | * 2. Identify the next output device to switch | 1509 | * 2. Identify the next output device to switch |
1569 | * 3. call _DSS to do actual switch. | 1510 | * 3. call _DSS to do actual switch. |
1570 | */ | 1511 | */ |
1571 | 1512 | ||
1572 | static int | 1513 | static int acpi_video_switch_output(struct acpi_video_bus *video, int event) |
1573 | acpi_video_switch_output( | ||
1574 | struct acpi_video_bus *video, | ||
1575 | int event) | ||
1576 | { | 1514 | { |
1577 | struct list_head * node, * next; | 1515 | struct list_head *node, *next; |
1578 | struct acpi_video_device *dev=NULL; | 1516 | struct acpi_video_device *dev = NULL; |
1579 | struct acpi_video_device *dev_next=NULL; | 1517 | struct acpi_video_device *dev_next = NULL; |
1580 | struct acpi_video_device *dev_prev=NULL; | 1518 | struct acpi_video_device *dev_prev = NULL; |
1581 | unsigned long state; | 1519 | unsigned long state; |
1582 | int status = 0; | 1520 | int status = 0; |
1583 | 1521 | ||
@@ -1586,15 +1524,19 @@ acpi_video_switch_output( | |||
1586 | list_for_each_safe(node, next, &video->video_device_list) { | 1524 | list_for_each_safe(node, next, &video->video_device_list) { |
1587 | dev = container_of(node, struct acpi_video_device, entry); | 1525 | dev = container_of(node, struct acpi_video_device, entry); |
1588 | status = acpi_video_device_get_state(dev, &state); | 1526 | status = acpi_video_device_get_state(dev, &state); |
1589 | if (state & 0x2){ | 1527 | if (state & 0x2) { |
1590 | dev_next = container_of(node->next, struct acpi_video_device, entry); | 1528 | dev_next = |
1591 | dev_prev = container_of(node->prev, struct acpi_video_device, entry); | 1529 | container_of(node->next, struct acpi_video_device, |
1530 | entry); | ||
1531 | dev_prev = | ||
1532 | container_of(node->prev, struct acpi_video_device, | ||
1533 | entry); | ||
1592 | goto out; | 1534 | goto out; |
1593 | } | 1535 | } |
1594 | } | 1536 | } |
1595 | dev_next = container_of(node->next, struct acpi_video_device, entry); | 1537 | dev_next = container_of(node->next, struct acpi_video_device, entry); |
1596 | dev_prev = container_of(node->prev, struct acpi_video_device, entry); | 1538 | dev_prev = container_of(node->prev, struct acpi_video_device, entry); |
1597 | out: | 1539 | out: |
1598 | switch (event) { | 1540 | switch (event) { |
1599 | case ACPI_VIDEO_NOTIFY_CYCLE: | 1541 | case ACPI_VIDEO_NOTIFY_CYCLE: |
1600 | case ACPI_VIDEO_NOTIFY_NEXT_OUTPUT: | 1542 | case ACPI_VIDEO_NOTIFY_NEXT_OUTPUT: |
@@ -1611,21 +1553,16 @@ out: | |||
1611 | return_VALUE(status); | 1553 | return_VALUE(status); |
1612 | } | 1554 | } |
1613 | 1555 | ||
1614 | static int | 1556 | static int |
1615 | acpi_video_get_next_level( | 1557 | acpi_video_get_next_level(struct acpi_video_device *device, |
1616 | struct acpi_video_device *device, | 1558 | u32 level_current, u32 event) |
1617 | u32 level_current, | ||
1618 | u32 event) | ||
1619 | { | 1559 | { |
1620 | /*Fix me*/ | 1560 | /*Fix me */ |
1621 | return level_current; | 1561 | return level_current; |
1622 | } | 1562 | } |
1623 | 1563 | ||
1624 | |||
1625 | static void | 1564 | static void |
1626 | acpi_video_switch_brightness ( | 1565 | acpi_video_switch_brightness(struct acpi_video_device *device, int event) |
1627 | struct acpi_video_device *device, | ||
1628 | int event) | ||
1629 | { | 1566 | { |
1630 | unsigned long level_current, level_next; | 1567 | unsigned long level_current, level_next; |
1631 | acpi_video_device_lcd_get_level_current(device, &level_current); | 1568 | acpi_video_device_lcd_get_level_current(device, &level_current); |
@@ -1634,26 +1571,27 @@ acpi_video_switch_brightness ( | |||
1634 | } | 1571 | } |
1635 | 1572 | ||
1636 | static int | 1573 | static int |
1637 | acpi_video_bus_get_devices ( | 1574 | acpi_video_bus_get_devices(struct acpi_video_bus *video, |
1638 | struct acpi_video_bus *video, | 1575 | struct acpi_device *device) |
1639 | struct acpi_device *device) | ||
1640 | { | 1576 | { |
1641 | int status = 0; | 1577 | int status = 0; |
1642 | struct list_head *node, *next; | 1578 | struct list_head *node, *next; |
1643 | 1579 | ||
1644 | ACPI_FUNCTION_TRACE("acpi_video_get_devices"); | 1580 | ACPI_FUNCTION_TRACE("acpi_video_get_devices"); |
1645 | 1581 | ||
1646 | acpi_video_device_enumerate(video); | 1582 | acpi_video_device_enumerate(video); |
1647 | 1583 | ||
1648 | list_for_each_safe(node, next, &device->children) { | 1584 | list_for_each_safe(node, next, &device->children) { |
1649 | struct acpi_device *dev = list_entry(node, struct acpi_device, node); | 1585 | struct acpi_device *dev = |
1586 | list_entry(node, struct acpi_device, node); | ||
1650 | 1587 | ||
1651 | if (!dev) | 1588 | if (!dev) |
1652 | continue; | 1589 | continue; |
1653 | 1590 | ||
1654 | status = acpi_video_bus_get_one_device(dev, video); | 1591 | status = acpi_video_bus_get_one_device(dev, video); |
1655 | if (ACPI_FAILURE(status)) { | 1592 | if (ACPI_FAILURE(status)) { |
1656 | ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Cant attach device\n")); | 1593 | ACPI_DEBUG_PRINT((ACPI_DB_ERROR, |
1594 | "Cant attach device\n")); | ||
1657 | continue; | 1595 | continue; |
1658 | } | 1596 | } |
1659 | 1597 | ||
@@ -1661,9 +1599,7 @@ acpi_video_bus_get_devices ( | |||
1661 | return_VALUE(status); | 1599 | return_VALUE(status); |
1662 | } | 1600 | } |
1663 | 1601 | ||
1664 | static int | 1602 | static int acpi_video_bus_put_one_device(struct acpi_video_device *device) |
1665 | acpi_video_bus_put_one_device( | ||
1666 | struct acpi_video_device *device) | ||
1667 | { | 1603 | { |
1668 | acpi_status status; | 1604 | acpi_status status; |
1669 | struct acpi_video_bus *video; | 1605 | struct acpi_video_bus *video; |
@@ -1681,31 +1617,32 @@ acpi_video_bus_put_one_device( | |||
1681 | acpi_video_device_remove_fs(device->dev); | 1617 | acpi_video_device_remove_fs(device->dev); |
1682 | 1618 | ||
1683 | status = acpi_remove_notify_handler(device->handle, | 1619 | status = acpi_remove_notify_handler(device->handle, |
1684 | ACPI_DEVICE_NOTIFY, acpi_video_device_notify); | 1620 | ACPI_DEVICE_NOTIFY, |
1621 | acpi_video_device_notify); | ||
1685 | if (ACPI_FAILURE(status)) | 1622 | if (ACPI_FAILURE(status)) |
1686 | ACPI_DEBUG_PRINT((ACPI_DB_ERROR, | 1623 | ACPI_DEBUG_PRINT((ACPI_DB_ERROR, |
1687 | "Error removing notify handler\n")); | 1624 | "Error removing notify handler\n")); |
1688 | 1625 | ||
1689 | return_VALUE(0); | 1626 | return_VALUE(0); |
1690 | } | 1627 | } |
1691 | 1628 | ||
1692 | static int | 1629 | static int acpi_video_bus_put_devices(struct acpi_video_bus *video) |
1693 | acpi_video_bus_put_devices ( | ||
1694 | struct acpi_video_bus *video) | ||
1695 | { | 1630 | { |
1696 | int status; | 1631 | int status; |
1697 | struct list_head *node, *next; | 1632 | struct list_head *node, *next; |
1698 | 1633 | ||
1699 | ACPI_FUNCTION_TRACE("acpi_video_bus_put_devices"); | 1634 | ACPI_FUNCTION_TRACE("acpi_video_bus_put_devices"); |
1700 | 1635 | ||
1701 | list_for_each_safe(node, next, &video->video_device_list) { | 1636 | list_for_each_safe(node, next, &video->video_device_list) { |
1702 | struct acpi_video_device *data = list_entry(node, struct acpi_video_device, entry); | 1637 | struct acpi_video_device *data = |
1638 | list_entry(node, struct acpi_video_device, entry); | ||
1703 | if (!data) | 1639 | if (!data) |
1704 | continue; | 1640 | continue; |
1705 | 1641 | ||
1706 | status = acpi_video_bus_put_one_device(data); | 1642 | status = acpi_video_bus_put_one_device(data); |
1707 | if(ACPI_FAILURE(status)) | 1643 | if (ACPI_FAILURE(status)) |
1708 | printk(KERN_WARNING PREFIX "hhuuhhuu bug in acpi video driver.\n"); | 1644 | printk(KERN_WARNING PREFIX |
1645 | "hhuuhhuu bug in acpi video driver.\n"); | ||
1709 | 1646 | ||
1710 | if (data->brightness) | 1647 | if (data->brightness) |
1711 | kfree(data->brightness); | 1648 | kfree(data->brightness); |
@@ -1718,28 +1655,20 @@ acpi_video_bus_put_devices ( | |||
1718 | 1655 | ||
1719 | /* acpi_video interface */ | 1656 | /* acpi_video interface */ |
1720 | 1657 | ||
1721 | static int | 1658 | static int acpi_video_bus_start_devices(struct acpi_video_bus *video) |
1722 | acpi_video_bus_start_devices( | ||
1723 | struct acpi_video_bus *video) | ||
1724 | { | 1659 | { |
1725 | return acpi_video_bus_DOS(video, 1, 0); | 1660 | return acpi_video_bus_DOS(video, 1, 0); |
1726 | } | 1661 | } |
1727 | 1662 | ||
1728 | static int | 1663 | static int acpi_video_bus_stop_devices(struct acpi_video_bus *video) |
1729 | acpi_video_bus_stop_devices( | ||
1730 | struct acpi_video_bus *video) | ||
1731 | { | 1664 | { |
1732 | return acpi_video_bus_DOS(video, 0, 1); | 1665 | return acpi_video_bus_DOS(video, 0, 1); |
1733 | } | 1666 | } |
1734 | 1667 | ||
1735 | static void | 1668 | static void acpi_video_bus_notify(acpi_handle handle, u32 event, void *data) |
1736 | acpi_video_bus_notify ( | ||
1737 | acpi_handle handle, | ||
1738 | u32 event, | ||
1739 | void *data) | ||
1740 | { | 1669 | { |
1741 | struct acpi_video_bus *video = (struct acpi_video_bus *) data; | 1670 | struct acpi_video_bus *video = (struct acpi_video_bus *)data; |
1742 | struct acpi_device *device = NULL; | 1671 | struct acpi_device *device = NULL; |
1743 | 1672 | ||
1744 | ACPI_FUNCTION_TRACE("acpi_video_bus_notify"); | 1673 | ACPI_FUNCTION_TRACE("acpi_video_bus_notify"); |
1745 | printk("video bus notify\n"); | 1674 | printk("video bus notify\n"); |
@@ -1764,30 +1693,27 @@ acpi_video_bus_notify ( | |||
1764 | acpi_bus_generate_event(device, event, 0); | 1693 | acpi_bus_generate_event(device, event, 0); |
1765 | break; | 1694 | break; |
1766 | 1695 | ||
1767 | case ACPI_VIDEO_NOTIFY_CYCLE: /* Cycle Display output hotkey pressed.*/ | 1696 | case ACPI_VIDEO_NOTIFY_CYCLE: /* Cycle Display output hotkey pressed. */ |
1768 | case ACPI_VIDEO_NOTIFY_NEXT_OUTPUT: /* Next Display output hotkey pressed. */ | 1697 | case ACPI_VIDEO_NOTIFY_NEXT_OUTPUT: /* Next Display output hotkey pressed. */ |
1769 | case ACPI_VIDEO_NOTIFY_PREV_OUTPUT: /* previous Display output hotkey pressed. */ | 1698 | case ACPI_VIDEO_NOTIFY_PREV_OUTPUT: /* previous Display output hotkey pressed. */ |
1770 | acpi_video_switch_output(video, event); | 1699 | acpi_video_switch_output(video, event); |
1771 | acpi_bus_generate_event(device, event, 0); | 1700 | acpi_bus_generate_event(device, event, 0); |
1772 | break; | 1701 | break; |
1773 | 1702 | ||
1774 | default: | 1703 | default: |
1775 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, | 1704 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, |
1776 | "Unsupported event [0x%x]\n", event)); | 1705 | "Unsupported event [0x%x]\n", event)); |
1777 | break; | 1706 | break; |
1778 | } | 1707 | } |
1779 | 1708 | ||
1780 | return_VOID; | 1709 | return_VOID; |
1781 | } | 1710 | } |
1782 | 1711 | ||
1783 | static void | 1712 | static void acpi_video_device_notify(acpi_handle handle, u32 event, void *data) |
1784 | acpi_video_device_notify ( | ||
1785 | acpi_handle handle, | ||
1786 | u32 event, | ||
1787 | void *data) | ||
1788 | { | 1713 | { |
1789 | struct acpi_video_device *video_device = (struct acpi_video_device *) data; | 1714 | struct acpi_video_device *video_device = |
1790 | struct acpi_device *device = NULL; | 1715 | (struct acpi_video_device *)data; |
1716 | struct acpi_device *device = NULL; | ||
1791 | 1717 | ||
1792 | ACPI_FUNCTION_TRACE("acpi_video_device_notify"); | 1718 | ACPI_FUNCTION_TRACE("acpi_video_device_notify"); |
1793 | 1719 | ||
@@ -1799,36 +1725,34 @@ acpi_video_device_notify ( | |||
1799 | return_VOID; | 1725 | return_VOID; |
1800 | 1726 | ||
1801 | switch (event) { | 1727 | switch (event) { |
1802 | case ACPI_VIDEO_NOTIFY_SWITCH: /* change in status (cycle output device) */ | 1728 | case ACPI_VIDEO_NOTIFY_SWITCH: /* change in status (cycle output device) */ |
1803 | case ACPI_VIDEO_NOTIFY_PROBE: /* change in status (output device status) */ | 1729 | case ACPI_VIDEO_NOTIFY_PROBE: /* change in status (output device status) */ |
1804 | acpi_bus_generate_event(device, event, 0); | 1730 | acpi_bus_generate_event(device, event, 0); |
1805 | break; | 1731 | break; |
1806 | case ACPI_VIDEO_NOTIFY_CYCLE_BRIGHTNESS: /* Cycle brightness */ | 1732 | case ACPI_VIDEO_NOTIFY_CYCLE_BRIGHTNESS: /* Cycle brightness */ |
1807 | case ACPI_VIDEO_NOTIFY_INC_BRIGHTNESS: /* Increase brightness */ | 1733 | case ACPI_VIDEO_NOTIFY_INC_BRIGHTNESS: /* Increase brightness */ |
1808 | case ACPI_VIDEO_NOTIFY_DEC_BRIGHTNESS: /* Decrease brightness */ | 1734 | case ACPI_VIDEO_NOTIFY_DEC_BRIGHTNESS: /* Decrease brightness */ |
1809 | case ACPI_VIDEO_NOTIFY_ZERO_BRIGHTNESS: /* zero brightnesss */ | 1735 | case ACPI_VIDEO_NOTIFY_ZERO_BRIGHTNESS: /* zero brightnesss */ |
1810 | case ACPI_VIDEO_NOTIFY_DISPLAY_OFF: /* display device off */ | 1736 | case ACPI_VIDEO_NOTIFY_DISPLAY_OFF: /* display device off */ |
1811 | acpi_video_switch_brightness (video_device, event); | 1737 | acpi_video_switch_brightness(video_device, event); |
1812 | acpi_bus_generate_event(device, event, 0); | 1738 | acpi_bus_generate_event(device, event, 0); |
1813 | break; | 1739 | break; |
1814 | default: | 1740 | default: |
1815 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, | 1741 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, |
1816 | "Unsupported event [0x%x]\n", event)); | 1742 | "Unsupported event [0x%x]\n", event)); |
1817 | break; | 1743 | break; |
1818 | } | 1744 | } |
1819 | return_VOID; | 1745 | return_VOID; |
1820 | } | 1746 | } |
1821 | 1747 | ||
1822 | static int | 1748 | static int acpi_video_bus_add(struct acpi_device *device) |
1823 | acpi_video_bus_add ( | ||
1824 | struct acpi_device *device) | ||
1825 | { | 1749 | { |
1826 | int result = 0; | 1750 | int result = 0; |
1827 | acpi_status status = 0; | 1751 | acpi_status status = 0; |
1828 | struct acpi_video_bus *video = NULL; | 1752 | struct acpi_video_bus *video = NULL; |
1829 | 1753 | ||
1830 | ACPI_FUNCTION_TRACE("acpi_video_bus_add"); | 1754 | ACPI_FUNCTION_TRACE("acpi_video_bus_add"); |
1831 | 1755 | ||
1832 | if (!device) | 1756 | if (!device) |
1833 | return_VALUE(-EINVAL); | 1757 | return_VALUE(-EINVAL); |
1834 | 1758 | ||
@@ -1858,21 +1782,22 @@ acpi_video_bus_add ( | |||
1858 | acpi_video_bus_start_devices(video); | 1782 | acpi_video_bus_start_devices(video); |
1859 | 1783 | ||
1860 | status = acpi_install_notify_handler(video->handle, | 1784 | status = acpi_install_notify_handler(video->handle, |
1861 | ACPI_DEVICE_NOTIFY, acpi_video_bus_notify, video); | 1785 | ACPI_DEVICE_NOTIFY, |
1786 | acpi_video_bus_notify, video); | ||
1862 | if (ACPI_FAILURE(status)) { | 1787 | if (ACPI_FAILURE(status)) { |
1863 | ACPI_DEBUG_PRINT((ACPI_DB_ERROR, | 1788 | ACPI_DEBUG_PRINT((ACPI_DB_ERROR, |
1864 | "Error installing notify handler\n")); | 1789 | "Error installing notify handler\n")); |
1865 | result = -ENODEV; | 1790 | result = -ENODEV; |
1866 | goto end; | 1791 | goto end; |
1867 | } | 1792 | } |
1868 | 1793 | ||
1869 | printk(KERN_INFO PREFIX "%s [%s] (multi-head: %s rom: %s post: %s)\n", | 1794 | printk(KERN_INFO PREFIX "%s [%s] (multi-head: %s rom: %s post: %s)\n", |
1870 | ACPI_VIDEO_DEVICE_NAME, acpi_device_bid(device), | 1795 | ACPI_VIDEO_DEVICE_NAME, acpi_device_bid(device), |
1871 | video->flags.multihead ? "yes":"no", | 1796 | video->flags.multihead ? "yes" : "no", |
1872 | video->flags.rom ? "yes":"no", | 1797 | video->flags.rom ? "yes" : "no", |
1873 | video->flags.post ? "yes":"no"); | 1798 | video->flags.post ? "yes" : "no"); |
1874 | 1799 | ||
1875 | end: | 1800 | end: |
1876 | if (result) { | 1801 | if (result) { |
1877 | acpi_video_bus_remove_fs(device); | 1802 | acpi_video_bus_remove_fs(device); |
1878 | kfree(video); | 1803 | kfree(video); |
@@ -1881,28 +1806,26 @@ end: | |||
1881 | return_VALUE(result); | 1806 | return_VALUE(result); |
1882 | } | 1807 | } |
1883 | 1808 | ||
1884 | static int | 1809 | static int acpi_video_bus_remove(struct acpi_device *device, int type) |
1885 | acpi_video_bus_remove ( | ||
1886 | struct acpi_device *device, | ||
1887 | int type) | ||
1888 | { | 1810 | { |
1889 | acpi_status status = 0; | 1811 | acpi_status status = 0; |
1890 | struct acpi_video_bus *video = NULL; | 1812 | struct acpi_video_bus *video = NULL; |
1891 | 1813 | ||
1892 | ACPI_FUNCTION_TRACE("acpi_video_bus_remove"); | 1814 | ACPI_FUNCTION_TRACE("acpi_video_bus_remove"); |
1893 | 1815 | ||
1894 | if (!device || !acpi_driver_data(device)) | 1816 | if (!device || !acpi_driver_data(device)) |
1895 | return_VALUE(-EINVAL); | 1817 | return_VALUE(-EINVAL); |
1896 | 1818 | ||
1897 | video = (struct acpi_video_bus *) acpi_driver_data(device); | 1819 | video = (struct acpi_video_bus *)acpi_driver_data(device); |
1898 | 1820 | ||
1899 | acpi_video_bus_stop_devices(video); | 1821 | acpi_video_bus_stop_devices(video); |
1900 | 1822 | ||
1901 | status = acpi_remove_notify_handler(video->handle, | 1823 | status = acpi_remove_notify_handler(video->handle, |
1902 | ACPI_DEVICE_NOTIFY, acpi_video_bus_notify); | 1824 | ACPI_DEVICE_NOTIFY, |
1825 | acpi_video_bus_notify); | ||
1903 | if (ACPI_FAILURE(status)) | 1826 | if (ACPI_FAILURE(status)) |
1904 | ACPI_DEBUG_PRINT((ACPI_DB_ERROR, | 1827 | ACPI_DEBUG_PRINT((ACPI_DB_ERROR, |
1905 | "Error removing notify handler\n")); | 1828 | "Error removing notify handler\n")); |
1906 | 1829 | ||
1907 | acpi_video_bus_put_devices(video); | 1830 | acpi_video_bus_put_devices(video); |
1908 | acpi_video_bus_remove_fs(device); | 1831 | acpi_video_bus_remove_fs(device); |
@@ -1914,15 +1837,12 @@ acpi_video_bus_remove ( | |||
1914 | return_VALUE(0); | 1837 | return_VALUE(0); |
1915 | } | 1838 | } |
1916 | 1839 | ||
1917 | |||
1918 | static int | 1840 | static int |
1919 | acpi_video_bus_match ( | 1841 | acpi_video_bus_match(struct acpi_device *device, struct acpi_driver *driver) |
1920 | struct acpi_device *device, | ||
1921 | struct acpi_driver *driver) | ||
1922 | { | 1842 | { |
1923 | acpi_handle h_dummy1; | 1843 | acpi_handle h_dummy1; |
1924 | acpi_handle h_dummy2; | 1844 | acpi_handle h_dummy2; |
1925 | acpi_handle h_dummy3; | 1845 | acpi_handle h_dummy3; |
1926 | 1846 | ||
1927 | ACPI_FUNCTION_TRACE("acpi_video_bus_match"); | 1847 | ACPI_FUNCTION_TRACE("acpi_video_bus_match"); |
1928 | 1848 | ||
@@ -1948,22 +1868,19 @@ acpi_video_bus_match ( | |||
1948 | ACPI_SUCCESS(acpi_get_handle(device->handle, "_SPD", &h_dummy3))) | 1868 | ACPI_SUCCESS(acpi_get_handle(device->handle, "_SPD", &h_dummy3))) |
1949 | return_VALUE(0); | 1869 | return_VALUE(0); |
1950 | 1870 | ||
1951 | |||
1952 | return_VALUE(-ENODEV); | 1871 | return_VALUE(-ENODEV); |
1953 | } | 1872 | } |
1954 | 1873 | ||
1955 | 1874 | static int __init acpi_video_init(void) | |
1956 | static int __init | ||
1957 | acpi_video_init (void) | ||
1958 | { | 1875 | { |
1959 | int result = 0; | 1876 | int result = 0; |
1960 | 1877 | ||
1961 | ACPI_FUNCTION_TRACE("acpi_video_init"); | 1878 | ACPI_FUNCTION_TRACE("acpi_video_init"); |
1962 | 1879 | ||
1963 | /* | 1880 | /* |
1964 | acpi_dbg_level = 0xFFFFFFFF; | 1881 | acpi_dbg_level = 0xFFFFFFFF; |
1965 | acpi_dbg_layer = 0x08000000; | 1882 | acpi_dbg_layer = 0x08000000; |
1966 | */ | 1883 | */ |
1967 | 1884 | ||
1968 | acpi_video_dir = proc_mkdir(ACPI_VIDEO_CLASS, acpi_root_dir); | 1885 | acpi_video_dir = proc_mkdir(ACPI_VIDEO_CLASS, acpi_root_dir); |
1969 | if (!acpi_video_dir) | 1886 | if (!acpi_video_dir) |
@@ -1979,8 +1896,7 @@ acpi_video_init (void) | |||
1979 | return_VALUE(0); | 1896 | return_VALUE(0); |
1980 | } | 1897 | } |
1981 | 1898 | ||
1982 | static void __exit | 1899 | static void __exit acpi_video_exit(void) |
1983 | acpi_video_exit (void) | ||
1984 | { | 1900 | { |
1985 | ACPI_FUNCTION_TRACE("acpi_video_exit"); | 1901 | ACPI_FUNCTION_TRACE("acpi_video_exit"); |
1986 | 1902 | ||