Re: [PATCH][next] wifi: mt76: mt7921: Replace fake flex-arrays with flexible-array members

From: Simon Horman
Date: Mon Mar 20 2023 - 15:49:13 EST


On Mon, Mar 20, 2023 at 01:26:49PM -0600, Gustavo A. R. Silva wrote:
> On Mon, Mar 20, 2023 at 03:56:54PM +0100, Simon Horman wrote:
> > > struct mt7921_asar_cl {
> > > @@ -85,7 +85,7 @@ struct mt7921_asar_fg {
> > > u8 rsvd;
> > > u8 nr_flag;
> > > u8 rsvd1;
> > > - u8 flag[0];
> > > + u8 flag[];
> >
> > I am curious to know why DECLARE_FLEX_ARRAY isn't used here.
>
> In contrast to the other structs, there is no object of type struct
> mt7921_asar_fg declared in a union:
>
> 91 struct mt7921_acpi_sar {
> 92 u8 ver;
> 93 union {
> 94 struct mt7921_asar_dyn *dyn;
> 95 struct mt7921_asar_dyn_v2 *dyn_v2;
> 96 };
> 97 union {
> 98 struct mt7921_asar_geo *geo;
> 99 struct mt7921_asar_geo_v2 *geo_v2;
> 100 };
> 101 struct mt7921_asar_cl *countrylist;
> 102 struct mt7921_asar_fg *fg;
> 103 };
>
> The DECLARE_FLEX_ARRAY() helper was created to declare flex-array members
> in unions or alone in structs[1].

Thanks for the clarification, much appreciated.

FWIIW, with this information I'm happy with this patch.

Reviewed-by: Simon Horman <simon.horman@xxxxxxxxxxxx>