From: Daniel Golle <daniel@makrotopia.org>
To: Hauke Mehrtens <hauke@hauke-m.de>, Andrew Lunn <andrew@lunn.ch>,
Vladimir Oltean <olteanv@gmail.com>,
"David S. Miller" <davem@davemloft.net>,
Eric Dumazet <edumazet@google.com>,
Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>,
Russell King <linux@armlinux.org.uk>,
netdev@vger.kernel.org, linux-kernel@vger.kernel.org
Cc: Andreas Schirm <andreas.schirm@siemens.com>,
Lukas Stockmann <lukas.stockmann@siemens.com>,
Alexander Sverdlin <alexander.sverdlin@siemens.com>,
Peter Christen <peter.christen@siemens.com>,
Avinash Jayaraman <ajayaraman@maxlinear.com>,
Bing tao Xu <bxu@maxlinear.com>, Liang Xu <lxu@maxlinear.com>,
Juraj Povazanec <jpovazanec@maxlinear.com>,
"Fanni (Fang-Yi) Chan" <fchan@maxlinear.com>,
"Benny (Ying-Tsan) Weng" <yweng@maxlinear.com>,
"Livia M. Rosu" <lrosu@maxlinear.com>,
John Crispin <john@phrozen.org>
Subject: [PATCH net-next v3 4/7] net: dsa: lantiq_gswip: manually convert remaining uses of read accessors
Date: Sun, 19 Oct 2025 13:48:36 +0100 [thread overview]
Message-ID: <b0cc75e63daffee27f5fdab35d49d7bfb10e48bb.1760877626.git.daniel@makrotopia.org> (raw)
In-Reply-To: <cover.1760877626.git.daniel@makrotopia.org>
Manually convert the remaining uses of the read accessor functions and
remove them now that they are unused.
Signed-off-by: Daniel Golle <daniel@makrotopia.org>
---
drivers/net/dsa/lantiq/lantiq_gswip.c | 65 ++++++++++++++-------------
1 file changed, 34 insertions(+), 31 deletions(-)
diff --git a/drivers/net/dsa/lantiq/lantiq_gswip.c b/drivers/net/dsa/lantiq/lantiq_gswip.c
index 8ab16972b2be..41e59f56a2e9 100644
--- a/drivers/net/dsa/lantiq/lantiq_gswip.c
+++ b/drivers/net/dsa/lantiq/lantiq_gswip.c
@@ -111,15 +111,6 @@ static const struct gswip_rmon_cnt_desc gswip_rmon_cnt[] = {
MIB_DESC(2, 0x0E, "TxGoodBytes"),
};
-static u32 gswip_switch_r(struct gswip_priv *priv, u32 offset)
-{
- u32 val;
-
- regmap_read(priv->gswip, offset, &val);
-
- return val;
-}
-
static void gswip_switch_mask(struct gswip_priv *priv, u32 clear, u32 set,
u32 offset)
{
@@ -135,15 +126,6 @@ static u32 gswip_switch_r_timeout(struct gswip_priv *priv, u32 offset,
!(val & cleared), 20, 50000);
}
-static u32 gswip_mdio_r(struct gswip_priv *priv, u32 offset)
-{
- u32 val;
-
- regmap_read(priv->mdio, offset, &val);
-
- return val;
-}
-
static void gswip_mdio_mask(struct gswip_priv *priv, u32 clear, u32 set,
u32 offset)
{
@@ -225,6 +207,7 @@ static int gswip_mdio_wr(struct mii_bus *bus, int addr, int reg, u16 val)
static int gswip_mdio_rd(struct mii_bus *bus, int addr, int reg)
{
struct gswip_priv *priv = bus->priv;
+ u32 val;
int err;
err = gswip_mdio_poll(priv);
@@ -244,7 +227,11 @@ static int gswip_mdio_rd(struct mii_bus *bus, int addr, int reg)
return err;
}
- return gswip_mdio_r(priv, GSWIP_MDIO_READ);
+ err = regmap_read(priv->mdio, GSWIP_MDIO_READ, &val);
+ if (err)
+ return err;
+
+ return val;
}
static int gswip_mdio(struct gswip_priv *priv)
@@ -288,6 +275,7 @@ static int gswip_pce_table_entry_read(struct gswip_priv *priv,
int i;
int err;
u16 crtl;
+ u32 tmp;
u16 addr_mode = tbl->key_mode ? GSWIP_PCE_TBL_CTRL_OPMOD_KSRD :
GSWIP_PCE_TBL_CTRL_OPMOD_ADRD;
@@ -313,16 +301,29 @@ static int gswip_pce_table_entry_read(struct gswip_priv *priv,
return err;
}
- for (i = 0; i < ARRAY_SIZE(tbl->key); i++)
- tbl->key[i] = gswip_switch_r(priv, GSWIP_PCE_TBL_KEY(i));
-
- for (i = 0; i < ARRAY_SIZE(tbl->val); i++)
- tbl->val[i] = gswip_switch_r(priv, GSWIP_PCE_TBL_VAL(i));
+ for (i = 0; i < ARRAY_SIZE(tbl->key); i++) {
+ err = regmap_read(priv->gswip, GSWIP_PCE_TBL_KEY(i), &tmp);
+ if (err)
+ return err;
+ tbl->key[i] = tmp;
+ }
+ for (i = 0; i < ARRAY_SIZE(tbl->val); i++) {
+ err = regmap_read(priv->gswip, GSWIP_PCE_TBL_VAL(i), &tmp);
+ if (err)
+ return err;
+ tbl->val[i] = tmp;
+ }
- tbl->mask = gswip_switch_r(priv, GSWIP_PCE_TBL_MASK);
+ err = regmap_read(priv->gswip, GSWIP_PCE_TBL_MASK, &tmp);
+ if (err)
+ return err;
- crtl = gswip_switch_r(priv, GSWIP_PCE_TBL_CTRL);
+ tbl->mask = tmp;
+ err = regmap_read(priv->gswip, GSWIP_PCE_TBL_CTRL, &tmp);
+ if (err)
+ return err;
+ crtl = tmp;
tbl->type = !!(crtl & GSWIP_PCE_TBL_CTRL_TYPE);
tbl->valid = !!(crtl & GSWIP_PCE_TBL_CTRL_VLD);
tbl->gmap = (crtl & GSWIP_PCE_TBL_CTRL_GMAP_MASK) >> 7;
@@ -338,6 +339,7 @@ static int gswip_pce_table_entry_write(struct gswip_priv *priv,
int i;
int err;
u16 crtl;
+ u32 tmp;
u16 addr_mode = tbl->key_mode ? GSWIP_PCE_TBL_CTRL_OPMOD_KSWR :
GSWIP_PCE_TBL_CTRL_OPMOD_ADWR;
@@ -369,9 +371,9 @@ static int gswip_pce_table_entry_write(struct gswip_priv *priv,
regmap_write(priv->gswip, GSWIP_PCE_TBL_MASK, tbl->mask);
- crtl = gswip_switch_r(priv, GSWIP_PCE_TBL_CTRL);
- crtl &= ~(GSWIP_PCE_TBL_CTRL_TYPE | GSWIP_PCE_TBL_CTRL_VLD |
- GSWIP_PCE_TBL_CTRL_GMAP_MASK);
+ regmap_read(priv->gswip, GSWIP_PCE_TBL_CTRL, &tmp);
+ crtl = tmp & ~(GSWIP_PCE_TBL_CTRL_TYPE | GSWIP_PCE_TBL_CTRL_VLD |
+ GSWIP_PCE_TBL_CTRL_GMAP_MASK);
if (tbl->type)
crtl |= GSWIP_PCE_TBL_CTRL_TYPE;
if (tbl->valid)
@@ -1525,7 +1527,7 @@ static void gswip_get_strings(struct dsa_switch *ds, int port, u32 stringset,
static u32 gswip_bcm_ram_entry_read(struct gswip_priv *priv, u32 table,
u32 index)
{
- u32 result;
+ u32 result, val;
int err;
regmap_write(priv->gswip, GSWIP_BM_RAM_ADDR, index);
@@ -1543,7 +1545,8 @@ static u32 gswip_bcm_ram_entry_read(struct gswip_priv *priv, u32 table,
}
regmap_read(priv->gswip, GSWIP_BM_RAM_VAL(0), &result);
- result |= gswip_switch_r(priv, GSWIP_BM_RAM_VAL(1)) << 16;
+ regmap_read(priv->gswip, GSWIP_BM_RAM_VAL(1), &val);
+ result |= val << 16;
return result;
}
--
2.51.1.dirty
next prev parent reply other threads:[~2025-10-19 12:48 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-10-19 12:46 [PATCH net-next v3 0/7] net: dsa: lantiq_gswip: use regmap for register access Daniel Golle
2025-10-19 12:46 ` [PATCH net-next v3 1/7] net: dsa: lantiq_gswip: clarify GSWIP 2.2 VLAN mode in comment Daniel Golle
2025-10-22 2:29 ` Andrew Lunn
2025-10-22 7:43 ` Daniel Golle
2025-10-19 12:47 ` [PATCH net-next v3 2/7] net: dsa: lantiq_gswip: convert accessors to use regmap Daniel Golle
2025-10-22 2:34 ` Andrew Lunn
2025-10-19 12:48 ` [PATCH net-next v3 3/7] net: dsa: lantiq_gswip: convert trivial accessor uses to regmap Daniel Golle
2025-10-22 2:35 ` Andrew Lunn
2025-10-19 12:48 ` Daniel Golle [this message]
2025-10-19 22:25 ` [PATCH net-next v3 4/7] net: dsa: lantiq_gswip: manually convert remaining uses of read accessors Jakub Kicinski
2025-10-20 0:23 ` Daniel Golle
2025-10-19 12:48 ` [PATCH net-next v3 5/7] net: dsa: lantiq_gswip: replace *_mask() functions with regmap API Daniel Golle
2025-10-22 2:36 ` Andrew Lunn
2025-10-19 12:48 ` [PATCH net-next v3 6/7] net: dsa: lantiq_gswip: optimize regmap_write_bits() statements Daniel Golle
2025-10-19 12:48 ` [PATCH net-next v3 7/7] net: dsa: lantiq_gswip: harmonize gswip_mii_mask_*() parameters Daniel Golle
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=b0cc75e63daffee27f5fdab35d49d7bfb10e48bb.1760877626.git.daniel@makrotopia.org \
--to=daniel@makrotopia.org \
--cc=ajayaraman@maxlinear.com \
--cc=alexander.sverdlin@siemens.com \
--cc=andreas.schirm@siemens.com \
--cc=andrew@lunn.ch \
--cc=bxu@maxlinear.com \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=fchan@maxlinear.com \
--cc=hauke@hauke-m.de \
--cc=john@phrozen.org \
--cc=jpovazanec@maxlinear.com \
--cc=kuba@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux@armlinux.org.uk \
--cc=lrosu@maxlinear.com \
--cc=lukas.stockmann@siemens.com \
--cc=lxu@maxlinear.com \
--cc=netdev@vger.kernel.org \
--cc=olteanv@gmail.com \
--cc=pabeni@redhat.com \
--cc=peter.christen@siemens.com \
--cc=yweng@maxlinear.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®