diff options
author | YueHaibing <yuehaibing@huawei.com> | 2019-08-01 08:27:32 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2019-08-01 13:10:34 -0400 |
commit | 291f4b6de48aa8a4140a189ab974d7c398d72bea (patch) | |
tree | 7dff6ed102f4060bc238127636fdfe4d95a39c82 | |
parent | 6551c8c807b8d35b404f5a4bfeb02b20bf8c1fad (diff) |
net: dsa: b53: use devm_platform_ioremap_resource() to simplify code
Use devm_platform_ioremap_resource() to simplify the code a bit.
This is detected by coccinelle.
Reported-by: Hulk Robot <hulkci@huawei.com>
Signed-off-by: YueHaibing <yuehaibing@huawei.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r-- | drivers/net/dsa/b53/b53_srab.c | 8 |
1 files changed, 2 insertions, 6 deletions
diff --git a/drivers/net/dsa/b53/b53_srab.c b/drivers/net/dsa/b53/b53_srab.c index d9c56a779c08..0a1be5259be0 100644 --- a/drivers/net/dsa/b53/b53_srab.c +++ b/drivers/net/dsa/b53/b53_srab.c | |||
@@ -536,7 +536,6 @@ static void b53_srab_mux_init(struct platform_device *pdev) | |||
536 | struct b53_device *dev = platform_get_drvdata(pdev); | 536 | struct b53_device *dev = platform_get_drvdata(pdev); |
537 | struct b53_srab_priv *priv = dev->priv; | 537 | struct b53_srab_priv *priv = dev->priv; |
538 | struct b53_srab_port_priv *p; | 538 | struct b53_srab_port_priv *p; |
539 | struct resource *r; | ||
540 | unsigned int port; | 539 | unsigned int port; |
541 | u32 reg, off = 0; | 540 | u32 reg, off = 0; |
542 | int ret; | 541 | int ret; |
@@ -544,8 +543,7 @@ static void b53_srab_mux_init(struct platform_device *pdev) | |||
544 | if (dev->pdata && dev->pdata->chip_id != BCM58XX_DEVICE_ID) | 543 | if (dev->pdata && dev->pdata->chip_id != BCM58XX_DEVICE_ID) |
545 | return; | 544 | return; |
546 | 545 | ||
547 | r = platform_get_resource(pdev, IORESOURCE_MEM, 1); | 546 | priv->mux_config = devm_platform_ioremap_resource(pdev, 1); |
548 | priv->mux_config = devm_ioremap_resource(&pdev->dev, r); | ||
549 | if (IS_ERR(priv->mux_config)) | 547 | if (IS_ERR(priv->mux_config)) |
550 | return; | 548 | return; |
551 | 549 | ||
@@ -593,7 +591,6 @@ static int b53_srab_probe(struct platform_device *pdev) | |||
593 | const struct of_device_id *of_id = NULL; | 591 | const struct of_device_id *of_id = NULL; |
594 | struct b53_srab_priv *priv; | 592 | struct b53_srab_priv *priv; |
595 | struct b53_device *dev; | 593 | struct b53_device *dev; |
596 | struct resource *r; | ||
597 | 594 | ||
598 | if (dn) | 595 | if (dn) |
599 | of_id = of_match_node(b53_srab_of_match, dn); | 596 | of_id = of_match_node(b53_srab_of_match, dn); |
@@ -610,8 +607,7 @@ static int b53_srab_probe(struct platform_device *pdev) | |||
610 | if (!priv) | 607 | if (!priv) |
611 | return -ENOMEM; | 608 | return -ENOMEM; |
612 | 609 | ||
613 | r = platform_get_resource(pdev, IORESOURCE_MEM, 0); | 610 | priv->regs = devm_platform_ioremap_resource(pdev, 0); |
614 | priv->regs = devm_ioremap_resource(&pdev->dev, r); | ||
615 | if (IS_ERR(priv->regs)) | 611 | if (IS_ERR(priv->regs)) |
616 | return -ENOMEM; | 612 | return -ENOMEM; |
617 | 613 | ||