* [PATCH] ethernet: Use devm_platform_ioremap_resource() in three functions
@ 2019-09-18 13:30 Markus Elfring
2019-09-18 14:16 ` Radhey Shyam Pandey
0 siblings, 1 reply; 8+ messages in thread
From: Markus Elfring @ 2019-09-18 13:30 UTC (permalink / raw)
To: netdev, linux-arm-kernel, David S. Miller, Hans Ulli Kroll,
Hauke Mehrtens, Linus Walleij, Michal Simek, Radhey Shyam Pandey
Cc: LKML, kernel-janitors, Bartosz Golaszewski, Himanshu Jha
From: Markus Elfring <elfring@users.sourceforge.net>
Date: Wed, 18 Sep 2019 15:15:06 +0200
Simplify these function implementations by using a known wrapper function.
This issue was detected by using the Coccinelle software.
Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
---
drivers/net/ethernet/cortina/gemini.c | 6 +-----
drivers/net/ethernet/lantiq_xrx200.c | 11 +----------
drivers/net/ethernet/xilinx/xilinx_axienet_main.c | 9 +--------
3 files changed, 3 insertions(+), 23 deletions(-)
diff --git a/drivers/net/ethernet/cortina/gemini.c b/drivers/net/ethernet/cortina/gemini.c
index e736ce2c58ca..f009415ee4d8 100644
--- a/drivers/net/ethernet/cortina/gemini.c
+++ b/drivers/net/ethernet/cortina/gemini.c
@@ -2549,17 +2549,13 @@ static int gemini_ethernet_probe(struct platform_device *pdev)
struct device *dev = &pdev->dev;
struct gemini_ethernet *geth;
unsigned int retry = 5;
- struct resource *res;
u32 val;
/* Global registers */
geth = devm_kzalloc(dev, sizeof(*geth), GFP_KERNEL);
if (!geth)
return -ENOMEM;
- res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
- if (!res)
- return -ENODEV;
- geth->base = devm_ioremap_resource(dev, res);
+ geth->base = devm_platform_ioremap_resource(pdev, 0);
if (IS_ERR(geth->base))
return PTR_ERR(geth->base);
geth->dev = dev;
diff --git a/drivers/net/ethernet/lantiq_xrx200.c b/drivers/net/ethernet/lantiq_xrx200.c
index 900affbdcc0e..0a7ea45b9e59 100644
--- a/drivers/net/ethernet/lantiq_xrx200.c
+++ b/drivers/net/ethernet/lantiq_xrx200.c
@@ -424,7 +424,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;
const u8 *mac;
@@ -443,15 +442,7 @@ static int xrx200_probe(struct platform_device *pdev)
SET_NETDEV_DEV(net_dev, dev);
net_dev->min_mtu = ETH_ZLEN;
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_ioremap_resource(pdev, 0);
if (IS_ERR(priv->pmac_reg)) {
dev_err(dev, "failed to request and remap io ranges\n");
return PTR_ERR(priv->pmac_reg);
diff --git a/drivers/net/ethernet/xilinx/xilinx_axienet_main.c b/drivers/net/ethernet/xilinx/xilinx_axienet_main.c
index 4fc627fb4d11..92783aaaa0a2 100644
--- a/drivers/net/ethernet/xilinx/xilinx_axienet_main.c
+++ b/drivers/net/ethernet/xilinx/xilinx_axienet_main.c
@@ -1787,14 +1787,7 @@ static int axienet_probe(struct platform_device *pdev)
of_node_put(np);
lp->eth_irq = platform_get_irq(pdev, 0);
} else {
- /* Check for these resources directly on the Ethernet node. */
- struct resource *res = platform_get_resource(pdev,
- IORESOURCE_MEM, 1);
- if (!res) {
- dev_err(&pdev->dev, "unable to get DMA memory resource\n");
- goto free_netdev;
- }
- lp->dma_regs = devm_ioremap_resource(&pdev->dev, res);
+ lp->dma_regs = devm_platform_ioremap_resource(pdev, 1);
lp->rx_irq = platform_get_irq(pdev, 1);
lp->tx_irq = platform_get_irq(pdev, 0);
lp->eth_irq = platform_get_irq(pdev, 2);
--
2.23.0
^ permalink raw reply related [flat|nested] 8+ messages in thread
* RE: [PATCH] ethernet: Use devm_platform_ioremap_resource() in three functions
2019-09-18 13:30 [PATCH] ethernet: Use devm_platform_ioremap_resource() in three functions Markus Elfring
@ 2019-09-18 14:16 ` Radhey Shyam Pandey
2019-09-20 9:23 ` [PATCH v2] ethernet: gemini: Use devm_platform_ioremap_resource() in gemini_ethernet_probe() Markus Elfring
` (2 more replies)
0 siblings, 3 replies; 8+ messages in thread
From: Radhey Shyam Pandey @ 2019-09-18 14:16 UTC (permalink / raw)
To: Markus Elfring, netdev, linux-arm-kernel, David S. Miller,
Hans Ulli Kroll, Hauke Mehrtens, Linus Walleij, Michal Simek
Cc: LKML, kernel-janitors, Bartosz Golaszewski, Himanshu Jha
> -----Original Message-----
> From: Markus Elfring <Markus.Elfring@web.de>
> Sent: Wednesday, September 18, 2019 7:01 PM
> To: netdev@vger.kernel.org; linux-arm-kernel@lists.infradead.org; David S.
> Miller <davem@davemloft.net>; Hans Ulli Kroll <ulli.kroll@googlemail.com>;
> Hauke Mehrtens <hauke@hauke-m.de>; Linus Walleij
> <linus.walleij@linaro.org>; Michal Simek <michals@xilinx.com>; Radhey
> Shyam Pandey <radheys@xilinx.com>
> Cc: LKML <linux-kernel@vger.kernel.org>; kernel-janitors@vger.kernel.org;
> Bartosz Golaszewski <bgolaszewski@baylibre.com>; Himanshu Jha
> <himanshujha199640@gmail.com>
> Subject: [PATCH] ethernet: Use devm_platform_ioremap_resource() in three
> functions
Prefer using a separate patch for each driver. Also skip mentioning
"three functions" in commit description.
>
> From: Markus Elfring <elfring@users.sourceforge.net>
> Date: Wed, 18 Sep 2019 15:15:06 +0200
>
> Simplify these function implementations by using a known wrapper function.
Minor nit- Better to mention about these funcs in commit description.
Something like- uses devm_platform_ioremap_resource() instead of using
platform_get_resource() and devm_ioremap_resource() together to simplify.
>
> This issue was detected by using the Coccinelle software.
>
> Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
> ---
> drivers/net/ethernet/cortina/gemini.c | 6 +-----
> drivers/net/ethernet/lantiq_xrx200.c | 11 +----------
> drivers/net/ethernet/xilinx/xilinx_axienet_main.c | 9 +--------
> 3 files changed, 3 insertions(+), 23 deletions(-)
>
> diff --git a/drivers/net/ethernet/cortina/gemini.c
> b/drivers/net/ethernet/cortina/gemini.c
> index e736ce2c58ca..f009415ee4d8 100644
> --- a/drivers/net/ethernet/cortina/gemini.c
> +++ b/drivers/net/ethernet/cortina/gemini.c
> @@ -2549,17 +2549,13 @@ static int gemini_ethernet_probe(struct
> platform_device *pdev)
> struct device *dev = &pdev->dev;
> struct gemini_ethernet *geth;
> unsigned int retry = 5;
> - struct resource *res;
> u32 val;
>
> /* Global registers */
> geth = devm_kzalloc(dev, sizeof(*geth), GFP_KERNEL);
> if (!geth)
> return -ENOMEM;
> - res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
> - if (!res)
> - return -ENODEV;
> - geth->base = devm_ioremap_resource(dev, res);
> + geth->base = devm_platform_ioremap_resource(pdev, 0);
> if (IS_ERR(geth->base))
> return PTR_ERR(geth->base);
> geth->dev = dev;
> diff --git a/drivers/net/ethernet/lantiq_xrx200.c
> b/drivers/net/ethernet/lantiq_xrx200.c
> index 900affbdcc0e..0a7ea45b9e59 100644
> --- a/drivers/net/ethernet/lantiq_xrx200.c
> +++ b/drivers/net/ethernet/lantiq_xrx200.c
> @@ -424,7 +424,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;
> const u8 *mac;
> @@ -443,15 +442,7 @@ static int xrx200_probe(struct platform_device *pdev)
> SET_NETDEV_DEV(net_dev, dev);
> net_dev->min_mtu = ETH_ZLEN;
> 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_ioremap_resource(pdev, 0);
> if (IS_ERR(priv->pmac_reg)) {
> dev_err(dev, "failed to request and remap io ranges\n");
> return PTR_ERR(priv->pmac_reg);
> diff --git a/drivers/net/ethernet/xilinx/xilinx_axienet_main.c
> b/drivers/net/ethernet/xilinx/xilinx_axienet_main.c
> index 4fc627fb4d11..92783aaaa0a2 100644
> --- a/drivers/net/ethernet/xilinx/xilinx_axienet_main.c
> +++ b/drivers/net/ethernet/xilinx/xilinx_axienet_main.c
> @@ -1787,14 +1787,7 @@ static int axienet_probe(struct platform_device
> *pdev)
> of_node_put(np);
> lp->eth_irq = platform_get_irq(pdev, 0);
> } else {
> - /* Check for these resources directly on the Ethernet node. */
> - struct resource *res = platform_get_resource(pdev,
> -
> IORESOURCE_MEM, 1);
> - if (!res) {
> - dev_err(&pdev->dev, "unable to get DMA memory
> resource\n");
> - goto free_netdev;
> - }
> - lp->dma_regs = devm_ioremap_resource(&pdev->dev, res);
> + lp->dma_regs = devm_platform_ioremap_resource(pdev, 1);
> lp->rx_irq = platform_get_irq(pdev, 1);
> lp->tx_irq = platform_get_irq(pdev, 0);
> lp->eth_irq = platform_get_irq(pdev, 2);
> --
> 2.23.0
^ permalink raw reply [flat|nested] 8+ messages in thread
* [PATCH v2] ethernet: gemini: Use devm_platform_ioremap_resource() in gemini_ethernet_probe()
2019-09-18 14:16 ` Radhey Shyam Pandey
@ 2019-09-20 9:23 ` Markus Elfring
2019-10-04 21:08 ` Linus Walleij
2019-09-20 10:57 ` [PATCH v2] ethernet: lantiq_xrx200: Use devm_platform_ioremap_resource() in xrx200_probe() Markus Elfring
2019-09-20 11:30 ` [PATCH v2] ethernet: axienet: Use devm_platform_ioremap_resource() in axienet_probe() Markus Elfring
2 siblings, 1 reply; 8+ messages in thread
From: Markus Elfring @ 2019-09-20 9:23 UTC (permalink / raw)
To: netdev, linux-arm-kernel, David S. Miller, Hans Ulli Kroll,
Linus Walleij, Radhey Shyam Pandey
Cc: LKML, kernel-janitors
From: Markus Elfring <elfring@users.sourceforge.net>
Date: Fri, 20 Sep 2019 10:52:56 +0200
Simplify this function implementation by using the wrapper function
“devm_platform_ioremap_resource” instead of calling the functions
“platform_get_resource” and “devm_ioremap_resource” directly.
* Thus reduce also a bit of exception handling code here.
* Delete the local variable “res”.
This issue was detected by using the Coccinelle software.
Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
---
v2:
Further changes were requested by Radhey Shyam Pandey.
https://lore.kernel.org/r/CH2PR02MB700047AFFFE08FE5FD563541C78E0@CH2PR02MB7000.namprd02.prod.outlook.com/
* Updates for three modules were split into
a separate patch for each driver.
* The commit description was adjusted.
drivers/net/ethernet/cortina/gemini.c | 6 +-----
1 file changed, 1 insertion(+), 5 deletions(-)
diff --git a/drivers/net/ethernet/cortina/gemini.c b/drivers/net/ethernet/cortina/gemini.c
index e736ce2c58ca..f009415ee4d8 100644
--- a/drivers/net/ethernet/cortina/gemini.c
+++ b/drivers/net/ethernet/cortina/gemini.c
@@ -2549,17 +2549,13 @@ static int gemini_ethernet_probe(struct platform_device *pdev)
struct device *dev = &pdev->dev;
struct gemini_ethernet *geth;
unsigned int retry = 5;
- struct resource *res;
u32 val;
/* Global registers */
geth = devm_kzalloc(dev, sizeof(*geth), GFP_KERNEL);
if (!geth)
return -ENOMEM;
- res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
- if (!res)
- return -ENODEV;
- geth->base = devm_ioremap_resource(dev, res);
+ geth->base = devm_platform_ioremap_resource(pdev, 0);
if (IS_ERR(geth->base))
return PTR_ERR(geth->base);
geth->dev = dev;
--
2.23.0
^ permalink raw reply related [flat|nested] 8+ messages in thread
* [PATCH v2] ethernet: lantiq_xrx200: Use devm_platform_ioremap_resource() in xrx200_probe()
2019-09-18 14:16 ` Radhey Shyam Pandey
2019-09-20 9:23 ` [PATCH v2] ethernet: gemini: Use devm_platform_ioremap_resource() in gemini_ethernet_probe() Markus Elfring
@ 2019-09-20 10:57 ` Markus Elfring
2019-09-20 19:23 ` Hauke Mehrtens
2019-09-20 11:30 ` [PATCH v2] ethernet: axienet: Use devm_platform_ioremap_resource() in axienet_probe() Markus Elfring
2 siblings, 1 reply; 8+ messages in thread
From: Markus Elfring @ 2019-09-20 10:57 UTC (permalink / raw)
To: netdev, David S. Miller, Hauke Mehrtens, Radhey Shyam Pandey
Cc: LKML, kernel-janitors
From: Markus Elfring <elfring@users.sourceforge.net>
Date: Fri, 20 Sep 2019 11:48:33 +0200
Simplify this function implementation by using the wrapper function
“devm_platform_ioremap_resource” instead of calling the functions
“platform_get_resource” and “devm_ioremap_resource” directly.
* Thus reduce also a bit of exception handling code here.
* Delete the local variable “res”.
This issue was detected by using the Coccinelle software.
Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
---
v2:
Further changes were requested by Radhey Shyam Pandey.
https://lore.kernel.org/r/CH2PR02MB700047AFFFE08FE5FD563541C78E0@CH2PR02MB7000.namprd02.prod.outlook.com/
* Updates for three modules were split into a separate patch for each driver.
* The commit description was adjusted.
drivers/net/ethernet/lantiq_xrx200.c | 11 +----------
1 file changed, 1 insertion(+), 10 deletions(-)
diff --git a/drivers/net/ethernet/lantiq_xrx200.c b/drivers/net/ethernet/lantiq_xrx200.c
index 900affbdcc0e..0a7ea45b9e59 100644
--- a/drivers/net/ethernet/lantiq_xrx200.c
+++ b/drivers/net/ethernet/lantiq_xrx200.c
@@ -424,7 +424,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;
const u8 *mac;
@@ -443,15 +442,7 @@ static int xrx200_probe(struct platform_device *pdev)
SET_NETDEV_DEV(net_dev, dev);
net_dev->min_mtu = ETH_ZLEN;
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_ioremap_resource(pdev, 0);
if (IS_ERR(priv->pmac_reg)) {
dev_err(dev, "failed to request and remap io ranges\n");
return PTR_ERR(priv->pmac_reg);
--
2.23.0
^ permalink raw reply related [flat|nested] 8+ messages in thread
* [PATCH v2] ethernet: axienet: Use devm_platform_ioremap_resource() in axienet_probe()
2019-09-18 14:16 ` Radhey Shyam Pandey
2019-09-20 9:23 ` [PATCH v2] ethernet: gemini: Use devm_platform_ioremap_resource() in gemini_ethernet_probe() Markus Elfring
2019-09-20 10:57 ` [PATCH v2] ethernet: lantiq_xrx200: Use devm_platform_ioremap_resource() in xrx200_probe() Markus Elfring
@ 2019-09-20 11:30 ` Markus Elfring
2019-09-20 11:57 ` Radhey Shyam Pandey
2 siblings, 1 reply; 8+ messages in thread
From: Markus Elfring @ 2019-09-20 11:30 UTC (permalink / raw)
To: netdev, linux-arm-kernel, David S. Miller, Michal Simek,
Radhey Shyam Pandey
Cc: LKML, kernel-janitors
From: Markus Elfring <elfring@users.sourceforge.net>
Date: Fri, 20 Sep 2019 13:17:01 +0200
Simplify this function implementation by using the wrapper function
“devm_platform_ioremap_resource” instead of calling the functions
“platform_get_resource” and “devm_ioremap_resource” directly.
* Thus reduce also a bit of exception handling code here.
* Delete the local variable “res”.
This issue was detected by using the Coccinelle software.
Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
---
v2:
Further changes were requested by Radhey Shyam Pandey.
https://lore.kernel.org/r/CH2PR02MB700047AFFFE08FE5FD563541C78E0@CH2PR02MB7000.namprd02.prod.outlook.com/
* Updates for three modules were split into a separate patch for each driver.
* The commit description was adjusted.
drivers/net/ethernet/xilinx/xilinx_axienet_main.c | 9 +--------
1 file changed, 1 insertion(+), 8 deletions(-)
diff --git a/drivers/net/ethernet/xilinx/xilinx_axienet_main.c b/drivers/net/ethernet/xilinx/xilinx_axienet_main.c
index 4fc627fb4d11..92783aaaa0a2 100644
--- a/drivers/net/ethernet/xilinx/xilinx_axienet_main.c
+++ b/drivers/net/ethernet/xilinx/xilinx_axienet_main.c
@@ -1787,14 +1787,7 @@ static int axienet_probe(struct platform_device *pdev)
of_node_put(np);
lp->eth_irq = platform_get_irq(pdev, 0);
} else {
- /* Check for these resources directly on the Ethernet node. */
- struct resource *res = platform_get_resource(pdev,
- IORESOURCE_MEM, 1);
- if (!res) {
- dev_err(&pdev->dev, "unable to get DMA memory resource\n");
- goto free_netdev;
- }
- lp->dma_regs = devm_ioremap_resource(&pdev->dev, res);
+ lp->dma_regs = devm_platform_ioremap_resource(pdev, 1);
lp->rx_irq = platform_get_irq(pdev, 1);
lp->tx_irq = platform_get_irq(pdev, 0);
lp->eth_irq = platform_get_irq(pdev, 2);
--
2.23.0
^ permalink raw reply related [flat|nested] 8+ messages in thread
* RE: [PATCH v2] ethernet: axienet: Use devm_platform_ioremap_resource() in axienet_probe()
2019-09-20 11:30 ` [PATCH v2] ethernet: axienet: Use devm_platform_ioremap_resource() in axienet_probe() Markus Elfring
@ 2019-09-20 11:57 ` Radhey Shyam Pandey
0 siblings, 0 replies; 8+ messages in thread
From: Radhey Shyam Pandey @ 2019-09-20 11:57 UTC (permalink / raw)
To: Markus Elfring, netdev, linux-arm-kernel, David S. Miller, Michal Simek
Cc: LKML, kernel-janitors
> -----Original Message-----
> From: Markus Elfring <Markus.Elfring@web.de>
> Sent: Friday, September 20, 2019 5:01 PM
> To: netdev@vger.kernel.org; linux-arm-kernel@lists.infradead.org; David S.
> Miller <davem@davemloft.net>; Michal Simek <michals@xilinx.com>;
> Radhey Shyam Pandey <radheys@xilinx.com>
> Cc: LKML <linux-kernel@vger.kernel.org>; kernel-janitors@vger.kernel.org
> Subject: [PATCH v2] ethernet: axienet: Use
> devm_platform_ioremap_resource() in axienet_probe()
>
> From: Markus Elfring <elfring@users.sourceforge.net>
> Date: Fri, 20 Sep 2019 13:17:01 +0200
>
> Simplify this function implementation by using the wrapper function
> “devm_platform_ioremap_resource” instead of calling the functions
> “platform_get_resource” and “devm_ioremap_resource” directly.
>
> * Thus reduce also a bit of exception handling code here.
> * Delete the local variable “res”.
>
> This issue was detected by using the Coccinelle software.
>
> Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
Reviewed-by: Radhey Shyam Pandey <radhey.shyam.pandey@xilinx.com>
Thanks!
> ---
>
> v2:
> Further changes were requested by Radhey Shyam Pandey.
> https://lore.kernel.org/r/CH2PR02MB700047AFFFE08FE5FD563541C78E0@C
> H2PR02MB7000.namprd02.prod.outlook.com/
>
> * Updates for three modules were split into a separate patch for each driver.
> * The commit description was adjusted.
>
>
> drivers/net/ethernet/xilinx/xilinx_axienet_main.c | 9 +--------
> 1 file changed, 1 insertion(+), 8 deletions(-)
>
> diff --git a/drivers/net/ethernet/xilinx/xilinx_axienet_main.c
> b/drivers/net/ethernet/xilinx/xilinx_axienet_main.c
> index 4fc627fb4d11..92783aaaa0a2 100644
> --- a/drivers/net/ethernet/xilinx/xilinx_axienet_main.c
> +++ b/drivers/net/ethernet/xilinx/xilinx_axienet_main.c
> @@ -1787,14 +1787,7 @@ static int axienet_probe(struct platform_device
> *pdev)
> of_node_put(np);
> lp->eth_irq = platform_get_irq(pdev, 0);
> } else {
> - /* Check for these resources directly on the Ethernet node.
> */
> - struct resource *res = platform_get_resource(pdev,
> -
> IORESOURCE_MEM, 1);
> - if (!res) {
> - dev_err(&pdev->dev, "unable to get DMA memory
> resource\n");
> - goto free_netdev;
> - }
> - lp->dma_regs = devm_ioremap_resource(&pdev->dev, res);
> + lp->dma_regs = devm_platform_ioremap_resource(pdev, 1);
> lp->rx_irq = platform_get_irq(pdev, 1);
> lp->tx_irq = platform_get_irq(pdev, 0);
> lp->eth_irq = platform_get_irq(pdev, 2);
> --
> 2.23.0
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH v2] ethernet: lantiq_xrx200: Use devm_platform_ioremap_resource() in xrx200_probe()
2019-09-20 10:57 ` [PATCH v2] ethernet: lantiq_xrx200: Use devm_platform_ioremap_resource() in xrx200_probe() Markus Elfring
@ 2019-09-20 19:23 ` Hauke Mehrtens
0 siblings, 0 replies; 8+ messages in thread
From: Hauke Mehrtens @ 2019-09-20 19:23 UTC (permalink / raw)
To: Markus Elfring, netdev, David S. Miller, Radhey Shyam Pandey
Cc: LKML, kernel-janitors
[-- Attachment #1.1: Type: text/plain, Size: 2328 bytes --]
On 9/20/19 12:57 PM, Markus Elfring wrote:
> From: Markus Elfring <elfring@users.sourceforge.net>
> Date: Fri, 20 Sep 2019 11:48:33 +0200
>
> Simplify this function implementation by using the wrapper function
> “devm_platform_ioremap_resource” instead of calling the functions
> “platform_get_resource” and “devm_ioremap_resource” directly.
>
> * Thus reduce also a bit of exception handling code here.
> * Delete the local variable “res”.
>
> This issue was detected by using the Coccinelle software.
>
> Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
Acked-by: Hauke Mehrtens <hauke@hauke-m.de>
But this can also wait till kernel 5.5.
> ---
>
> v2:
> Further changes were requested by Radhey Shyam Pandey.
>
> https://lore.kernel.org/r/CH2PR02MB700047AFFFE08FE5FD563541C78E0@CH2PR02MB7000.namprd02.prod.outlook.com/
>
>
>
> * Updates for three modules were split into a separate patch for each driver.
>
> * The commit description was adjusted.
>
>
>
>
>
> drivers/net/ethernet/lantiq_xrx200.c | 11 +----------
> 1 file changed, 1 insertion(+), 10 deletions(-)
>
> diff --git a/drivers/net/ethernet/lantiq_xrx200.c b/drivers/net/ethernet/lantiq_xrx200.c
> index 900affbdcc0e..0a7ea45b9e59 100644
> --- a/drivers/net/ethernet/lantiq_xrx200.c
> +++ b/drivers/net/ethernet/lantiq_xrx200.c
> @@ -424,7 +424,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;
> const u8 *mac;
> @@ -443,15 +442,7 @@ static int xrx200_probe(struct platform_device *pdev)
> SET_NETDEV_DEV(net_dev, dev);
> net_dev->min_mtu = ETH_ZLEN;
> 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_ioremap_resource(pdev, 0);
> if (IS_ERR(priv->pmac_reg)) {
> dev_err(dev, "failed to request and remap io ranges\n");
> return PTR_ERR(priv->pmac_reg);
> --
> 2.23.0
>
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 488 bytes --]
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH v2] ethernet: gemini: Use devm_platform_ioremap_resource() in gemini_ethernet_probe()
2019-09-20 9:23 ` [PATCH v2] ethernet: gemini: Use devm_platform_ioremap_resource() in gemini_ethernet_probe() Markus Elfring
@ 2019-10-04 21:08 ` Linus Walleij
0 siblings, 0 replies; 8+ messages in thread
From: Linus Walleij @ 2019-10-04 21:08 UTC (permalink / raw)
To: Markus Elfring
Cc: netdev, Linux ARM, David S. Miller, Hans Ulli Kroll,
Radhey Shyam Pandey, LKML, kernel-janitors
On Fri, Sep 20, 2019 at 11:23 AM Markus Elfring <Markus.Elfring@web.de> wrote:
> From: Markus Elfring <elfring@users.sourceforge.net>
> Date: Fri, 20 Sep 2019 10:52:56 +0200
>
> Simplify this function implementation by using the wrapper function
> “devm_platform_ioremap_resource” instead of calling the functions
> “platform_get_resource” and “devm_ioremap_resource” directly.
>
> * Thus reduce also a bit of exception handling code here.
> * Delete the local variable “res”.
>
> This issue was detected by using the Coccinelle software.
>
> Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
Seems correct.
Reviewed-by: Linus Walleij <linus.walleij@linaro.org>
BR
Linus Walleij
^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2019-10-04 21:08 UTC | newest]
Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-09-18 13:30 [PATCH] ethernet: Use devm_platform_ioremap_resource() in three functions Markus Elfring
2019-09-18 14:16 ` Radhey Shyam Pandey
2019-09-20 9:23 ` [PATCH v2] ethernet: gemini: Use devm_platform_ioremap_resource() in gemini_ethernet_probe() Markus Elfring
2019-10-04 21:08 ` Linus Walleij
2019-09-20 10:57 ` [PATCH v2] ethernet: lantiq_xrx200: Use devm_platform_ioremap_resource() in xrx200_probe() Markus Elfring
2019-09-20 19:23 ` Hauke Mehrtens
2019-09-20 11:30 ` [PATCH v2] ethernet: axienet: Use devm_platform_ioremap_resource() in axienet_probe() Markus Elfring
2019-09-20 11:57 ` Radhey Shyam Pandey
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).