[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <Yw8uiAv95LbBh2FD@black.fi.intel.com>
Date: Wed, 31 Aug 2022 12:48:56 +0300
From: Mika Westerberg <mika.westerberg@...ux.intel.com>
To: Hans de Goede <hdegoede@...hat.com>
Cc: Andy Shevchenko <andriy.shevchenko@...ux.intel.com>,
linux-acpi@...r.kernel.org, linux-kernel@...r.kernel.org,
"Rafael J. Wysocki" <rafael@...nel.org>,
Len Brown <lenb@...nel.org>, Andy Shevchenko <andy@...nel.org>
Subject: Re: [PATCH v2 2/3] ACPI: PMIC: Replace open coded be16_to_cpu()
On Wed, Aug 31, 2022 at 11:37:21AM +0200, Hans de Goede wrote:
> Hi,
>
> 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 ;-)
Powered by blists - more mailing lists