[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <6e467434-7d38-7810-03fb-c884447f3d75@huawei.com>
Date: Fri, 11 Jun 2021 15:40:22 +0800
From: Yang Yingliang <yangyingliang@...wei.com>
To: "weiyongjun (A)" <weiyongjun1@...wei.com>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
"netdev@...r.kernel.org" <netdev@...r.kernel.org>
CC: "davem@...emloft.net" <davem@...emloft.net>,
"kuba@...nel.org" <kuba@...nel.org>,
"andrew@...n.ch" <andrew@...n.ch>
Subject: Re: [PATCH net-next v2] net: mdio: mscc-miim: Use
devm_platform_get_and_ioremap_resource()
On 2021/6/11 14:57, weiyongjun (A) wrote:
>
>> Use devm_platform_get_and_ioremap_resource() to simplify
>> code.
>>
>> Signed-off-by: Yang Yingliang <yangyingliang@...wei.com>
>> ---
>> v2:
>> only convert the first platform_get_resource()
>> ---
>> drivers/net/mdio/mdio-mscc-miim.c | 6 +-----
>> 1 file changed, 1 insertion(+), 5 deletions(-)
>>
>> diff --git a/drivers/net/mdio/mdio-mscc-miim.c
>> b/drivers/net/mdio/mdio-mscc-miim.c
>> index b36e5ea04ddf..071c654bab29 100644
>> --- a/drivers/net/mdio/mdio-mscc-miim.c
>> +++ b/drivers/net/mdio/mdio-mscc-miim.c
>> @@ -139,10 +139,6 @@ static int mscc_miim_probe(struct
>> platform_device *pdev)
>> struct mscc_miim_dev *dev;
>> int ret;
>> - res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
>> - if (!res)
>> - return -ENODEV;
>> -
>> bus = devm_mdiobus_alloc_size(&pdev->dev, sizeof(*dev));
>> if (!bus)
>> return -ENOMEM;
>> @@ -155,7 +151,7 @@ static int mscc_miim_probe(struct platform_device
>> *pdev)
>> bus->parent = &pdev->dev;
>> dev = bus->priv;
>> - dev->regs = devm_ioremap_resource(&pdev->dev, res);
>> + dev->regs = devm_platform_get_and_ioremap_resource(pdev, 0, &res);
>
>
> res not used later, so should be
>
> dev->regs = devm_platform_get_and_ioremap_resource(pdev, 0, NULL);
Yes, I will send a v3 later.
Thanks,
Yang
>
>
>> if (IS_ERR(dev->regs)) {
>> dev_err(&pdev->dev, "Unable to map MIIM registers\n");
>> return PTR_ERR(dev->regs);
> .
Powered by blists - more mailing lists