From: Guenter Roeck Date: Mon, 15 Jul 2024 14:22:44 +0000 (-0700) Subject: hwmon: (max1668) Use BIT macro X-Git-Tag: v6.12-rc1~150^2~65 X-Git-Url: https://git.kernel.dk/?a=commitdiff_plain;h=696dbe45fb1739eee853b1a110b5001b898031c8;p=linux-block.git hwmon: (max1668) Use BIT macro Use bit macro to make the code easier to understand and reduce duplication. Reviewed-by: Tzung-Bi Shih Signed-off-by: Guenter Roeck --- diff --git a/drivers/hwmon/max1668.c b/drivers/hwmon/max1668.c index f5b5cc29da17..83085ed0ae7e 100644 --- a/drivers/hwmon/max1668.c +++ b/drivers/hwmon/max1668.c @@ -6,6 +6,7 @@ * some credit to Christoph Scheurer, but largely a rewrite */ +#include #include #include #include @@ -172,7 +173,7 @@ static ssize_t show_alarm(struct device *dev, struct device_attribute *attr, if (IS_ERR(data)) return PTR_ERR(data); - return sprintf(buf, "%u\n", (data->alarms >> index) & 0x1); + return sprintf(buf, "%u\n", !!(data->alarms & BIT(index))); } static ssize_t show_fault(struct device *dev, @@ -185,7 +186,7 @@ static ssize_t show_fault(struct device *dev, return PTR_ERR(data); return sprintf(buf, "%u\n", - (data->alarms & (1 << 12)) && data->temp[index] == 127); + (data->alarms & BIT(12)) && data->temp[index] == 127); } static ssize_t set_temp_max(struct device *dev,