Re: [PATCHv3 net-next] net: modernize ioremap in probe

From: Rosen Penev
Date: Wed Nov 20 2024 - 14:29:38 EST


On Tue, Nov 19, 2024 at 12:02 PM Sergey Shtylyov <s.shtylyov@xxxxxx> wrote:
>
> On 11/18/24 12:27 AM, Rosen Penev wrote:
>
> > Convert platform_get_resource_bynam + devm_ioremap_resource to
> > devm_platform_ioremap_resource_byname.
> >
> > Convert platform_get_resource + devm_ioremap_resource to
> > devm_platform_ioremap_resource.
> >
> > resource aquisition and ioremap can be performed in one step.
> >
> > Signed-off-by: Rosen Penev <rosenp@xxxxxxxxx>
> > ---
> > v3: reworded commit message again. Also removed devm_ioremap
> > conversions. Even though they use normal resource, they are not
> > the same.
> > v2: fixed compilation errors on PPC and reworded commit message
> > drivers/net/dsa/hirschmann/hellcreek.c | 18 +++---------------
> > drivers/net/ethernet/atheros/ag71xx.c | 13 +++++--------
> > drivers/net/ethernet/broadcom/bcm63xx_enet.c | 6 ++----
> > .../net/ethernet/marvell/mvpp2/mvpp2_main.c | 14 +++++---------
> > drivers/net/ethernet/renesas/rswitch.c | 9 +--------
> > drivers/net/ethernet/renesas/rtsn.c | 10 ++--------
> > drivers/net/mdio/mdio-ipq4019.c | 5 +----
> > 7 files changed, 19 insertions(+), 56 deletions(-)
> >
> > diff --git a/drivers/net/dsa/hirschmann/hellcreek.c b/drivers/net/dsa/hirschmann/hellcreek.c
> > index 283ec5a6e23c..940c4fa6a924 100644
> > --- a/drivers/net/dsa/hirschmann/hellcreek.c
> > +++ b/drivers/net/dsa/hirschmann/hellcreek.c
> [...]
> > @@ -1982,23 +1981,12 @@ static int hellcreek_probe(struct platform_device *pdev)
> >
> > hellcreek->dev = dev;
> >
> > - res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "tsn");
> > - if (!res) {
> > - dev_err(dev, "No memory region provided!\n");
> > - return -ENODEV;
> > - }
> > -
> > - hellcreek->base = devm_ioremap_resource(dev, res);
> > + hellcreek->base = devm_platform_ioremap_resource_byname(pdev, "tsn");
> > if (IS_ERR(hellcreek->base))
> > return PTR_ERR(hellcreek->base);
> >
> > - res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "ptp");
> > - if (!res) {
> > - dev_err(dev, "No PTP memory region provided!\n");
> > - return -ENODEV;
> > - }
> > -
> > - hellcreek->ptp_base = devm_ioremap_resource(dev, res);
> > + hellcreek->ptp_base =
> > + devm_platform_ioremap_resource_byname(pdev, "ptp");
>
> You have full 100 columns now, so doing this with 2 lines doesn't seem necessary --
> checkpatch.pl shouldn't complain...
Looks like that's bdc48fa11e46f according to git blame. Reading the
commit message, 80 is still prefered. The reason it's done here is
because of .clang-format, which still lists 80.
>
> [...]
>
> Other than that, looks saner now... :-)
>
> MBR, Sergey
>