drivers/acpi/button.c | 27 ++++++++++----------------- 1 file changed, 10 insertions(+), 17 deletions(-)
From: "Rafael J. Wysocki" <rafael.j.wysocki@intel.com>
Two switch () statements in acpi_button_probe() operate on the same
value and the statements between them can be reordered with respect
to the second one, so merge them.
No intentional functional impact.
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
---
drivers/acpi/button.c | 27 ++++++++++-----------------
1 file changed, 10 insertions(+), 17 deletions(-)
diff --git a/drivers/acpi/button.c b/drivers/acpi/button.c
index f0d29870b926..c035741e5abf 100644
--- a/drivers/acpi/button.c
+++ b/drivers/acpi/button.c
@@ -582,14 +582,19 @@ static int acpi_button_probe(struct platform_device *pdev)
switch (button_type) {
case ACPI_BUTTON_TYPE_LID:
input->name = ACPI_BUTTON_DEVICE_NAME_LID;
+ input_set_capability(input, EV_SW, SW_LID);
+ input->open = acpi_lid_input_open;
+
handler = acpi_lid_notify;
sprintf(class, "%s/%s",
ACPI_BUTTON_CLASS, ACPI_BUTTON_SUBCLASS_LID);
- input->open = acpi_lid_input_open;
break;
case ACPI_BUTTON_TYPE_POWER:
input->name = ACPI_BUTTON_DEVICE_NAME_POWER;
+ input_set_capability(input, EV_KEY, KEY_POWER);
+ input_set_capability(input, EV_KEY, KEY_WAKEUP);
+
handler = acpi_button_notify;
sprintf(class, "%s/%s",
ACPI_BUTTON_CLASS, ACPI_BUTTON_SUBCLASS_POWER);
@@ -597,6 +602,8 @@ static int acpi_button_probe(struct platform_device *pdev)
case ACPI_BUTTON_TYPE_SLEEP:
input->name = ACPI_BUTTON_DEVICE_NAME_SLEEP;
+ input_set_capability(input, EV_KEY, KEY_SLEEP);
+
handler = acpi_button_notify;
sprintf(class, "%s/%s",
ACPI_BUTTON_CLASS, ACPI_BUTTON_SUBCLASS_SLEEP);
@@ -613,28 +620,14 @@ static int acpi_button_probe(struct platform_device *pdev)
goto err_free_button;
}
- snprintf(button->phys, sizeof(button->phys), "%s/button/input0", id->id);
+ snprintf(button->phys, sizeof(button->phys), "%s/button/input0",
+ acpi_device_hid(device));
input->phys = button->phys;
input->id.bustype = BUS_HOST;
input->id.product = button_type;
input->dev.parent = dev;
- switch (button_type) {
- case ACPI_BUTTON_TYPE_POWER:
- input_set_capability(input, EV_KEY, KEY_POWER);
- input_set_capability(input, EV_KEY, KEY_WAKEUP);
- break;
-
- case ACPI_BUTTON_TYPE_SLEEP:
- input_set_capability(input, EV_KEY, KEY_SLEEP);
- break;
-
- case ACPI_BUTTON_TYPE_LID:
- input_set_capability(input, EV_SW, SW_LID);
- break;
- }
-
input_set_drvdata(input, button);
error = input_register_device(input);
if (error) {
--
2.51.0
© 2016 - 2026 Red Hat, Inc.