diff options
author | Jingoo Han <jg1.han@samsung.com> | 2013-05-23 06:47:58 -0400 |
---|---|---|
committer | Marc Kleine-Budde <mkl@pengutronix.de> | 2013-06-03 07:13:49 -0400 |
commit | 00e4bbc8cd7efac66caa4ce6bcf5f02e944184f6 (patch) | |
tree | 57aac83b859b47d0bc4fb444b9b5a39800754b04 /drivers/net/can/mscan/mpc5xxx_can.c | |
parent | 4c4726faed6cf0c7545ac6523de4cc66acd0a61d (diff) |
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>
Diffstat (limited to 'drivers/net/can/mscan/mpc5xxx_can.c')
-rw-r--r-- | drivers/net/can/mscan/mpc5xxx_can.c | 10 |
1 files changed, 4 insertions, 6 deletions
diff --git a/drivers/net/can/mscan/mpc5xxx_can.c b/drivers/net/can/mscan/mpc5xxx_can.c index 668850e441dc..5b0ee8ef5885 100644 --- a/drivers/net/can/mscan/mpc5xxx_can.c +++ b/drivers/net/can/mscan/mpc5xxx_can.c | |||
@@ -302,7 +302,7 @@ static int mpc5xxx_can_probe(struct platform_device *ofdev) | |||
302 | goto exit_free_mscan; | 302 | goto exit_free_mscan; |
303 | } | 303 | } |
304 | 304 | ||
305 | dev_set_drvdata(&ofdev->dev, dev); | 305 | platform_set_drvdata(ofdev, dev); |
306 | 306 | ||
307 | dev_info(&ofdev->dev, "MSCAN at 0x%p, irq %d, clock %d Hz\n", | 307 | dev_info(&ofdev->dev, "MSCAN at 0x%p, irq %d, clock %d Hz\n", |
308 | priv->reg_base, dev->irq, priv->can.clock.freq); | 308 | priv->reg_base, dev->irq, priv->can.clock.freq); |
@@ -321,11 +321,9 @@ exit_unmap_mem: | |||
321 | 321 | ||
322 | static int mpc5xxx_can_remove(struct platform_device *ofdev) | 322 | static int mpc5xxx_can_remove(struct platform_device *ofdev) |
323 | { | 323 | { |
324 | struct net_device *dev = dev_get_drvdata(&ofdev->dev); | 324 | struct net_device *dev = platform_get_drvdata(ofdev); |
325 | struct mscan_priv *priv = netdev_priv(dev); | 325 | struct mscan_priv *priv = netdev_priv(dev); |
326 | 326 | ||
327 | dev_set_drvdata(&ofdev->dev, NULL); | ||
328 | |||
329 | unregister_mscandev(dev); | 327 | unregister_mscandev(dev); |
330 | iounmap(priv->reg_base); | 328 | iounmap(priv->reg_base); |
331 | irq_dispose_mapping(dev->irq); | 329 | irq_dispose_mapping(dev->irq); |
@@ -338,7 +336,7 @@ static int mpc5xxx_can_remove(struct platform_device *ofdev) | |||
338 | static struct mscan_regs saved_regs; | 336 | static struct mscan_regs saved_regs; |
339 | static int mpc5xxx_can_suspend(struct platform_device *ofdev, pm_message_t state) | 337 | static int mpc5xxx_can_suspend(struct platform_device *ofdev, pm_message_t state) |
340 | { | 338 | { |
341 | struct net_device *dev = dev_get_drvdata(&ofdev->dev); | 339 | struct net_device *dev = platform_get_drvdata(ofdev); |
342 | struct mscan_priv *priv = netdev_priv(dev); | 340 | struct mscan_priv *priv = netdev_priv(dev); |
343 | struct mscan_regs *regs = (struct mscan_regs *)priv->reg_base; | 341 | struct mscan_regs *regs = (struct mscan_regs *)priv->reg_base; |
344 | 342 | ||
@@ -349,7 +347,7 @@ static int mpc5xxx_can_suspend(struct platform_device *ofdev, pm_message_t state | |||
349 | 347 | ||
350 | static int mpc5xxx_can_resume(struct platform_device *ofdev) | 348 | static int mpc5xxx_can_resume(struct platform_device *ofdev) |
351 | { | 349 | { |
352 | struct net_device *dev = dev_get_drvdata(&ofdev->dev); | 350 | struct net_device *dev = platform_get_drvdata(ofdev); |
353 | struct mscan_priv *priv = netdev_priv(dev); | 351 | struct mscan_priv *priv = netdev_priv(dev); |
354 | struct mscan_regs *regs = (struct mscan_regs *)priv->reg_base; | 352 | struct mscan_regs *regs = (struct mscan_regs *)priv->reg_base; |
355 | 353 | ||