Re: [PATCH 2/4] power_supply: Introduce generic psy charging driver

From: Pavel Machek
Date: Fri Mar 07 2014 - 15:10:03 EST


Hi!

> >> > +++ b/include/linux/power/power_supply_charger.h
> >>
> >> > +#define MAX_CUR_VOLT_SAMPLES 3
> >> > +#define DEF_CUR_VOLT_SAMPLE_JIFF (30*HZ)
> >>
> >> Why are things defined in Jiffies like this insead of seconds, milliseconds
> >> etc? This will vary with the current operating frequency of the system,
> >> why should physical measurements do that?
> >
> > Is it fine if I use msecs_to_jiffies(30000)?
>
> Keep the
> #define DEF_CUR_VOLT_SAMPLE_PERIOD 30000
>
> Then use msecs_to_jiffies(DEF_CUR_VOLT_SAMPLE_PERIOD)
> in the call site.

Actually, I do not think this is good suggestion. 30*HZ -- is pretty
clearly 30 seconds. 30000 may be 30sec or 30msec ... hard to tell.

If the constant is used in just one place, maybe you don't need the
define?
Pavel
--
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html
--
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/