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 for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-id: <000001cf1cc3$7747ac20$65d70460$%han@samsung.com>
Date:	Wed, 29 Jan 2014 16:26:45 +0900
From:	Jingoo Han <jg1.han@...sung.com>
To:	'Jenny Tc' <jenny.tc@...el.com>, 'Pavel Machek' <pavel@....cz>
Cc:	linux-kernel@...r.kernel.org,
	'Dmitry Eremin-Solenikov' <dbaryshkov@...il.com>,
	'Anton Vorontsov' <cbouatmailru@...il.com>,
	'Anton Vorontsov' <anton.vorontsov@...aro.org>,
	'Kim Milo' <Milo.Kim@...com>,
	'Lee Jones' <lee.jones@...aro.org>,
	'Chanwoo Choi' <cw00.choi@...sung.com>,
	'Sachin Kamat' <sachin.kamat@...aro.org>,
	'Rupesh Kumar' <rupesh.kumar@...ricsson.com>,
	'Lars-Peter Clausen' <lars@...afoo.de>,
	'Pali Roh?r' <pali.rohar@...il.com>,
	'Mark Brown' <broonie@...nsource.wolfsonmicro.com>,
	'Rhyland Klein' <rklein@...dia.com>,
	'David Woodhouse' <dwmw2@...radead.org>,
	'Tony Lindgren' <tony@...mide.com>,
	'Russell King' <linux@....linux.org.uk>,
	'Sebastian Reichel' <sre@...g0.de>, aaro.koskinen@....fi,
	freemangordon@....bg, linux-omap@...r.kernel.org,
	'Jingoo Han' <jg1.han@...sung.com>
Subject: Re: [PATCH 4/4] power_supply: bq24261 charger driver

On Wednesday, January 29, 2014 10:24 PM, Jenny Tc wrote:
> On Tue, Jan 28, 2014 at 07:14:45AM -0700, Pavel Machek wrote:
> > > +#define BQ24261_ICHRG_MASK		(0x1F << 3)
> > > +#define BQ24261_ICHRG_100ma		(0x01 << 3)
> > > +#define BQ24261_ICHRG_200ma		(0x01 << 4)
> > > +#define BQ24261_ICHRG_400ma		(0x01 << 5)
> > > +#define BQ24261_ICHRG_800ma		(0x01 << 6)
> > > +#define BQ24261_ICHRG_1600ma		(0x01 << 7)
> >
> > First, its mA, not ma.
> 
> Camel Case allowed? Ignore Checkpatch.pl warning?

Yep, Camel Case is allowed by the commit d8b0771 "checkpatch:
extend CamelCase types and ignore existing CamelCase uses in
a patch".

Thus, the following cases are currently allowed.

#define BQ24261_ICHRG_1600ma           (0x01 << 7)
#define BQ24261_ICHRG_1600MA           (0x01 << 7)
#define BQ24261_ICHRG_1600mA           (0x01 << 7)
....

Best regards,
Jingoo Han

> > > +u16 bq24261_iterm[][2] = {
> > > +	{0, 0x00}
> > > +	,
> > > +	{50, BQ24261_ITERM_50ma}
> > > +	,
> > > +	{100, BQ24261_ITERM_100ma}
> > > +	,
> > > +	{150, BQ24261_ITERM_100ma | BQ24261_ITERM_50ma}
> >
> > ...this is very obscure way to do with table what can be done with
> >
> > (x/50) << 3, right ?
> 
> Few register settings need table mapping, but some can have logic as your
> comment say. Just wanted to keep same logic for all register settings.
> Doesn't it make more readable?
> 
> > > +u16 bq24261_cc[][2] = {
> > > +
> > > +	{500, 0x00}
> > > +	,
> > > +	{600, BQ24261_ICHRG_100ma}
> > > +	,
> > > +	{700, BQ24261_ICHRG_200ma}
> > > +	,
> > > +	{800, BQ24261_ICHRG_100ma | BQ24261_ICHRG_200ma}
> > > +	,
> > > +	{900, BQ24261_ICHRG_400ma}
> >
> > I suspect you can get rid of this, too, if you expand macros.
> Same as above comment.
> 
> -Jenny

--
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