Thread (90 messages) flat view 90 messages, 9 authors, 2021-12-31

Re: [PATCH net-next v2 06/13] net: dsa: realtek: use phy_read in ds->ops

From: Florian Fainelli <f.fainelli@gmail.com>
Date: 2021-12-19 19:58:34


On 12/18/2021 12:14 AM, Luiz Angelo Daros de Luca wrote:
quoted hunk ↗ jump to hunk
The ds->ops->phy_read will only be used if the ds->slave_mii_bus
was not initialized. Calling realtek_smi_setup_mdio will create a
ds->slave_mii_bus, making ds->ops->phy_read dormant.

Using ds->ops->phy_read will allow switches connected through non-SMI
interfaces (like mdio) to let ds allocate slave_mii_bus and reuse the
same code.

Reviewed-by: Linus Walleij <redacted>
Tested-by: Arınç ÜNAL <redacted>
Signed-off-by: Luiz Angelo Daros de Luca <luizluca@gmail.com>
---
  drivers/net/dsa/realtek/realtek-smi.c |  8 ++++----
  drivers/net/dsa/realtek/realtek.h     |  3 ---
  drivers/net/dsa/realtek/rtl8365mb.c   | 10 ++++++----
  drivers/net/dsa/realtek/rtl8366rb.c   | 10 ++++++----
  4 files changed, 16 insertions(+), 15 deletions(-)
diff --git a/drivers/net/dsa/realtek/realtek-smi.c b/drivers/net/dsa/realtek/realtek-smi.c
index 351df8792ab3..32690bd28128 100644
--- a/drivers/net/dsa/realtek/realtek-smi.c
+++ b/drivers/net/dsa/realtek/realtek-smi.c
@@ -328,17 +328,17 @@ static const struct regmap_config realtek_smi_mdio_regmap_config = {
  
  static int realtek_smi_mdio_read(struct mii_bus *bus, int addr, int regnum)
  {
-	struct realtek_priv *priv = bus->priv;
+	struct dsa_switch *ds = ((struct realtek_priv *)bus->priv)->ds;
No need to cast a void pointer, this applies throughout the entire patch 
series.
-- 
Florian
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help