mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Anton Vorontsov <avorontsov@ru.mvista.com>
To: Paul Fertser <fercerpav@gmail.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 04:08:14 +0300	[thread overview]
Message-ID: <20091116010814.GB4927@oksana.dev.rtsoft.ru> (raw)
In-Reply-To: <1257820673-30801-2-git-send-email-fercerpav@gmail.com>

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

  parent reply	other threads:[~2009-11-16  1:08 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 [this message]
2009-11-16 14:56     ` Paul Fertser

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=20091116010814.GB4927@oksana.dev.rtsoft.ru \
    --to=avorontsov@ru.mvista.com \
    --cc=cbou@mail.ru \
    --cc=dwmw2@infradead.org \
    --cc=fercerpav@gmail.com \
    --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®