From: Robert P. J. Day Date: Wed, 6 Feb 2008 09:38:42 +0000 (-0800) Subject: rtc-s3c: Use is_power_of_2() macro for simplicity. X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=9974b6ea7b85a32f34f824443f47aa501c85ee8f;p=GitHub%2FLineageOS%2FG12%2Fandroid_kernel_amlogic_linux-4.9.git rtc-s3c: Use is_power_of_2() macro for simplicity. Use is_power_of_2() macro for simplicity. Signed-off-by: Robert P. J. Day Signed-off-by: Alessandro Zummo Cc: David Brownell Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- diff --git a/drivers/rtc/rtc-s3c.c b/drivers/rtc/rtc-s3c.c index e2041b4d0c85..86766f1f2496 100644 --- a/drivers/rtc/rtc-s3c.c +++ b/drivers/rtc/rtc-s3c.c @@ -20,6 +20,7 @@ #include #include #include +#include #include #include @@ -309,9 +310,7 @@ static int s3c_rtc_ioctl(struct device *dev, break; case RTC_IRQP_SET: - /* check for power of 2 */ - - if ((arg & (arg-1)) != 0 || arg < 1) { + if (!is_power_of_2(arg)) { ret = -EINVAL; goto exit; }