net: can: 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: Marc Kleine-Budde <mkl@pengutronix.de>
This commit is contained in:

committed by
Marc Kleine-Budde

parent
4c4726faed
commit
00e4bbc8cd
@@ -265,7 +265,7 @@ static int cc770_isa_probe(struct platform_device *pdev)
|
||||
else
|
||||
priv->clkout = COR_DEFAULT;
|
||||
|
||||
dev_set_drvdata(&pdev->dev, dev);
|
||||
platform_set_drvdata(pdev, dev);
|
||||
SET_NETDEV_DEV(dev, &pdev->dev);
|
||||
|
||||
err = register_cc770dev(dev);
|
||||
@@ -293,12 +293,11 @@ static int cc770_isa_probe(struct platform_device *pdev)
|
||||
|
||||
static int cc770_isa_remove(struct platform_device *pdev)
|
||||
{
|
||||
struct net_device *dev = dev_get_drvdata(&pdev->dev);
|
||||
struct net_device *dev = platform_get_drvdata(pdev);
|
||||
struct cc770_priv *priv = netdev_priv(dev);
|
||||
int idx = pdev->id;
|
||||
|
||||
unregister_cc770dev(dev);
|
||||
dev_set_drvdata(&pdev->dev, NULL);
|
||||
|
||||
if (mem[idx]) {
|
||||
iounmap(priv->reg_base);
|
||||
|
@@ -216,7 +216,7 @@ static int cc770_platform_probe(struct platform_device *pdev)
|
||||
priv->reg_base, dev->irq, priv->can.clock.freq,
|
||||
priv->cpu_interface, priv->bus_config, priv->clkout);
|
||||
|
||||
dev_set_drvdata(&pdev->dev, dev);
|
||||
platform_set_drvdata(pdev, dev);
|
||||
SET_NETDEV_DEV(dev, &pdev->dev);
|
||||
|
||||
err = register_cc770dev(dev);
|
||||
@@ -240,7 +240,7 @@ exit_release_mem:
|
||||
|
||||
static int cc770_platform_remove(struct platform_device *pdev)
|
||||
{
|
||||
struct net_device *dev = dev_get_drvdata(&pdev->dev);
|
||||
struct net_device *dev = platform_get_drvdata(pdev);
|
||||
struct cc770_priv *priv = netdev_priv(dev);
|
||||
struct resource *mem;
|
||||
|
||||
|
Reference in New Issue
Block a user