[PATCH net-next 09/15] net: dsa: sja1105: remove sja1105_mdio_private

Vladimir Oltean
2025-11-18T19:06:06Z

This structure is no longer used for anything. We can just set the
bus->priv of the PCS MDIO bus to be struct sja1105_private.

Signed-off-by: Vladimir Oltean <vladimir.oltean@nxp.com>
---
drivers/net/dsa/sja1105/sja1105.h | 4 ----
drivers/net/dsa/sja1105/sja1105_mdio.c | 18 ++++++------------
2 files changed, 6 insertions(+), 16 deletions(-)

diff --git a/drivers/net/dsa/sja1105/sja1105.h b/drivers/net/dsa/sja1105/sja1105.h
index ff6b69663851..22fce143cb76 100644
--- a/drivers/net/dsa/sja1105/sja1105.h
+++ b/drivers/net/dsa/sja1105/sja1105.h
@@ -94,10 +94,6 @@ struct sja1105_regs {
u64 pcs_base[SJA1105_MAX_NUM_PORTS];
};

-struct sja1105_mdio_private {
- struct sja1105_private *priv;
-};
-
enum {
SJA1105_SPEED_AUTO,
SJA1105_SPEED_10MBPS,
diff --git a/drivers/net/dsa/sja1105/sja1105_mdio.c b/drivers/net/dsa/sja1105/sja1105_mdio.c
index b803ce71f5cc..d5577c702902 100644
--- a/drivers/net/dsa/sja1105/sja1105_mdio.c
+++ b/drivers/net/dsa/sja1105/sja1105_mdio.c
@@ -9,8 +9,7 @@

int sja1105_pcs_mdio_read_c45(struct mii_bus *bus, int phy, int mmd, int reg)
{
- struct sja1105_mdio_private *mdio_priv = bus->priv;
- struct sja1105_private *priv = mdio_priv->priv;
+ struct sja1105_private *priv = bus->priv;
u64 addr;
u32 tmp;
int rc;
@@ -35,8 +34,7 @@ int sja1105_pcs_mdio_read_c45(struct mii_bus *bus, int phy, int mmd, int reg)
int sja1105_pcs_mdio_write_c45(struct mii_bus *bus, int phy, int mmd,
int reg, u16 val)
{
- struct sja1105_mdio_private *mdio_priv = bus->priv;
- struct sja1105_private *priv = mdio_priv->priv;
+ struct sja1105_private *priv = bus->priv;
u64 addr;
u32 tmp;

@@ -51,8 +49,7 @@ int sja1105_pcs_mdio_write_c45(struct mii_bus *bus, int phy, int mmd,

int sja1110_pcs_mdio_read_c45(struct mii_bus *bus, int phy, int mmd, int reg)
{
- struct sja1105_mdio_private *mdio_priv = bus->priv;
- struct sja1105_private *priv = mdio_priv->priv;
+ struct sja1105_private *priv = bus->priv;
const struct sja1105_regs *regs = priv->info->regs;
int offset, bank;
u64 addr;
@@ -97,8 +94,7 @@ int sja1110_pcs_mdio_read_c45(struct mii_bus *bus, int phy, int mmd, int reg)
int sja1110_pcs_mdio_write_c45(struct mii_bus *bus, int phy, int mmd, int reg,
u16 val)
{
- struct sja1105_mdio_private *mdio_priv = bus->priv;
- struct sja1105_private *priv = mdio_priv->priv;
+ struct sja1105_private *priv = bus->priv;
const struct sja1105_regs *regs = priv->info->regs;
int offset, bank;
u64 addr;
@@ -135,7 +131,6 @@ int sja1110_pcs_mdio_write_c45(struct mii_bus *bus, int phy, int mmd, int reg,

static int sja1105_mdiobus_pcs_register(struct sja1105_private *priv)
{
- struct sja1105_mdio_private *mdio_priv;
struct dsa_switch *ds = priv->ds;
struct mii_bus *bus;
int rc = 0;
@@ -144,7 +139,7 @@ static int sja1105_mdiobus_pcs_register(struct sja1105_private *priv)
if (!priv->info->pcs_mdio_read_c45 || !priv->info->pcs_mdio_write_c45)
return 0;

- bus = mdiobus_alloc_size(sizeof(*mdio_priv));
+ bus = mdiobus_alloc_size(0);
if (!bus)
return -ENOMEM;

@@ -158,8 +153,7 @@ static int sja1105_mdiobus_pcs_register(struct sja1105_private *priv)
* from auto probing.
*/
bus->phy_mask = ~0;
- mdio_priv = bus->priv;
- mdio_priv->priv = priv;
+ bus->priv = priv;

rc = mdiobus_register(bus);
if (rc) {
--
2.34.1