lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20091116145618.GF22476@home.pavel.comp>
Date:	Mon, 16 Nov 2009 17:56:18 +0300
From:	Paul Fertser <fercerpav@...il.com>
To:	Anton Vorontsov <avorontsov@...mvista.com>
Cc:	Anton Vorontsov <cbou@...l.ru>,
	David Woodhouse <dwmw2@...radead.org>,
	linux-kernel@...r.kernel.org, Pavel Machek <pavel@....cz>,
	zaurus-devel@....linuxtogo.org
Subject: Re: [RFC PATCH 1/2] power: implement platform battery driver

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@...il.com
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