Re: [rtc-linux] [RESEND PATCH] RTC: MAX77686: Add Maxim 77686 driver

From: Joe Perches
Date: Tue Dec 18 2012 - 20:00:43 EST


On Tue, 2012-12-18 at 16:30 -0800, Andrew Morton wrote:
> On Wed, 28 Nov 2012 15:50:57 +0900
> Jonghwa Lee <jonghwa3.lee@xxxxxxxxxxx> wrote:
>
> > Add driver for support max77686 rtc.
> > MAX77686 rtc support smpl and wtsr mode. It has two alarm register
> > which can be used for alarming to wake system up. This drvier uses regmap
> > to access its register.
> >
> > ...
> >
> > +static inline int max77686_rtc_calculate_wday(u8 shifted)
> > +{
> > + int counter = -1;
> > + while (shifted) {
> > + shifted >>= 1;
> > + counter++;
> > + }
> > + return counter;
> > +}
>
> We should be able to use log2() in here?

fls(shifted) - 1


--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/