Re: [PATCH v8 2/4] drivers/acpi: Introduce Platform Firmware Runtime Update device driver

From: Chen Yu
Date: Mon Nov 08 2021 - 07:09:08 EST


On Mon, Nov 08, 2021 at 11:20:22AM +0200, Andy Shevchenko wrote:
> On Sat, Nov 06, 2021 at 11:14:56PM +0800, Chen Yu wrote:
> > On Wed, Nov 03, 2021 at 07:32:09PM +0200, Andy Shevchenko wrote:
> > > On Wed, Nov 03, 2021 at 11:43:50PM +0800, Chen Yu wrote:
>
> ...
>
> > > > +enum cap_index {
> > > > + CAP_STATUS_IDX = 0,
> > > > + CAP_UPDATE_IDX = 1,
> > > > + CAP_CODE_TYPE_IDX = 2,
> > > > + CAP_FW_VER_IDX = 3,
> > > > + CAP_CODE_RT_VER_IDX = 4,
> > > > + CAP_DRV_TYPE_IDX = 5,
> > > > + CAP_DRV_RT_VER_IDX = 6,
> > > > + CAP_DRV_SVN_IDX = 7,
> > > > + CAP_PLAT_ID_IDX = 8,
> > > > + CAP_OEM_ID_IDX = 9,
> > > > + CAP_OEM_INFO_IDX = 10,
> > >
> > > > + CAP_NR_IDX = 11
> > >
> > > Assignment here doesn't make any sense (it just adds unneeded churn and
> > > burden). Same to the rest of similar cases below.
> > >
> > Greg mentioned that, we might need to "explicit about the numbers here, because it
> > is uncerntain this is guaranteed by all C compilers or not."
> > https://lore.kernel.org/lkml/YXj+QaMcCeV71XbI@xxxxxxxxx/
> > My understanding is that, this applys to both uapi headers and the kernel internal
> > headers.
>
> I was talking only about the last item. This is guaranteed to be LAST+1 by the
> C standard and any deviation from that is a compiler bug that must be fixed.
>
> The first elements may be explicitly defined so we will be sure they are always
> stay. Greg is right about it.
>
Ok, got it. Previously I've sent a v9 patch set that addressed the issues in v8, except
for this enum issue. I'll wait for a day or two, if there is no further comments on
v9, I'll send a refreshed v10 with this enum issue fixed.

thanks,
Chenyu