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]
Date:	Wed, 7 May 2014 15:23:47 +0200
From:	Pavel Machek <pavel@....cz>
To:	Jenny Tc <jenny.tc@...el.com>
Cc:	linux-kernel@...r.kernel.org, dbaryshkov@...il.com,
	cbouatmailru@...il.com, anton.vorontsov@...aro.org,
	tony@...mide.com, linux-omap@...r.kernel.org
Subject: Re: [jenny.tc@...el.com: [RFC] power_supply: Introduce generic psy
 charging driver]

Hi!

> > > +#define PSY_MAX_CV(psy) \
> > > +		psy_get_ps_int_property(psy,\
> > > +			POWER_SUPPLY_PROP_CONSTANT_CHARGE_VOLTAGE_MAX)
> > > +#define PSY_VOLTAGE_NOW(psy) \
> > > +		psy_get_ps_int_property(psy, POWER_SUPPLY_PROP_VOLTAGE_NOW)
> > > +#define PSY_VOLTAGE_OCV(psy) \
> > > +		psy_get_ps_int_property(psy, POWER_SUPPLY_PROP_VOLTAGE_OCV)
> > > +#define PSY_CURRENT_NOW(psy) \
> > > +		psy_get_ps_int_property(psy, POWER_SUPPLY_PROP_CURRENT_NOW)
> > > +#define PSY_STATUS(psy) \
> > > +		psy_get_ps_int_property(psy, POWER_SUPPLY_PROP_STATUS)
> > > +#define PSY_TEMPERATURE(psy) \
> > > +		psy_get_ps_int_property(psy, POWER_SUPPLY_PROP_TEMP)
> > > +#define PSY_BATTERY_TYPE(psy) \
> > > +		psy_get_ps_int_property(psy, POWER_SUPPLY_PROP_TECHNOLOGY)
> > > +#define PSY_ONLINE(psy) \
> > > +		psy_get_ps_int_property(psy, POWER_SUPPLY_PROP_ONLINE)
> > 
> > This looks like bad idea. Just opencode it.
> 
> This was to make it more readable, and avoids open codes in multiple places.
> Initially Anton had positive thoughts about this. Isn't it more readable with
> the macros?

Well... I'd expect PSY_ONLINE() macro to do something like (psy &
0x01), not call function. Yes, it is shorter, but IMO it is not
clearer.

But if Anton likes it...

									Pavel
-- 
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html
--
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