diff options
| author | Len Brown <len.brown@intel.com> | 2011-03-22 23:20:49 -0400 |
|---|---|---|
| committer | Len Brown <len.brown@intel.com> | 2011-03-22 23:20:49 -0400 |
| commit | 2935b544041bbdc32a6864ba9350a7629c56d722 (patch) | |
| tree | de60ec2bbff1dfe8c1318d6eb02e3d7aae48d262 | |
| parent | 25076246e80c0c48cc4c9115335b83343b9dc727 (diff) | |
| parent | 912b7427fc13467bac042cc72f2eccbdbc39d773 (diff) | |
Merge branch 'button-cleanup' into release
| -rw-r--r-- | Documentation/feature-removal-schedule.txt | 8 | ||||
| -rw-r--r-- | drivers/acpi/button.c | 163 |
2 files changed, 60 insertions, 111 deletions
diff --git a/Documentation/feature-removal-schedule.txt b/Documentation/feature-removal-schedule.txt index b3f35e5f9c95..e4615253ba89 100644 --- a/Documentation/feature-removal-schedule.txt +++ b/Documentation/feature-removal-schedule.txt | |||
| @@ -259,14 +259,6 @@ Who: Zhang Rui <rui.zhang@intel.com> | |||
| 259 | 259 | ||
| 260 | --------------------------- | 260 | --------------------------- |
| 261 | 261 | ||
| 262 | What: /proc/acpi/button | ||
| 263 | When: August 2007 | ||
| 264 | Why: /proc/acpi/button has been replaced by events to the input layer | ||
| 265 | since 2.6.20. | ||
| 266 | Who: Len Brown <len.brown@intel.com> | ||
| 267 | |||
| 268 | --------------------------- | ||
| 269 | |||
| 270 | What: /proc/acpi/event | 262 | What: /proc/acpi/event |
| 271 | When: February 2008 | 263 | When: February 2008 |
| 272 | Why: /proc/acpi/event has been replaced by events via the input layer | 264 | Why: /proc/acpi/event has been replaced by events via the input layer |
diff --git a/drivers/acpi/button.c b/drivers/acpi/button.c index 12c28f4adb67..d27d072472f9 100644 --- a/drivers/acpi/button.c +++ b/drivers/acpi/button.c | |||
| @@ -78,8 +78,6 @@ static int acpi_button_add(struct acpi_device *device); | |||
| 78 | static int acpi_button_remove(struct acpi_device *device, int type); | 78 | static int acpi_button_remove(struct acpi_device *device, int type); |
| 79 | static int acpi_button_resume(struct acpi_device *device); | 79 | static int acpi_button_resume(struct acpi_device *device); |
| 80 | static void acpi_button_notify(struct acpi_device *device, u32 event); | 80 | static void acpi_button_notify(struct acpi_device *device, u32 event); |
| 81 | static int acpi_button_info_open_fs(struct inode *inode, struct file *file); | ||
| 82 | static int acpi_button_state_open_fs(struct inode *inode, struct file *file); | ||
| 83 | 81 | ||
| 84 | static struct acpi_driver acpi_button_driver = { | 82 | static struct acpi_driver acpi_button_driver = { |
| 85 | .name = "button", | 83 | .name = "button", |
| @@ -101,22 +99,6 @@ struct acpi_button { | |||
| 101 | bool wakeup_enabled; | 99 | bool wakeup_enabled; |
| 102 | }; | 100 | }; |
| 103 | 101 | ||
| 104 | static const struct file_operations acpi_button_info_fops = { | ||
| 105 | .owner = THIS_MODULE, | ||
| 106 | .open = acpi_button_info_open_fs, | ||
| 107 | .read = seq_read, | ||
| 108 | .llseek = seq_lseek, | ||
| 109 | .release = single_release, | ||
| 110 | }; | ||
| 111 | |||
| 112 | static const struct file_operations acpi_button_state_fops = { | ||
| 113 | .owner = THIS_MODULE, | ||
| 114 | .open = acpi_button_state_open_fs, | ||
| 115 | .read = seq_read, | ||
| 116 | .llseek = seq_lseek, | ||
| 117 | .release = single_release, | ||
| 118 | }; | ||
| 119 | |||
| 120 | static BLOCKING_NOTIFIER_HEAD(acpi_lid_notifier); | 102 | static BLOCKING_NOTIFIER_HEAD(acpi_lid_notifier); |
| 121 | static struct acpi_device *lid_device; | 103 | static struct acpi_device *lid_device; |
| 122 | 104 | ||
| @@ -125,20 +107,7 @@ static struct acpi_device *lid_device; | |||
| 125 | -------------------------------------------------------------------------- */ | 107 | -------------------------------------------------------------------------- */ |
| 126 | 108 | ||
| 127 | static struct proc_dir_entry *acpi_button_dir; | 109 | static struct proc_dir_entry *acpi_button_dir; |
| 128 | 110 | static struct proc_dir_entry *acpi_lid_dir; | |
| 129 | static int acpi_button_info_seq_show(struct seq_file *seq, void *offset) | ||
| 130 | { | ||
| 131 | struct acpi_device *device = seq->private; | ||
| 132 | |||
| 133 | seq_printf(seq, "type: %s\n", | ||
| 134 | acpi_device_name(device)); | ||
| 135 | return 0; | ||
| 136 | } | ||
| 137 | |||
| 138 | static int acpi_button_info_open_fs(struct inode *inode, struct file *file) | ||
| 139 | { | ||
| 140 | return single_open(file, acpi_button_info_seq_show, PDE(inode)->data); | ||
| 141 | } | ||
| 142 | 111 | ||
| 143 | static int acpi_button_state_seq_show(struct seq_file *seq, void *offset) | 112 | static int acpi_button_state_seq_show(struct seq_file *seq, void *offset) |
| 144 | { | 113 | { |
| @@ -158,77 +127,85 @@ static int acpi_button_state_open_fs(struct inode *inode, struct file *file) | |||
| 158 | return single_open(file, acpi_button_state_seq_show, PDE(inode)->data); | 127 | return single_open(file, acpi_button_state_seq_show, PDE(inode)->data); |
| 159 | } | 128 | } |
| 160 | 129 | ||
| 161 | static struct proc_dir_entry *acpi_power_dir; | 130 | static const struct file_operations acpi_button_state_fops = { |
| 162 | static struct proc_dir_entry *acpi_sleep_dir; | 131 | .owner = THIS_MODULE, |
| 163 | static struct proc_dir_entry *acpi_lid_dir; | 132 | .open = acpi_button_state_open_fs, |
| 133 | .read = seq_read, | ||
| 134 | .llseek = seq_lseek, | ||
| 135 | .release = single_release, | ||
| 136 | }; | ||
| 164 | 137 | ||
| 165 | static int acpi_button_add_fs(struct acpi_device *device) | 138 | static int acpi_button_add_fs(struct acpi_device *device) |
| 166 | { | 139 | { |
| 167 | struct acpi_button *button = acpi_driver_data(device); | 140 | struct acpi_button *button = acpi_driver_data(device); |
| 168 | struct proc_dir_entry *entry = NULL; | 141 | struct proc_dir_entry *entry = NULL; |
| 142 | int ret = 0; | ||
| 169 | 143 | ||
| 170 | switch (button->type) { | 144 | /* procfs I/F for ACPI lid device only */ |
| 171 | case ACPI_BUTTON_TYPE_POWER: | 145 | if (button->type != ACPI_BUTTON_TYPE_LID) |
| 172 | if (!acpi_power_dir) | 146 | return 0; |
| 173 | acpi_power_dir = proc_mkdir(ACPI_BUTTON_SUBCLASS_POWER, | 147 | |
| 174 | acpi_button_dir); | 148 | if (acpi_button_dir || acpi_lid_dir) { |
| 175 | entry = acpi_power_dir; | 149 | printk(KERN_ERR PREFIX "More than one Lid device found!\n"); |
| 176 | break; | 150 | return -EEXIST; |
| 177 | case ACPI_BUTTON_TYPE_SLEEP: | ||
| 178 | if (!acpi_sleep_dir) | ||
| 179 | acpi_sleep_dir = proc_mkdir(ACPI_BUTTON_SUBCLASS_SLEEP, | ||
| 180 | acpi_button_dir); | ||
| 181 | entry = acpi_sleep_dir; | ||
| 182 | break; | ||
| 183 | case ACPI_BUTTON_TYPE_LID: | ||
| 184 | if (!acpi_lid_dir) | ||
| 185 | acpi_lid_dir = proc_mkdir(ACPI_BUTTON_SUBCLASS_LID, | ||
| 186 | acpi_button_dir); | ||
| 187 | entry = acpi_lid_dir; | ||
| 188 | break; | ||
| 189 | } | 151 | } |
| 190 | 152 | ||
| 191 | if (!entry) | 153 | /* create /proc/acpi/button */ |
| 154 | acpi_button_dir = proc_mkdir(ACPI_BUTTON_CLASS, acpi_root_dir); | ||
| 155 | if (!acpi_button_dir) | ||
| 192 | return -ENODEV; | 156 | return -ENODEV; |
| 193 | 157 | ||
| 194 | acpi_device_dir(device) = proc_mkdir(acpi_device_bid(device), entry); | 158 | /* create /proc/acpi/button/lid */ |
| 195 | if (!acpi_device_dir(device)) | 159 | acpi_lid_dir = proc_mkdir(ACPI_BUTTON_SUBCLASS_LID, acpi_button_dir); |
| 196 | return -ENODEV; | 160 | if (!acpi_lid_dir) { |
| 161 | ret = -ENODEV; | ||
| 162 | goto remove_button_dir; | ||
| 163 | } | ||
| 197 | 164 | ||
| 198 | /* 'info' [R] */ | 165 | /* create /proc/acpi/button/lid/LID/ */ |
| 199 | entry = proc_create_data(ACPI_BUTTON_FILE_INFO, | 166 | acpi_device_dir(device) = proc_mkdir(acpi_device_bid(device), acpi_lid_dir); |
| 200 | S_IRUGO, acpi_device_dir(device), | 167 | if (!acpi_device_dir(device)) { |
| 201 | &acpi_button_info_fops, device); | 168 | ret = -ENODEV; |
| 202 | if (!entry) | 169 | goto remove_lid_dir; |
| 203 | return -ENODEV; | 170 | } |
| 204 | 171 | ||
| 205 | /* show lid state [R] */ | 172 | /* create /proc/acpi/button/lid/LID/state */ |
| 206 | if (button->type == ACPI_BUTTON_TYPE_LID) { | 173 | entry = proc_create_data(ACPI_BUTTON_FILE_STATE, |
| 207 | entry = proc_create_data(ACPI_BUTTON_FILE_STATE, | 174 | S_IRUGO, acpi_device_dir(device), |
| 208 | S_IRUGO, acpi_device_dir(device), | 175 | &acpi_button_state_fops, device); |
| 209 | &acpi_button_state_fops, device); | 176 | if (!entry) { |
| 210 | if (!entry) | 177 | ret = -ENODEV; |
| 211 | return -ENODEV; | 178 | goto remove_dev_dir; |
| 212 | } | 179 | } |
| 213 | 180 | ||
| 214 | return 0; | 181 | done: |
| 182 | return ret; | ||
| 183 | |||
| 184 | remove_dev_dir: | ||
| 185 | remove_proc_entry(acpi_device_bid(device), | ||
| 186 | acpi_lid_dir); | ||
| 187 | acpi_device_dir(device) = NULL; | ||
| 188 | remove_lid_dir: | ||
| 189 | remove_proc_entry(ACPI_BUTTON_SUBCLASS_LID, acpi_button_dir); | ||
| 190 | remove_button_dir: | ||
| 191 | remove_proc_entry(ACPI_BUTTON_CLASS, acpi_root_dir); | ||
