lkml.org 
[lkml]   [2009]   [Nov]   [15]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [RFC PATCH 1/2] power: implement platform battery driver
Hi Paul,

On Tue, Nov 10, 2009 at 05:37:52AM +0300, Paul Fertser wrote:
[...]
> +static int platform_bat_get_property(struct power_supply *psy,
> + enum power_supply_property psp,
> + union power_supply_propval *val)
> +{
> + struct platform_battery *bat =
> + container_of(psy, struct platform_battery, psy);
> + size_t i;
> + int present = 1;
> +
> + if (bat->pdata->is_present)
> + present = bat->pdata->is_present();
> +
> + if (psp != POWER_SUPPLY_PROP_PRESENT && !present)
> + return -ENODEV;
> +
> + for (i = 0; i < psy->num_properties; i++)
> + if (psy->properties[i] == psp) {
> + val->intval = bat->pdata->get_property[i]();
> + return 0;
> + }

I'm not sure I like this. Why don't you just pass the enum
to pdata hook? So platform devices would just use a single
get_property function and a 'switch', like the rest of the
power supply drivers.

Thanks,

--
Anton Vorontsov
email: cbouatmailru@gmail.com
irc://irc.freenode.net/bd2


\
 
 \ /
  Last update: 2009-11-16 02:11    [W:0.078 / U:0.504 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site