Commit ce9c2f44 authored by Robert P. J. Day's avatar Robert P. J. Day Committed by Mark M. Hoffman

hwmon: (adt7470) Replace power-of-two test

Since <linux/log2.h> already supplies a power-of-two test, there's no
point in having this source file redefine it again.
Signed-off-by: default avatarRobert P. J. Day <rpjday@crashcourse.ca>
Acked-by: default avatarJean Delvare <khali@linux-fr.org>
Signed-off-by: default avatarMark M. Hoffman <mhoffman@lightlink.com>
parent 5aebefb0
...@@ -114,8 +114,6 @@ I2C_CLIENT_INSMOD_1(adt7470); ...@@ -114,8 +114,6 @@ I2C_CLIENT_INSMOD_1(adt7470);
/* sleep 1s while gathering temperature data */ /* sleep 1s while gathering temperature data */
#define TEMP_COLLECTION_TIME 1000 #define TEMP_COLLECTION_TIME 1000
#define power_of_2(x) (((x) & ((x) - 1)) == 0)
/* datasheet says to divide this number by the fan reading to get fan rpm */ /* datasheet says to divide this number by the fan reading to get fan rpm */
#define FAN_PERIOD_TO_RPM(x) ((90000 * 60) / (x)) #define FAN_PERIOD_TO_RPM(x) ((90000 * 60) / (x))
#define FAN_RPM_TO_PERIOD FAN_PERIOD_TO_RPM #define FAN_RPM_TO_PERIOD FAN_PERIOD_TO_RPM
...@@ -677,7 +675,7 @@ static int cvt_auto_temp(int input) ...@@ -677,7 +675,7 @@ static int cvt_auto_temp(int input)
{ {
if (input == ADT7470_PWM_ALL_TEMPS) if (input == ADT7470_PWM_ALL_TEMPS)
return 0; return 0;
if (input < 1 || !power_of_2(input)) if (input < 1 || !is_power_of_2(input))
return -EINVAL; return -EINVAL;
return ilog2(input) + 1; return ilog2(input) + 1;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment