* [PATCH net-next] net: lantiq: Use devm_platform_get_and_ioremap_resource()
@ 2021-06-05 9:26 Yang Yingliang
2021-06-05 10:58 ` Hauke Mehrtens
0 siblings, 1 reply; 3+ messages in thread
From: Yang Yingliang @ 2021-06-05 9:26 UTC (permalink / raw)
To: linux-kernel, netdev; +Cc: hauke, davem, kuba
Use devm_platform_get_and_ioremap_resource() to simplify
code.
Signed-off-by: Yang Yingliang <yangyingliang@huawei.com>
---
drivers/net/ethernet/lantiq_xrx200.c | 8 +-------
1 file changed, 1 insertion(+), 7 deletions(-)
diff --git a/drivers/net/ethernet/lantiq_xrx200.c b/drivers/net/ethernet/lantiq_xrx200.c
index 36dc3e5f6218..003df49e40b1 100644
--- a/drivers/net/ethernet/lantiq_xrx200.c
+++ b/drivers/net/ethernet/lantiq_xrx200.c
@@ -456,13 +456,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, &res);
if (IS_ERR(priv->pmac_reg))
return PTR_ERR(priv->pmac_reg);
--
2.25.1
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH net-next] net: lantiq: Use devm_platform_get_and_ioremap_resource()
2021-06-05 9:26 [PATCH net-next] net: lantiq: Use devm_platform_get_and_ioremap_resource() Yang Yingliang
@ 2021-06-05 10:58 ` Hauke Mehrtens
2021-06-05 11:55 ` Yang Yingliang
0 siblings, 1 reply; 3+ messages in thread
From: Hauke Mehrtens @ 2021-06-05 10:58 UTC (permalink / raw)
To: Yang Yingliang, linux-kernel, netdev; +Cc: davem, kuba
[-- Attachment #1.1.1: Type: text/plain, Size: 1236 bytes --]
On 6/5/21 11:26 AM, Yang Yingliang wrote:
> Use devm_platform_get_and_ioremap_resource() to simplify
> code.
>
> Signed-off-by: Yang Yingliang <yangyingliang@huawei.com>
> ---
> drivers/net/ethernet/lantiq_xrx200.c | 8 +-------
> 1 file changed, 1 insertion(+), 7 deletions(-)
>
> diff --git a/drivers/net/ethernet/lantiq_xrx200.c b/drivers/net/ethernet/lantiq_xrx200.c
> index 36dc3e5f6218..003df49e40b1 100644
> --- a/drivers/net/ethernet/lantiq_xrx200.c
> +++ b/drivers/net/ethernet/lantiq_xrx200.c
> @@ -456,13 +456,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, &res);
res is not used anywhere else, you can provide NULL instead of res and
remove the variable.
priv->pmac_reg = devm_platform_get_and_ioremap_resource(pdev, 0, NULL);
> if (IS_ERR(priv->pmac_reg))
> return PTR_ERR(priv->pmac_reg);
>
>
[-- Attachment #1.1.2: OpenPGP public key --]
[-- Type: application/pgp-keys, Size: 10027 bytes --]
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 488 bytes --]
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH net-next] net: lantiq: Use devm_platform_get_and_ioremap_resource()
2021-06-05 10:58 ` Hauke Mehrtens
@ 2021-06-05 11:55 ` Yang Yingliang
0 siblings, 0 replies; 3+ messages in thread
From: Yang Yingliang @ 2021-06-05 11:55 UTC (permalink / raw)
To: Hauke Mehrtens, linux-kernel, netdev; +Cc: davem, kuba
On 2021/6/5 18:58, Hauke Mehrtens wrote:
> On 6/5/21 11:26 AM, Yang Yingliang wrote:
>> Use devm_platform_get_and_ioremap_resource() to simplify
>> code.
>>
>> Signed-off-by: Yang Yingliang <yangyingliang@huawei.com>
>> ---
>> drivers/net/ethernet/lantiq_xrx200.c | 8 +-------
>> 1 file changed, 1 insertion(+), 7 deletions(-)
>>
>> diff --git a/drivers/net/ethernet/lantiq_xrx200.c
>> b/drivers/net/ethernet/lantiq_xrx200.c
>> index 36dc3e5f6218..003df49e40b1 100644
>> --- a/drivers/net/ethernet/lantiq_xrx200.c
>> +++ b/drivers/net/ethernet/lantiq_xrx200.c
>> @@ -456,13 +456,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,
>> &res);
>
> res is not used anywhere else, you can provide NULL instead of res and
> remove the variable.
>
> priv->pmac_reg = devm_platform_get_and_ioremap_resource(pdev, 0, NULL);
OK, thanks for your suggestion.
>
>> if (IS_ERR(priv->pmac_reg))
>> return PTR_ERR(priv->pmac_reg);
>>
>
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2021-06-05 11:55 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-06-05 9:26 [PATCH net-next] net: lantiq: Use devm_platform_get_and_ioremap_resource() Yang Yingliang
2021-06-05 10:58 ` Hauke Mehrtens
2021-06-05 11:55 ` Yang Yingliang
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.