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
@@ -10108,7 +10108,7 @@ static int niu_of_probe(struct platform_device *op)
|
||||
goto err_out_iounmap;
|
||||
}
|
||||
|
||||
dev_set_drvdata(&op->dev, dev);
|
||||
platform_set_drvdata(op, dev);
|
||||
|
||||
niu_device_announce(np);
|
||||
|
||||
@@ -10145,7 +10145,7 @@ err_out:
|
||||
|
||||
static int niu_of_remove(struct platform_device *op)
|
||||
{
|
||||
struct net_device *dev = dev_get_drvdata(&op->dev);
|
||||
struct net_device *dev = platform_get_drvdata(op);
|
||||
|
||||
if (dev) {
|
||||
struct niu *np = netdev_priv(dev);
|
||||
@@ -10175,7 +10175,6 @@ static int niu_of_remove(struct platform_device *op)
|
||||
niu_put_parent(np);
|
||||
|
||||
free_netdev(dev);
|
||||
dev_set_drvdata(&op->dev, NULL);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
@@ -2506,7 +2506,7 @@ static struct quattro *quattro_sbus_find(struct platform_device *child)
|
||||
struct quattro *qp;
|
||||
|
||||
op = to_platform_device(parent);
|
||||
qp = dev_get_drvdata(&op->dev);
|
||||
qp = platform_get_drvdata(op);
|
||||
if (qp)
|
||||
return qp;
|
||||
|
||||
@@ -2521,7 +2521,7 @@ static struct quattro *quattro_sbus_find(struct platform_device *child)
|
||||
qp->next = qfe_sbus_list;
|
||||
qfe_sbus_list = qp;
|
||||
|
||||
dev_set_drvdata(&op->dev, qp);
|
||||
platform_set_drvdata(op, qp);
|
||||
}
|
||||
return qp;
|
||||
}
|
||||
|
@@ -767,7 +767,7 @@ static struct sunqec *get_qec(struct platform_device *child)
|
||||
struct platform_device *op = to_platform_device(child->dev.parent);
|
||||
struct sunqec *qecp;
|
||||
|
||||
qecp = dev_get_drvdata(&op->dev);
|
||||
qecp = platform_get_drvdata(op);
|
||||
if (!qecp) {
|
||||
qecp = kzalloc(sizeof(struct sunqec), GFP_KERNEL);
|
||||
if (qecp) {
|
||||
@@ -801,7 +801,7 @@ static struct sunqec *get_qec(struct platform_device *child)
|
||||
goto fail;
|
||||
}
|
||||
|
||||
dev_set_drvdata(&op->dev, qecp);
|
||||
platform_set_drvdata(op, qecp);
|
||||
|
||||
qecp->next_module = root_qec_dev;
|
||||
root_qec_dev = qecp;
|
||||
@@ -902,7 +902,7 @@ static int qec_ether_init(struct platform_device *op)
|
||||
if (res)
|
||||
goto fail;
|
||||
|
||||
dev_set_drvdata(&op->dev, qe);
|
||||
platform_set_drvdata(op, qe);
|
||||
|
||||
printk(KERN_INFO "%s: qe channel[%d] %pM\n", dev->name, qe->channel,
|
||||
dev->dev_addr);
|
||||
@@ -934,7 +934,7 @@ static int qec_sbus_probe(struct platform_device *op)
|
||||
|
||||
static int qec_sbus_remove(struct platform_device *op)
|
||||
{
|
||||
struct sunqe *qp = dev_get_drvdata(&op->dev);
|
||||
struct sunqe *qp = platform_get_drvdata(op);
|
||||
struct net_device *net_dev = qp->dev;
|
||||
|
||||
unregister_netdev(net_dev);
|
||||
@@ -948,8 +948,6 @@ static int qec_sbus_remove(struct platform_device *op)
|
||||
|
||||
free_netdev(net_dev);
|
||||
|
||||
dev_set_drvdata(&op->dev, NULL);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user