Skip to content

Commit 3b3643e

Browse files
robherringWim Van Sebroeck
authored andcommitted
watchdog: rti_wdt: Use of_reserved_mem_region_to_resource() for "memory-region"
Use the newly added of_reserved_mem_region_to_resource() function to handle "memory-region" properties. The error handling is a bit different. "memory-region" is optional, so failed lookup is not an error. But then an error in of_address_to_resource() is treated as an error. However, that distinction is not really important. Either the region is available and usable or it is not. So now, it is just of_reserved_mem_region_to_resource() which is checked for an error. Signed-off-by: Rob Herring (Arm) <[email protected]> Reviewed-by: Guenter Roeck <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Guenter Roeck <[email protected]> Signed-off-by: Wim Van Sebroeck <[email protected]>
1 parent 0987760 commit 3b3643e

File tree

1 file changed

+3
-11
lines changed

1 file changed

+3
-11
lines changed

drivers/watchdog/rti_wdt.c

Lines changed: 3 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
#include <linux/module.h>
1616
#include <linux/moduleparam.h>
1717
#include <linux/of.h>
18-
#include <linux/of_address.h>
18+
#include <linux/of_reserved_mem.h>
1919
#include <linux/platform_device.h>
2020
#include <linux/pm_runtime.h>
2121
#include <linux/types.h>
@@ -214,7 +214,6 @@ static int rti_wdt_probe(struct platform_device *pdev)
214214
struct rti_wdt_device *wdt;
215215
struct clk *clk;
216216
u32 last_ping = 0;
217-
struct device_node *node;
218217
u32 reserved_mem_size;
219218
struct resource res;
220219
u32 *vaddr;
@@ -299,15 +298,8 @@ static int rti_wdt_probe(struct platform_device *pdev)
299298
}
300299
}
301300

302-
node = of_parse_phandle(pdev->dev.of_node, "memory-region", 0);
303-
if (node) {
304-
ret = of_address_to_resource(node, 0, &res);
305-
of_node_put(node);
306-
if (ret) {
307-
dev_err(dev, "No memory address assigned to the region.\n");
308-
goto err_iomap;
309-
}
310-
301+
ret = of_reserved_mem_region_to_resource(pdev->dev.of_node, 0, &res);
302+
if (!ret) {
311303
/*
312304
* If reserved memory is defined for watchdog reset cause.
313305
* Readout the Power-on(PON) reason and pass to bootstatus.

0 commit comments

Comments
 (0)