提交 1bce8113 编写于 作者: B Bjorn Helgaas 提交者: Len Brown

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: NBjorn Helgaas <bjorn.helgaas@hp.com>
Signed-off-by: NLen Brown <len.brown@intel.com>
上级 e2fb9754
...@@ -162,10 +162,8 @@ static struct proc_dir_entry *acpi_lid_dir; ...@@ -162,10 +162,8 @@ static struct proc_dir_entry *acpi_lid_dir;
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 proc_dir_entry *entry = NULL; struct proc_dir_entry *entry = NULL;
struct acpi_button *button;
button = acpi_driver_data(device);
switch (button->type) { switch (button->type) {
case ACPI_BUTTON_TYPE_POWER: case ACPI_BUTTON_TYPE_POWER:
...@@ -291,9 +289,8 @@ static void acpi_button_notify(struct acpi_device *device, u32 event) ...@@ -291,9 +289,8 @@ static void acpi_button_notify(struct acpi_device *device, u32 event)
static int acpi_button_resume(struct acpi_device *device) static int acpi_button_resume(struct acpi_device *device)
{ {
struct acpi_button *button; struct acpi_button *button = acpi_driver_data(device);
button = acpi_driver_data(device);
if (button->type == ACPI_BUTTON_TYPE_LID) if (button->type == ACPI_BUTTON_TYPE_LID)
return acpi_lid_send_state(button); return acpi_lid_send_state(button);
return 0; return 0;
...@@ -301,9 +298,9 @@ static int acpi_button_resume(struct acpi_device *device) ...@@ -301,9 +298,9 @@ static int acpi_button_resume(struct acpi_device *device)
static int acpi_button_add(struct acpi_device *device) static int acpi_button_add(struct acpi_device *device)
{ {
int error;
struct acpi_button *button; struct acpi_button *button;
struct input_dev *input; struct input_dev *input;
int error;
button = kzalloc(sizeof(struct acpi_button), GFP_KERNEL); button = kzalloc(sizeof(struct acpi_button), GFP_KERNEL);
if (!button) if (!button)
...@@ -419,9 +416,7 @@ static int acpi_button_add(struct acpi_device *device) ...@@ -419,9 +416,7 @@ 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)
{ {
struct acpi_button *button; struct acpi_button *button = acpi_driver_data(device);
button = acpi_driver_data(device);
acpi_button_remove_fs(device); acpi_button_remove_fs(device);
input_unregister_device(button->input); input_unregister_device(button->input);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册