Skip to content

Commit c80de50

Browse files
robherringhdeller
authored andcommitted
fbdev: simplefb: 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]> Signed-off-by: Helge Deller <[email protected]>
1 parent 523b84d commit c80de50

File tree

1 file changed

+4
-13
lines changed

1 file changed

+4
-13
lines changed

drivers/video/fbdev/simplefb.c

Lines changed: 4 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,9 @@
2121
#include <linux/platform_device.h>
2222
#include <linux/clk.h>
2323
#include <linux/of.h>
24-
#include <linux/of_address.h>
2524
#include <linux/of_clk.h>
2625
#include <linux/of_platform.h>
26+
#include <linux/of_reserved_mem.h>
2727
#include <linux/parser.h>
2828
#include <linux/pm_domain.h>
2929
#include <linux/regulator/consumer.h>
@@ -134,7 +134,7 @@ struct simplefb_params {
134134
static int simplefb_parse_dt(struct platform_device *pdev,
135135
struct simplefb_params *params)
136136
{
137-
struct device_node *np = pdev->dev.of_node, *mem;
137+
struct device_node *np = pdev->dev.of_node;
138138
int ret;
139139
const char *format;
140140
int i;
@@ -174,19 +174,10 @@ static int simplefb_parse_dt(struct platform_device *pdev,
174174
return -EINVAL;
175175
}
176176

177-
mem = of_parse_phandle(np, "memory-region", 0);
178-
if (mem) {
179-
ret = of_address_to_resource(mem, 0, &params->memory);
180-
if (ret < 0) {
181-
dev_err(&pdev->dev, "failed to parse memory-region\n");
182-
of_node_put(mem);
183-
return ret;
184-
}
185-
177+
ret = of_reserved_mem_region_to_resource(np, 0, &params->memory);
178+
if (!ret) {
186179
if (of_property_present(np, "reg"))
187180
dev_warn(&pdev->dev, "preferring \"memory-region\" over \"reg\" property\n");
188-
189-
of_node_put(mem);
190181
} else {
191182
memset(&params->memory, 0, sizeof(params->memory));
192183
}

0 commit comments

Comments
 (0)