Commit 6e37c658aefa57c472b2dbf1de88dbd3c67cdb52
Committed by
Len Brown
1 parent
d09fe55510
Exists in
master
and in
7 other branches
ACPI video: make procfs I/F depend on CONFIG_ACPI_PROCFS
Mark ACPI video driver procfs I/F deprecated, including: /proc/acpi/video/*/info /proc/acpi/video/*/DOS /proc/acpi/video/*/ROM /proc/acpi/video/*/POST /proc/acpi/video/*/POST_info /proc/acpi/video/*/*/info /proc/acpi/video/*/*/state /proc/acpi/video/*/*/EDID and /proc/acpi/video/*/*/brightness, because 1. we already have the sysfs I/F /sysclass/backlight/ as the replacement of /proc/acpi/video/*/*/brightness. 2. the other procfs I/F is not useful for userspace. Signed-off-by: Zhang Rui <rui.zhang@intel.com> Signed-off-by: Len Brown <len.brown@intel.com>
Showing 2 changed files with 82 additions and 50 deletions Side-by-side Diff
drivers/acpi/Kconfig
drivers/acpi/video.c
... | ... | @@ -152,7 +152,9 @@ |
152 | 152 | struct acpi_video_bus_flags flags; |
153 | 153 | struct list_head video_device_list; |
154 | 154 | struct mutex device_list_lock; /* protects video_device_list */ |
155 | +#ifdef CONFIG_ACPI_PROCFS | |
155 | 156 | struct proc_dir_entry *dir; |
157 | +#endif | |
156 | 158 | struct input_dev *input; |
157 | 159 | char phys[32]; /* for input device */ |
158 | 160 | struct notifier_block pm_nb; |
... | ... | @@ -208,6 +210,7 @@ |
208 | 210 | struct output_device *output_dev; |
209 | 211 | }; |
210 | 212 | |
213 | +#ifdef CONFIG_ACPI_PROCFS | |
211 | 214 | /* bus */ |
212 | 215 | static int acpi_video_bus_info_open_fs(struct inode *inode, struct file *file); |
213 | 216 | static const struct file_operations acpi_video_bus_info_fops = { |
... | ... | @@ -307,6 +310,7 @@ |
307 | 310 | .llseek = seq_lseek, |
308 | 311 | .release = single_release, |
309 | 312 | }; |
313 | +#endif /* CONFIG_ACPI_PROCFS */ | |
310 | 314 | |
311 | 315 | static const char device_decode[][30] = { |
312 | 316 | "motherboard VGA device", |
... | ... | @@ -450,16 +454,6 @@ |
450 | 454 | /* device */ |
451 | 455 | |
452 | 456 | static int |
453 | -acpi_video_device_query(struct acpi_video_device *device, unsigned long long *state) | |
454 | -{ | |
455 | - int status; | |
456 | - | |
457 | - status = acpi_evaluate_integer(device->dev->handle, "_DGS", NULL, state); | |
458 | - | |
459 | - return status; | |
460 | -} | |
461 | - | |
462 | -static int | |
463 | 457 | acpi_video_device_get_state(struct acpi_video_device *device, |
464 | 458 | unsigned long long *state) |
465 | 459 | { |
... | ... | @@ -698,46 +692,6 @@ |
698 | 692 | |
699 | 693 | /* bus */ |
700 | 694 | |
701 | -static int | |
702 | -acpi_video_bus_set_POST(struct acpi_video_bus *video, unsigned long option) | |
703 | -{ | |
704 | - int status; | |
705 | - unsigned long long tmp; | |
706 | - union acpi_object arg0 = { ACPI_TYPE_INTEGER }; | |
707 | - struct acpi_object_list args = { 1, &arg0 }; | |
708 | - | |
709 | - | |
710 | - arg0.integer.value = option; | |
711 | - | |
712 | - status = acpi_evaluate_integer(video->device->handle, "_SPD", &args, &tmp); | |
713 | - if (ACPI_SUCCESS(status)) | |
714 | - status = tmp ? (-EINVAL) : (AE_OK); | |
715 | - | |
716 | - return status; | |
717 | -} | |
718 | - | |
719 | -static int | |
720 | -acpi_video_bus_get_POST(struct acpi_video_bus *video, unsigned long long *id) | |
721 | -{ | |
722 | - int status; | |
723 | - | |
724 | - status = acpi_evaluate_integer(video->device->handle, "_GPD", NULL, id); | |
725 | - | |
726 | - return status; | |
727 | -} | |
728 | - | |
729 | -static int | |
730 | -acpi_video_bus_POST_options(struct acpi_video_bus *video, | |
731 | - unsigned long long *options) | |
732 | -{ | |
733 | - int status; | |
734 | - | |
735 | - status = acpi_evaluate_integer(video->device->handle, "_VPO", NULL, options); | |
736 | - *options &= 3; | |
737 | - | |
738 | - return status; | |
739 | -} | |
740 | - | |
741 | 695 | /* |
742 | 696 | * Arg: |
743 | 697 | * video : video bus device pointer |
... | ... | @@ -1159,6 +1113,7 @@ |
1159 | 1113 | /* -------------------------------------------------------------------------- |
1160 | 1114 | FS Interface (/proc) |
1161 | 1115 | -------------------------------------------------------------------------- */ |
1116 | +#ifdef CONFIG_ACPI_PROCFS | |
1162 | 1117 | |
1163 | 1118 | static struct proc_dir_entry *acpi_video_dir; |
1164 | 1119 | |
... | ... | @@ -1198,6 +1153,18 @@ |
1198 | 1153 | PDE(inode)->data); |
1199 | 1154 | } |
1200 | 1155 | |
1156 | +static int | |
1157 | +acpi_video_device_query(struct acpi_video_device *device, | |
1158 | + unsigned long long *state) | |
1159 | +{ | |
1160 | + int status; | |
1161 | + | |
1162 | + status = acpi_evaluate_integer(device->dev->handle, "_DGS", | |
1163 | + NULL, state); | |
1164 | + | |
1165 | + return status; | |
1166 | +} | |
1167 | + | |
1201 | 1168 | static int acpi_video_device_state_seq_show(struct seq_file *seq, void *offset) |
1202 | 1169 | { |
1203 | 1170 | int status; |
... | ... | @@ -1492,6 +1459,19 @@ |
1492 | 1459 | return single_open(file, acpi_video_bus_ROM_seq_show, PDE(inode)->data); |
1493 | 1460 | } |
1494 | 1461 | |
1462 | +static int | |
1463 | +acpi_video_bus_POST_options(struct acpi_video_bus *video, | |
1464 | + unsigned long long *options) | |
1465 | +{ | |
1466 | + int status; | |
1467 | + | |
1468 | + status = acpi_evaluate_integer(video->device->handle, "_VPO", | |
1469 | + NULL, options); | |
1470 | + *options &= 3; | |
1471 | + | |
1472 | + return status; | |
1473 | +} | |
1474 | + | |
1495 | 1475 | static int acpi_video_bus_POST_info_seq_show(struct seq_file *seq, void *offset) |
1496 | 1476 | { |
1497 | 1477 | struct acpi_video_bus *video = seq->private; |
... | ... | @@ -1530,6 +1510,16 @@ |
1530 | 1510 | PDE(inode)->data); |
1531 | 1511 | } |
1532 | 1512 | |
1513 | +static int | |
1514 | +acpi_video_bus_get_POST(struct acpi_video_bus *video, unsigned long long *id) | |
1515 | +{ | |
1516 | + int status; | |
1517 | + | |
1518 | + status = acpi_evaluate_integer(video->device->handle, "_GPD", NULL, id); | |
1519 | + | |
1520 | + return status; | |
1521 | +} | |
1522 | + | |
1533 | 1523 | static int acpi_video_bus_POST_seq_show(struct seq_file *seq, void *offset) |
1534 | 1524 | { |
1535 | 1525 | struct acpi_video_bus *video = seq->private; |
... | ... | @@ -1572,6 +1562,25 @@ |
1572 | 1562 | return single_open(file, acpi_video_bus_DOS_seq_show, PDE(inode)->data); |
1573 | 1563 | } |
1574 | 1564 | |
1565 | +static int | |
1566 | +acpi_video_bus_set_POST(struct acpi_video_bus *video, unsigned long option) | |
1567 | +{ | |
1568 | + int status; | |
1569 | + unsigned long long tmp; | |
1570 | + union acpi_object arg0 = { ACPI_TYPE_INTEGER }; | |
1571 | + struct acpi_object_list args = { 1, &arg0 }; | |
1572 | + | |
1573 | + | |
1574 | + arg0.integer.value = option; | |
1575 | + | |
1576 | + status = acpi_evaluate_integer(video->device->handle, "_SPD", | |
1577 | + &args, &tmp); | |
1578 | + if (ACPI_SUCCESS(status)) | |
1579 | + status = tmp ? (-EINVAL) : (AE_OK); | |
1580 | + | |
1581 | + return status; | |
1582 | +} | |
1583 | + | |
1575 | 1584 | static ssize_t |
1576 | 1585 | acpi_video_bus_write_POST(struct file *file, |
1577 | 1586 | const char __user * buffer, |
... | ... | @@ -1722,6 +1731,24 @@ |
1722 | 1731 | |
1723 | 1732 | return 0; |
1724 | 1733 | } |
1734 | +#else | |
1735 | +static inline int acpi_video_device_add_fs(struct acpi_device *device) | |
1736 | +{ | |
1737 | + return 0; | |
1738 | +} | |
1739 | +static inline int acpi_video_device_remove_fs(struct acpi_device *device) | |
1740 | +{ | |
1741 | + return 0; | |
1742 | +} | |
1743 | +static inline int acpi_video_bus_add_fs(struct acpi_device *device) | |
1744 | +{ | |
1745 | + return 0; | |
1746 | +} | |
1747 | +static inline int acpi_video_bus_remove_fs(struct acpi_device *device) | |
1748 | +{ | |
1749 | + return 0; | |
1750 | +} | |
1751 | +#endif /* CONFIG_ACPI_PROCFS */ | |
1725 | 1752 | |
1726 | 1753 | /* -------------------------------------------------------------------------- |
1727 | 1754 | Driver Interface |
1728 | 1755 | |
... | ... | @@ -2557,9 +2584,11 @@ |
2557 | 2584 | return 0; |
2558 | 2585 | } |
2559 | 2586 | |
2587 | +#ifdef CONFIG_ACPI_PROCFS | |
2560 | 2588 | acpi_video_dir = proc_mkdir(ACPI_VIDEO_CLASS, acpi_root_dir); |
2561 | 2589 | if (!acpi_video_dir) |
2562 | 2590 | return -ENODEV; |
2591 | +#endif | |
2563 | 2592 | |
2564 | 2593 | result = acpi_bus_register_driver(&acpi_video_bus); |
2565 | 2594 | if (result < 0) { |
2566 | 2595 | |
... | ... | @@ -2588,7 +2617,9 @@ |
2588 | 2617 | } |
2589 | 2618 | acpi_bus_unregister_driver(&acpi_video_bus); |
2590 | 2619 | |
2620 | +#ifdef CONFIG_ACPI_PROCFS | |
2591 | 2621 | remove_proc_entry(ACPI_VIDEO_CLASS, acpi_root_dir); |
2622 | +#endif | |
2592 | 2623 | |
2593 | 2624 | register_count = 0; |
2594 | 2625 |