Re: [PATCH v6 2/3] reset: mchp: sparx5: add switch reset driver

From: Steen Hegelund
Date: Fri Feb 26 2021 - 03:04:43 EST


Hi Alex,

On Thu, 2021-02-25 at 21:40 +0100, Alexandre Belloni wrote:
> EXTERNAL EMAIL: Do not click links or open attachments unless you
> know the content is safe
>
> Hello,
>
> >

...

> > +static int mchp_sparx5_map_io(struct platform_device *pdev, char
> > *name,
> > +                           struct regmap **target)
> > +{
> > +     struct resource *res;
> > +     struct regmap *map;
> > +     void __iomem *mem;
> > +
> > +     res = platform_get_resource_byname(pdev, IORESOURCE_MEM,
> > name);
> > +     if (!res) {
> > +             dev_err(&pdev->dev, "No '%s' resource\n", name);
> > +             return -ENODEV;
> > +     }
> > +     mem = devm_ioremap(&pdev->dev, res->start, res->end - res-
> > >start + 1);
> > +     if (!mem) {
> > +             dev_err(&pdev->dev, "Could not map '%s' resource\n",
> > name);
> > +             return -ENXIO;
> > +     }
>
> Someone is going to tell you to use
> devm_platform_get_and_ioremap_resource so it may as well be me ;)

Very nice.
Thanks for the info. I will use that instead.

>
> --
> Alexandre Belloni, co-owner and COO, Bootlin
> Embedded Linux and Kernel engineering
> https://bootlin.com

--
BR
Steen

-=-=-=-=-=-=-=-=-=-=-=-=-=-=
steen.hegelund@xxxxxxxxxxxxx