From: Paul Fertser <fercerpav@gmail.com>
To: Anton Vorontsov <avorontsov@ru.mvista.com>
Cc: Anton Vorontsov <cbou@mail.ru>,
David Woodhouse <dwmw2@infradead.org>,
linux-kernel@vger.kernel.org, Pavel Machek <pavel@ucw.cz>,
zaurus-devel@www.linuxtogo.org
Subject: Re: [RFC PATCH 1/2] power: implement platform battery driver
Date: Mon, 16 Nov 2009 17:56:18 +0300 [thread overview]
Message-ID: <20091116145618.GF22476@home.pavel.comp> (raw)
In-Reply-To: <20091116010814.GB4927@oksana.dev.rtsoft.ru>
Hi,
On Mon, Nov 16, 2009 at 04:08:14AM +0300, Anton Vorontsov wrote:
> 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.
Of course, i thought about that. It seemed to me that it would tie platform
code and power_supply API a bit too much, so if you ever change the API,
the platform code would need to be changed as well. But if you think that
it is a non-issue, sure, i'll do it the way you suggest.
--
Be free, use free (http://www.gnu.org/philosophy/free-sw.html) software!
mailto:fercerpav@gmail.com
prev parent reply other threads:[~2009-11-16 14:55 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-11-10 2:37 [RFC PATCH 0/2] " Paul Fertser
2009-11-10 2:37 ` [RFC PATCH 1/2] " Paul Fertser
2009-11-10 2:37 ` [RFC PATCH 2/2] gta02: add support for platform_battery Paul Fertser
2009-11-10 13:21 ` [RFC PATCH 1/2] power: implement platform battery driver Pavel Machek
2009-11-10 16:22 ` Paul Fertser
2009-11-10 20:51 ` Pavel Machek
2009-11-16 1:08 ` Anton Vorontsov
2009-11-16 14:56 ` Paul Fertser [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20091116145618.GF22476@home.pavel.comp \
--to=fercerpav@gmail.com \
--cc=avorontsov@ru.mvista.com \
--cc=cbou@mail.ru \
--cc=dwmw2@infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=pavel@ucw.cz \
--cc=zaurus-devel@www.linuxtogo.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®