Skip to content

Commit cf9e60a

Browse files
pcercueidavem330
authored andcommitted
net: davicom: Fix regulator not turned off on driver removal
We must disable the regulator that was enabled in the probe function. Fixes: 7994fe5 ("dm9000: Add regulator and reset support to dm9000") Signed-off-by: Paul Cercueil <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent ac88c53 commit cf9e60a

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

drivers/net/ethernet/davicom/dm9000.c

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -133,6 +133,8 @@ struct board_info {
133133
u32 wake_state;
134134

135135
int ip_summed;
136+
137+
struct regulator *power_supply;
136138
};
137139

138140
/* debug code */
@@ -1481,6 +1483,8 @@ dm9000_probe(struct platform_device *pdev)
14811483

14821484
db->dev = &pdev->dev;
14831485
db->ndev = ndev;
1486+
if (!IS_ERR(power))
1487+
db->power_supply = power;
14841488

14851489
spin_lock_init(&db->lock);
14861490
mutex_init(&db->addr_lock);
@@ -1766,10 +1770,13 @@ static int
17661770
dm9000_drv_remove(struct platform_device *pdev)
17671771
{
17681772
struct net_device *ndev = platform_get_drvdata(pdev);
1773+
struct board_info *dm = to_dm9000_board(ndev);
17691774

17701775
unregister_netdev(ndev);
1771-
dm9000_release_board(pdev, netdev_priv(ndev));
1776+
dm9000_release_board(pdev, dm);
17721777
free_netdev(ndev); /* free device structure */
1778+
if (dm->power_supply)
1779+
regulator_disable(dm->power_supply);
17731780

17741781
dev_dbg(&pdev->dev, "released and freed device\n");
17751782
return 0;

0 commit comments

Comments
 (0)