[PATCH] ACPICA: Make check to install handler more obviously correct

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



The loop

	for (i = 0; i < ACPI_NUM_NOTIFY_TYPES; i++) {
		if (handler_type & (i + 1)) {
			...
		}
	}

looks strange. Only with knowing that ACPI_NUM_NOTIFY_TYPES == 2 you can
see that the two least significant bits are checked. Still replace

	i + 1

by

	1 << i

which shouldn't make a relevant difference to compiler and compiled
code, but is easier to understand for a human code reader.

Signed-off-by: Uwe Kleine-König <u.kleine-koenig@xxxxxxxxxxxxxx>
---
 drivers/acpi/acpica/evxface.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/acpi/acpica/evxface.c b/drivers/acpi/acpica/evxface.c
index 18219abba108..d1b3411d2449 100644
--- a/drivers/acpi/acpica/evxface.c
+++ b/drivers/acpi/acpica/evxface.c
@@ -170,7 +170,7 @@ acpi_install_notify_handler(acpi_handle device,
 	/* Install the handler at the list head(s) */
 
 	for (i = 0; i < ACPI_NUM_NOTIFY_TYPES; i++) {
-		if (handler_type & (i + 1)) {
+		if (handler_type & (1 << i)) {
 			handler_obj->notify.next[i] =
 			    obj_desc->common_notify.notify_list[i];
 

base-commit: fe15c26ee26efa11741a7b632e9f23b01aca4cc6
-- 
2.39.2




[Index of Archives]     [Linux IBM ACPI]     [Linux Power Management]     [Linux Kernel]     [Linux Laptop]     [Kernel Newbies]     [Share Photos]     [Security]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Samba]     [Video 4 Linux]     [Device Mapper]     [Linux Resources]
  Powered by Linux