[PATCH v1 05/15] ACPI: button: Eliminate ternary operator from acpi_lid_evaluate_state()

From: Rafael J. Wysocki

Date: Mon Jun 01 2026 - 13:19:48 EST


From: "Rafael J. Wysocki" <rafael.j.wysocki@xxxxxxxxx>

The ternary operator in acpi_lid_evaluate_state() is not actually needed
because the same result can be achieved by applying the !! operator to
the lid_state value, so update the code accordingly.

No intentional functional impact.

Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@xxxxxxxxx>
---
drivers/acpi/button.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/acpi/button.c b/drivers/acpi/button.c
index 21a10da8b60b..ae97c83bae2c 100644
--- a/drivers/acpi/button.c
+++ b/drivers/acpi/button.c
@@ -201,7 +201,7 @@ static int acpi_lid_evaluate_state(acpi_handle lid_handle)
if (ACPI_FAILURE(status))
return -ENODEV;

- return lid_state ? 1 : 0;
+ return !!lid_state;
}

static int acpi_lid_notify_state(struct acpi_button *button, bool state)
--
2.51.0