diff mbox series

[net-next,v2] net: lantiq: Use devm_platform_get_and_ioremap_resource()

Message ID 20210605122127.2469235-1-yangyingliang@huawei.com (mailing list archive)
State Accepted
Commit d402af20315c99d85c9310d6f7a00e5aca53e192
Delegated to: Netdev Maintainers
Headers show
Series [net-next,v2] net: lantiq: Use devm_platform_get_and_ioremap_resource() | expand

Checks

Context Check Description
netdev/cover_letter success Link
netdev/fixes_present success Link
netdev/patch_count success Link
netdev/tree_selection success Clearly marked for net-next
netdev/subject_prefix success Link
netdev/cc_maintainers success CCed 4 of 4 maintainers
netdev/source_inline success Was 0 now: 0
netdev/verify_signedoff success Link
netdev/module_param success Was 0 now: 0
netdev/build_32bit success Errors and warnings before: 0 this patch: 0
netdev/kdoc success Errors and warnings before: 0 this patch: 0
netdev/verify_fixes success Link
netdev/checkpatch success total: 0 errors, 0 warnings, 0 checks, 21 lines checked
netdev/build_allmodconfig_warn success Errors and warnings before: 0 this patch: 0
netdev/header_inline success Link

Commit Message

Yang Yingliang June 5, 2021, 12:21 p.m. UTC
Use devm_platform_get_and_ioremap_resource() to simplify
code.

Signed-off-by: Yang Yingliang <yangyingliang@huawei.com>
---
v2:
  remove 'res'
---
 drivers/net/ethernet/lantiq_xrx200.c | 9 +--------
 1 file changed, 1 insertion(+), 8 deletions(-)

Comments

Hauke Mehrtens June 5, 2021, 12:49 p.m. UTC | #1
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@huawei.com>

Acked-by: Hauke Mehrtens <hauke@hauke-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);
>   
>
patchwork-bot+netdevbpf@kernel.org June 7, 2021, 8:10 p.m. UTC | #2
Hello:

This patch was applied to netdev/net-next.git (refs/heads/master):

On Sat, 5 Jun 2021 20:21:27 +0800 you wrote:
> Use devm_platform_get_and_ioremap_resource() to simplify
> code.
> 
> Signed-off-by: Yang Yingliang <yangyingliang@huawei.com>
> ---
> v2:
>   remove 'res'
> 
> [...]

Here is the summary with links:
  - [net-next,v2] net: lantiq: Use devm_platform_get_and_ioremap_resource()
    https://git.kernel.org/netdev/net-next/c/d402af20315c

You are awesome, thank you!
--
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html
diff mbox series

Patch

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);