Message ID | 20210605092647.2374125-1-yangyingliang@huawei.com (mailing list archive) |
---|---|
State | Superseded |
Delegated to: | Netdev Maintainers |
Headers | show |
Series | [net-next] net: lantiq: Use devm_platform_get_and_ioremap_resource() | expand |
Context | Check | Description |
---|---|---|
netdev/cover_letter | success | Link |
netdev/fixes_present | success | Link |
netdev/patch_count | success | Link |
netdev/tree_selection | success | Clearly marked for net-next |
netdev/subject_prefix | success | Link |
netdev/cc_maintainers | success | CCed 4 of 4 maintainers |
netdev/source_inline | success | Was 0 now: 0 |
netdev/verify_signedoff | success | Link |
netdev/module_param | success | Was 0 now: 0 |
netdev/build_32bit | success | Errors and warnings before: 0 this patch: 0 |
netdev/kdoc | success | Errors and warnings before: 0 this patch: 0 |
netdev/verify_fixes | success | Link |
netdev/checkpatch | success | total: 0 errors, 0 warnings, 0 checks, 14 lines checked |
netdev/build_allmodconfig_warn | success | Errors and warnings before: 0 this patch: 0 |
netdev/header_inline | success | Link |
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); > >
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); >> >
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);
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(-)