aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/acpi
diff options
context:
space:
mode:
authorBjorn Helgaas <bjorn.helgaas@hp.com>2009-04-08 11:39:59 -0400
committerLen Brown <len.brown@intel.com>2009-04-11 00:36:40 -0400
commit106c19e7b978e1b84ea5cabbd470a0ddced577c8 (patch)
treeeb3cbc966392a2cfa6b891397cb071e545c6980d /drivers/acpi
parentbf04a77227db76f163bc2355ef4e176794987be2 (diff)
ACPI: button: remove button->device pointer
We no longer need a pointer from struct acpi_button back to the struct acpi_device. Everywhere we used that pointer, we either already have, or can easily get, the acpi_device pointer without using the copy from acpi_button. So this patch removes the structure element. Signed-off-by: Bjorn Helgaas <bjorn.helgaas@hp.com> Signed-off-by: Len Brown <len.brown@intel.com>
Diffstat (limited to 'drivers/acpi')
-rw-r--r--drivers/acpi/button.c31
1 files changed, 13 insertions, 18 deletions
diff --git a/drivers/acpi/button.c b/drivers/acpi/button.c
index 9f6d2e6844a7..c8441627f68e 100644
--- a/drivers/acpi/button.c
+++ b/drivers/acpi/button.c
@@ -95,7 +95,6 @@ static struct acpi_driver acpi_button_driver = {
95}; 95};
96 96
97struct acpi_button { 97struct acpi_button {
98 struct acpi_device *device; /* Fixed button kludge */
99 unsigned int type; 98 unsigned int type;
100 struct input_dev *input; 99 struct input_dev *input;
101 char phys[32]; /* for input device */ 100 char phys[32]; /* for input device */
@@ -126,10 +125,10 @@ static struct proc_dir_entry *acpi_button_dir;
126 125
127static int acpi_button_info_seq_show(struct seq_file *seq, void *offset) 126static int acpi_button_info_seq_show(struct seq_file *seq, void *offset)
128{ 127{
129 struct acpi_button *button = seq->private; 128 struct acpi_device *device = seq->private;
130 129
131 seq_printf(seq, "type: %s\n", 130 seq_printf(seq, "type: %s\n",
132 acpi_device_name(button->device)); 131 acpi_device_name(device));
133 return 0; 132 return 0;
134} 133}
135 134
@@ -140,11 +139,11 @@ static int acpi_button_info_open_fs(struct inode *inode, struct file *file)
140 139
141static int acpi_button_state_seq_show(struct seq_file *seq, void *offset) 140static int acpi_button_state_seq_show(struct seq_file *seq, void *offset)
142{ 141{
143 struct acpi_button *button = seq->private; 142 struct acpi_device *device = seq->private;
144 acpi_status status; 143 acpi_status status;
145 unsigned long long state; 144 unsigned long long state;
146 145
147 status = acpi_evaluate_integer(button->device->handle, "_LID", NULL, &state); 146 status = acpi_evaluate_integer(device->handle, "_LID", NULL, &state);
148 seq_printf(seq, "state: %s\n", 147 seq_printf(seq, "state: %s\n",
149 ACPI_FAILURE(status) ? "unsupported" : 148 ACPI_FAILURE(status) ? "unsupported" :
150 (state ? "open" : "closed")); 149 (state ? "open" : "closed"));
@@ -198,8 +197,7 @@ static int acpi_button_add_fs(struct acpi_device *device)
198 /* 'info' [R] */ 197 /* 'info' [R] */
199 entry = proc_create_data(ACPI_BUTTON_FILE_INFO, 198 entry = proc_create_data(ACPI_BUTTON_FILE_INFO,
200 S_IRUGO, acpi_device_dir(device), 199 S_IRUGO, acpi_device_dir(device),
201 &acpi_button_info_fops, 200 &acpi_button_info_fops, device);
202 acpi_driver_data(device));
203 if (!entry) 201 if (!entry)
204 return -ENODEV; 202 return -ENODEV;
205 203
@@ -207,8 +205,7 @@ static int acpi_button_add_fs(struct acpi_device *device)
207 if (button->type == ACPI_BUTTON_TYPE_LID) { 205 if (button->type == ACPI_BUTTON_TYPE_LID) {
208 entry = proc_create_data(ACPI_BUTTON_FILE_STATE, 206 entry = proc_create_data(ACPI_BUTTON_FILE_STATE,
209 S_IRUGO, acpi_device_dir(device), 207 S_IRUGO, acpi_device_dir(device),
210 &acpi_button_state_fops, 208 &acpi_button_state_fops, device);
211 acpi_driver_data(device));
212 if (!entry) 209 if (!entry)
213 return -ENODEV; 210 return -ENODEV;
214 } 211 }
@@ -238,13 +235,13 @@ static int acpi_button_remove_fs(struct acpi_device *device)
238/* -------------------------------------------------------------------------- 235/* --------------------------------------------------------------------------
239 Driver Interface 236 Driver Interface
240 -------------------------------------------------------------------------- */ 237 -------------------------------------------------------------------------- */
241static int acpi_lid_send_state(struct acpi_button *button) 238static int acpi_lid_send_state(struct acpi_device *device)
242{ 239{
240 struct acpi_button *button = acpi_driver_data(device);
243 unsigned long long state; 241 unsigned long long state;
244 acpi_status status; 242 acpi_status status;
245 243
246 status = acpi_evaluate_integer(button->device->handle, "_LID", NULL, 244 status = acpi_evaluate_integer(device->handle, "_LID", NULL, &state);
247 &state);
248 if (ACPI_FAILURE(status)) 245 if (ACPI_FAILURE(status))
249 return -ENODEV; 246 return -ENODEV;
250 247
@@ -266,7 +263,7 @@ static void acpi_button_notify(struct acpi_device *device, u32 event)
266 case ACPI_BUTTON_NOTIFY_STATUS: 263 case ACPI_BUTTON_NOTIFY_STATUS:
267 input = button->input; 264 input = button->input;
268 if (button->type == ACPI_BUTTON_TYPE_LID) { 265 if (button->type == ACPI_BUTTON_TYPE_LID) {
269 acpi_lid_send_state(button); 266 acpi_lid_send_state(device);
270 } else { 267 } else {
271 int keycode = test_bit(KEY_SLEEP, input->keybit) ? 268 int keycode = test_bit(KEY_SLEEP, input->keybit) ?
272 KEY_SLEEP : KEY_POWER; 269 KEY_SLEEP : KEY_POWER;
@@ -277,8 +274,7 @@ static void acpi_button_notify(struct acpi_device *device, u32 event)
277 input_sync(input); 274 input_sync(input);
278 } 275 }
279 276
280 acpi_bus_generate_proc_event(button->device, event, 277 acpi_bus_generate_proc_event(device, event, ++button->pushed);
281 ++button->pushed);
282 break; 278 break;
283 default: 279 default:
284 ACPI_DEBUG_PRINT((ACPI_DB_INFO, 280 ACPI_DEBUG_PRINT((ACPI_DB_INFO,
@@ -292,7 +288,7 @@ static int acpi_button_resume(struct acpi_device *device)
292 struct acpi_button *button = acpi_driver_data(device); 288 struct acpi_button *button = acpi_driver_data(device);
293 289
294 if (button->type == ACPI_BUTTON_TYPE_LID) 290 if (button->type == ACPI_BUTTON_TYPE_LID)
295 return acpi_lid_send_state(button); 291 return acpi_lid_send_state(device);
296 return 0; 292 return 0;
297} 293}
298 294
@@ -307,7 +303,6 @@ static int acpi_button_add(struct acpi_device *device)
307 if (!button) 303 if (!button)
308 return -ENOMEM; 304 return -ENOMEM;
309 305
310 button->device = device;
311 device->driver_data = button; 306 device->driver_data = button;
312 307
313 button->input = input = input_allocate_device(); 308 button->input = input = input_allocate_device();
@@ -390,7 +385,7 @@ static int acpi_button_add(struct acpi_device *device)
390 if (error) 385 if (error)
391 goto err_remove_fs; 386 goto err_remove_fs;
392 if (button->type == ACPI_BUTTON_TYPE_LID) 387 if (button->type == ACPI_BUTTON_TYPE_LID)
393 acpi_lid_send_state(button); 388 acpi_lid_send_state(device);
394 389
395 if (device->wakeup.flags.valid) { 390 if (device->wakeup.flags.valid) {
396 /* Button's GPE is run-wake GPE */ 391 /* Button's GPE is run-wake GPE */