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