Commit 6e37c658 authored by Zhang Rui's avatar Zhang Rui Committed by Len Brown

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: default avatarZhang Rui <rui.zhang@intel.com>
Signed-off-by: default avatarLen Brown <len.brown@intel.com>
parent d09fe555
...@@ -56,6 +56,7 @@ config ACPI_PROCFS ...@@ -56,6 +56,7 @@ config ACPI_PROCFS
/proc/acpi/processor/*/throttling (/sys/class/thermal/ /proc/acpi/processor/*/throttling (/sys/class/thermal/
cooling_device*/*) cooling_device*/*)
/proc/acpi/video/*/brightness (/sys/class/backlight/)
This option has no effect on /proc/acpi/ files This option has no effect on /proc/acpi/ files
and functions which do not yet exist in /sys. and functions which do not yet exist in /sys.
......
...@@ -152,7 +152,9 @@ struct acpi_video_bus { ...@@ -152,7 +152,9 @@ struct acpi_video_bus {
struct acpi_video_bus_flags flags; struct acpi_video_bus_flags flags;
struct list_head video_device_list; struct list_head video_device_list;
struct mutex device_list_lock; /* protects video_device_list */ struct mutex device_list_lock; /* protects video_device_list */
#ifdef CONFIG_ACPI_PROCFS
struct proc_dir_entry *dir; struct proc_dir_entry *dir;
#endif
struct input_dev *input; struct input_dev *input;
char phys[32]; /* for input device */ char phys[32]; /* for input device */
struct notifier_block pm_nb; struct notifier_block pm_nb;
...@@ -208,6 +210,7 @@ struct acpi_video_device { ...@@ -208,6 +210,7 @@ struct acpi_video_device {
struct output_device *output_dev; struct output_device *output_dev;
}; };
#ifdef CONFIG_ACPI_PROCFS
/* bus */ /* bus */
static int acpi_video_bus_info_open_fs(struct inode *inode, struct file *file); static int acpi_video_bus_info_open_fs(struct inode *inode, struct file *file);
static const struct file_operations acpi_video_bus_info_fops = { 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,6 +310,7 @@ static const struct file_operations acpi_video_device_EDID_fops = {
.llseek = seq_lseek, .llseek = seq_lseek,
.release = single_release, .release = single_release,
}; };
#endif /* CONFIG_ACPI_PROCFS */
static const char device_decode[][30] = { static const char device_decode[][30] = {
"motherboard VGA device", "motherboard VGA device",
...@@ -449,16 +453,6 @@ static struct thermal_cooling_device_ops video_cooling_ops = { ...@@ -449,16 +453,6 @@ static struct thermal_cooling_device_ops video_cooling_ops = {
/* device */ /* device */
static int
acpi_video_device_query(struct acpi_video_device *device, unsigned long long *state)
{
int status;
status = acpi_evaluate_integer(device->dev->handle, "_DGS", NULL, state);
return status;
}
static int static int
acpi_video_device_get_state(struct acpi_video_device *device, acpi_video_device_get_state(struct acpi_video_device *device,
unsigned long long *state) unsigned long long *state)
...@@ -698,46 +692,6 @@ acpi_video_device_EDID(struct acpi_video_device *device, ...@@ -698,46 +692,6 @@ acpi_video_device_EDID(struct acpi_video_device *device,
/* bus */ /* bus */
static int
acpi_video_bus_set_POST(struct acpi_video_bus *video, unsigned long option)
{
int status;
unsigned long long tmp;
union acpi_object arg0 = { ACPI_TYPE_INTEGER };
struct acpi_object_list args = { 1, &arg0 };
arg0.integer.value = option;
status = acpi_evaluate_integer(video->device->handle, "_SPD", &args, &tmp);
if (ACPI_SUCCESS(status))
status = tmp ? (-EINVAL) : (AE_OK);
return status;
}
static int
acpi_video_bus_get_POST(struct acpi_video_bus *video, unsigned long long *id)
{
int status;
status = acpi_evaluate_integer(video->device->handle, "_GPD", NULL, id);
return status;
}
static int
acpi_video_bus_POST_options(struct acpi_video_bus *video,
unsigned long long *options)
{
int status;
status = acpi_evaluate_integer(video->device->handle, "_VPO", NULL, options);
*options &= 3;
return status;
}
/* /*
* Arg: * Arg:
* video : video bus device pointer * video : video bus device pointer
...@@ -1159,6 +1113,7 @@ static int acpi_video_bus_check(struct acpi_video_bus *video) ...@@ -1159,6 +1113,7 @@ static int acpi_video_bus_check(struct acpi_video_bus *video)
/* -------------------------------------------------------------------------- /* --------------------------------------------------------------------------
FS Interface (/proc) FS Interface (/proc)
-------------------------------------------------------------------------- */ -------------------------------------------------------------------------- */
#ifdef CONFIG_ACPI_PROCFS
static struct proc_dir_entry *acpi_video_dir; static struct proc_dir_entry *acpi_video_dir;
...@@ -1198,6 +1153,18 @@ acpi_video_device_info_open_fs(struct inode *inode, struct file *file) ...@@ -1198,6 +1153,18 @@ acpi_video_device_info_open_fs(struct inode *inode, struct file *file)
PDE(inode)->data); PDE(inode)->data);
} }
static int
acpi_video_device_query(struct acpi_video_device *device,
unsigned long long *state)
{
int status;
status = acpi_evaluate_integer(device->dev->handle, "_DGS",
NULL, state);
return status;
}
static int acpi_video_device_state_seq_show(struct seq_file *seq, void *offset) static int acpi_video_device_state_seq_show(struct seq_file *seq, void *offset)
{ {
int status; int status;
...@@ -1492,6 +1459,19 @@ static int acpi_video_bus_ROM_open_fs(struct inode *inode, struct file *file) ...@@ -1492,6 +1459,19 @@ static int acpi_video_bus_ROM_open_fs(struct inode *inode, struct file *file)
return single_open(file, acpi_video_bus_ROM_seq_show, PDE(inode)->data); return single_open(file, acpi_video_bus_ROM_seq_show, PDE(inode)->data);
} }
static int
acpi_video_bus_POST_options(struct acpi_video_bus *video,
unsigned long long *options)
{
int status;
status = acpi_evaluate_integer(video->device->handle, "_VPO",
NULL, options);
*options &= 3;
return status;
}
static int acpi_video_bus_POST_info_seq_show(struct seq_file *seq, void *offset) static int acpi_video_bus_POST_info_seq_show(struct seq_file *seq, void *offset)
{ {
struct acpi_video_bus *video = seq->private; 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,6 +1510,16 @@ acpi_video_bus_POST_info_open_fs(struct inode *inode, struct file *file)
PDE(inode)->data); PDE(inode)->data);
} }
static int
acpi_video_bus_get_POST(struct acpi_video_bus *video, unsigned long long *id)
{
int status;
status = acpi_evaluate_integer(video->device->handle, "_GPD", NULL, id);
return status;
}
static int acpi_video_bus_POST_seq_show(struct seq_file *seq, void *offset) static int acpi_video_bus_POST_seq_show(struct seq_file *seq, void *offset)
{ {
struct acpi_video_bus *video = seq->private; 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,6 +1562,25 @@ static int acpi_video_bus_DOS_open_fs(struct inode *inode, struct file *file)
return single_open(file, acpi_video_bus_DOS_seq_show, PDE(inode)->data); return single_open(file, acpi_video_bus_DOS_seq_show, PDE(inode)->data);
} }
static int
acpi_video_bus_set_POST(struct acpi_video_bus *video, unsigned long option)
{
int status;
unsigned long long tmp;
union acpi_object arg0 = { ACPI_TYPE_INTEGER };
struct acpi_object_list args = { 1, &arg0 };
arg0.integer.value = option;
status = acpi_evaluate_integer(video->device->handle, "_SPD",
&args, &tmp);
if (ACPI_SUCCESS(status))
status = tmp ? (-EINVAL) : (AE_OK);
return status;
}
static ssize_t static ssize_t
acpi_video_bus_write_POST(struct file *file, acpi_video_bus_write_POST(struct file *file,
const char __user * buffer, const char __user * buffer,
...@@ -1722,6 +1731,24 @@ static int acpi_video_bus_remove_fs(struct acpi_device *device) ...@@ -1722,6 +1731,24 @@ static int acpi_video_bus_remove_fs(struct acpi_device *device)
return 0; return 0;
} }
#else
static inline int acpi_video_device_add_fs(struct acpi_device *device)
{
return 0;
}
static inline int acpi_video_device_remove_fs(struct acpi_device *device)
{
return 0;
}
static inline int acpi_video_bus_add_fs(struct acpi_device *device)
{
return 0;
}
static inline int acpi_video_bus_remove_fs(struct acpi_device *device)
{
return 0;
}
#endif /* CONFIG_ACPI_PROCFS */
/* -------------------------------------------------------------------------- /* --------------------------------------------------------------------------
Driver Interface Driver Interface
...@@ -2557,9 +2584,11 @@ int acpi_video_register(void) ...@@ -2557,9 +2584,11 @@ int acpi_video_register(void)
return 0; return 0;
} }
#ifdef CONFIG_ACPI_PROCFS
acpi_video_dir = proc_mkdir(ACPI_VIDEO_CLASS, acpi_root_dir); acpi_video_dir = proc_mkdir(ACPI_VIDEO_CLASS, acpi_root_dir);
if (!acpi_video_dir) if (!acpi_video_dir)
return -ENODEV; return -ENODEV;
#endif
result = acpi_bus_register_driver(&acpi_video_bus); result = acpi_bus_register_driver(&acpi_video_bus);
if (result < 0) { if (result < 0) {
...@@ -2588,7 +2617,9 @@ void acpi_video_unregister(void) ...@@ -2588,7 +2617,9 @@ void acpi_video_unregister(void)
} }
acpi_bus_unregister_driver(&acpi_video_bus); acpi_bus_unregister_driver(&acpi_video_bus);
#ifdef CONFIG_ACPI_PROCFS
remove_proc_entry(ACPI_VIDEO_CLASS, acpi_root_dir); remove_proc_entry(ACPI_VIDEO_CLASS, acpi_root_dir);
#endif
register_count = 0; register_count = 0;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment