net: ethernet: use platform_{get,set}_drvdata()
Use the wrapper functions for getting and setting the driver data using platform_device instead of using dev_{get,set}_drvdata() with &pdev->dev, so we can directly pass a struct platform_device. Also, unnecessary dev_set_drvdata() is removed, because the driver core clears the driver data to NULL after device_release or on probe failure. Signed-off-by: Jingoo Han <jg1.han@samsung.com> Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
committed by
David S. Miller
parent
6d0bfe2261
commit
8513fbd880
@ -1484,7 +1484,7 @@ static int axienet_of_probe(struct platform_device *op)
|
||||
return -ENOMEM;
|
||||
|
||||
ether_setup(ndev);
|
||||
dev_set_drvdata(&op->dev, ndev);
|
||||
platform_set_drvdata(op, ndev);
|
||||
|
||||
SET_NETDEV_DEV(ndev, &op->dev);
|
||||
ndev->flags &= ~IFF_MULTICAST; /* clear multicast */
|
||||
@ -1622,7 +1622,7 @@ nodev:
|
||||
|
||||
static int axienet_of_remove(struct platform_device *op)
|
||||
{
|
||||
struct net_device *ndev = dev_get_drvdata(&op->dev);
|
||||
struct net_device *ndev = platform_get_drvdata(op);
|
||||
struct axienet_local *lp = netdev_priv(ndev);
|
||||
|
||||
axienet_mdio_teardown(lp);
|
||||
@ -1632,8 +1632,6 @@ static int axienet_of_remove(struct platform_device *op)
|
||||
of_node_put(lp->phy_node);
|
||||
lp->phy_node = NULL;
|
||||
|
||||
dev_set_drvdata(&op->dev, NULL);
|
||||
|
||||
iounmap(lp->regs);
|
||||
if (lp->dma_regs)
|
||||
iounmap(lp->dma_regs);
|
||||
|
Reference in New Issue
Block a user