You've already forked linux-apfs
mirror of
https://github.com/linux-apfs/linux-apfs.git
synced 2026-05-01 15:00:59 -07:00
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
@@ -580,7 +580,7 @@ static int bfin_can_probe(struct platform_device *pdev)
|
||||
priv->pin_list = pdata;
|
||||
priv->can.clock.freq = get_sclk();
|
||||
|
||||
dev_set_drvdata(&pdev->dev, dev);
|
||||
platform_set_drvdata(pdev, dev);
|
||||
SET_NETDEV_DEV(dev, &pdev->dev);
|
||||
|
||||
dev->flags |= IFF_ECHO; /* we support local echo */
|
||||
@@ -613,7 +613,7 @@ exit:
|
||||
|
||||
static int bfin_can_remove(struct platform_device *pdev)
|
||||
{
|
||||
struct net_device *dev = dev_get_drvdata(&pdev->dev);
|
||||
struct net_device *dev = platform_get_drvdata(pdev);
|
||||
struct bfin_can_priv *priv = netdev_priv(dev);
|
||||
struct resource *res;
|
||||
|
||||
@@ -621,8 +621,6 @@ static int bfin_can_remove(struct platform_device *pdev)
|
||||
|
||||
unregister_candev(dev);
|
||||
|
||||
dev_set_drvdata(&pdev->dev, NULL);
|
||||
|
||||
res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
|
||||
release_mem_region(res->start, resource_size(res));
|
||||
|
||||
@@ -635,7 +633,7 @@ static int bfin_can_remove(struct platform_device *pdev)
|
||||
#ifdef CONFIG_PM
|
||||
static int bfin_can_suspend(struct platform_device *pdev, pm_message_t mesg)
|
||||
{
|
||||
struct net_device *dev = dev_get_drvdata(&pdev->dev);
|
||||
struct net_device *dev = platform_get_drvdata(pdev);
|
||||
struct bfin_can_priv *priv = netdev_priv(dev);
|
||||
struct bfin_can_regs __iomem *reg = priv->membase;
|
||||
int timeout = BFIN_CAN_TIMEOUT;
|
||||
@@ -658,7 +656,7 @@ static int bfin_can_suspend(struct platform_device *pdev, pm_message_t mesg)
|
||||
|
||||
static int bfin_can_resume(struct platform_device *pdev)
|
||||
{
|
||||
struct net_device *dev = dev_get_drvdata(&pdev->dev);
|
||||
struct net_device *dev = platform_get_drvdata(pdev);
|
||||
struct bfin_can_priv *priv = netdev_priv(dev);
|
||||
struct bfin_can_regs __iomem *reg = priv->membase;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user