drm/simpledrm: Use of_reserved_mem_region_to_resource() for "memory-region"
Subsystems (3)
PATCH 1/1 drm/simpledrm: 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.
Signed-off-by Rob Herring (Arm) <[email protected]>
--- drivers/gpu/drm/sysfb/simpledrm.c | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-)
drivers/gpu/drm/sysfb/simpledrm.c +5 -10
@@ -4,7 +4,7 @@#include <linux/clk.h> #include <linux/of_clk.h> #include <linux/minmax.h> -#include <linux/of_address.h> +#include <linux/of_reserved_mem.h> #include <linux/platform_data/simplefb.h> #include <linux/platform_device.h> #include <linux/pm_domain.h>
@@ -180,22 +180,17 @@ simplefb_get_format_of(struct drm_device *dev, struct device_node *of_node)static struct resource *simplefb_get_memory_of (struct drm_device *dev,struct device_node *of_node) { -struct device_node *np; -struct resource *res; +struct resource r, *res;int err; - np =of_parse_phandle (of_node,"memory-region" ,0 ); -if (!np) + err =of_reserved_mem_region_to_resource (of_node,0 , &r); +if (err)return NULL ; - res =devm_kzalloc (dev->dev,sizeof (*res),GFP_KERNEL ); + res =devm_kmemdup (dev->dev, &r,sizeof (r),GFP_KERNEL );if (!res)return ERR_PTR (-ENOMEM ); - err =of_address_to_resource (np,0 , res); -if (err) -return ERR_PTR (err); -if (of_property_present (of_node,"reg" ))drm_warn (dev,"preferring \"memory-region\" over \"reg\" property\n" );
Signature · 1 line
2.47.2
cc'ing Thierry
Hi,
thanks for the patch.
Am 03.07.25 um 20:34 schrieb Rob Herring (Arm):
Quoted 4 lines
Use the newly added
of_reserved_mem_region_to_resource()function to handle "memory-region" properties.Signed-off-by Rob Herring (Arm) <[email protected]>
as far as the code is concerned. Might need a review from Thierry, who added the functionality in the first place.
Best regards
Thomas
Quoted 44 lines
--- drivers/gpu/drm/sysfb/simpledrm.c | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-)drivers/gpu/drm/sysfb/simpledrm.c +5
-10@@ -4,7 +4,7 @@#include <linux/clk.h> #include <linux/of_clk.h> #include <linux/minmax.h> -#include <linux/of_address.h> +#include <linux/of_reserved_mem.h> #include <linux/platform_data/simplefb.h> #include <linux/platform_device.h> #include <linux/pm_domain.h> @@ -180,22 +180,17 @@ simplefb_get_format_of(struct drm_device *dev, struct device_node *of_node)static struct resource *simplefb_get_memory_of (struct drm_device *dev,struct device_node *of_node) { -struct device_node *np; -struct resource *res; +struct resource r, *res;int err; - np =of_parse_phandle (of_node,"memory-region" ,0 ); -if (!np) + err =of_reserved_mem_region_to_resource (of_node,0 , &r); +if (err)return NULL ; - res =devm_kzalloc (dev->dev,sizeof (*res),GFP_KERNEL ); + res =devm_kmemdup (dev->dev, &r,sizeof (r),GFP_KERNEL );if (!res)return ERR_PTR (-ENOMEM ); - err =of_address_to_resource (np,0 , res); -if (err) -return ERR_PTR (err); -if (of_property_present (of_node,"reg" ))drm_warn (dev,"preferring \"memory-region\" over \"reg\" property\n" );
Signature · 7 lines
-- Thomas Zimmermann Graphics Driver Developer SUSE Software Solutions Germany GmbH Frankenstrasse 146, 90461 Nuernberg, Germany GF: Ivo Totev, Andrew Myers, Andrew McDonald, Boudien Moerman HRB 36809 (AG Nuernberg)
"Rob Herring (Arm)" <[email protected]> writes:
Hello Rob,
Quoted 5 lines
Use the newly added
of_reserved_mem_region_to_resource()function to handle "memory-region" properties.Signed-off-by Rob Herring (Arm) <[email protected]>---
Reviewed-by Javier Martinez Canillas <[email protected]>
Signature · 5 lines
Best regards, Javier Martinez Canillas Core Platforms Red Hat