ACPI button: remove unused procfs I/F

Remove unused ACPI button procfs interface.
Only /proc/acpi/button/lid/LID/state remains.

Signed-off-by: Zhang Rui <rui.zhang@intel.com>
Signed-off-by: Len Brown <len.brown@intel.com>
This commit is contained in:
Zhang Rui 2011-03-23 10:21:40 +08:00 committed by Len Brown
parent aad83b1430
commit 912b7427fc
2 changed files with 60 additions and 111 deletions

View File

@ -259,14 +259,6 @@ Who: Zhang Rui <rui.zhang@intel.com>
--------------------------- ---------------------------
What: /proc/acpi/button
When: August 2007
Why: /proc/acpi/button has been replaced by events to the input layer
since 2.6.20.
Who: Len Brown <len.brown@intel.com>
---------------------------
What: /proc/acpi/event What: /proc/acpi/event
When: February 2008 When: February 2008
Why: /proc/acpi/event has been replaced by events via the input layer Why: /proc/acpi/event has been replaced by events via the input layer

View File

@ -78,8 +78,6 @@ static int acpi_button_add(struct acpi_device *device);
static int acpi_button_remove(struct acpi_device *device, int type); static int acpi_button_remove(struct acpi_device *device, int type);
static int acpi_button_resume(struct acpi_device *device); static int acpi_button_resume(struct acpi_device *device);
static void acpi_button_notify(struct acpi_device *device, u32 event); static void acpi_button_notify(struct acpi_device *device, u32 event);
static int acpi_button_info_open_fs(struct inode *inode, struct file *file);
static int acpi_button_state_open_fs(struct inode *inode, struct file *file);
static struct acpi_driver acpi_button_driver = { static struct acpi_driver acpi_button_driver = {
.name = "button", .name = "button",
@ -101,22 +99,6 @@ struct acpi_button {
bool wakeup_enabled; bool wakeup_enabled;
}; };
static const struct file_operations acpi_button_info_fops = {
.owner = THIS_MODULE,
.open = acpi_button_info_open_fs,
.read = seq_read,
.llseek = seq_lseek,
.release = single_release,
};
static const struct file_operations acpi_button_state_fops = {
.owner = THIS_MODULE,
.open = acpi_button_state_open_fs,
.read = seq_read,
.llseek = seq_lseek,
.release = single_release,
};
static BLOCKING_NOTIFIER_HEAD(acpi_lid_notifier); static BLOCKING_NOTIFIER_HEAD(acpi_lid_notifier);
static struct acpi_device *lid_device; static struct acpi_device *lid_device;
@ -125,20 +107,7 @@ static struct acpi_device *lid_device;
-------------------------------------------------------------------------- */ -------------------------------------------------------------------------- */
static struct proc_dir_entry *acpi_button_dir; static struct proc_dir_entry *acpi_button_dir;
static struct proc_dir_entry *acpi_lid_dir;
static int acpi_button_info_seq_show(struct seq_file *seq, void *offset)
{
struct acpi_device *device = seq->private;
seq_printf(seq, "type: %s\n",
acpi_device_name(device));
return 0;
}
static int acpi_button_info_open_fs(struct inode *inode, struct file *file)
{
return single_open(file, acpi_button_info_seq_show, PDE(inode)->data);
}
static int acpi_button_state_seq_show(struct seq_file *seq, void *offset) static int acpi_button_state_seq_show(struct seq_file *seq, void *offset)
{ {
@ -158,77 +127,85 @@ static int acpi_button_state_open_fs(struct inode *inode, struct file *file)
return single_open(file, acpi_button_state_seq_show, PDE(inode)->data); return single_open(file, acpi_button_state_seq_show, PDE(inode)->data);
} }
static struct proc_dir_entry *acpi_power_dir; static const struct file_operations acpi_button_state_fops = {
static struct proc_dir_entry *acpi_sleep_dir; .owner = THIS_MODULE,
static struct proc_dir_entry *acpi_lid_dir; .open = acpi_button_state_open_fs,
.read = seq_read,
.llseek = seq_lseek,
.release = single_release,
};
static int acpi_button_add_fs(struct acpi_device *device) static int acpi_button_add_fs(struct acpi_device *device)
{ {
struct acpi_button *button = acpi_driver_data(device); struct acpi_button *button = acpi_driver_data(device);
struct proc_dir_entry *entry = NULL; struct proc_dir_entry *entry = NULL;
int ret = 0;
switch (button->type) { /* procfs I/F for ACPI lid device only */
case ACPI_BUTTON_TYPE_POWER: if (button->type != ACPI_BUTTON_TYPE_LID)
if (!acpi_power_dir) return 0;
acpi_power_dir = proc_mkdir(ACPI_BUTTON_SUBCLASS_POWER,
acpi_button_dir); if (acpi_button_dir || acpi_lid_dir) {
entry = acpi_power_dir; printk(KERN_ERR PREFIX "More than one Lid device found!\n");
break; return -EEXIST;
case ACPI_BUTTON_TYPE_SLEEP:
if (!acpi_sleep_dir)
acpi_sleep_dir = proc_mkdir(ACPI_BUTTON_SUBCLASS_SLEEP,
acpi_button_dir);
entry = acpi_sleep_dir;
break;
case ACPI_BUTTON_TYPE_LID:
if (!acpi_lid_dir)
acpi_lid_dir = proc_mkdir(ACPI_BUTTON_SUBCLASS_LID,
acpi_button_dir);
entry = acpi_lid_dir;
break;
} }
if (!entry) /* create /proc/acpi/button */
acpi_button_dir = proc_mkdir(ACPI_BUTTON_CLASS, acpi_root_dir);
if (!acpi_button_dir)
return -ENODEV; return -ENODEV;
acpi_device_dir(device) = proc_mkdir(acpi_device_bid(device), entry); /* create /proc/acpi/button/lid */
if (!acpi_device_dir(device)) acpi_lid_dir = proc_mkdir(ACPI_BUTTON_SUBCLASS_LID, acpi_button_dir);
return -ENODEV; if (!acpi_lid_dir) {
ret = -ENODEV;
goto remove_button_dir;
}
/* 'info' [R] */ /* create /proc/acpi/button/lid/LID/ */
entry = proc_create_data(ACPI_BUTTON_FILE_INFO, acpi_device_dir(device) = proc_mkdir(acpi_device_bid(device), acpi_lid_dir);
if (!acpi_device_dir(device)) {
ret = -ENODEV;
goto remove_lid_dir;
}
/* create /proc/acpi/button/lid/LID/state */
entry = proc_create_data(ACPI_BUTTON_FILE_STATE,
S_IRUGO, acpi_device_dir(device), S_IRUGO, acpi_device_dir(device),
&acpi_button_info_fops, device); &acpi_button_state_fops, device);
if (!entry) if (!entry) {
return -ENODEV; ret = -ENODEV;
goto remove_dev_dir;
/* show lid state [R] */
if (button->type == ACPI_BUTTON_TYPE_LID) {
entry = proc_create_data(ACPI_BUTTON_FILE_STATE,
S_IRUGO, acpi_device_dir(device),
&acpi_button_state_fops, device);
if (!entry)
return -ENODEV;
} }
return 0; done:
return ret;
remove_dev_dir:
remove_proc_entry(acpi_device_bid(device),
acpi_lid_dir);
acpi_device_dir(device) = NULL;
remove_lid_dir:
remove_proc_entry(ACPI_BUTTON_SUBCLASS_LID, acpi_button_dir);
remove_button_dir:
remove_proc_entry(ACPI_BUTTON_CLASS, acpi_root_dir);
goto done;
} }
static int acpi_button_remove_fs(struct acpi_device *device) static int acpi_button_remove_fs(struct acpi_device *device)
{ {
struct acpi_button *button = acpi_driver_data(device); struct acpi_button *button = acpi_driver_data(device);
if (acpi_device_dir(device)) { if (button->type != ACPI_BUTTON_TYPE_LID)
if (button->type == ACPI_BUTTON_TYPE_LID) return 0;
remove_proc_entry(ACPI_BUTTON_FILE_STATE,
acpi_device_dir(device));
remove_proc_entry(ACPI_BUTTON_FILE_INFO,
acpi_device_dir(device));
remove_proc_entry(acpi_device_bid(device), remove_proc_entry(ACPI_BUTTON_FILE_STATE,
acpi_device_dir(device)->parent); acpi_device_dir(device));
acpi_device_dir(device) = NULL; remove_proc_entry(acpi_device_bid(device),
} acpi_lid_dir);
acpi_device_dir(device) = NULL;
remove_proc_entry(ACPI_BUTTON_SUBCLASS_LID, acpi_button_dir);
remove_proc_entry(ACPI_BUTTON_CLASS, acpi_root_dir);
return 0; return 0;
} }
@ -468,32 +445,12 @@ static int acpi_button_remove(struct acpi_device *device, int type)
static int __init acpi_button_init(void) static int __init acpi_button_init(void)
{ {
int result; return acpi_bus_register_driver(&acpi_button_driver);
acpi_button_dir = proc_mkdir(ACPI_BUTTON_CLASS, acpi_root_dir);
if (!acpi_button_dir)
return -ENODEV;
result = acpi_bus_register_driver(&acpi_button_driver);
if (result < 0) {
remove_proc_entry(ACPI_BUTTON_CLASS, acpi_root_dir);
return -ENODEV;
}
return 0;
} }
static void __exit acpi_button_exit(void) static void __exit acpi_button_exit(void)
{ {
acpi_bus_unregister_driver(&acpi_button_driver); acpi_bus_unregister_driver(&acpi_button_driver);
if (acpi_power_dir)
remove_proc_entry(ACPI_BUTTON_SUBCLASS_POWER, acpi_button_dir);
if (acpi_sleep_dir)
remove_proc_entry(ACPI_BUTTON_SUBCLASS_SLEEP, acpi_button_dir);
if (acpi_lid_dir)
remove_proc_entry(ACPI_BUTTON_SUBCLASS_LID, acpi_button_dir);
remove_proc_entry(ACPI_BUTTON_CLASS, acpi_root_dir);
} }
module_init(acpi_button_init); module_init(acpi_button_init);