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

From: Anton Vorontsov
Date: Fri Jan 14 2011 - 10:24:00 EST


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!

--
Anton Vorontsov
Email: cbouatmailru@xxxxxxxxx
--
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/