diff options
author | Zhang Rui <rui.zhang@intel.com> | 2010-07-14 22:46:43 -0400 |
---|---|---|
committer | Len Brown <len.brown@intel.com> | 2010-08-15 00:34:06 -0400 |
commit | 6e37c658aefa57c472b2dbf1de88dbd3c67cdb52 (patch) | |
tree | b16e489f5a371a8d60e86245e27fddc2b946d8a1 /drivers/acpi/video.c | |
parent | d09fe55510257f1acd21ea80a9bdd7c72b5895b3 (diff) |
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>
Diffstat (limited to 'drivers/acpi/video.c')
-rw-r--r-- | drivers/acpi/video.c | 131 |
1 files changed, 81 insertions, 50 deletions
diff --git a/drivers/acpi/video.c b/drivers/acpi/video.c index 9865d46f49a8..909ae7bf3b93 100644 --- a/drivers/acpi/video.c +++ b/drivers/acpi/video.c | |||
@@ -152,7 +152,9 @@ struct acpi_video_bus { | |||
152 | struct acpi_video_bus_flags flags; | 152 | struct acpi_video_bus_flags flags; |
153 | struct list_head video_device_list; | 153 | struct list_head video_device_list; |
154 | struct mutex device_list_lock; /* protects video_device_list */ | 154 | struct mutex device_list_lock; /* protects video_device_list */ |
155 | #ifdef CONFIG_ACPI_PROCFS | ||
155 | struct proc_dir_entry *dir; | 156 | struct proc_dir_entry *dir; |
157 | #endif | ||
156 | struct input_dev *input; | 158 | struct input_dev *input; |
157 | char phys[32]; /* for input device */ | 159 | char phys[32]; /* for input device */ |
158 | struct notifier_block pm_nb; | 160 | struct notifier_block pm_nb; |
@@ -208,6 +210,7 @@ struct acpi_video_device { | |||
208 | struct output_device *output_dev; | 210 | struct output_device *output_dev; |
209 | }; | 211 | }; |
210 | 212 | ||
213 | #ifdef CONFIG_ACPI_PROCFS | ||
211 | /* bus */ | 214 | /* bus */ |
212 | static int acpi_video_bus_info_open_fs(struct inode *inode, struct file *file); | 215 | static int acpi_video_bus_info_open_fs(struct inode *inode, struct file *file); |
213 | static const struct file_operations acpi_video_bus_info_fops = { | 216 | static const struct file_operations acpi_video_bus_info_fops = { |
@@ -307,6 +310,7 @@ static const struct file_operations acpi_video_device_EDID_fops = { | |||
307 | .llseek = seq_lseek, | 310 | .llseek = seq_lseek, |
308 | .release = single_release, | 311 | .release = single_release, |
309 | }; | 312 | }; |
313 | #endif /* CONFIG_ACPI_PROCFS */ | ||
310 | 314 | ||
311 | static const char device_decode[][30] = { | 315 | static const char device_decode[][30] = { |
312 | "motherboard VGA device", | 316 | "motherboard VGA device", |
@@ -450,16 +454,6 @@ static struct thermal_cooling_device_ops video_cooling_ops = { | |||
450 | /* device */ | 454 | /* device */ |
451 | 455 | ||
452 | static int | 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 | acpi_video_device_get_state(struct acpi_video_device *device, | 457 | acpi_video_device_get_state(struct acpi_video_device *device, |
464 | unsigned long long *state) | 458 | unsigned long long *state) |
465 | { | 459 | { |
@@ -698,46 +692,6 @@ acpi_video_device_EDID(struct acpi_video_device *device, | |||
698 | 692 | ||
699 | /* bus */ | 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 | * Arg: | 696 | * Arg: |
743 | * video : video bus device pointer | 697 | * video : video bus device pointer |
@@ -1159,6 +1113,7 @@ static int acpi_video_bus_check(struct acpi_video_bus *video) | |||
1159 | /* -------------------------------------------------------------------------- | 1113 | /* -------------------------------------------------------------------------- |
1160 | FS Interface (/proc) | 1114 | FS Interface (/proc) |
1161 | -------------------------------------------------------------------------- */ | 1115 | -------------------------------------------------------------------------- */ |
1116 | #ifdef CONFIG_ACPI_PROCFS | ||
1162 | 1117 | ||
1163 | static struct proc_dir_entry *acpi_video_dir; | 1118 | static struct proc_dir_entry *acpi_video_dir; |
1164 | 1119 | ||
@@ -1198,6 +1153,18 @@ acpi_video_device_info_open_fs(struct inode *inode, struct file *file) | |||
1198 | PDE(inode)->data); | 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 | static int acpi_video_device_state_seq_show(struct seq_file *seq, void *offset) | 1168 | static int acpi_video_device_state_seq_show(struct seq_file *seq, void *offset) |
1202 | { | 1169 | { |
1203 | int status; | 1170 | int status; |
@@ -1492,6 +1459,19 @@ static int acpi_video_bus_ROM_open_fs(struct inode *inode, struct file *file) | |||
1492 | return single_open(file, acpi_video_bus_ROM_seq_show, PDE(inode)->data); | 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 | static int acpi_video_bus_POST_info_seq_show(struct seq_file *seq, void *offset) | 1475 | static int acpi_video_bus_POST_info_seq_show(struct seq_file *seq, void *offset) |
1496 | { | 1476 | { |
1497 | struct acpi_video_bus *video = seq->private; | 1477 | struct acpi_video_bus *video = seq->private; |
@@ -1530,6 +1510,16 @@ acpi_video_bus_POST_info_open_fs(struct inode *inode, struct file *file) | |||
1530 | PDE(inode)->data); | 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 | static int acpi_video_bus_POST_seq_show(struct seq_file *seq, void *offset) | 1523 | static int acpi_video_bus_POST_seq_show(struct seq_file *seq, void *offset) |
1534 | { | 1524 | { |
1535 | struct acpi_video_bus *video = seq->private; | 1525 | struct acpi_video_bus *video = seq->private; |
@@ -1572,6 +1562,25 @@ static int acpi_video_bus_DOS_open_fs(struct inode *inode, struct file *file) | |||
1572 | return single_open(file, acpi_video_bus_DOS_seq_show, PDE(inode)->data); | 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 | static ssize_t | 1584 | static ssize_t |
1576 | acpi_video_bus_write_POST(struct file *file, | 1585 | acpi_video_bus_write_POST(struct file *file, |
1577 | const char __user * buffer, | 1586 | const char __user * buffer, |
@@ -1722,6 +1731,24 @@ static int acpi_video_bus_remove_fs(struct acpi_device *device) | |||
1722 | 1731 | ||
1723 | return 0; | 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 | Driver Interface | 1754 | Driver Interface |
@@ -2557,9 +2584,11 @@ int acpi_video_register(void) | |||
2557 | return 0; | 2584 | return 0; |
2558 | } | 2585 | } |
2559 | 2586 | ||
2587 | #ifdef CONFIG_ACPI_PROCFS | ||
2560 | acpi_video_dir = proc_mkdir(ACPI_VIDEO_CLASS, acpi_root_dir); | 2588 | acpi_video_dir = proc_mkdir(ACPI_VIDEO_CLASS, acpi_root_dir); |
2561 | if (!acpi_video_dir) | 2589 | if (!acpi_video_dir) |
2562 | return -ENODEV; | 2590 | return -ENODEV; |
2591 | #endif | ||
2563 | 2592 | ||
2564 | result = acpi_bus_register_driver(&acpi_video_bus); | 2593 | result = acpi_bus_register_driver(&acpi_video_bus); |
2565 | if (result < 0) { | 2594 | if (result < 0) { |
@@ -2588,7 +2617,9 @@ void acpi_video_unregister(void) | |||
2588 | } | 2617 | } |
2589 | acpi_bus_unregister_driver(&acpi_video_bus); | 2618 | acpi_bus_unregister_driver(&acpi_video_bus); |
2590 | 2619 | ||
2620 | #ifdef CONFIG_ACPI_PROCFS | ||
2591 | remove_proc_entry(ACPI_VIDEO_CLASS, acpi_root_dir); | 2621 | remove_proc_entry(ACPI_VIDEO_CLASS, acpi_root_dir); |
2622 | #endif | ||
2592 | 2623 | ||
2593 | register_count = 0; | 2624 | register_count = 0; |
2594 | 2625 | ||