Message ID | 20210822193145.1312668-2-alvin@pqrs.dk |
---|---|
State | New |
Headers | show |
Series | net: dsa: add support for RTL8365MB-VC | expand |
On Mon, Aug 23, 2021 at 1:16 AM Andrew Lunn <andrew@lunn.ch> wrote: > > No, there isn't. I neglected to mention in the rtl8365mb patch that I > > reworked the IRQ setup (compared with rtl8366rb) so that it could be > > torn down in a neat way. So you will see that the new driver does it > > properly, but I did not touch rtl8366rb because I am not using it. I am > > happy to do the same to rtl8366rb but I don't think I should make it > > part of this series. What do you think? > > Lets see if Linus has time. He can probably model the change based on > what you have done here. I have limited bandwidth as I am effectively on parental leave, so I can't do much of writing code, but I can certainly test a patch or two. Yours, Linus Walleij
On 8/28/21 12:06 AM, Linus Walleij wrote: > On Mon, Aug 23, 2021 at 1:16 AM Andrew Lunn <andrew@lunn.ch> wrote: > >>> No, there isn't. I neglected to mention in the rtl8365mb patch that I >>> reworked the IRQ setup (compared with rtl8366rb) so that it could be >>> torn down in a neat way. So you will see that the new driver does it >>> properly, but I did not touch rtl8366rb because I am not using it. I am >>> happy to do the same to rtl8366rb but I don't think I should make it >>> part of this series. What do you think? >> >> Lets see if Linus has time. He can probably model the change based on >> what you have done here. > > I have limited bandwidth as I am effectively on parental leave, so > I can't do much of writing code, but I can certainly test a patch or > two. No problem - I will follow up on this and submit some patches when I get there. Alvin > > Yours, > Linus Walleij >
diff --git a/drivers/net/dsa/realtek-smi-core.c b/drivers/net/dsa/realtek-smi-core.c index 8e49d4f85d48..6992b6b31db6 100644 --- a/drivers/net/dsa/realtek-smi-core.c +++ b/drivers/net/dsa/realtek-smi-core.c @@ -383,6 +383,12 @@ int realtek_smi_setup_mdio(struct realtek_smi *smi) return ret; } +void realtek_smi_teardown_mdio(struct realtek_smi *smi) +{ + if (smi->slave_mii_bus) + mdiobus_unregister(smi->slave_mii_bus); +} + static int realtek_smi_probe(struct platform_device *pdev) { const struct realtek_smi_variant *var; diff --git a/drivers/net/dsa/realtek-smi-core.h b/drivers/net/dsa/realtek-smi-core.h index fcf465f7f922..6cfa5f2df7ea 100644 --- a/drivers/net/dsa/realtek-smi-core.h +++ b/drivers/net/dsa/realtek-smi-core.h @@ -119,6 +119,7 @@ struct realtek_smi_variant { int realtek_smi_write_reg_noack(struct realtek_smi *smi, u32 addr, u32 data); int realtek_smi_setup_mdio(struct realtek_smi *smi); +void realtek_smi_teardown_mdio(struct realtek_smi *smi); /* RTL8366 library helpers */ int rtl8366_mc_is_used(struct realtek_smi *smi, int mc_index, int *used); diff --git a/drivers/net/dsa/rtl8366rb.c b/drivers/net/dsa/rtl8366rb.c index a89093bc6c6a..6537fac7aba4 100644 --- a/drivers/net/dsa/rtl8366rb.c +++ b/drivers/net/dsa/rtl8366rb.c @@ -982,6 +982,13 @@ static int rtl8366rb_setup(struct dsa_switch *ds) return 0; } +static void rtl8366rb_teardown(struct dsa_switch *ds) +{ + struct realtek_smi *smi = ds->priv; + + realtek_smi_teardown_mdio(smi); +} + static enum dsa_tag_protocol rtl8366_get_tag_protocol(struct dsa_switch *ds, int port, enum dsa_tag_protocol mp) @@ -1505,6 +1512,7 @@ static int rtl8366rb_detect(struct realtek_smi *smi) static const struct dsa_switch_ops rtl8366rb_switch_ops = { .get_tag_protocol = rtl8366_get_tag_protocol, .setup = rtl8366rb_setup, + .teardown = rtl8366rb_teardown, .phylink_mac_link_up = rtl8366rb_mac_link_up, .phylink_mac_link_down = rtl8366rb_mac_link_down, .get_strings = rtl8366_get_strings,