[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <9e2463ef-dfbe-2e55-4ab5-5d328cfefc29@hauke-m.de>
Date: Sat, 5 Jun 2021 14:49:26 +0200
From: Hauke Mehrtens <hauke@...ke-m.de>
To: Yang Yingliang <yangyingliang@...wei.com>,
linux-kernel@...r.kernel.org, netdev@...r.kernel.org
Cc: davem@...emloft.net, kuba@...nel.org
Subject: Re: [PATCH net-next v2] net: lantiq: Use
devm_platform_get_and_ioremap_resource()
On 6/5/21 2:21 PM, Yang Yingliang wrote:
> Use devm_platform_get_and_ioremap_resource() to simplify
> code.
>
> Signed-off-by: Yang Yingliang <yangyingliang@...wei.com>
Acked-by: Hauke Mehrtens <hauke@...ke-m.de>
> ---
> v2:
> remove 'res'
> ---
> drivers/net/ethernet/lantiq_xrx200.c | 9 +--------
> 1 file changed, 1 insertion(+), 8 deletions(-)
>
> diff --git a/drivers/net/ethernet/lantiq_xrx200.c b/drivers/net/ethernet/lantiq_xrx200.c
> index 36dc3e5f6218..27df06ed355e 100644
> --- a/drivers/net/ethernet/lantiq_xrx200.c
> +++ b/drivers/net/ethernet/lantiq_xrx200.c
> @@ -436,7 +436,6 @@ static int xrx200_probe(struct platform_device *pdev)
> {
> struct device *dev = &pdev->dev;
> struct device_node *np = dev->of_node;
> - struct resource *res;
> struct xrx200_priv *priv;
> struct net_device *net_dev;
> int err;
> @@ -456,13 +455,7 @@ static int xrx200_probe(struct platform_device *pdev)
> net_dev->max_mtu = XRX200_DMA_DATA_LEN;
>
> /* load the memory ranges */
> - res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
> - if (!res) {
> - dev_err(dev, "failed to get resources\n");
> - return -ENOENT;
> - }
> -
> - priv->pmac_reg = devm_ioremap_resource(dev, res);
> + priv->pmac_reg = devm_platform_get_and_ioremap_resource(pdev, 0, NULL);
> if (IS_ERR(priv->pmac_reg))
> return PTR_ERR(priv->pmac_reg);
>
>
Download attachment "OpenPGP_0x93DD20630910B515.asc" of type "application/pgp-keys" (9896 bytes)
Download attachment "OpenPGP_signature" of type "application/pgp-signature" (489 bytes)
Powered by blists - more mailing lists