lkml.org 
[lkml]   [2019]   [Sep]   [18]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
SubjectRe: [PATCH net-next] net: ethernet: ti: use devm_platform_ioremap_resource() to simplify code
From
Date


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

\
 
 \ /
  Last update: 2019-09-18 11:30    [W:0.056 / U:0.496 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site