* [PATCH net-next] net: ethernet: ti: use devm_platform_ioremap_resource() to simplify code
@ 2019-08-21 12:48 YueHaibing
2019-08-21 14:20 ` Grygorii Strashko
` (2 more replies)
0 siblings, 3 replies; 6+ messages in thread
From: YueHaibing @ 2019-08-21 12:48 UTC (permalink / raw)
To: davem, grygorii.strashko, ivan.khoronzhuk, andrew, ynezz
Cc: linux-kernel, netdev, linux-omap, YueHaibing
Use devm_platform_ioremap_resource() to simplify the code a bit.
This is detected by coccinelle.
Reported-by: Hulk Robot <hulkci@huawei.com>
Signed-off-by: YueHaibing <yuehaibing@huawei.com>
---
drivers/net/ethernet/ti/cpsw.c | 5 ++---
1 file changed, 2 insertions(+), 3 deletions(-)
diff --git a/drivers/net/ethernet/ti/cpsw.c b/drivers/net/ethernet/ti/cpsw.c
index 32a8974..5401095 100644
--- a/drivers/net/ethernet/ti/cpsw.c
+++ b/drivers/net/ethernet/ti/cpsw.c
@@ -2764,7 +2764,7 @@ static int cpsw_probe(struct platform_device *pdev)
struct net_device *ndev;
struct cpsw_priv *priv;
void __iomem *ss_regs;
- struct resource *res, *ss_res;
+ struct resource *ss_res;
struct gpio_descs *mode;
const struct soc_device_attribute *soc;
struct cpsw_common *cpsw;
@@ -2798,8 +2798,7 @@ static int cpsw_probe(struct platform_device *pdev)
return PTR_ERR(ss_regs);
cpsw->regs = ss_regs;
- res = platform_get_resource(pdev, IORESOURCE_MEM, 1);
- cpsw->wr_regs = devm_ioremap_resource(dev, res);
+ cpsw->wr_regs = devm_platform_ioremap_resource(pdev, 1);
if (IS_ERR(cpsw->wr_regs))
return PTR_ERR(cpsw->wr_regs);
--
2.7.4
^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [PATCH net-next] net: ethernet: ti: use devm_platform_ioremap_resource() to simplify code
2019-08-21 12:48 [PATCH net-next] net: ethernet: ti: use devm_platform_ioremap_resource() to simplify code YueHaibing
@ 2019-08-21 14:20 ` Grygorii Strashko
2019-08-21 20:42 ` David Miller
2019-09-17 18:35 ` Geert Uytterhoeven
2 siblings, 0 replies; 6+ messages in thread
From: Grygorii Strashko @ 2019-08-21 14:20 UTC (permalink / raw)
To: YueHaibing, davem, ivan.khoronzhuk, andrew, ynezz
Cc: linux-kernel, netdev, linux-omap
On 21/08/2019 15:48, YueHaibing wrote:
> Use devm_platform_ioremap_resource() to simplify the code a bit.
> This is detected by coccinelle.
>
> Reported-by: Hulk Robot <hulkci@huawei.com>
> Signed-off-by: YueHaibing <yuehaibing@huawei.com>
> ---
> drivers/net/ethernet/ti/cpsw.c | 5 ++---
> 1 file changed, 2 insertions(+), 3 deletions(-)
>
Thank you.
Reviewed-by: Grygorii Strashko <grygorii.strashko@ti.com>
--
Best regards,
grygorii
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH net-next] net: ethernet: ti: use devm_platform_ioremap_resource() to simplify code
2019-08-21 12:48 [PATCH net-next] net: ethernet: ti: use devm_platform_ioremap_resource() to simplify code YueHaibing
2019-08-21 14:20 ` Grygorii Strashko
@ 2019-08-21 20:42 ` David Miller
2019-09-17 18:35 ` Geert Uytterhoeven
2 siblings, 0 replies; 6+ messages in thread
From: David Miller @ 2019-08-21 20:42 UTC (permalink / raw)
To: yuehaibing
Cc: grygorii.strashko, ivan.khoronzhuk, andrew, ynezz, linux-kernel,
netdev, linux-omap
From: YueHaibing <yuehaibing@huawei.com>
Date: Wed, 21 Aug 2019 20:48:50 +0800
> Use devm_platform_ioremap_resource() to simplify the code a bit.
> This is detected by coccinelle.
>
> Reported-by: Hulk Robot <hulkci@huawei.com>
> Signed-off-by: YueHaibing <yuehaibing@huawei.com>
Applied.
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH net-next] net: ethernet: ti: use devm_platform_ioremap_resource() to simplify code
2019-08-21 12:48 [PATCH net-next] net: ethernet: ti: use devm_platform_ioremap_resource() to simplify code YueHaibing
2019-08-21 14:20 ` Grygorii Strashko
2019-08-21 20:42 ` David Miller
@ 2019-09-17 18:35 ` Geert Uytterhoeven
2019-09-18 9:29 ` Grygorii Strashko
2 siblings, 1 reply; 6+ messages in thread
From: Geert Uytterhoeven @ 2019-09-17 18:35 UTC (permalink / raw)
To: YueHaibing
Cc: David S. Miller, Grygorii Strashko, ivan.khoronzhuk, Andrew Lunn,
Petr Štetiar, Linux Kernel Mailing List, netdev,
open list:TI ETHERNET SWITCH DRIVER (CPSW)
Hi YueHaibing,
On Wed, Aug 21, 2019 at 2:51 PM YueHaibing <yuehaibing@huawei.com> wrote:
> Use devm_platform_ioremap_resource() to simplify the code a bit.
> This is detected by coccinelle.
>
> Reported-by: Hulk Robot <hulkci@huawei.com>
> Signed-off-by: YueHaibing <yuehaibing@huawei.com>
> ---
> drivers/net/ethernet/ti/cpsw.c | 5 ++---
> 1 file changed, 2 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/net/ethernet/ti/cpsw.c b/drivers/net/ethernet/ti/cpsw.c
> index 32a8974..5401095 100644
> --- a/drivers/net/ethernet/ti/cpsw.c
> +++ b/drivers/net/ethernet/ti/cpsw.c
> @@ -2764,7 +2764,7 @@ static int cpsw_probe(struct platform_device *pdev)
> struct net_device *ndev;
> struct cpsw_priv *priv;
> void __iomem *ss_regs;
> - struct resource *res, *ss_res;
> + struct resource *ss_res;
> struct gpio_descs *mode;
> const struct soc_device_attribute *soc;
> struct cpsw_common *cpsw;
> @@ -2798,8 +2798,7 @@ static int cpsw_probe(struct platform_device *pdev)
And just out-of-context, we also have:
ss_res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
ss_regs = devm_ioremap_resource(dev, ss_res);
if (IS_ERR(ss_regs))
which was not detected as being the same pattern?
Interesting...
> return PTR_ERR(ss_regs);
> cpsw->regs = ss_regs;
>
> - res = platform_get_resource(pdev, IORESOURCE_MEM, 1);
> - cpsw->wr_regs = devm_ioremap_resource(dev, res);
> + cpsw->wr_regs = devm_platform_ioremap_resource(pdev, 1);
> if (IS_ERR(cpsw->wr_regs))
> return PTR_ERR(cpsw->wr_regs);
Gr{oetje,eeting}s,
Geert
--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org
In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH net-next] net: ethernet: ti: use devm_platform_ioremap_resource() to simplify code
2019-09-17 18:35 ` Geert Uytterhoeven
@ 2019-09-18 9:29 ` Grygorii Strashko
2019-09-18 9:35 ` Geert Uytterhoeven
0 siblings, 1 reply; 6+ messages in thread
From: Grygorii Strashko @ 2019-09-18 9:29 UTC (permalink / raw)
To: Geert Uytterhoeven, YueHaibing
Cc: David S. Miller, ivan.khoronzhuk, Andrew Lunn, Petr Štetiar,
Linux Kernel Mailing List, netdev,
open list:TI ETHERNET SWITCH DRIVER (CPSW)
On 17/09/2019 21:35, Geert Uytterhoeven wrote:
> Hi YueHaibing,
>
> On Wed, Aug 21, 2019 at 2:51 PM YueHaibing <yuehaibing@huawei.com> wrote:
>> Use devm_platform_ioremap_resource() to simplify the code a bit.
>> This is detected by coccinelle.
>>
>> Reported-by: Hulk Robot <hulkci@huawei.com>
>> Signed-off-by: YueHaibing <yuehaibing@huawei.com>
>> ---
>> drivers/net/ethernet/ti/cpsw.c | 5 ++---
>> 1 file changed, 2 insertions(+), 3 deletions(-)
>>
>> diff --git a/drivers/net/ethernet/ti/cpsw.c b/drivers/net/ethernet/ti/cpsw.c
>> index 32a8974..5401095 100644
>> --- a/drivers/net/ethernet/ti/cpsw.c
>> +++ b/drivers/net/ethernet/ti/cpsw.c
>> @@ -2764,7 +2764,7 @@ static int cpsw_probe(struct platform_device *pdev)
>> struct net_device *ndev;
>> struct cpsw_priv *priv;
>> void __iomem *ss_regs;
>> - struct resource *res, *ss_res;
>> + struct resource *ss_res;
>> struct gpio_descs *mode;
>> const struct soc_device_attribute *soc;
>> struct cpsw_common *cpsw;
>> @@ -2798,8 +2798,7 @@ static int cpsw_probe(struct platform_device *pdev)
>
> And just out-of-context, we also have:
>
> ss_res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
> ss_regs = devm_ioremap_resource(dev, ss_res);
> if (IS_ERR(ss_regs))
>
> which was not detected as being the same pattern?
>
> Interesting...
ss_res is used below to determine phys address of CPPI RAM.
>
>> return PTR_ERR(ss_regs);
>> cpsw->regs = ss_regs;
>>
>> - res = platform_get_resource(pdev, IORESOURCE_MEM, 1);
>> - cpsw->wr_regs = devm_ioremap_resource(dev, res);
>> + cpsw->wr_regs = devm_platform_ioremap_resource(pdev, 1);
>> if (IS_ERR(cpsw->wr_regs))
>> return PTR_ERR(cpsw->wr_regs);
--
Best regards,
grygorii
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH net-next] net: ethernet: ti: use devm_platform_ioremap_resource() to simplify code
2019-09-18 9:29 ` Grygorii Strashko
@ 2019-09-18 9:35 ` Geert Uytterhoeven
0 siblings, 0 replies; 6+ messages in thread
From: Geert Uytterhoeven @ 2019-09-18 9:35 UTC (permalink / raw)
To: Grygorii Strashko
Cc: YueHaibing, David S. Miller, ivan.khoronzhuk, Andrew Lunn,
Petr Štetiar, Linux Kernel Mailing List, netdev,
open list:TI ETHERNET SWITCH DRIVER (CPSW)
Hi Grygorii,
On Wed, Sep 18, 2019 at 11:29 AM Grygorii Strashko
<grygorii.strashko@ti.com> wrote:
> On 17/09/2019 21:35, Geert Uytterhoeven wrote:
> > On Wed, Aug 21, 2019 at 2:51 PM YueHaibing <yuehaibing@huawei.com> wrote:
> >> Use devm_platform_ioremap_resource() to simplify the code a bit.
> >> This is detected by coccinelle.
> >>
> >> Reported-by: Hulk Robot <hulkci@huawei.com>
> >> Signed-off-by: YueHaibing <yuehaibing@huawei.com>
> >> ---
> >> drivers/net/ethernet/ti/cpsw.c | 5 ++---
> >> 1 file changed, 2 insertions(+), 3 deletions(-)
> >>
> >> diff --git a/drivers/net/ethernet/ti/cpsw.c b/drivers/net/ethernet/ti/cpsw.c
> >> index 32a8974..5401095 100644
> >> --- a/drivers/net/ethernet/ti/cpsw.c
> >> +++ b/drivers/net/ethernet/ti/cpsw.c
> >> @@ -2764,7 +2764,7 @@ static int cpsw_probe(struct platform_device *pdev)
> >> struct net_device *ndev;
> >> struct cpsw_priv *priv;
> >> void __iomem *ss_regs;
> >> - struct resource *res, *ss_res;
> >> + struct resource *ss_res;
> >> struct gpio_descs *mode;
> >> const struct soc_device_attribute *soc;
> >> struct cpsw_common *cpsw;
> >> @@ -2798,8 +2798,7 @@ static int cpsw_probe(struct platform_device *pdev)
> >
> > And just out-of-context, we also have:
> >
> > ss_res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
> > ss_regs = devm_ioremap_resource(dev, ss_res);
> > if (IS_ERR(ss_regs))
> >
> > which was not detected as being the same pattern?
> >
> > Interesting...
>
> ss_res is used below to determine phys address of CPPI RAM.
Right, thanks, I missed that.
> >
> >> return PTR_ERR(ss_regs);
> >> cpsw->regs = ss_regs;
> >>
> >> - res = platform_get_resource(pdev, IORESOURCE_MEM, 1);
> >> - cpsw->wr_regs = devm_ioremap_resource(dev, res);
> >> + cpsw->wr_regs = devm_platform_ioremap_resource(pdev, 1);
> >> if (IS_ERR(cpsw->wr_regs))
> >> return PTR_ERR(cpsw->wr_regs);
Gr{oetje,eeting}s,
Geert
--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org
In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2019-09-18 9:36 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-08-21 12:48 [PATCH net-next] net: ethernet: ti: use devm_platform_ioremap_resource() to simplify code YueHaibing
2019-08-21 14:20 ` Grygorii Strashko
2019-08-21 20:42 ` David Miller
2019-09-17 18:35 ` Geert Uytterhoeven
2019-09-18 9:29 ` Grygorii Strashko
2019-09-18 9:35 ` Geert Uytterhoeven
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).