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.c270
1 files changed, 104 insertions, 166 deletions
diff --git a/drivers/acpi/video.c b/drivers/acpi/video.c
index e7e9a693953a..9feb633087a9 100644
--- a/drivers/acpi/video.c
+++ b/drivers/acpi/video.c
@@ -272,10 +272,9 @@ static int
272acpi_video_device_query(struct acpi_video_device *device, unsigned long *state) 272acpi_video_device_query(struct acpi_video_device *device, unsigned long *state)
273{ 273{
274 int status; 274 int status;
275 ACPI_FUNCTION_TRACE("acpi_video_device_query");
276 status = acpi_evaluate_integer(device->handle, "_DGS", NULL, state); 275 status = acpi_evaluate_integer(device->handle, "_DGS", NULL, state);
277 276
278 return_VALUE(status); 277 return status;
279} 278}
280 279
281static int 280static int
@@ -284,11 +283,10 @@ acpi_video_device_get_state(struct acpi_video_device *device,
284{ 283{
285 int status; 284 int status;
286 285
287 ACPI_FUNCTION_TRACE("acpi_video_device_get_state");
288 286
289 status = acpi_evaluate_integer(device->handle, "_DCS", NULL, state); 287 status = acpi_evaluate_integer(device->handle, "_DCS", NULL, state);
290 288
291 return_VALUE(status); 289 return status;
292} 290}
293 291
294static int 292static int
@@ -299,12 +297,11 @@ acpi_video_device_set_state(struct acpi_video_device *device, int state)
299 struct acpi_object_list args = { 1, &arg0 }; 297 struct acpi_object_list args = { 1, &arg0 };
300 unsigned long ret; 298 unsigned long ret;
301 299
302 ACPI_FUNCTION_TRACE("acpi_video_device_set_state");
303 300
304 arg0.integer.value = state; 301 arg0.integer.value = state;
305 status = acpi_evaluate_integer(device->handle, "_DSS", &args, &ret); 302 status = acpi_evaluate_integer(device->handle, "_DSS", &args, &ret);
306 303
307 return_VALUE(status); 304 return status;
308} 305}
309 306
310static int 307static int
@@ -315,28 +312,27 @@ acpi_video_device_lcd_query_levels(struct acpi_video_device *device,
315 struct acpi_buffer buffer = { ACPI_ALLOCATE_BUFFER, NULL }; 312 struct acpi_buffer buffer = { ACPI_ALLOCATE_BUFFER, NULL };
316 union acpi_object *obj; 313 union acpi_object *obj;
317 314
318 ACPI_FUNCTION_TRACE("acpi_video_device_lcd_query_levels");
319 315
320 *levels = NULL; 316 *levels = NULL;
321 317
322 status = acpi_evaluate_object(device->handle, "_BCL", NULL, &buffer); 318 status = acpi_evaluate_object(device->handle, "_BCL", NULL, &buffer);
323 if (!ACPI_SUCCESS(status)) 319 if (!ACPI_SUCCESS(status))
324 return_VALUE(status); 320 return status;
325 obj = (union acpi_object *)buffer.pointer; 321 obj = (union acpi_object *)buffer.pointer;
326 if (!obj || (obj->type != ACPI_TYPE_PACKAGE)) { 322 if (!obj || (obj->type != ACPI_TYPE_PACKAGE)) {
327 ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Invalid _BCL data\n")); 323 printk(KERN_ERR PREFIX "Invalid _BCL data\n");
328 status = -EFAULT; 324 status = -EFAULT;
329 goto err; 325 goto err;
330 } 326 }
331 327
332 *levels = obj; 328 *levels = obj;
333 329
334 return_VALUE(0); 330 return 0;
335 331
336 err: 332 err:
337 kfree(buffer.pointer); 333 kfree(buffer.pointer);
338 334
339 return_VALUE(status); 335 return status;
340} 336}
341 337
342static int 338static int
@@ -346,13 +342,12 @@ acpi_video_device_lcd_set_level(struct acpi_video_device *device, int level)
346 union acpi_object arg0 = { ACPI_TYPE_INTEGER }; 342 union acpi_object arg0 = { ACPI_TYPE_INTEGER };
347 struct acpi_object_list args = { 1, &arg0 }; 343 struct acpi_object_list args = { 1, &arg0 };
348 344
349 ACPI_FUNCTION_TRACE("acpi_video_device_lcd_set_level");
350 345
351 arg0.integer.value = level; 346 arg0.integer.value = level;
352 status = acpi_evaluate_object(device->handle, "_BCM", &args, NULL); 347 status = acpi_evaluate_object(device->handle, "_BCM", &args, NULL);
353 348
354 printk(KERN_DEBUG "set_level status: %x\n", status); 349 printk(KERN_DEBUG "set_level status: %x\n", status);
355 return_VALUE(status); 350 return status;
356} 351}
357 352
358static int 353static int
@@ -360,11 +355,10 @@ acpi_video_device_lcd_get_level_current(struct acpi_video_device *device,
360 unsigned long *level) 355 unsigned long *level)
361{ 356{
362 int status; 357 int status;
363 ACPI_FUNCTION_TRACE("acpi_video_device_lcd_get_level_current");
364 358
365 status = acpi_evaluate_integer(device->handle, "_BQC", NULL, level); 359 status = acpi_evaluate_integer(device->handle, "_BQC", NULL, level);
366 360
367 return_VALUE(status); 361 return status;
368} 362}
369 363
370static int 364static int
@@ -377,34 +371,33 @@ acpi_video_device_EDID(struct acpi_video_device *device,
377 union acpi_object arg0 = { ACPI_TYPE_INTEGER }; 371 union acpi_object arg0 = { ACPI_TYPE_INTEGER };
378 struct acpi_object_list args = { 1, &arg0 }; 372 struct acpi_object_list args = { 1, &arg0 };
379 373
380 ACPI_FUNCTION_TRACE("acpi_video_device_get_EDID");
381 374
382 *edid = NULL; 375 *edid = NULL;
383 376
384 if (!device) 377 if (!device)
385 return_VALUE(-ENODEV); 378 return -ENODEV;
386 if (length == 128) 379 if (length == 128)
387 arg0.integer.value = 1; 380 arg0.integer.value = 1;
388 else if (length == 256) 381 else if (length == 256)
389 arg0.integer.value = 2; 382 arg0.integer.value = 2;
390 else 383 else
391 return_VALUE(-EINVAL); 384 return -EINVAL;
392 385
393 status = acpi_evaluate_object(device->handle, "_DDC", &args, &buffer); 386 status = acpi_evaluate_object(device->handle, "_DDC", &args, &buffer);
394 if (ACPI_FAILURE(status)) 387 if (ACPI_FAILURE(status))
395 return_VALUE(-ENODEV); 388 return -ENODEV;
396 389
397 obj = (union acpi_object *)buffer.pointer; 390 obj = (union acpi_object *)buffer.pointer;
398 391
399 if (obj && obj->type == ACPI_TYPE_BUFFER) 392 if (obj && obj->type == ACPI_TYPE_BUFFER)
400 *edid = obj; 393 *edid = obj;
401 else { 394 else {
402 ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Invalid _DDC data\n")); 395 printk(KERN_ERR PREFIX "Invalid _DDC data\n");
403 status = -EFAULT; 396 status = -EFAULT;
404 kfree(obj); 397 kfree(obj);
405 } 398 }
406 399
407 return_VALUE(status); 400 return status;
408} 401}
409 402
410/* bus */ 403/* bus */
@@ -417,7 +410,6 @@ acpi_video_bus_set_POST(struct acpi_video_bus *video, unsigned long option)
417 union acpi_object arg0 = { ACPI_TYPE_INTEGER }; 410 union acpi_object arg0 = { ACPI_TYPE_INTEGER };
418 struct acpi_object_list args = { 1, &arg0 }; 411 struct acpi_object_list args = { 1, &arg0 };
419 412
420 ACPI_FUNCTION_TRACE("acpi_video_bus_set_POST");
421 413
422 arg0.integer.value = option; 414 arg0.integer.value = option;
423 415
@@ -425,7 +417,7 @@ acpi_video_bus_set_POST(struct acpi_video_bus *video, unsigned long option)
425 if (ACPI_SUCCESS(status)) 417 if (ACPI_SUCCESS(status))
426 status = tmp ? (-EINVAL) : (AE_OK); 418 status = tmp ? (-EINVAL) : (AE_OK);
427 419
428 return_VALUE(status); 420 return status;
429} 421}
430 422
431static int 423static int
@@ -433,11 +425,10 @@ acpi_video_bus_get_POST(struct acpi_video_bus *video, unsigned long *id)
433{ 425{
434 int status; 426 int status;
435 427
436 ACPI_FUNCTION_TRACE("acpi_video_bus_get_POST");
437 428
438 status = acpi_evaluate_integer(video->handle, "_GPD", NULL, id); 429 status = acpi_evaluate_integer(video->handle, "_GPD", NULL, id);
439 430
440 return_VALUE(status); 431 return status;
441} 432}
442 433
443static int 434static int
@@ -445,12 +436,11 @@ acpi_video_bus_POST_options(struct acpi_video_bus *video,
445 unsigned long *options) 436 unsigned long *options)
446{ 437{
447 int status; 438 int status;
448 ACPI_FUNCTION_TRACE("acpi_video_bus_POST_options");
449 439
450 status = acpi_evaluate_integer(video->handle, "_VPO", NULL, options); 440 status = acpi_evaluate_integer(video->handle, "_VPO", NULL, options);
451 *options &= 3; 441 *options &= 3;
452 442
453 return_VALUE(status); 443 return status;
454} 444}
455 445
456/* 446/*
@@ -481,7 +471,6 @@ acpi_video_bus_DOS(struct acpi_video_bus *video, int bios_flag, int lcd_flag)
481 union acpi_object arg0 = { ACPI_TYPE_INTEGER }; 471 union acpi_object arg0 = { ACPI_TYPE_INTEGER };
482 struct acpi_object_list args = { 1, &arg0 }; 472 struct acpi_object_list args = { 1, &arg0 };
483 473
484 ACPI_FUNCTION_TRACE("acpi_video_bus_DOS");
485 474
486 if (bios_flag < 0 || bios_flag > 3 || lcd_flag < 0 || lcd_flag > 1) { 475 if (bios_flag < 0 || bios_flag > 3 || lcd_flag < 0 || lcd_flag > 1) {
487 status = -1; 476 status = -1;
@@ -492,7 +481,7 @@ acpi_video_bus_DOS(struct acpi_video_bus *video, int bios_flag, int lcd_flag)
492 acpi_evaluate_object(video->handle, "_DOS", &args, NULL); 481 acpi_evaluate_object(video->handle, "_DOS", &args, NULL);
493 482
494 Failed: 483 Failed:
495 return_VALUE(status); 484 return status;
496} 485}
497 486
498/* 487/*
@@ -514,7 +503,6 @@ static void acpi_video_device_find_cap(struct acpi_video_device *device)
514 union acpi_object *obj = NULL; 503 union acpi_object *obj = NULL;
515 struct acpi_video_device_brightness *br = NULL; 504 struct acpi_video_device_brightness *br = NULL;
516 505
517 ACPI_FUNCTION_TRACE("acpi_video_device_find_cap");
518 506
519 memset(&device->cap, 0, 4); 507 memset(&device->cap, 0, 4);
520 508
@@ -560,8 +548,7 @@ static void acpi_video_device_find_cap(struct acpi_video_device *device)
560 o = (union acpi_object *)&obj->package. 548 o = (union acpi_object *)&obj->package.
561 elements[i]; 549 elements[i];
562 if (o->type != ACPI_TYPE_INTEGER) { 550 if (o->type != ACPI_TYPE_INTEGER) {
563 ACPI_DEBUG_PRINT((ACPI_DB_ERROR, 551 printk(KERN_ERR PREFIX "Invalid data\n");
564 "Invalid data\n"));
565 continue; 552 continue;
566 } 553 }
567 br->levels[count] = (u32) o->integer.value; 554 br->levels[count] = (u32) o->integer.value;
@@ -583,7 +570,7 @@ static void acpi_video_device_find_cap(struct acpi_video_device *device)
583 570
584 kfree(obj); 571 kfree(obj);
585 572
586 return_VOID; 573 return;
587} 574}
588 575
589/* 576/*
@@ -630,10 +617,9 @@ static int acpi_video_bus_check(struct acpi_video_bus *video)
630{ 617{
631 acpi_status status = -ENOENT; 618 acpi_status status = -ENOENT;
632 619
633 ACPI_FUNCTION_TRACE("acpi_video_bus_check");
634 620
635 if (!video) 621 if (!video)
636 return_VALUE(-EINVAL); 622 return -EINVAL;
637 623
638 /* Since there is no HID, CID and so on for VGA driver, we have 624 /* Since there is no HID, CID and so on for VGA driver, we have
639 * to check well known required nodes. 625 * to check well known required nodes.
@@ -657,7 +643,7 @@ static int acpi_video_bus_check(struct acpi_video_bus *video)
657 status = 0; 643 status = 0;
658 } 644 }
659 645
660 return_VALUE(status); 646 return status;
661} 647}
662 648
663/* -------------------------------------------------------------------------- 649/* --------------------------------------------------------------------------
@@ -673,7 +659,6 @@ static int acpi_video_device_info_seq_show(struct seq_file *seq, void *offset)
673 struct acpi_video_device *dev = 659 struct acpi_video_device *dev =
674 (struct acpi_video_device *)seq->private; 660 (struct acpi_video_device *)seq->private;
675 661
676 ACPI_FUNCTION_TRACE("acpi_video_device_info_seq_show");
677 662
678 if (!dev) 663 if (!dev)
679 goto end; 664 goto end;
@@ -692,7 +677,7 @@ static int acpi_video_device_info_seq_show(struct seq_file *seq, void *offset)
692 seq_printf(seq, "known by bios: %s\n", dev->flags.bios ? "yes" : "no"); 677 seq_printf(seq, "known by bios: %s\n", dev->flags.bios ? "yes" : "no");
693 678
694 end: 679 end:
695 return_VALUE(0); 680 return 0;
696} 681}
697 682
698static int 683static int
@@ -709,7 +694,6 @@ static int acpi_video_device_state_seq_show(struct seq_file *seq, void *offset)
709 (struct acpi_video_device *)seq->private; 694 (struct acpi_video_device *)seq->private;
710 unsigned long state; 695 unsigned long state;
711 696
712 ACPI_FUNCTION_TRACE("acpi_video_device_state_seq_show");
713 697
714 if (!dev) 698 if (!dev)
715 goto end; 699 goto end;
@@ -729,7 +713,7 @@ static int acpi_video_device_state_seq_show(struct seq_file *seq, void *offset)
729 seq_printf(seq, "<not supported>\n"); 713 seq_printf(seq, "<not supported>\n");
730 714
731 end: 715 end:
732 return_VALUE(0); 716 return 0;
733} 717}
734 718
735static int 719static int
@@ -750,13 +734,12 @@ acpi_video_device_write_state(struct file *file,
750 char str[12] = { 0 }; 734 char str[12] = { 0 };
751 u32 state = 0; 735 u32 state = 0;
752 736
753 ACPI_FUNCTION_TRACE("acpi_video_device_write_state");
754 737
755 if (!dev || count + 1 > sizeof str) 738 if (!dev || count + 1 > sizeof str)
756 return_VALUE(-EINVAL); 739 return -EINVAL;
757 740
758 if (copy_from_user(str, buffer, count)) 741 if (copy_from_user(str, buffer, count))
759 return_VALUE(-EFAULT); 742 return -EFAULT;
760 743
761 str[count] = 0; 744 str[count] = 0;
762 state = simple_strtoul(str, NULL, 0); 745 state = simple_strtoul(str, NULL, 0);
@@ -765,9 +748,9 @@ acpi_video_device_write_state(struct file *file,
765 status = acpi_video_device_set_state(dev, state); 748 status = acpi_video_device_set_state(dev, state);
766 749
767 if (status) 750 if (status)
768 return_VALUE(-EFAULT); 751 return -EFAULT;
769 752
770 return_VALUE(count); 753 return count;
771} 754}
772 755
773static int 756static int
@@ -777,11 +760,10 @@ acpi_video_device_brightness_seq_show(struct seq_file *seq, void *offset)
777 (struct acpi_video_device *)seq->private; 760 (struct acpi_video_device *)seq->private;
778 int i; 761 int i;
779 762
780 ACPI_FUNCTION_TRACE("acpi_video_device_brightness_seq_show");
781 763
782 if (!dev || !dev->brightness) { 764 if (!dev || !dev->brightness) {
783 seq_printf(seq, "<not supported>\n"); 765 seq_printf(seq, "<not supported>\n");
784 return_VALUE(0); 766 return 0;
785 } 767 }
786 768
787 seq_printf(seq, "levels: "); 769 seq_printf(seq, "levels: ");
@@ -789,7 +771,7 @@ acpi_video_device_brightness_seq_show(struct seq_file *seq, void *offset)
789 seq_printf(seq, " %d", dev->brightness->levels[i]); 771 seq_printf(seq, " %d", dev->brightness->levels[i]);
790 seq_printf(seq, "\ncurrent: %d\n", dev->brightness->curr); 772 seq_printf(seq, "\ncurrent: %d\n", dev->brightness->curr);
791 773
792 return_VALUE(0); 774 return 0;
793} 775}
794 776
795static int 777static int
@@ -810,19 +792,18 @@ acpi_video_device_write_brightness(struct file *file,
810 unsigned int level = 0; 792 unsigned int level = 0;
811 int i; 793 int i;
812 794
813 ACPI_FUNCTION_TRACE("acpi_video_device_write_brightness");
814 795
815 if (!dev || !dev->brightness || count + 1 > sizeof str) 796 if (!dev || !dev->brightness || count + 1 > sizeof str)
816 return_VALUE(-EINVAL); 797 return -EINVAL;
817 798
818 if (copy_from_user(str, buffer, count)) 799 if (copy_from_user(str, buffer, count))
819 return_VALUE(-EFAULT); 800 return -EFAULT;
820 801
821 str[count] = 0; 802 str[count] = 0;
822 level = simple_strtoul(str, NULL, 0); 803 level = simple_strtoul(str, NULL, 0);
823 804
824 if (level > 100) 805 if (level > 100)
825 return_VALUE(-EFAULT); 806 return -EFAULT;
826 807
827 /* validate though the list of available levels */ 808 /* validate though the list of available levels */
828 for (i = 0; i < dev->brightness->count; i++) 809 for (i = 0; i < dev->brightness->count; i++)
@@ -833,7 +814,7 @@ acpi_video_device_write_brightness(struct file *file,
833 break; 814 break;
834 } 815 }
835 816
836 return_VALUE(count); 817 return count;
837} 818}
838 819
839static int acpi_video_device_EDID_seq_show(struct seq_file *seq, void *offset) 820static int acpi_video_device_EDID_seq_show(struct seq_file *seq, void *offset)
@@ -844,7 +825,6 @@ static int acpi_video_device_EDID_seq_show(struct seq_file *seq, void *offset)
844 int i; 825 int i;
845 union acpi_object *edid = NULL; 826 union acpi_object *edid = NULL;
846 827
847 ACPI_FUNCTION_TRACE("acpi_video_device_EDID_seq_show");
848 828
849 if (!dev) 829 if (!dev)
850 goto out; 830 goto out;
@@ -869,7 +849,7 @@ static int acpi_video_device_EDID_seq_show(struct seq_file *seq, void *offset)
869 else 849 else
870 kfree(edid); 850 kfree(edid);
871 851
872 return_VALUE(0); 852 return 0;
873} 853}
874 854
875static int 855static int
@@ -884,28 +864,26 @@ static int acpi_video_device_add_fs(struct acpi_device *device)
884 struct proc_dir_entry *entry = NULL; 864 struct proc_dir_entry *entry = NULL;
885 struct acpi_video_device *vid_dev; 865 struct acpi_video_device *vid_dev;
886 866
887 ACPI_FUNCTION_TRACE("acpi_video_device_add_fs");
888 867
889 if (!device) 868 if (!device)
890 return_VALUE(-ENODEV); 869 return -ENODEV;
891 870
892 vid_dev = (struct acpi_video_device *)acpi_driver_data(device); 871 vid_dev = (struct acpi_video_device *)acpi_driver_data(device);
893 if (!vid_dev) 872 if (!vid_dev)
894 return_VALUE(-ENODEV); 873 return -ENODEV;
895 874
896 if (!acpi_device_dir(device)) { 875 if (!acpi_device_dir(device)) {
897 acpi_device_dir(device) = proc_mkdir(acpi_device_bid(device), 876 acpi_device_dir(device) = proc_mkdir(acpi_device_bid(device),
898 vid_dev->video->dir); 877 vid_dev->video->dir);
899 if (!acpi_device_dir(device)) 878 if (!acpi_device_dir(device))
900 return_VALUE(-ENODEV); 879 return -ENODEV;
901 acpi_device_dir(device)->owner = THIS_MODULE; 880 acpi_device_dir(device)->owner = THIS_MODULE;
902 } 881 }
903 882
904 /* 'info' [R] */ 883 /* 'info' [R] */
905 entry = create_proc_entry("info", S_IRUGO, acpi_device_dir(device)); 884 entry = create_proc_entry("info", S_IRUGO, acpi_device_dir(device));
906 if (!entry) 885 if (!entry)
907 ACPI_DEBUG_PRINT((ACPI_DB_ERROR, 886 return -ENODEV;
908 "Unable to create 'info' fs entry\n"));
909 else { 887 else {
910 entry->proc_fops = &acpi_video_device_info_fops; 888 entry->proc_fops = &acpi_video_device_info_fops;
911 entry->data = acpi_driver_data(device); 889 entry->data = acpi_driver_data(device);
@@ -917,8 +895,7 @@ static int acpi_video_device_add_fs(struct acpi_device *device)
917 create_proc_entry("state", S_IFREG | S_IRUGO | S_IWUSR, 895 create_proc_entry("state", S_IFREG | S_IRUGO | S_IWUSR,
918 acpi_device_dir(device)); 896 acpi_device_dir(device));
919 if (!entry) 897 if (!entry)
920 ACPI_DEBUG_PRINT((ACPI_DB_ERROR, 898 return -ENODEV;
921 "Unable to create 'state' fs entry\n"));
922 else { 899 else {
923 acpi_video_device_state_fops.write = acpi_video_device_write_state; 900 acpi_video_device_state_fops.write = acpi_video_device_write_state;
924 entry->proc_fops = &acpi_video_device_state_fops; 901 entry->proc_fops = &acpi_video_device_state_fops;
@@ -931,8 +908,7 @@ static int acpi_video_device_add_fs(struct acpi_device *device)
931 create_proc_entry("brightness", S_IFREG | S_IRUGO | S_IWUSR, 908 create_proc_entry("brightness", S_IFREG | S_IRUGO | S_IWUSR,
932 acpi_device_dir(device)); 909 acpi_device_dir(device));
933 if (!entry) 910 if (!entry)
934 ACPI_DEBUG_PRINT((ACPI_DB_ERROR, 911 return -ENODEV;
935 "Unable to create 'brightness' fs entry\n"));
936 else { 912 else {
937 acpi_video_device_brightness_fops.write = acpi_video_device_write_brightness; 913 acpi_video_device_brightness_fops.write = acpi_video_device_write_brightness;
938 entry->proc_fops = &acpi_video_device_brightness_fops; 914 entry->proc_fops = &acpi_video_device_brightness_fops;
@@ -943,25 +919,23 @@ static int acpi_video_device_add_fs(struct acpi_device *device)
943 /* 'EDID' [R] */ 919 /* 'EDID' [R] */
944 entry = create_proc_entry("EDID", S_IRUGO, acpi_device_dir(device)); 920 entry = create_proc_entry("EDID", S_IRUGO, acpi_device_dir(device));
945 if (!entry) 921 if (!entry)
946 ACPI_DEBUG_PRINT((ACPI_DB_ERROR, 922 return -ENODEV;
947 "Unable to create 'brightness' fs entry\n"));
948 else { 923 else {
949 entry->proc_fops = &acpi_video_device_EDID_fops; 924 entry->proc_fops = &acpi_video_device_EDID_fops;
950 entry->data = acpi_driver_data(device); 925 entry->data = acpi_driver_data(device);
951 entry->owner = THIS_MODULE; 926 entry->owner = THIS_MODULE;
952 } 927 }
953 928
954 return_VALUE(0); 929 return 0;
955} 930}
956 931
957static int acpi_video_device_remove_fs(struct acpi_device *device) 932static int acpi_video_device_remove_fs(struct acpi_device *device)
958{ 933{
959 struct acpi_video_device *vid_dev; 934 struct acpi_video_device *vid_dev;
960 ACPI_FUNCTION_TRACE("acpi_video_device_remove_fs");
961 935
962 vid_dev = (struct acpi_video_device *)acpi_driver_data(device); 936 vid_dev = (struct acpi_video_device *)acpi_driver_data(device);
963 if (!vid_dev || !vid_dev->video || !vid_dev->video->dir) 937 if (!vid_dev || !vid_dev->video || !vid_dev->video->dir)
964 return_VALUE(-ENODEV); 938 return -ENODEV;
965 939
966 if (acpi_device_dir(device)) { 940 if (acpi_device_dir(device)) {
967 remove_proc_entry("info", acpi_device_dir(device)); 941 remove_proc_entry("info", acpi_device_dir(device));
@@ -972,7 +946,7 @@ static int acpi_video_device_remove_fs(struct acpi_device *device)
972 acpi_device_dir(device) = NULL; 946 acpi_device_dir(device) = NULL;
973 } 947 }
974 948
975 return_VALUE(0); 949 return 0;
976} 950}
977 951
978/* video bus */ 952/* video bus */
@@ -980,7 +954,6 @@ static int acpi_video_bus_info_seq_show(struct seq_file *seq, void *offset)
980{ 954{
981 struct acpi_video_bus *video = (struct acpi_video_bus *)seq->private; 955 struct acpi_video_bus *video = (struct acpi_video_bus *)seq->private;
982 956
983 ACPI_FUNCTION_TRACE("acpi_video_bus_info_seq_show");
984 957
985 if (!video) 958 if (!video)
986 goto end; 959 goto end;
@@ -993,7 +966,7 @@ static int acpi_video_bus_info_seq_show(struct seq_file *seq, void *offset)
993 video->flags.post ? "yes" : "no"); 966 video->flags.post ? "yes" : "no");
994 967
995 end: 968 end:
996 return_VALUE(0); 969 return 0;
997} 970}
998 971
999static int acpi_video_bus_info_open_fs(struct inode *inode, struct file *file) 972static int acpi_video_bus_info_open_fs(struct inode *inode, struct file *file)
@@ -1006,7 +979,6 @@ static int acpi_video_bus_ROM_seq_show(struct seq_file *seq, void *offset)
1006{ 979{
1007 struct acpi_video_bus *video = (struct acpi_video_bus *)seq->private; 980 struct acpi_video_bus *video = (struct acpi_video_bus *)seq->private;
1008 981
1009 ACPI_FUNCTION_TRACE("acpi_video_bus_ROM_seq_show");
1010 982
1011 if (!video) 983 if (!video)
1012 goto end; 984 goto end;
@@ -1015,7 +987,7 @@ static int acpi_video_bus_ROM_seq_show(struct seq_file *seq, void *offset)
1015 seq_printf(seq, "<TODO>\n"); 987 seq_printf(seq, "<TODO>\n");
1016 988
1017 end: 989 end:
1018 return_VALUE(0); 990 return 0;
1019} 991}
1020 992
1021static int acpi_video_bus_ROM_open_fs(struct inode *inode, struct file *file) 993static int acpi_video_bus_ROM_open_fs(struct inode *inode, struct file *file)
@@ -1029,7 +1001,6 @@ static int acpi_video_bus_POST_info_seq_show(struct seq_file *seq, void *offset)
1029 unsigned long options; 1001 unsigned long options;
1030 int status; 1002 int status;
1031 1003
1032 ACPI_FUNCTION_TRACE("acpi_video_bus_POST_info_seq_show");
1033 1004
1034 if (!video) 1005 if (!video)
1035 goto end; 1006 goto end;
@@ -1052,7 +1023,7 @@ static int acpi_video_bus_POST_info_seq_show(struct seq_file *seq, void *offset)
1052 } else 1023 } else
1053 seq_printf(seq, "<not supported>\n"); 1024 seq_printf(seq, "<not supported>\n");
1054 end: 1025 end:
1055 return_VALUE(0); 1026 return 0;
1056} 1027}
1057 1028
1058static int 1029static int
@@ -1068,7 +1039,6 @@ static int acpi_video_bus_POST_seq_show(struct seq_file *seq, void *offset)
1068 int status; 1039 int status;
1069 unsigned long id; 1040 unsigned long id;
1070 1041
1071 ACPI_FUNCTION_TRACE("acpi_video_bus_POST_seq_show");
1072 1042
1073 if (!video) 1043 if (!video)
1074 goto end; 1044 goto end;
@@ -1081,18 +1051,17 @@ static int acpi_video_bus_POST_seq_show(struct seq_file *seq, void *offset)
1081 seq_printf(seq, "device posted is <%s>\n", device_decode[id & 3]); 1051 seq_printf(seq, "device posted is <%s>\n", device_decode[id & 3]);
1082 1052
1083 end: 1053 end:
1084 return_VALUE(0); 1054 return 0;
1085} 1055}
1086 1056
1087static int acpi_video_bus_DOS_seq_show(struct seq_file *seq, void *offset) 1057static int acpi_video_bus_DOS_seq_show(struct seq_file *seq, void *offset)
1088{ 1058{
1089 struct acpi_video_bus *video = (struct acpi_video_bus *)seq->private; 1059 struct acpi_video_bus *video = (struct acpi_video_bus *)seq->private;
1090 1060
1091 ACPI_FUNCTION_TRACE("acpi_video_bus_DOS_seq_show");
1092 1061
1093 seq_printf(seq, "DOS setting: <%d>\n", video->dos_setting); 1062 seq_printf(seq, "DOS setting: <%d>\n", video->dos_setting);
1094 1063
1095 return_VALUE(0); 1064 return 0;
1096} 1065}
1097 1066
1098static int acpi_video_bus_POST_open_fs(struct inode *inode, struct file *file) 1067static int acpi_video_bus_POST_open_fs(struct inode *inode, struct file *file)
@@ -1117,22 +1086,21 @@ acpi_video_bus_write_POST(struct file *file,
1117 char str[12] = { 0 }; 1086 char str[12] = { 0 };
1118 unsigned long opt, options; 1087 unsigned long opt, options;
1119 1088
1120 ACPI_FUNCTION_TRACE("acpi_video_bus_write_POST");
1121 1089
1122 if (!video || count + 1 > sizeof str) 1090 if (!video || count + 1 > sizeof str)
1123 return_VALUE(-EINVAL); 1091 return -EINVAL;
1124 1092
1125 status = acpi_video_bus_POST_options(video, &options); 1093 status = acpi_video_bus_POST_options(video, &options);
1126 if (!ACPI_SUCCESS(status)) 1094 if (!ACPI_SUCCESS(status))
1127 return_VALUE(-EINVAL); 1095 return -EINVAL;
1128 1096
1129 if (copy_from_user(str, buffer, count)) 1097 if (copy_from_user(str, buffer, count))
1130 return_VALUE(-EFAULT); 1098 return -EFAULT;
1131 1099
1132 str[count] = 0; 1100 str[count] = 0;
1133 opt = strtoul(str, NULL, 0); 1101 opt = strtoul(str, NULL, 0);
1134 if (opt > 3) 1102 if (opt > 3)
1135 return_VALUE(-EFAULT); 1103 return -EFAULT;
1136 1104
1137 /* just in case an OEM 'forget' the motherboard... */ 1105 /* just in case an OEM 'forget' the motherboard... */
1138 options |= 1; 1106 options |= 1;
@@ -1140,11 +1108,11 @@ acpi_video_bus_write_POST(struct file *file,
1140 if (options & (1ul << opt)) { 1108 if (options & (1ul << opt)) {
1141 status = acpi_video_bus_set_POST(video, opt); 1109 status = acpi_video_bus_set_POST(video, opt);
1142 if (!ACPI_SUCCESS(status)) 1110 if (!ACPI_SUCCESS(status))
1143 return_VALUE(-EFAULT); 1111 return -EFAULT;
1144 1112
1145 } 1113 }
1146 1114
1147 return_VALUE(count); 1115 return count;
1148} 1116}
1149 1117
1150static ssize_t 1118static ssize_t
@@ -1158,25 +1126,24 @@ acpi_video_bus_write_DOS(struct file *file,
1158 char str[12] = { 0 }; 1126 char str[12] = { 0 };
1159 unsigned long opt; 1127 unsigned long opt;
1160 1128
1161 ACPI_FUNCTION_TRACE("acpi_video_bus_write_DOS");
1162 1129
1163 if (!video || count + 1 > sizeof str) 1130 if (!video || count + 1 > sizeof str)
1164 return_VALUE(-EINVAL); 1131 return -EINVAL;
1165 1132
1166 if (copy_from_user(str, buffer, count)) 1133 if (copy_from_user(str, buffer, count))
1167 return_VALUE(-EFAULT); 1134 return -EFAULT;
1168 1135
1169 str[count] = 0; 1136 str[count] = 0;
1170 opt = strtoul(str, NULL, 0); 1137 opt = strtoul(str, NULL, 0);
1171 if (opt > 7) 1138 if (opt > 7)
1172 return_VALUE(-EFAULT); 1139 return -EFAULT;
1173 1140
1174 status = acpi_video_bus_DOS(video, opt & 0x3, (opt & 0x4) >> 2); 1141 status = acpi_video_bus_DOS(video, opt & 0x3, (opt & 0x4) >> 2);
1175 1142
1176 if (!ACPI_SUCCESS(status)) 1143 if (!ACPI_SUCCESS(status))
1177 return_VALUE(-EFAULT); 1144 return -EFAULT;
1178 1145
1179 return_VALUE(count); 1146 return count;
1180} 1147}
1181 1148
1182static int acpi_video_bus_add_fs(struct acpi_device *device) 1149static int acpi_video_bus_add_fs(struct acpi_device *device)
@@ -1184,7 +1151,6 @@ static int acpi_video_bus_add_fs(struct acpi_device *device)
1184 struct proc_dir_entry *entry = NULL; 1151 struct proc_dir_entry *entry = NULL;
1185 struct acpi_video_bus *video; 1152 struct acpi_video_bus *video;
1186 1153
1187 ACPI_FUNCTION_TRACE("acpi_video_bus_add_fs");
1188 1154
1189 video = (struct acpi_video_bus *)acpi_driver_data(device); 1155 video = (struct acpi_video_bus *)acpi_driver_data(device);
1190 1156
@@ -1192,7 +1158,7 @@ static int acpi_video_bus_add_fs(struct acpi_device *device)
1192 acpi_device_dir(device) = proc_mkdir(acpi_device_bid(device), 1158 acpi_device_dir(device) = proc_mkdir(acpi_device_bid(device),
1193 acpi_video_dir); 1159 acpi_video_dir);
1194 if (!acpi_device_dir(device)) 1160 if (!acpi_device_dir(device))
1195 return_VALUE(-ENODEV); 1161 return -ENODEV;
1196 video->dir = acpi_device_dir(device); 1162 video->dir = acpi_device_dir(device);
1197 acpi_device_dir(device)->owner = THIS_MODULE; 1163 acpi_device_dir(device)->owner = THIS_MODULE;
1198 } 1164 }
@@ -1200,8 +1166,7 @@ static int acpi_video_bus_add_fs(struct acpi_device *device)
1200 /* 'info' [R] */ 1166 /* 'info' [R] */
1201 entry = create_proc_entry("info", S_IRUGO, acpi_device_dir(device)); 1167 entry = create_proc_entry("info", S_IRUGO, acpi_device_dir(device));
1202 if (!entry) 1168 if (!entry)
1203 ACPI_DEBUG_PRINT((ACPI_DB_ERROR, 1169 return -ENODEV;
1204 "Unable to create 'info' fs entry\n"));
1205 else { 1170 else {
1206 entry->proc_fops = &acpi_video_bus_info_fops; 1171 entry->proc_fops = &acpi_video_bus_info_fops;
1207 entry->data = acpi_driver_data(device); 1172 entry->data = acpi_driver_data(device);
@@ -1211,8 +1176,7 @@ static int acpi_video_bus_add_fs(struct acpi_device *device)
1211 /* 'ROM' [R] */ 1176 /* 'ROM' [R] */
1212 entry = create_proc_entry("ROM", S_IRUGO, acpi_device_dir(device)); 1177 entry = create_proc_entry("ROM", S_IRUGO, acpi_device_dir(device));
1213 if (!entry) 1178 if (!entry)
1214 ACPI_DEBUG_PRINT((ACPI_DB_ERROR, 1179 return -ENODEV;
1215 "Unable to create 'ROM' fs entry\n"));
1216 else { 1180 else {
1217 entry->proc_fops = &acpi_video_bus_ROM_fops; 1181 entry->proc_fops = &acpi_video_bus_ROM_fops;
1218 entry->data = acpi_driver_data(device); 1182 entry->data = acpi_driver_data(device);
@@ -1223,8 +1187,7 @@ static int acpi_video_bus_add_fs(struct acpi_device *device)
1223 entry = 1187 entry =
1224 create_proc_entry("POST_info", S_IRUGO, acpi_device_dir(device)); 1188 create_proc_entry("POST_info", S_IRUGO, acpi_device_dir(device));
1225 if (!entry) 1189 if (!entry)
1226 ACPI_DEBUG_PRINT((ACPI_DB_ERROR, 1190 return -ENODEV;
1227 "Unable to create 'POST_info' fs entry\n"));
1228 else { 1191 else {
1229 entry->proc_fops = &acpi_video_bus_POST_info_fops; 1192 entry->proc_fops = &acpi_video_bus_POST_info_fops;
1230 entry->data = acpi_driver_data(device); 1193 entry->data = acpi_driver_data(device);
@@ -1236,8 +1199,7 @@ static int acpi_video_bus_add_fs(struct acpi_device *device)
1236 create_proc_entry("POST", S_IFREG | S_IRUGO | S_IRUSR, 1199 create_proc_entry("POST", S_IFREG | S_IRUGO | S_IRUSR,
1237 acpi_device_dir(device)); 1200 acpi_device_dir(device));
1238 if (!entry) 1201 if (!entry)
1239 ACPI_DEBUG_PRINT((ACPI_DB_ERROR, 1202 return -ENODEV;
1240 "Unable to create 'POST' fs entry\n"));
1241 else { 1203 else {
1242 acpi_video_bus_POST_fops.write = acpi_video_bus_write_POST; 1204 acpi_video_bus_POST_fops.write = acpi_video_bus_write_POST;
1243 entry->proc_fops = &acpi_video_bus_POST_fops; 1205 entry->proc_fops = &acpi_video_bus_POST_fops;
@@ -1250,8 +1212,7 @@ static int acpi_video_bus_add_fs(struct acpi_device *device)
1250 create_proc_entry("DOS", S_IFREG | S_IRUGO | S_IRUSR, 1212 create_proc_entry("DOS", S_IFREG | S_IRUGO | S_IRUSR,
1251 acpi_device_dir(device)); 1213 acpi_device_dir(device));
1252 if (!entry) 1214 if (!entry)
1253 ACPI_DEBUG_PRINT((ACPI_DB_ERROR, 1215 return -ENODEV;
1254 "Unable to create 'DOS' fs entry\n"));
1255 else { 1216 else {
1256 acpi_video_bus_DOS_fops.write = acpi_video_bus_write_DOS; 1217 acpi_video_bus_DOS_fops.write = acpi_video_bus_write_DOS;
1257 entry->proc_fops = &acpi_video_bus_DOS_fops; 1218 entry->proc_fops = &acpi_video_bus_DOS_fops;
@@ -1259,14 +1220,13 @@ static int acpi_video_bus_add_fs(struct acpi_device *device)
1259 entry->owner = THIS_MODULE; 1220 entry->owner = THIS_MODULE;
1260 } 1221 }
1261 1222
1262 return_VALUE(0); 1223 return 0;
1263} 1224}
1264 1225
1265static int acpi_video_bus_remove_fs(struct acpi_device *device) 1226static int acpi_video_bus_remove_fs(struct acpi_device *device)
1266{ 1227{
1267 struct acpi_video_bus *video; 1228 struct acpi_video_bus *video;
1268 1229
1269 ACPI_FUNCTION_TRACE("acpi_video_bus_remove_fs");
1270 1230
1271 video = (struct acpi_video_bus *)acpi_driver_data(device); 1231 video = (struct acpi_video_bus *)acpi_driver_data(device);
1272 1232
@@ -1280,7 +1240,7 @@ static int acpi_video_bus_remove_fs(struct acpi_device *device)
1280 acpi_device_dir(device) = NULL; 1240 acpi_device_dir(device) = NULL;
1281 } 1241 }
1282 1242
1283 return_VALUE(0); 1243 return 0;
1284} 1244}
1285 1245
1286/* -------------------------------------------------------------------------- 1246/* --------------------------------------------------------------------------
@@ -1297,10 +1257,9 @@ acpi_video_bus_get_one_device(struct acpi_device *device,
1297 int status; 1257 int status;
1298 struct acpi_video_device *data; 1258 struct acpi_video_device *data;
1299 1259
1300 ACPI_FUNCTION_TRACE("acpi_video_bus_get_one_device");
1301 1260
1302 if (!device || !video) 1261 if (!device || !video)
1303 return_VALUE(-EINVAL); 1262 return -EINVAL;
1304 1263
1305 status = 1264 status =
1306 acpi_evaluate_integer(device->handle, "_ADR", NULL, &device_id); 1265 acpi_evaluate_integer(device->handle, "_ADR", NULL, &device_id);
@@ -1308,7 +1267,7 @@ acpi_video_bus_get_one_device(struct acpi_device *device,
1308 1267
1309 data = kmalloc(sizeof(struct acpi_video_device), GFP_KERNEL); 1268 data = kmalloc(sizeof(struct acpi_video_device), GFP_KERNEL);
1310 if (!data) 1269 if (!data)
1311 return_VALUE(-ENOMEM); 1270 return -ENOMEM;
1312 1271
1313 memset(data, 0, sizeof(struct acpi_video_device)); 1272 memset(data, 0, sizeof(struct acpi_video_device));
1314 1273
@@ -1359,10 +1318,10 @@ acpi_video_bus_get_one_device(struct acpi_device *device,
1359 1318
1360 acpi_video_device_add_fs(device); 1319 acpi_video_device_add_fs(device);
1361 1320
1362 return_VALUE(0); 1321 return 0;
1363 } 1322 }
1364 1323
1365 return_VALUE(-ENOENT); 1324 return -ENOENT;
1366} 1325}
1367 1326
1368/* 1327/*
@@ -1405,7 +1364,6 @@ acpi_video_device_bind(struct acpi_video_bus *video,
1405 struct acpi_video_device *device) 1364 struct acpi_video_device *device)
1406{ 1365{
1407 int i; 1366 int i;
1408 ACPI_FUNCTION_TRACE("acpi_video_device_bind");
1409 1367
1410#define IDS_VAL(i) video->attached_array[i].value.int_val 1368#define IDS_VAL(i) video->attached_array[i].value.int_val
1411#define IDS_BIND(i) video->attached_array[i].bind_info 1369#define IDS_BIND(i) video->attached_array[i].bind_info
@@ -1442,17 +1400,16 @@ static int acpi_video_device_enumerate(struct acpi_video_bus *video)
1442 union acpi_object *dod = NULL; 1400 union acpi_object *dod = NULL;
1443 union acpi_object *obj; 1401 union acpi_object *obj;
1444 1402
1445 ACPI_FUNCTION_TRACE("acpi_video_device_enumerate");
1446 1403
1447 status = acpi_evaluate_object(video->handle, "_DOD", NULL, &buffer); 1404 status = acpi_evaluate_object(video->handle, "_DOD", NULL, &buffer);
1448 if (!ACPI_SUCCESS(status)) { 1405 if (!ACPI_SUCCESS(status)) {
1449 ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Error evaluating _DOD\n")); 1406 ACPI_EXCEPTION((AE_INFO, status, "Evaluating _DOD"));
1450 return_VALUE(status); 1407 return status;
1451 } 1408 }
1452 1409
1453 dod = (union acpi_object *)buffer.pointer; 1410 dod = (union acpi_object *)buffer.pointer;
1454 if (!dod || (dod->type != ACPI_TYPE_PACKAGE)) { 1411 if (!dod || (dod->type != ACPI_TYPE_PACKAGE)) {
1455 ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Invalid _DOD data\n")); 1412 ACPI_EXCEPTION((AE_INFO, status, "Invalid _DOD data"));
1456 status = -EFAULT; 1413 status = -EFAULT;
1457 goto out; 1414 goto out;
1458 } 1415 }
@@ -1476,8 +1433,7 @@ static int acpi_video_device_enumerate(struct acpi_video_bus *video)
1476 obj = (union acpi_object *)&dod->package.elements[i]; 1433 obj = (union acpi_object *)&dod->package.elements[i];
1477 1434
1478 if (obj->type != ACPI_TYPE_INTEGER) { 1435 if (obj->type != ACPI_TYPE_INTEGER) {
1479 ACPI_DEBUG_PRINT((ACPI_DB_ERROR, 1436 printk(KERN_ERR PREFIX "Invalid _DOD data\n");
1480 "Invalid _DOD data\n"));
1481 active_device_list[i].value.int_val = 1437 active_device_list[i].value.int_val =
1482 ACPI_VIDEO_HEAD_INVALID; 1438 ACPI_VIDEO_HEAD_INVALID;
1483 } 1439 }
@@ -1495,7 +1451,7 @@ static int acpi_video_device_enumerate(struct acpi_video_bus *video)
1495 video->attached_count = count; 1451 video->attached_count = count;
1496 out: 1452 out:
1497 acpi_os_free(buffer.pointer); 1453 acpi_os_free(buffer.pointer);
1498 return_VALUE(status); 1454 return status;
1499} 1455}
1500 1456
1501/* 1457/*
@@ -1520,7 +1476,6 @@ static int acpi_video_switch_output(struct acpi_video_bus *video, int event)
1520 unsigned long state; 1476 unsigned long state;
1521 int status = 0; 1477 int status = 0;
1522 1478
1523 ACPI_FUNCTION_TRACE("acpi_video_switch_output");
1524 1479
1525 list_for_each_safe(node, next, &video->video_device_list) { 1480 list_for_each_safe(node, next, &video->video_device_list) {
1526 dev = container_of(node, struct acpi_video_device, entry); 1481 dev = container_of(node, struct acpi_video_device, entry);
@@ -1551,7 +1506,7 @@ static int acpi_video_switch_output(struct acpi_video_bus *video, int event)
1551 break; 1506 break;
1552 } 1507 }
1553 1508
1554 return_VALUE(status); 1509 return status;
1555} 1510}
1556 1511
1557static int 1512static int
@@ -1578,7 +1533,6 @@ acpi_video_bus_get_devices(struct acpi_video_bus *video,
1578 int status = 0; 1533 int status = 0;
1579 struct list_head *node, *next; 1534 struct list_head *node, *next;
1580 1535
1581 ACPI_FUNCTION_TRACE("acpi_video_get_devices");
1582 1536
1583 acpi_video_device_enumerate(video); 1537 acpi_video_device_enumerate(video);
1584 1538
@@ -1591,13 +1545,12 @@ acpi_video_bus_get_devices(struct acpi_video_bus *video,
1591 1545
1592 status = acpi_video_bus_get_one_device(dev, video); 1546 status = acpi_video_bus_get_one_device(dev, video);
1593 if (ACPI_FAILURE(status)) { 1547 if (ACPI_FAILURE(status)) {
1594 ACPI_DEBUG_PRINT((ACPI_DB_ERROR, 1548 ACPI_EXCEPTION((AE_INFO, status, "Cant attach device"));
1595 "Cant attach device\n"));
1596 continue; 1549 continue;
1597 } 1550 }
1598 1551
1599 } 1552 }
1600 return_VALUE(status); 1553 return status;
1601} 1554}
1602 1555
1603static int acpi_video_bus_put_one_device(struct acpi_video_device *device) 1556static int acpi_video_bus_put_one_device(struct acpi_video_device *device)
@@ -1605,10 +1558,9 @@ static int acpi_video_bus_put_one_device(struct acpi_video_device *device)
1605 acpi_status status; 1558 acpi_status status;
1606 struct acpi_video_bus *video; 1559 struct acpi_video_bus *video;
1607 1560
1608 ACPI_FUNCTION_TRACE("acpi_video_bus_put_one_device");
1609 1561
1610 if (!device || !device->video) 1562 if (!device || !device->video)
1611 return_VALUE(-ENOENT); 1563 return -ENOENT;
1612 1564
1613 video = device->video; 1565 video = device->video;
1614 1566
@@ -1620,11 +1572,8 @@ static int acpi_video_bus_put_one_device(struct acpi_video_device *device)
1620 status = acpi_remove_notify_handler(device->handle, 1572 status = acpi_remove_notify_handler(device->handle,
1621 ACPI_DEVICE_NOTIFY, 1573 ACPI_DEVICE_NOTIFY,
1622 acpi_video_device_notify); 1574 acpi_video_device_notify);
1623 if (ACPI_FAILURE(status))
1624 ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
1625 "Error removing notify handler\n"));
1626 1575
1627 return_VALUE(0); 1576 return 0;
1628} 1577}
1629 1578
1630static int acpi_video_bus_put_devices(struct acpi_video_bus *video) 1579static int acpi_video_bus_put_devices(struct acpi_video_bus *video)
@@ -1632,7 +1581,6 @@ static int acpi_video_bus_put_devices(struct acpi_video_bus *video)
1632 int status; 1581 int status;
1633 struct list_head *node, *next; 1582 struct list_head *node, *next;
1634 1583
1635 ACPI_FUNCTION_TRACE("acpi_video_bus_put_devices");
1636 1584
1637 list_for_each_safe(node, next, &video->video_device_list) { 1585 list_for_each_safe(node, next, &video->video_device_list) {
1638 struct acpi_video_device *data = 1586 struct acpi_video_device *data =
@@ -1651,7 +1599,7 @@ static int acpi_video_bus_put_devices(struct acpi_video_bus *video)
1651 kfree(data); 1599 kfree(data);
1652 } 1600 }
1653 1601
1654 return_VALUE(0); 1602 return 0;
1655} 1603}
1656 1604
1657/* acpi_video interface */ 1605/* acpi_video interface */
@@ -1671,14 +1619,13 @@ static void acpi_video_bus_notify(acpi_handle handle, u32 event, void *data)
1671 struct acpi_video_bus *video = (struct acpi_video_bus *)data; 1619 struct acpi_video_bus *video = (struct acpi_video_bus *)data;
1672 struct acpi_device *device = NULL; 1620 struct acpi_device *device = NULL;
1673 1621
1674 ACPI_FUNCTION_TRACE("acpi_video_bus_notify");
1675 printk("video bus notify\n"); 1622 printk("video bus notify\n");
1676 1623
1677 if (!video) 1624 if (!video)
1678 return_VOID; 1625 return;
1679 1626
1680 if (acpi_bus_get_device(handle, &device)) 1627 if (acpi_bus_get_device(handle, &device))
1681 return_VOID; 1628 return;
1682 1629
1683 switch (event) { 1630 switch (event) {
1684 case ACPI_VIDEO_NOTIFY_SWITCH: /* User request that a switch occur, 1631 case ACPI_VIDEO_NOTIFY_SWITCH: /* User request that a switch occur,
@@ -1707,7 +1654,7 @@ static void acpi_video_bus_notify(acpi_handle handle, u32 event, void *data)
1707 break; 1654 break;
1708 } 1655 }
1709 1656
1710 return_VOID; 1657 return;
1711} 1658}
1712 1659
1713static void acpi_video_device_notify(acpi_handle handle, u32 event, void *data) 1660static void acpi_video_device_notify(acpi_handle handle, u32 event, void *data)
@@ -1716,14 +1663,13 @@ static void acpi_video_device_notify(acpi_handle handle, u32 event, void *data)
1716 (struct acpi_video_device *)data; 1663 (struct acpi_video_device *)data;
1717 struct acpi_device *device = NULL; 1664 struct acpi_device *device = NULL;
1718 1665
1719 ACPI_FUNCTION_TRACE("acpi_video_device_notify");
1720 1666
1721 printk("video device notify\n"); 1667 printk("video device notify\n");
1722 if (!video_device) 1668 if (!video_device)
1723 return_VOID; 1669 return;
1724 1670
1725 if (acpi_bus_get_device(handle, &device)) 1671 if (acpi_bus_get_device(handle, &device))
1726 return_VOID; 1672 return;
1727 1673
1728 switch (event) { 1674 switch (event) {
1729 case ACPI_VIDEO_NOTIFY_SWITCH: /* change in status (cycle output device) */ 1675 case ACPI_VIDEO_NOTIFY_SWITCH: /* change in status (cycle output device) */
@@ -1743,7 +1689,7 @@ static void acpi_video_device_notify(acpi_handle handle, u32 event, void *data)
1743 "Unsupported event [0x%x]\n", event)); 1689 "Unsupported event [0x%x]\n", event));
1744 break; 1690 break;
1745 } 1691 }
1746 return_VOID; 1692 return;
1747} 1693}
1748 1694
1749static int acpi_video_bus_add(struct acpi_device *device) 1695static int acpi_video_bus_add(struct acpi_device *device)
@@ -1752,14 +1698,13 @@ static int acpi_video_bus_add(struct acpi_device *device)
1752 acpi_status status = 0; 1698 acpi_status status = 0;
1753 struct acpi_video_bus *video = NULL; 1699 struct acpi_video_bus *video = NULL;
1754 1700
1755 ACPI_FUNCTION_TRACE("acpi_video_bus_add");
1756 1701
1757 if (!device) 1702 if (!device)
1758 return_VALUE(-EINVAL); 1703 return -EINVAL;
1759 1704
1760 video = kmalloc(sizeof(struct acpi_video_bus), GFP_KERNEL); 1705 video = kmalloc(sizeof(struct acpi_video_bus), GFP_KERNEL);
1761 if (!video) 1706 if (!video)
1762 return_VALUE(-ENOMEM); 1707 return -ENOMEM;
1763 memset(video, 0, sizeof(struct acpi_video_bus)); 1708 memset(video, 0, sizeof(struct acpi_video_bus));
1764 1709
1765 video->handle = device->handle; 1710 video->handle = device->handle;
@@ -1806,7 +1751,7 @@ static int acpi_video_bus_add(struct acpi_device *device)
1806 if (result) 1751 if (result)
1807 kfree(video); 1752 kfree(video);
1808 1753
1809 return_VALUE(result); 1754 return result;
1810} 1755}
1811 1756
1812static int acpi_video_bus_remove(struct acpi_device *device, int type) 1757static int acpi_video_bus_remove(struct acpi_device *device, int type)
@@ -1814,10 +1759,9 @@ static int acpi_video_bus_remove(struct acpi_device *device, int type)
1814 acpi_status status = 0; 1759 acpi_status status = 0;
1815 struct acpi_video_bus *video = NULL; 1760 struct acpi_video_bus *video = NULL;
1816 1761
1817 ACPI_FUNCTION_TRACE("acpi_video_bus_remove");
1818 1762
1819 if (!device || !acpi_driver_data(device)) 1763 if (!device || !acpi_driver_data(device))
1820 return_VALUE(-EINVAL); 1764 return -EINVAL;
1821 1765
1822 video = (struct acpi_video_bus *)acpi_driver_data(device); 1766 video = (struct acpi_video_bus *)acpi_driver_data(device);
1823 1767
@@ -1826,9 +1770,6 @@ static int acpi_video_bus_remove(struct acpi_device *device, int type)
1826 status = acpi_remove_notify_handler(video->handle, 1770 status = acpi_remove_notify_handler(video->handle,
1827 ACPI_DEVICE_NOTIFY, 1771 ACPI_DEVICE_NOTIFY,
1828 acpi_video_bus_notify); 1772 acpi_video_bus_notify);
1829 if (ACPI_FAILURE(status))
1830 ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
1831 "Error removing notify handler\n"));
1832 1773
1833 acpi_video_bus_put_devices(video); 1774 acpi_video_bus_put_devices(video);
1834 acpi_video_bus_remove_fs(device); 1775 acpi_video_bus_remove_fs(device);
@@ -1836,7 +1777,7 @@ static int acpi_video_bus_remove(struct acpi_device *device, int type)
1836 kfree(video->attached_array); 1777 kfree(video->attached_array);
1837 kfree(video); 1778 kfree(video);
1838 1779
1839 return_VALUE(0); 1780 return 0;
1840} 1781}
1841 1782
1842static int 1783static int
@@ -1846,10 +1787,9 @@ acpi_video_bus_match(struct acpi_device *device, struct acpi_driver *driver)
1846 acpi_handle h_dummy2; 1787 acpi_handle h_dummy2;
1847 acpi_handle h_dummy3; 1788 acpi_handle h_dummy3;
1848 1789
1849 ACPI_FUNCTION_TRACE("acpi_video_bus_match");
1850 1790
1851 if (!device || !driver) 1791 if (!device || !driver)
1852 return_VALUE(-EINVAL); 1792 return -EINVAL;
1853 1793
1854 /* Since there is no HID, CID for ACPI Video drivers, we have 1794 /* Since there is no HID, CID for ACPI Video drivers, we have
1855 * to check well known required nodes for each feature we support. 1795 * to check well known required nodes for each feature we support.
@@ -1858,26 +1798,25 @@ acpi_video_bus_match(struct acpi_device *device, struct acpi_driver *driver)
1858 /* Does this device able to support video switching ? */ 1798 /* Does this device able to support video switching ? */
1859 if (ACPI_SUCCESS(acpi_get_handle(device->handle, "_DOD", &h_dummy1)) && 1799 if (ACPI_SUCCESS(acpi_get_handle(device->handle, "_DOD", &h_dummy1)) &&
1860 ACPI_SUCCESS(acpi_get_handle(device->handle, "_DOS", &h_dummy2))) 1800 ACPI_SUCCESS(acpi_get_handle(device->handle, "_DOS", &h_dummy2)))
1861 return_VALUE(0); 1801 return 0;
1862 1802
1863 /* Does this device able to retrieve a video ROM ? */ 1803 /* Does this device able to retrieve a video ROM ? */
1864 if (ACPI_SUCCESS(acpi_get_handle(device->handle, "_ROM", &h_dummy1))) 1804 if (ACPI_SUCCESS(acpi_get_handle(device->handle, "_ROM", &h_dummy1)))
1865 return_VALUE(0); 1805 return 0;
1866 1806
1867 /* Does this device able to configure which video head to be POSTed ? */ 1807 /* Does this device able to configure which video head to be POSTed ? */
1868 if (ACPI_SUCCESS(acpi_get_handle(device->handle, "_VPO", &h_dummy1)) && 1808 if (ACPI_SUCCESS(acpi_get_handle(device->handle, "_VPO", &h_dummy1)) &&
1869 ACPI_SUCCESS(acpi_get_handle(device->handle, "_GPD", &h_dummy2)) && 1809 ACPI_SUCCESS(acpi_get_handle(device->handle, "_GPD", &h_dummy2)) &&
1870 ACPI_SUCCESS(acpi_get_handle(device->handle, "_SPD", &h_dummy3))) 1810 ACPI_SUCCESS(acpi_get_handle(device->handle, "_SPD", &h_dummy3)))
1871 return_VALUE(0); 1811 return 0;
1872 1812
1873 return_VALUE(-ENODEV); 1813 return -ENODEV;
1874} 1814}
1875 1815
1876static int __init acpi_video_init(void) 1816static int __init acpi_video_init(void)
1877{ 1817{
1878 int result = 0; 1818 int result = 0;
1879 1819
1880 ACPI_FUNCTION_TRACE("acpi_video_init");
1881 1820
1882 /* 1821 /*
1883 acpi_dbg_level = 0xFFFFFFFF; 1822 acpi_dbg_level = 0xFFFFFFFF;
@@ -1886,27 +1825,26 @@ static int __init acpi_video_init(void)
1886 1825
1887 acpi_video_dir = proc_mkdir(ACPI_VIDEO_CLASS, acpi_root_dir); 1826 acpi_video_dir = proc_mkdir(ACPI_VIDEO_CLASS, acpi_root_dir);
1888 if (!acpi_video_dir) 1827 if (!acpi_video_dir)
1889 return_VALUE(-ENODEV); 1828 return -ENODEV;
1890 acpi_video_dir->owner = THIS_MODULE; 1829 acpi_video_dir->owner = THIS_MODULE;
1891 1830
1892 result = acpi_bus_register_driver(&acpi_video_bus); 1831 result = acpi_bus_register_driver(&acpi_video_bus);
1893 if (result < 0) { 1832 if (result < 0) {
1894 remove_proc_entry(ACPI_VIDEO_CLASS, acpi_root_dir); 1833 remove_proc_entry(ACPI_VIDEO_CLASS, acpi_root_dir);
1895 return_VALUE(-ENODEV); 1834 return -ENODEV;
1896 } 1835 }
1897 1836
1898 return_VALUE(0); 1837 return 0;
1899} 1838}
1900 1839
1901static void __exit acpi_video_exit(void) 1840static void __exit acpi_video_exit(void)
1902{ 1841{
1903 ACPI_FUNCTION_TRACE("acpi_video_exit");
1904 1842
1905 acpi_bus_unregister_driver(&acpi_video_bus); 1843 acpi_bus_unregister_driver(&acpi_video_bus);
1906 1844
1907 remove_proc_entry(ACPI_VIDEO_CLASS, acpi_root_dir); 1845 remove_proc_entry(ACPI_VIDEO_CLASS, acpi_root_dir);
1908 1846
1909 return_VOID; 1847 return;
1910} 1848}
1911 1849
1912module_init(acpi_video_init); 1850module_init(acpi_video_init);