From nobody Fri Oct 3 10:15:32 2025 Received: from pidgin.makrotopia.org (pidgin.makrotopia.org [185.142.180.65]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 45B45126C05; Tue, 2 Sep 2025 23:36:21 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=185.142.180.65 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1756856182; cv=none; b=Pvh2A4+NmNnBz0u3BSklsb+nAI0Zyy+SjsKDhHIDOL9ecjMYEqI8MnOHZu4BAtuyZxPuTC2zH/yO8vx+YSlBYA+EJWwHjYql3bpXmaReWrfRSmDgoOPJqvZsMyVQpu+YBkEl4K1WsgFE4YxRczrc8OjEQUed1X3pgMaP53GexMM= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1756856182; c=relaxed/simple; bh=2pIxf0HoF6Z6UiQch8+8jOIMygT02+QakPHOWqDwM94=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=fv9F0bcbLAVjPfVYbfhqGeiUjvJm8XSaMZKbCKa2hK+qIXQK7jNMxP3WzrO8ZOEZBDc7xWKbGgDoSFuj1P0onTFcpZGv3rKUetf8zYZy1AGhQOMW73f92utV0Z7/2BWTAVabME8MlcN4gCDLYIkDj4yCQKg2RRRmv1w11xaHgb4= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=makrotopia.org; spf=pass smtp.mailfrom=makrotopia.org; arc=none smtp.client-ip=185.142.180.65 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=makrotopia.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=makrotopia.org Received: from local by pidgin.makrotopia.org with esmtpsa (TLS1.3:TLS_AES_256_GCM_SHA384:256) (Exim 4.98.2) (envelope-from ) id 1utaXw-000000001IK-2JIC; Tue, 02 Sep 2025 23:36:16 +0000 Date: Wed, 3 Sep 2025 00:36:13 +0100 From: Daniel Golle To: Hauke Mehrtens , Andrew Lunn , Vladimir Oltean , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Russell King , netdev@vger.kernel.org, linux-kernel@vger.kernel.org Cc: Andreas Schirm , Lukas Stockmann , Alexander Sverdlin , Peter Christen , Avinash Jayaraman , Bing tao Xu , Liang Xu , Juraj Povazanec , "Fanni (Fang-Yi) Chan" , "Benny (Ying-Tsan) Weng" , "Livia M. Rosu" , John Crispin Subject: [RFC PATCH net-next 3/6] net: dsa: lantiq_gswip: manually convert remaining uses of read accessors Message-ID: <08a08504d030b8b9f4587097ef81e014acc98846.1756855069.git.daniel@makrotopia.org> References: Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Manually convert the remaining uses of the read accessor functions and remove them now that they are unused. Signed-off-by: Daniel Golle --- drivers/net/dsa/lantiq/lantiq_gswip.c | 77 ++++++++++++--------------- 1 file changed, 34 insertions(+), 43 deletions(-) diff --git a/drivers/net/dsa/lantiq/lantiq_gswip.c b/drivers/net/dsa/lantiq= /lantiq_gswip.c index 4c46b8f0ab3d..7ba562f02b57 100644 --- a/drivers/net/dsa/lantiq/lantiq_gswip.c +++ b/drivers/net/dsa/lantiq/lantiq_gswip.c @@ -111,21 +111,6 @@ static const struct gswip_rmon_cnt_desc gswip_rmon_cnt= [] =3D { MIB_DESC(2, 0x0E, "TxGoodBytes"), }; =20 -static u32 gswip_switch_r(struct gswip_priv *priv, u32 offset) -{ - unsigned int val; - int ret; - - ret =3D regmap_read(priv->gswip, offset, &val); - if (ret) { - WARN_ON_ONCE(1); - dev_err(priv->dev, "failed to read switch register\n"); - return 0; - } - - return val; -} - static void gswip_switch_mask(struct gswip_priv *priv, u32 clear, u32 set, u32 offset) { @@ -147,21 +132,6 @@ static u32 gswip_switch_r_timeout(struct gswip_priv *p= riv, u32 offset, !(val & cleared), 20, 50000); } =20 -static u32 gswip_mdio_r(struct gswip_priv *priv, u32 offset) -{ - u32 val; - int ret; - - ret =3D regmap_read(priv->mdio, offset, &val); - if (ret) { - WARN_ON_ONCE(1); - dev_err(priv->dev, "failed to read mdio register\n"); - return 0; - } - - return val; -} - static void gswip_mdio_mask(struct gswip_priv *priv, u32 clear, u32 set, u32 offset) { @@ -255,6 +225,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 =3D bus->priv; + u32 val; int err; =20 err =3D gswip_mdio_poll(priv); @@ -274,7 +245,11 @@ static int gswip_mdio_rd(struct mii_bus *bus, int addr= , int reg) return err; } =20 - return gswip_mdio_r(priv, GSWIP_MDIO_READ); + err =3D regmap_read(priv->mdio, GSWIP_MDIO_READ, &val); + if (err) + return err; + + return val; } =20 static int gswip_mdio(struct gswip_priv *priv) @@ -318,6 +293,7 @@ static int gswip_pce_table_entry_read(struct gswip_priv= *priv, int i; int err; u16 crtl; + u32 tmp; u16 addr_mode =3D tbl->key_mode ? GSWIP_PCE_TBL_CTRL_OPMOD_KSRD : GSWIP_PCE_TBL_CTRL_OPMOD_ADRD; =20 @@ -343,16 +319,29 @@ static int gswip_pce_table_entry_read(struct gswip_pr= iv *priv, return err; } =20 - for (i =3D 0; i < ARRAY_SIZE(tbl->key); i++) - tbl->key[i] =3D gswip_switch_r(priv, GSWIP_PCE_TBL_KEY(i)); - - for (i =3D 0; i < ARRAY_SIZE(tbl->val); i++) - tbl->val[i] =3D gswip_switch_r(priv, GSWIP_PCE_TBL_VAL(i)); + for (i =3D 0; i < ARRAY_SIZE(tbl->key); i++) { + err =3D regmap_read(priv->gswip, GSWIP_PCE_TBL_KEY(i), &tmp); + if (err) + return err; + tbl->key[i] =3D tmp; + } + for (i =3D 0; i < ARRAY_SIZE(tbl->val); i++) { + err =3D regmap_read(priv->gswip, GSWIP_PCE_TBL_VAL(i), &tmp); + if (err) + return err; + tbl->val[i] =3D tmp; + } =20 - tbl->mask =3D gswip_switch_r(priv, GSWIP_PCE_TBL_MASK); + err =3D regmap_read(priv->gswip, GSWIP_PCE_TBL_MASK, &tmp); + if (err) + return err; =20 - crtl =3D gswip_switch_r(priv, GSWIP_PCE_TBL_CTRL); + tbl->mask =3D tmp; + err =3D regmap_read(priv->gswip, GSWIP_PCE_TBL_CTRL, &tmp); + if (err) + return err; =20 + crtl =3D tmp; tbl->type =3D !!(crtl & GSWIP_PCE_TBL_CTRL_TYPE); tbl->valid =3D !!(crtl & GSWIP_PCE_TBL_CTRL_VLD); tbl->gmap =3D (crtl & GSWIP_PCE_TBL_CTRL_GMAP_MASK) >> 7; @@ -368,6 +357,7 @@ static int gswip_pce_table_entry_write(struct gswip_pri= v *priv, int i; int err; u16 crtl; + u32 tmp; u16 addr_mode =3D tbl->key_mode ? GSWIP_PCE_TBL_CTRL_OPMOD_KSWR : GSWIP_PCE_TBL_CTRL_OPMOD_ADWR; =20 @@ -399,9 +389,9 @@ static int gswip_pce_table_entry_write(struct gswip_pri= v *priv, =20 regmap_write(priv->gswip, GSWIP_PCE_TBL_MASK, tbl->mask); =20 - crtl =3D gswip_switch_r(priv, GSWIP_PCE_TBL_CTRL); - crtl &=3D ~(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 =3D tmp & ~(GSWIP_PCE_TBL_CTRL_TYPE | GSWIP_PCE_TBL_CTRL_VLD | + GSWIP_PCE_TBL_CTRL_GMAP_MASK); if (tbl->type) crtl |=3D GSWIP_PCE_TBL_CTRL_TYPE; if (tbl->valid) @@ -1563,7 +1553,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; =20 regmap_write(priv->gswip, GSWIP_BM_RAM_ADDR, index); @@ -1581,7 +1571,8 @@ static u32 gswip_bcm_ram_entry_read(struct gswip_priv= *priv, u32 table, } =20 regmap_read(priv->gswip, GSWIP_BM_RAM_VAL(0), &result); - result |=3D gswip_switch_r(priv, GSWIP_BM_RAM_VAL(1)) << 16; + regmap_read(priv->gswip, GSWIP_BM_RAM_VAL(1), &val); + result |=3D val << 16; =20 return result; } --=20 2.51.0