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

From
Steen Hegelund <steen.hegelund@microchip.com>
Date
2021-02-26 08:04:35
Also in
lkml
Reply to
Alexandre Belloni, 2021-02-25
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
Thread (6 messages) 6 messages, 2 authors, last reply 2021-02-26
Keyboard shortcuts
hback out one level
jnext message in thread / next series-diff position
kprevious message in thread / previous series-diff position
ldrill in
Escclose help / fold thread tree
?toggle this help