[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20230604130808.3lxuz5ezsouhku57@skbuf>
Date: Sun, 4 Jun 2023 16:08:08 +0300
From: Vladimir Oltean <olteanv@...il.com>
To: Arınç ÜNAL <arinc.unal@...nc9.com>
Cc: Sean Wang <sean.wang@...iatek.com>,
Landen Chao <Landen.Chao@...iatek.com>,
DENG Qingfang <dqfext@...il.com>,
Daniel Golle <daniel@...rotopia.org>,
Andrew Lunn <andrew@...n.ch>,
Florian Fainelli <f.fainelli@...il.com>,
"David S. Miller" <davem@...emloft.net>,
Eric Dumazet <edumazet@...gle.com>,
Jakub Kicinski <kuba@...nel.org>,
Paolo Abeni <pabeni@...hat.com>,
Matthias Brugger <matthias.bgg@...il.com>,
AngeloGioacchino Del Regno
<angelogioacchino.delregno@...labora.com>,
Russell King <linux@...linux.org.uk>,
Richard van Schagen <richard@...terhints.com>,
Richard van Schagen <vschagen@...com>,
Frank Wunderlich <frank-w@...lic-files.de>,
Bartel Eerdekens <bartel.eerdekens@...stell8.be>,
erkin.bozoglu@...ont.com, mithat.guner@...ont.com,
netdev@...r.kernel.org, linux-kernel@...r.kernel.org,
linux-arm-kernel@...ts.infradead.org,
linux-mediatek@...ts.infradead.org
Subject: Re: [PATCH net-next 25/30] net: dsa: mt7530: properly set
MT7531_CPU_PMAP
On Sun, Jun 04, 2023 at 11:21:48AM +0300, Arınç ÜNAL wrote:
> > Stylistically, the existence of an indirect call to priv->info->cpu_port_config()
> > per switch family is a bit dissonant with an explicit check for device id later
> > in the same function.
>
> mt753x_cpu_port_enable() is not being called from priv->info->cpu_port_config()
> though.
Quite the other way around. I'm saying that mt753x_cpu_port_enable(),
the function whose logic you're changing, already has a mechanism to
execute code specific to one switch family.
> I'm not sure how I would do this without the device ID check here.
Hmm, by defining a new mt7530_cpu_port_config() procedure for ID_MT7621
and ID_MT7530?
Although in a different thread we are perhaps challenging the idea that
what is currently in priv->info->cpu_port_config() is useful - at least
half of it are manual invocations of phylink methods which are possibly
not needed. If after the removal of those, it no longer makes sense to
have priv->info->cpu_port_config() at all, then I'm not saying that the
explicit check for device id here doesn't make sense. Just that it's not
in harmony with what currently exists 3 lines above.
> > > -#define MT7531_CPU_PMAP_MASK GENMASK(7, 0)
> > > +#define MT7531_CPU_PMAP(x) ((x) & 0xff)
> >
> > You can leave this as ((x) & GENMASK(7, 0))
>
> Now that I've read Russell's comment on the previous patch, the below would
> be even better?
>
> MT7531_CPU_PMAP(x) FIELD_PREP(MT7531_CPU_PMAP_MASK, x)
>
> >
> > > +#define MT7531_CPU_PMAP_MASK MT7531_CPU_PMAP(~0)
> >
> > There's no other user of MT7531_CPU_PMAP_MASK, you can remove this.
>
> Should I do above or remove this?
No specific preference. If you want to make this driver start using
FIELD_PREP() then go ahead.
Powered by blists - more mailing lists