Re: [PATCH 18/57] power: Add sysfs interfaces for capacity

From: Anton Vorontsov
Date: Fri Sep 28 2012 - 15:14:26 EST


On Fri, Sep 28, 2012 at 12:26:08PM -0600, Mathieu Poirier wrote:
> On 12-09-27 01:08 AM, Anton Vorontsov wrote:
> > On Tue, Sep 25, 2012 at 10:12:15AM -0600, mathieu.poirier@xxxxxxxxxx wrote:
> >> From: Daniel WILLERUD <daniel.willerud@xxxxxxxxxxxxxx>
> >>
> >> Switchable depending on whether capacity scaling is enabled
> >>
> >> Signed-off-by: Marcus Cooper <marcus.xm.cooper@xxxxxxxxxxxxxx>
> >> Signed-off-by: Daniel WILLERUD <daniel.willerud@xxxxxxxxxxxxxx>
> >> Signed-off-by: Mathieu Poirier <mathieu.poirier@xxxxxxxxxx>
> >> Reviewed-by: Jonas ABERG <jonas.aberg@xxxxxxxxxxxxxx>
> >> ---
> >> drivers/power/ab8500_fg.c | 57 ++++++++++++++++++++++++++++++++++++++++++++-
> >> 1 files changed, 56 insertions(+), 1 deletions(-)
> >>
> >> diff --git a/drivers/power/ab8500_fg.c b/drivers/power/ab8500_fg.c
> >> index 8507254..46010ec 100644
> >> --- a/drivers/power/ab8500_fg.c
> >> +++ b/drivers/power/ab8500_fg.c
> >> @@ -266,7 +266,6 @@ static enum power_supply_property ab8500_fg_props[] = {
> >> POWER_SUPPLY_PROP_CHARGE_FULL_DESIGN,
> >> POWER_SUPPLY_PROP_CHARGE_FULL,
> >> POWER_SUPPLY_PROP_CHARGE_NOW,
> >> - POWER_SUPPLY_PROP_CAPACITY,
> > [...]
> >> +static struct device_attribute ab8500_fg_sysfs_psy_attrs[] = {
> >> + __ATTR(capacity, S_IRUGO, ab8500_show_capacity, NULL),
> >> +};
> >
> > I don't understand the rationale behind this patch. Why remove normal
> > power supply property, and make your own with the same name? Something
> > isn't right...
>
> The similarity in the naming convention it a coincidence here. In one
> case it's a enum and the other sysfs attribute. Could you expand on
> your suspicions ?

>From the userland point of view, how would the new attribute look like?

Originally the driver reported capacity via power supply class, i.e.
PROP_CAPACITY, now you change to your own attribute.. so the question is
why you do this.

If you need optional attributes, it is still possible to make this w/o
introducing your own attributes mechanisms.

Thanks,
Anton.
--
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/