aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/acpi/button.c
diff options
context:
space:
mode:
authorBjorn Helgaas <bjorn.helgaas@hp.com>2009-04-08 11:39:49 -0400
committerLen Brown <len.brown@intel.com>2009-04-11 00:36:40 -0400
commit1bce81131c71064bc3163078f24545b839a31967 (patch)
treee11d1c2f70accf396c878d61796d55d143aedb54 /drivers/acpi/button.c
parente2fb9754d27513918a4936e8cbaad50ff56cfd3d (diff)
ACPI: button: use Linux style for getting driver_data
It's typical and slightly more compact to look up the driver_data structure by initializing the automatic variable at its definition. Signed-off-by: Bjorn Helgaas <bjorn.helgaas@hp.com> Signed-off-by: Len Brown <len.brown@intel.com>
Diffstat (limited to 'drivers/acpi/button.c')
-rw-r--r--drivers/acpi/button.c13
1 files changed, 4 insertions, 9 deletions
diff --git a/drivers/acpi/button.c b/drivers/acpi/button.c
index c4632366226f..8ef8f443f539 100644
--- a/drivers/acpi/button.c
+++ b/drivers/acpi/button.c
@@ -162,10 +162,8 @@ static struct proc_dir_entry *acpi_lid_dir;
162 162
163static int acpi_button_add_fs(struct acpi_device *device) 163static int acpi_button_add_fs(struct acpi_device *device)
164{ 164{
165 struct acpi_button *button = acpi_driver_data(device);
165 struct proc_dir_entry *entry = NULL; 166 struct proc_dir_entry *entry = NULL;
166 struct acpi_button *button;
167
168 button = acpi_driver_data(device);
169 167
170 switch (button->type) { 168 switch (button->type) {
171 case ACPI_BUTTON_TYPE_POWER: 169 case ACPI_BUTTON_TYPE_POWER:
@@ -291,9 +289,8 @@ static void acpi_button_notify(struct acpi_device *device, u32 event)
291 289
292static int acpi_button_resume(struct acpi_device *device) 290static int acpi_button_resume(struct acpi_device *device)
293{ 291{
294 struct acpi_button *button; 292 struct acpi_button *button = acpi_driver_data(device);
295 293
296 button = acpi_driver_data(device);
297 if (button->type == ACPI_BUTTON_TYPE_LID) 294 if (button->type == ACPI_BUTTON_TYPE_LID)
298 return acpi_lid_send_state(button); 295 return acpi_lid_send_state(button);
299 return 0; 296 return 0;
@@ -301,9 +298,9 @@ static int acpi_button_resume(struct acpi_device *device)
301 298
302static int acpi_button_add(struct acpi_device *device) 299static int acpi_button_add(struct acpi_device *device)
303{ 300{
304 int error;
305 struct acpi_button *button; 301 struct acpi_button *button;
306 struct input_dev *input; 302 struct input_dev *input;
303 int error;
307 304
308 button = kzalloc(sizeof(struct acpi_button), GFP_KERNEL); 305 button = kzalloc(sizeof(struct acpi_button), GFP_KERNEL);
309 if (!button) 306 if (!button)
@@ -419,9 +416,7 @@ static int acpi_button_add(struct acpi_device *device)
419 416
420static int acpi_button_remove(struct acpi_device *device, int type) 417static int acpi_button_remove(struct acpi_device *device, int type)
421{ 418{
422 struct acpi_button *button; 419 struct acpi_button *button = acpi_driver_data(device);
423
424 button = acpi_driver_data(device);
425 420
426 acpi_button_remove_fs(device); 421 acpi_button_remove_fs(device);
427 input_unregister_device(button->input); 422 input_unregister_device(button->input);