Re: [PATCH net-next v3 3/6] net: dsa: lantiq: allow arbitrary MII registers
From: Daniel Golle
Date: Fri Jan 16 2026 - 06:47:58 EST
On Thu, Jan 15, 2026 at 07:11:08PM -0800, Jakub Kicinski wrote:
> On Fri, 16 Jan 2026 00:07:37 +0000 Daniel Golle wrote:
> > +__diag_push();
> > +__diag_ignore_all("-Woverride-init",
> > + "logic to initialize all and then override some is OK");
>
> This seems quite unjustified to save at a glance 4 lines of code.
So I'll spell it out instead. I kinda like the notion of default
initializers, it's much more obviously correct and impossible to
accidentally leave anything uninitialized (or rather wrongly initialized
with 0).
In lantiq_gswip.c it would look like this then:
.mii_cfg = {
[0] = GSWIP_MII_CFGp(0),
[1] = GSWIP_MII_CFGp(1),
[2 ... 4] = -1,
[5] = GSWIP_MII_CFGp(5),
[6] = -1,
},
.mii_pcdu = {
[0] = GSWIP_MII_PCDU0,
[1] = GSWIP_MII_PCDU1,
[2 ... 4] = -1,
[5] = GSWIP_MII_PCDU5,
[6] = -1,
},
...
.mii_cfg = {
[0] = GSWIP_MII_CFGp(0),
[1 ... 4] = -1,
[5] = GSWIP_MII_CFGp(5),
[6] = -1,
},
.mii_pcdu = {
[0] = GSWIP_MII_PCDU0,
[1 ... 4] = -1,
[5] = GSWIP_MII_PCDU5,
[6] = -1,
},