Subject: Re: [PATCH 2/2][next] net: ethtool: Avoid thousands of -Wflex-array-member-not-at-end warnings

From: Jakub Kicinski <[email-masked]>
Date: Tue, 29 Oct 2024 11:54:26 -0700

On Tue, 29 Oct 2024 12:48:32 -0600 Gustavo A. R. Silva wrote:
> >> Is this going to be a priority for any other netdev patches in the future?  
> > 
> > It's been the preferred formatting for a decade or more.
> > Which is why the net/ethtool/ code you're touching follows
> > this convention. We're less strict about driver code.  
> 
> I mean, the thing about moving the initialization out of line to accommodate
> for the convention.
> 
> What I'm understanding is that now you're asking me to change the following
> 
>       const struct linkmodes_reply_data *data = LINKMODES_REPDATA(reply_base);
>       const struct ethtool_link_ksettings *ksettings = &data->ksettings;
> -    const struct ethtool_link_settings *lsettings = &ksettings->base;
> +    const struct ethtool_link_settings_hdr *lsettings = &ksettings->base;
> 
> to this:
> 
>       const struct linkmodes_reply_data *data = LINKMODES_REPDATA(reply_base);
>       const struct ethtool_link_settings_hdr *lsettings;
>       const struct ethtool_link_ksettings *ksettings;
> 
>       ksettings = &data->ksettings;

You don't have to move this one out of line but either way is fine.

>       lsettings = &ksettings->base;
> 
> I just want to have clear if this is going to be a priority and in which scenarios
> should I/others modify the code to accommodate for the convention?

I don't understand what you mean by priority. If you see code under
net/ or drivers/net which follows the reverse xmas tree variable
sorting you should not be breaking this convention. And yes, if
there are dependencies between variables you should move the init
out of line.