Re: [PATCH net-next 05/13] net: dsa: realtek: use phy_read in ds->ops
From: Luiz Angelo Daros de Luca <luizluca@gmail.com>
Date: 2021-12-18 06:27:03
On Thu, Dec 16, 2021 at 9:14 PM [off-list ref] wrote:quoted
From: Luiz Angelo Daros de Luca <luizluca@gmail.com> 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. Tested-by: Arınç ÜNAL <redacted> Signed-off-by: Luiz Angelo Daros de Luca <luizluca@gmail.com>(...)quoted
-static int rtl8365mb_phy_read(struct realtek_priv *priv, int phy, int regnum) +static int rtl8365mb_phy_read(struct dsa_switch *ds, int phy, int regnum) { u32 ocp_addr; u16 val; int ret; + struct realtek_priv *priv = ds->priv;Needs to be on top (reverse christmas tree, christmas is getting close).quoted
-static int rtl8365mb_phy_write(struct realtek_priv *priv, int phy, int regnum, +static int rtl8365mb_phy_write(struct dsa_switch *ds, int phy, int regnum, u16 val) { u32 ocp_addr; int ret; + struct realtek_priv *priv = (struct realtek_priv *)ds->priv;Dito.quoted
-static int rtl8366rb_phy_read(struct realtek_priv *priv, int phy, int regnum) +static int rtl8366rb_phy_read(struct dsa_switch *ds, int phy, int regnum) { u32 val; u32 reg; int ret; + struct realtek_priv *priv = ds->priv;Dito.quoted
-static int rtl8366rb_phy_write(struct realtek_priv *priv, int phy, int regnum, +static int rtl8366rb_phy_write(struct dsa_switch *ds, int phy, int regnum, u16 val) { u32 reg; int ret; + struct realtek_priv *priv = ds->priv;Dito. Other than that it's a great patch, so with these nitpicky changes feel free to add: Reviewed-by: Linus Walleij <redacted>
Thanks! Fixed and added.