From: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
To: David Laight <David.Laight@aculab.com>
Cc: 'Mika Westerberg' <mika.westerberg@linux.intel.com>,
Hans de Goede <hdegoede@redhat.com>,
"linux-acpi@vger.kernel.org" <linux-acpi@vger.kernel.org>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
"Rafael J. Wysocki" <rafael@kernel.org>,
Len Brown <lenb@kernel.org>, Andy Shevchenko <andy@kernel.org>
Subject: Re: [PATCH v2 2/3] ACPI: PMIC: Replace open coded be16_to_cpu()
Date: Wed, 31 Aug 2022 13:27:53 +0300 [thread overview]
Message-ID: <Yw83qaJVhoUdUgap@smile.fi.intel.com> (raw)
In-Reply-To: <bce5d03cd5ea4aa78ed679399dde0759@AcuMS.aculab.com>
On Wed, Aug 31, 2022 at 10:06:09AM +0000, David Laight wrote:
> From: Mika Westerberg
> > Sent: 31 August 2022 10:49
> > On Wed, Aug 31, 2022 at 11:37:21AM +0200, Hans de Goede wrote:
> > > On 8/31/22 11:34, Andy Shevchenko wrote:
> > > > On Wed, Aug 31, 2022 at 08:43:54AM +0300, Mika Westerberg wrote:
> > > >> On Tue, Aug 30, 2022 at 08:11:54PM +0300, Andy Shevchenko wrote:
> > > >>> -#define VR_MODE_DISABLED 0
> > > >>> -#define VR_MODE_AUTO BIT(0)
> > > >>> -#define VR_MODE_NORMAL BIT(1)
> > > >>> -#define VR_MODE_SWITCH BIT(2)
> > > >>> -#define VR_MODE_ECO (BIT(0)|BIT(1))
> > > >>> +#define PMIC_REG_MASK GENMASK(11, 0)
> > > >>> +
> > > >>> +#define VR_MODE_DISABLED (0 << 0)
> > > >>> +#define VR_MODE_AUTO (1 << 0)
> > > >>> +#define VR_MODE_NORMAL (2 << 0)
> > > >>> +#define VR_MODE_ECO (3 << 0)
> > > >>> +#define VR_MODE_SWITCH (4 << 0)
> > > >>
> > > >> IMHO this one is worse than what it was.
> > > >
> > > > I'm not sure why. Here is obvious wrong use of BIT() macro against
> > > > plain numbers. I can split it into a separate change with an explanation
> > > > of why it's better. But I think it doesn't worth the churn.
> > >
> > > FWIW I'm with Andy here, the VR_MODE_ECO clearly is trying
> > > to just say 3, so this is just a plain enum for values 0-4 and
> > > as such should not use the BIT macros.
> >
> > Yeah, enum would look better but the << 0 just makes me confused ;-)
>
> No idea what that code is doing.
> The values are all used to initialise a .bit structure member.
> So maybe BIT() is right.
> The _ECO value isn't used at all.
>
> Deeper analysis may be needed.
So, can you do that since you already started?
--
With Best Regards,
Andy Shevchenko
next prev parent reply other threads:[~2022-08-31 10:28 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-08-30 17:11 [PATCH v2 1/3] ACPI: PMIC: Use sizeof() instead of hard coded value Andy Shevchenko
2022-08-30 17:11 ` [PATCH v2 2/3] ACPI: PMIC: Replace open coded be16_to_cpu() Andy Shevchenko
2022-08-31 5:43 ` Mika Westerberg
2022-08-31 9:34 ` Andy Shevchenko
2022-08-31 9:37 ` Hans de Goede
2022-08-31 9:48 ` Mika Westerberg
2022-08-31 10:06 ` David Laight
2022-08-31 10:27 ` Andy Shevchenko [this message]
2022-08-30 17:11 ` [PATCH v2 3/3] ACPI: PMIC: Convert pr_*() to dev_*() printing macros Andy Shevchenko
2022-08-31 5:44 ` Mika Westerberg
2022-08-31 5:37 ` [PATCH v2 1/3] ACPI: PMIC: Use sizeof() instead of hard coded value Mika Westerberg
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=Yw83qaJVhoUdUgap@smile.fi.intel.com \
--to=andriy.shevchenko@linux.intel.com \
--cc=David.Laight@aculab.com \
--cc=andy@kernel.org \
--cc=hdegoede@redhat.com \
--cc=lenb@kernel.org \
--cc=linux-acpi@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mika.westerberg@linux.intel.com \
--cc=rafael@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