Commit 3230a55b authored by YueHaibing's avatar YueHaibing Committed by David S. Miller

mvpp2: 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: default avatarHulk Robot <hulkci@huawei.com>
Signed-off-by: default avatarYueHaibing <yuehaibing@huawei.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 3247b272
...@@ -5014,7 +5014,6 @@ static int mvpp2_port_probe(struct platform_device *pdev, ...@@ -5014,7 +5014,6 @@ static int mvpp2_port_probe(struct platform_device *pdev,
struct device_node *port_node = to_of_node(port_fwnode); struct device_node *port_node = to_of_node(port_fwnode);
netdev_features_t features; netdev_features_t features;
struct net_device *dev; struct net_device *dev;
struct resource *res;
struct phylink *phylink; struct phylink *phylink;
char *mac_from = ""; char *mac_from = "";
unsigned int ntxqs, nrxqs, thread; unsigned int ntxqs, nrxqs, thread;
...@@ -5118,8 +5117,7 @@ static int mvpp2_port_probe(struct platform_device *pdev, ...@@ -5118,8 +5117,7 @@ static int mvpp2_port_probe(struct platform_device *pdev,
port->comphy = comphy; port->comphy = comphy;
if (priv->hw_version == MVPP21) { if (priv->hw_version == MVPP21) {
res = platform_get_resource(pdev, IORESOURCE_MEM, 2 + id); port->base = devm_platform_ioremap_resource(pdev, 2 + id);
port->base = devm_ioremap_resource(&pdev->dev, res);
if (IS_ERR(port->base)) { if (IS_ERR(port->base)) {
err = PTR_ERR(port->base); err = PTR_ERR(port->base);
goto err_free_irq; goto err_free_irq;
...@@ -5551,14 +5549,12 @@ static int mvpp2_probe(struct platform_device *pdev) ...@@ -5551,14 +5549,12 @@ static int mvpp2_probe(struct platform_device *pdev)
if (priv->hw_version == MVPP21) if (priv->hw_version == MVPP21)
queue_mode = MVPP2_QDIST_SINGLE_MODE; queue_mode = MVPP2_QDIST_SINGLE_MODE;
res = platform_get_resource(pdev, IORESOURCE_MEM, 0); base = devm_platform_ioremap_resource(pdev, 0);
base = devm_ioremap_resource(&pdev->dev, res);
if (IS_ERR(base)) if (IS_ERR(base))
return PTR_ERR(base); return PTR_ERR(base);
if (priv->hw_version == MVPP21) { if (priv->hw_version == MVPP21) {
res = platform_get_resource(pdev, IORESOURCE_MEM, 1); priv->lms_base = devm_platform_ioremap_resource(pdev, 1);
priv->lms_base = devm_ioremap_resource(&pdev->dev, res);
if (IS_ERR(priv->lms_base)) if (IS_ERR(priv->lms_base))
return PTR_ERR(priv->lms_base); return PTR_ERR(priv->lms_base);
} else { } else {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment