Linux Power Management development
 help / color / mirror / Atom feed
From: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
To: Matti Vaittinen <mazziesaccount@gmail.com>
Cc: "Matti Vaittinen" <matti.vaittinen@fi.rohmeurope.com>,
	"Matti Vaittinen" <matti.vaittinen@linux.dev>,
	"Andreas Kemnade" <andreas@kemnade.info>,
	"Sebastian Reichel" <sre@kernel.org>,
	linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org,
	"Kalle Niemi" <kaleposti@gmail.com>,
	"Topi Sonkajärvi" <sonkajarvi@hotmail.com>,
	"Mikko Mutanen" <mikko.mutanen@fi.rohmeurope.com>,
	"Markus Laine" <markus.laine@fi.rohmeurope.com>
Subject: Re: [PATCH 2/5] power: supply: bd71828: Fix current direction
Date: Tue, 11 Aug 2026 13:04:30 +0300	[thread overview]
Message-ID: <anrzrlmp7V_onPwo@ashevche-desk.local> (raw)
In-Reply-To: <440e5deb-8a2c-4379-bc58-e838b427e48e@gmail.com>

On Tue, Aug 11, 2026 at 11:46:59AM +0300, Matti Vaittinen wrote:
> On 10/08/2026 20:18, Andy Shevchenko wrote:
> > On Mon, Aug 10, 2026 at 01:09:07PM +0300, Matti Vaittinen wrote:

...

> > > static int bd71828_get_current_ds_adc(struct bd71828_power *pwr, int *curr, int
> > 
> > >   {
> > >   	__be16 tmp_curr;
> > >   	char *tmp = (char *)&tmp_curr;
> > > -	int dir = 1;
> > >   	int regs[] = { pwr->regs->ibat, pwr->regs->ibat_avg };
> > >   	int *vals[] = { curr, curr_avg };
> > >   	int ret, i;
> > 
> > > -	for (dir = 1, i = 0; i < ARRAY_SIZE(regs); i++) {
> > > +	for (i = 0; i < ARRAY_SIZE(regs); i++) {
> > 
> > 
> > While at it
> > 
> > 	for (unsigned int i = 0; i < ARRAY_SIZE(regs); i++) {
> > 
> > > +		int dir = 1;
> > 
> > 
> > ...and drop it from the top declaration.
> 
> Nope. I'm not a fan of introducing variables inside loop conditions. It's
> too easy for me to miss them. And, even if I liked the idea (and I don't),
> it is not a change related to the actual fix - and making it for this loop
> only would make the style inconsistent in this file.

This is a preferred style [1]. So, I would still do it independently on this
being a fix. This is practically a small change that's coupled with what you
are doing.  A separate patch would be an unneeded churn, indeed.

[1]: (sub-thread) https://lore.kernel.org/lkml/alCoTEDUY8AO9OzD@ashevche-desk.local/

-- 
With Best Regards,
Andy Shevchenko



  reply	other threads:[~2026-08-11 10:04 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-08-10 10:08 [PATCH 0/5] ROHM bd71828 power-supply fixes Matti Vaittinen
2026-08-10 10:08 ` [PATCH 1/5] power: supply: bd71815: Fix temperature reading Matti Vaittinen
2026-08-10 10:09 ` [PATCH 2/5] power: supply: bd71828: Fix current direction Matti Vaittinen
2026-08-10 17:18   ` Andy Shevchenko
2026-08-11  8:46     ` Matti Vaittinen
2026-08-11 10:04       ` Andy Shevchenko [this message]
2026-08-10 10:09 ` [PATCH 3/5] power: supply: bd71828: Drop duplicate power-supply property Matti Vaittinen
2026-08-10 18:01   ` Andy Shevchenko
2026-08-10 10:09 ` [PATCH 4/5] power: supply: bd71828: Do not hide errors Matti Vaittinen
2026-08-10 10:10 ` [PATCH 5/5] power: supply: bd99954: Drop bad register fields Matti Vaittinen
2026-08-10 18:03   ` Andy Shevchenko

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=anrzrlmp7V_onPwo@ashevche-desk.local \
    --to=andriy.shevchenko@linux.intel.com \
    --cc=andreas@kemnade.info \
    --cc=kaleposti@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pm@vger.kernel.org \
    --cc=markus.laine@fi.rohmeurope.com \
    --cc=matti.vaittinen@fi.rohmeurope.com \
    --cc=matti.vaittinen@linux.dev \
    --cc=mazziesaccount@gmail.com \
    --cc=mikko.mutanen@fi.rohmeurope.com \
    --cc=sonkajarvi@hotmail.com \
    --cc=sre@kernel.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