[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <712e82b5-62fc-423a-a356-8cc74fc22e3d@lunn.ch>
Date: Sun, 17 Aug 2025 17:36:13 +0200
From: Andrew Lunn <andrew@...n.ch>
To: Daniel Golle <daniel@...rotopia.org>
Cc: Vladimir Oltean <olteanv@...il.com>,
"David S. Miller" <davem@...emloft.net>,
Eric Dumazet <edumazet@...gle.com>,
Jakub Kicinski <kuba@...nel.org>, Paolo Abeni <pabeni@...hat.com>,
Hauke Mehrtens <hauke@...ke-m.de>, Simon Horman <horms@...nel.org>,
Russell King <linux@...linux.org.uk>,
Florian Fainelli <f.fainelli@...il.com>,
Arkadi Sharshevsky <arkadis@...lanox.com>,
linux-kernel@...r.kernel.org, netdev@...r.kernel.org,
Andreas Schirm <andreas.schirm@...mens.com>,
Lukas Stockmann <lukas.stockmann@...mens.com>,
Alexander Sverdlin <alexander.sverdlin@...mens.com>,
Peter Christen <peter.christen@...mens.com>,
Avinash Jayaraman <ajayaraman@...linear.com>,
Bing tao Xu <bxu@...linear.com>, Liang Xu <lxu@...linear.com>,
Juraj Povazanec <jpovazanec@...linear.com>,
"Fanni (Fang-Yi) Chan" <fchan@...linear.com>,
"Benny (Ying-Tsan) Weng" <yweng@...linear.com>,
"Livia M. Rosu" <lrosu@...linear.com>,
John Crispin <john@...ozen.org>
Subject: Re: [PATCH RFC net-next 09/23] net: dsa: lantiq_gswip: add support
for SWAPI version 2.3
On Sat, Aug 16, 2025 at 08:52:42PM +0100, Daniel Golle wrote:
> Add definition for switch API version 2.3 and a macro to make comparing
> the version more conveniant.
>
> Signed-off-by: Daniel Golle <daniel@...rotopia.org>
> ---
> drivers/net/dsa/lantiq_gswip.h | 3 +++
> 1 file changed, 3 insertions(+)
>
> diff --git a/drivers/net/dsa/lantiq_gswip.h b/drivers/net/dsa/lantiq_gswip.h
> index 433b65b047dd..fd0c01edb914 100644
> --- a/drivers/net/dsa/lantiq_gswip.h
> +++ b/drivers/net/dsa/lantiq_gswip.h
> @@ -7,6 +7,7 @@
> #include <linux/platform_device.h>
> #include <linux/regmap.h>
> #include <linux/reset.h>
> +#include <linux/swab.h>
> #include <net/dsa.h>
>
> /* GSWIP MDIO Registers */
> @@ -93,6 +94,8 @@
> #define GSWIP_VERSION_2_1 0x021
> #define GSWIP_VERSION_2_2 0x122
> #define GSWIP_VERSION_2_2_ETC 0x022
> +#define GSWIP_VERSION_2_3 0x023
> +#define GSWIP_VERSION_GE(priv, ver) (swab16(priv->version) >= swab16(ver))
Don't this depend on the endiannes of the CPU?
It seems like it would be better to make your new version member cpu
endian, and when writing to it, do le16_to_cpu().
Also, if i remember correctly, you made version a u32. Should it
really be a u16?
Andrew
Powered by blists - more mailing lists