Re: [PATCH 1/1] power: bq20z75: add support for charge properties

From: rklein
Date: Fri Jan 14 2011 - 13:33:13 EST


On Fri, 2011-01-14 at 07:23 -0800, Anton Vorontsov wrote:
> On Thu, Jan 13, 2011 at 10:50:13AM -0800, rklein@xxxxxxxxxx wrote:
> [...]
> > +#define PROP_NEEDS_AMPS(PSP) \
> > + ((PSP == POWER_SUPPLY_PROP_CHARGE_NOW) || \
> > + (PSP == POWER_SUPPLY_PROP_CHARGE_FULL) || \
> > + (PSP == POWER_SUPPLY_PROP_CHARGE_FULL_DESIGN))
> > +
> > +#define PROP_NEEDS_WATTS(PSP) \
> > + ((PSP == POWER_SUPPLY_PROP_ENERGY_NOW) || \
> > + (PSP == POWER_SUPPLY_PROP_ENERGY_FULL) || \
> > + (PSP == POWER_SUPPLY_PROP_ENERGY_FULL_DESIGN))
>
> Ugh. Please, implement it as a function.
>
> And maybe place it somewhere into linux/power_supply.h?
>
> Something like this maybe?
>
> static inline bool power_supply_is_amp_prop(enum power_supply_property psp)
> {
> switch (psp) {
> case POWER_SUPPLY_PROP_CHARGE_NOW:
> case POWER_SUPPLY_PROP_CHARGE_FULL:
> case POWER_SUPPLY_PROP_CHARGE_FULL_DESIGN:
> <...>
> return 1;
> }
> return 0;
> }
>
> Thanks!
>
Will do, that seems a much smarter idea as this could be reused.

-rhyland

--
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/