Skip to content

Commit

Permalink
Merge branch 'dsa-platform-remove-void'
Browse files Browse the repository at this point in the history
Uwe Kleine-König says:

====================
net: dsa: Convert to platform remove callback returning void

this series converts all platform drivers below drivers/net/dsa to use
remove_new. The motivation is to get rid of an integer return code
that is (mostly) ignored by the platform driver core and error prone on
the driver side.

See commit 5c5a768 ("platform: Provide a remove callback that
returns no value") for an extended explanation and the eventual goal.

There are no interdependencies between the patches. As there are still
quite a few drivers to convert, I'm happy about every patch that makes
it in. So even if there is a merge conflict with one patch until you
apply or a subject prefix is suboptimal, please apply the remainder of
this series anyhow.
====================

Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
David S. Miller committed Sep 20, 2023
2 parents 6f0b985 + ce322d4 commit ad1e15d
Show file tree
Hide file tree
Showing 11 changed files with 31 additions and 54 deletions.
6 changes: 2 additions & 4 deletions drivers/net/dsa/b53/b53_mmap.c
Original file line number Diff line number Diff line change
Expand Up @@ -324,14 +324,12 @@ static int b53_mmap_probe(struct platform_device *pdev)
return b53_switch_register(dev);
}

static int b53_mmap_remove(struct platform_device *pdev)
static void b53_mmap_remove(struct platform_device *pdev)
{
struct b53_device *dev = platform_get_drvdata(pdev);

if (dev)
b53_switch_remove(dev);

return 0;
}

static void b53_mmap_shutdown(struct platform_device *pdev)
Expand Down Expand Up @@ -372,7 +370,7 @@ MODULE_DEVICE_TABLE(of, b53_mmap_of_table);

