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

Steen Hegelund steen.hegelund at microchip.com
Fri Feb 26 03:02:52 EST 2021


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 at microchip.com




More information about the linux-arm-kernel mailing list