Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

net: ethernet: ravb: Use devm_platform_get_and_ioremap_resource()

Use devm_platform_get_and_ioremap_resource() to simplify
code.

Signed-off-by: Yang Yingliang <yangyingliang@huawei.com>
Reviewed-by: Sergei Shtylyov <sergei.shtylyov@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>

authored by

Yang Yingliang and committed by
David S. Miller
e89a2cdb 2c32a3d3

+4 -11
+4 -11
drivers/net/ethernet/renesas/ravb_main.c
··· 2047 2047 return -EINVAL; 2048 2048 } 2049 2049 2050 - /* Get base address */ 2051 - res = platform_get_resource(pdev, IORESOURCE_MEM, 0); 2052 - if (!res) { 2053 - dev_err(&pdev->dev, "invalid resource\n"); 2054 - return -EINVAL; 2055 - } 2056 - 2057 2050 ndev = alloc_etherdev_mqs(sizeof(struct ravb_private), 2058 2051 NUM_TX_QUEUE, NUM_RX_QUEUE); 2059 2052 if (!ndev) ··· 2057 2064 2058 2065 pm_runtime_enable(&pdev->dev); 2059 2066 pm_runtime_get_sync(&pdev->dev); 2060 - 2061 - /* The Ether-specific entries in the device structure. */ 2062 - ndev->base_addr = res->start; 2063 2067 2064 2068 chip_id = (enum ravb_chip_id)of_device_get_match_data(&pdev->dev); 2065 2069 ··· 2079 2089 priv->num_rx_ring[RAVB_BE] = BE_RX_RING_SIZE; 2080 2090 priv->num_tx_ring[RAVB_NC] = NC_TX_RING_SIZE; 2081 2091 priv->num_rx_ring[RAVB_NC] = NC_RX_RING_SIZE; 2082 - priv->addr = devm_ioremap_resource(&pdev->dev, res); 2092 + priv->addr = devm_platform_get_and_ioremap_resource(pdev, 0, &res); 2083 2093 if (IS_ERR(priv->addr)) { 2084 2094 error = PTR_ERR(priv->addr); 2085 2095 goto out_release; 2086 2096 } 2097 + 2098 + /* The Ether-specific entries in the device structure. */ 2099 + ndev->base_addr = res->start; 2087 2100 2088 2101 spin_lock_init(&priv->lock); 2089 2102 INIT_WORK(&priv->work, ravb_tx_timeout_work);