static struct platform_driver b53_mmap_driver = {
.probe = b53_mmap_probe,
.remove = b53_mmap_remove,
.remove_new = b53_mmap_remove,
.shutdown = b53_mmap_shutdown,
.driver = {
.name = "b53-switch",
Expand Down
8 changes: 3 additions & 5 deletions drivers/net/dsa/b53/b53_srab.c
Original file line number Diff line number Diff line change
Expand Up @@ -657,17 +657,15 @@ static int b53_srab_probe(struct platform_device *pdev)
return b53_switch_register(dev);
}

static int b53_srab_remove(struct platform_device *pdev)
static void b53_srab_remove(struct platform_device *pdev)
{
struct b53_device *dev = platform_get_drvdata(pdev);

if (!dev)
return 0;
return;

b53_srab_intr_set(dev->priv, false);
b53_switch_remove(dev);

return 0;
}

static void b53_srab_shutdown(struct platform_device *pdev)
Expand All @@ -684,7 +682,7 @@ static void b53_srab_shutdown(struct platform_device *pdev)

static struct platform_driver b53_srab_driver = {
.probe = b53_srab_probe,
.remove = b53_srab_remove,
.remove_new = b53_srab_remove,
.shutdown = b53_srab_shutdown,
.driver = {
.name = "b53-srab-switch",
Expand Down
8 changes: 3 additions & 5 deletions drivers/net/dsa/bcm_sf2.c
Original file line number Diff line number Diff line change
Expand Up @@ -1537,12 +1537,12 @@ static int bcm_sf2_sw_probe(struct platform_device *pdev)
return ret;
}

static int bcm_sf2_sw_remove(struct platform_device *pdev)
static void bcm_sf2_sw_remove(struct platform_device *pdev)
{
struct bcm_sf2_priv *priv = platform_get_drvdata(pdev);

if (!priv)
return 0;
return;

priv->wol_ports_mask = 0;
/* Disable interrupts */
Expand All @@ -1554,8 +1554,6 @@ static int bcm_sf2_sw_remove(struct platform_device *pdev)
clk_disable_unprepare(priv->clk);
if (priv->type == BCM7278_DEVICE_ID)
reset_control_assert(priv->rcdev);

return 0;
}

static void bcm_sf2_sw_shutdown(struct platform_device *pdev)
Expand Down Expand Up @@ -1601,7 +1599,7 @@ static SIMPLE_DEV_PM_OPS(bcm_sf2_pm_ops,

static struct platform_driver bcm_sf2_driver = {
.probe = bcm_sf2_sw_probe,
.remove = bcm_sf2_sw_remove,
.remove_new = bcm_sf2_sw_remove,
.shutdown = bcm_sf2_sw_shutdown,
.driver = {
.name = "brcm-sf2",
Expand Down
8 changes: 3 additions & 5 deletions drivers/net/dsa/hirschmann/hellcreek.c
Original file line number Diff line number Diff line change
Expand Up @@ -2060,18 +2060,16 @@ static int hellcreek_probe(struct platform_device *pdev)
return ret;
}

static int hellcreek_remove(struct platform_device *pdev)
static void hellcreek_remove(struct platform_device *pdev)
{
struct hellcreek *hellcreek = platform_get_drvdata(pdev);

if (!hellcreek)
return 0;
return;

hellcreek_hwtstamp_free(hellcreek);
hellcreek_ptp_free(hellcreek);
dsa_unregister_switch(hellcreek->ds);

return 0;
}

static void hellcreek_shutdown(struct platform_device *pdev)
Expand Down Expand Up @@ -2107,7 +2105,7 @@ MODULE_DEVICE_TABLE(of, hellcreek_of_match);

static struct platform_driver hellcreek_driver = {
.probe = hellcreek_probe,
.remove = hellcreek_remove,
.remove_new = hellcreek_remove,
.shutdown = hellcreek_shutdown,
.driver = {
.name = "hellcreek",
Expand Down
8 changes: 3 additions & 5 deletions drivers/net/dsa/lantiq_gswip.c
Original file line number Diff line number Diff line change
Expand Up @@ -2207,13 +2207,13 @@ static int gswip_probe(struct platform_device *pdev)
return err;
}

static int gswip_remove(struct platform_device *pdev)
static void gswip_remove(struct platform_device *pdev)
{
struct gswip_priv *priv = platform_get_drvdata(pdev);
int i;

if (!priv)
return 0;
return;

/* disable the switch */
gswip_mdio_mask(priv, GSWIP_MDIO_GLOB_ENABLE, 0, GSWIP_MDIO_GLOB);
Expand All @@ -2228,8 +2228,6 @@ static int gswip_remove(struct platform_device *pdev)

for (i = 0; i < priv->num_gphy_fw; i++)
gswip_gphy_fw_remove(priv, &priv->gphy_fw[i]);

return 0;
}

static void gswip_shutdown(struct platform_device *pdev)
Expand Down Expand Up @@ -2266,7 +2264,7 @@ MODULE_DEVICE_TABLE(of, gswip_of_match);

static struct platform_driver gswip_driver = {
.probe = gswip_probe,
.remove = gswip_remove,
.remove_new = gswip_remove,
.shutdown = gswip_shutdown,
.driver = {
.name = "gswip",
Expand Down
7 changes: 2 additions & 5 deletions drivers/net/dsa/mt7530-mmio.c
Original file line number Diff line number Diff line change
Expand Up @@ -63,15 +63,12 @@ mt7988_probe(struct platform_device *pdev)
return dsa_register_switch(priv->ds);
}

static int
mt7988_remove(struct platform_device *pdev)
static void mt7988_remove(struct platform_device *pdev)
{
struct mt7530_priv *priv = platform_get_drvdata(pdev);

if (priv)
mt7530_remove_common(priv);

return 0;
}

static void mt7988_shutdown(struct platform_device *pdev)
Expand All @@ -88,7 +85,7 @@ static void mt7988_shutdown(struct platform_device *pdev)

static struct platform_driver mt7988_platform_driver = {
.probe = mt7988_probe,
.remove = mt7988_remove,
.remove_new = mt7988_remove,
.shutdown = mt7988_shutdown,
.driver = {
.name = "mt7530-mmio",
Expand Down
8 changes: 3 additions & 5 deletions drivers/net/dsa/ocelot/ocelot_ext.c
Original file line number Diff line number Diff line change
Expand Up @@ -115,19 +115,17 @@ static int ocelot_ext_probe(struct platform_device *pdev)
return err;
}

static int ocelot_ext_remove(struct platform_device *pdev)
static void ocelot_ext_remove(struct platform_device *pdev)
{
struct felix *felix = dev_get_drvdata(&pdev->dev);

if (!felix)
return 0;
return;

dsa_unregister_switch(felix->ds);

kfree(felix->ds);
kfree(felix);

return 0;
}

static void ocelot_ext_shutdown(struct platform_device *pdev)
Expand All @@ -154,7 +152,7 @@ static struct platform_driver ocelot_ext_switch_driver = {
.of_match_table = ocelot_ext_switch_of_match,
},
.probe = ocelot_ext_probe,
.remove = ocelot_ext_remove,
.remove_new = ocelot_ext_remove,
.shutdown = ocelot_ext_shutdown,
};
module_platform_driver(ocelot_ext_switch_driver);
Expand Down
8 changes: 3 additions & 5 deletions drivers/net/dsa/ocelot/seville_vsc9953.c
Original file line number Diff line number Diff line change
Expand Up @@ -1029,19 +1029,17 @@ static int seville_probe(struct platform_device *pdev)
return err;
}

static int seville_remove(struct platform_device *pdev)
static void seville_remove(struct platform_device *pdev)
{
struct felix *felix = platform_get_drvdata(pdev);

if (!felix)
return 0;
return;

dsa_unregister_switch(felix->ds);

kfree(felix->ds);
kfree(felix);

return 0;
}

static void seville_shutdown(struct platform_device *pdev)
Expand All @@ -1064,7 +1062,7 @@ MODULE_DEVICE_TABLE(of, seville_of_match);

static struct platform_driver seville_vsc9953_driver = {
.probe = seville_probe,
.remove = seville_remove,
.remove_new = seville_remove,
.shutdown = seville_shutdown,
.driver = {
.name = "mscc_seville",
Expand Down
8 changes: 3 additions & 5 deletions drivers/net/dsa/realtek/realtek-smi.c
Original file line number Diff line number Diff line change
Expand Up @@ -506,12 +506,12 @@ static int realtek_smi_probe(struct platform_device *pdev)
return 0;
}

static int realtek_smi_remove(struct platform_device *pdev)
static void realtek_smi_remove(struct platform_device *pdev)
{
struct realtek_priv *priv = platform_get_drvdata(pdev);

if (!priv)
return 0;
return;

dsa_unregister_switch(priv->ds);
if (priv->slave_mii_bus)
Expand All @@ -520,8 +520,6 @@ static int realtek_smi_remove(struct platform_device *pdev)
/* leave the device reset asserted */
if (priv->reset)
gpiod_set_value(priv->reset, 1);

return 0;
}

static void realtek_smi_shutdown(struct platform_device *pdev)
Expand Down Expand Up @@ -559,7 +557,7 @@ static struct platform_driver realtek_smi_driver = {
.of_match_table = realtek_smi_of_match,
},
.probe = realtek_smi_probe,
.remove = realtek_smi_remove,
.remove_new = realtek_smi_remove,
.shutdown = realtek_smi_shutdown,
};
module_platform_driver(realtek_smi_driver);
Expand Down
8 changes: 3 additions & 5 deletions drivers/net/dsa/rzn1_a5psw.c
Original file line number Diff line number Diff line change
Expand Up @@ -1272,19 +1272,17 @@ static int a5psw_probe(struct platform_device *pdev)
return ret;
}

static int a5psw_remove(struct platform_device *pdev)
static void a5psw_remove(struct platform_device *pdev)
{
struct a5psw *a5psw = platform_get_drvdata(pdev);

if (!a5psw)
return 0;
return;

dsa_unregister_switch(&a5psw->ds);
a5psw_pcs_free(a5psw);
clk_disable_unprepare(a5psw->hclk);
clk_disable_unprepare(a5psw->clk);

return 0;
}

static void a5psw_shutdown(struct platform_device *pdev)
Expand All @@ -1311,7 +1309,7 @@ static struct platform_driver a5psw_driver = {
.of_match_table = a5psw_of_mtable,
},
.probe = a5psw_probe,
.remove = a5psw_remove,
.remove_new = a5psw_remove,
.shutdown = a5psw_shutdown,
};
module_platform_driver(a5psw_driver);
Expand Down
8 changes: 3 additions & 5 deletions drivers/net/dsa/vitesse-vsc73xx-platform.c
Original file line number Diff line number Diff line change
Expand Up @@ -112,16 +112,14 @@ static int vsc73xx_platform_probe(struct platform_device *pdev)
return vsc73xx_probe(&vsc_platform->vsc);
}

static int vsc73xx_platform_remove(struct platform_device *pdev)
static void vsc73xx_platform_remove(struct platform_device *pdev)
{
struct vsc73xx_platform *vsc_platform = platform_get_drvdata(pdev);

if (!vsc_platform)
return 0;
return;

vsc73xx_remove(&vsc_platform->vsc);

return 0;
}

static void vsc73xx_platform_shutdown(struct platform_device *pdev)
Expand Down Expand Up @@ -160,7 +158,7 @@ MODULE_DEVICE_TABLE(of, vsc73xx_of_match);

static struct platform_driver vsc73xx_platform_driver = {
.probe = vsc73xx_platform_probe,
.remove = vsc73xx_platform_remove,
.remove_new = vsc73xx_platform_remove,
.shutdown = vsc73xx_platform_shutdown,
.driver = {
.name = "vsc73xx-platform",
Expand Down

0 comments on commit ad1e15d

Please sign in to comment.