提交 291f4b6d 编写于 作者: Y YueHaibing 提交者: David S. Miller

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: NHulk Robot <hulkci@huawei.com>
Signed-off-by: NYueHaibing <yuehaibing@huawei.com>
Signed-off-by: NDavid S. Miller <davem@davemloft.net>
上级 6551c8c8
...@@ -536,7 +536,6 @@ static void b53_srab_mux_init(struct platform_device *pdev) ...@@ -536,7 +536,6 @@ static void b53_srab_mux_init(struct platform_device *pdev)
struct b53_device *dev = platform_get_drvdata(pdev); struct b53_device *dev = platform_get_drvdata(pdev);
struct b53_srab_priv *priv = dev->priv; struct b53_srab_priv *priv = dev->priv;
struct b53_srab_port_priv *p; struct b53_srab_port_priv *p;
struct resource *r;
unsigned int port; unsigned int port;
u32 reg, off = 0; u32 reg, off = 0;
int ret; int ret;
...@@ -544,8 +543,7 @@ static void b53_srab_mux_init(struct platform_device *pdev) ...@@ -544,8 +543,7 @@ static void b53_srab_mux_init(struct platform_device *pdev)
if (dev->pdata && dev->pdata->chip_id != BCM58XX_DEVICE_ID) if (dev->pdata && dev->pdata->chip_id != BCM58XX_DEVICE_ID)
return; return;
r = platform_get_resource(pdev, IORESOURCE_MEM, 1); priv->mux_config = devm_platform_ioremap_resource(pdev, 1);
priv->mux_config = devm_ioremap_resource(&pdev->dev, r);
if (IS_ERR(priv->mux_config)) if (IS_ERR(priv->mux_config))
return; return;
...@@ -593,7 +591,6 @@ static int b53_srab_probe(struct platform_device *pdev) ...@@ -593,7 +591,6 @@ static int b53_srab_probe(struct platform_device *pdev)
const struct of_device_id *of_id = NULL; const struct of_device_id *of_id = NULL;
struct b53_srab_priv *priv; struct b53_srab_priv *priv;
struct b53_device *dev; struct b53_device *dev;
struct resource *r;
if (dn) if (dn)
of_id = of_match_node(b53_srab_of_match, dn); of_id = of_match_node(b53_srab_of_match, dn);
...@@ -610,8 +607,7 @@ static int b53_srab_probe(struct platform_device *pdev) ...@@ -610,8 +607,7 @@ static int b53_srab_probe(struct platform_device *pdev)
if (!priv) if (!priv)
return -ENOMEM; return -ENOMEM;
r = platform_get_resource(pdev, IORESOURCE_MEM, 0); priv->regs = devm_platform_ioremap_resource(pdev, 0);
priv->regs = devm_ioremap_resource(&pdev->dev, r);
if (IS_ERR(priv->regs)) if (IS_ERR(priv->regs))
return -ENOMEM; return -ENOMEM;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册