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,
quoted
...
quoted
+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-quoted
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@microchip.com
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel