devicetree.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] fbdev: Use of_property_read_bool() for boolean properties
@ 2023-03-10 14:47 Rob Herring
  2023-03-11 12:02 ` Helge Deller
  0 siblings, 1 reply; 2+ messages in thread
From: Rob Herring @ 2023-03-10 14:47 UTC (permalink / raw)
  To: Helge Deller, Michal Simek
  Cc: devicetree, linux-fbdev, dri-devel, linux-kernel,
	linux-arm-kernel

It is preferred to use typed property access functions (i.e.
of_property_read_<type> functions) rather than low-level
of_get_property/of_find_property functions for reading properties.
Convert reading boolean properties to to of_property_read_bool().

Signed-off-by: Rob Herring <robh@kernel.org>
---
 drivers/video/fbdev/offb.c     | 4 ++--
 drivers/video/fbdev/sm501fb.c  | 4 ++--
 drivers/video/fbdev/tcx.c      | 3 +--
 drivers/video/fbdev/xilinxfb.c | 3 +--
 4 files changed, 6 insertions(+), 8 deletions(-)

diff --git a/drivers/video/fbdev/offb.c b/drivers/video/fbdev/offb.c
index f7ad6bc9d02d..b97d251d894b 100644
--- a/drivers/video/fbdev/offb.c
+++ b/drivers/video/fbdev/offb.c
@@ -549,10 +549,10 @@ static void offb_init_nodriver(struct platform_device *parent, struct device_nod
 	int foreign_endian = 0;
 
 #ifdef __BIG_ENDIAN
-	if (of_get_property(dp, "little-endian", NULL))
+	if (of_property_read_bool(dp, "little-endian"))
 		foreign_endian = FBINFO_FOREIGN_ENDIAN;
 #else
-	if (of_get_property(dp, "big-endian", NULL))
+	if (of_property_read_bool(dp, "big-endian"))
 		foreign_endian = FBINFO_FOREIGN_ENDIAN;
 #endif
 
diff --git a/drivers/video/fbdev/sm501fb.c b/drivers/video/fbdev/sm501fb.c
index f743bfbde2a6..1f3cbe723def 100644
--- a/drivers/video/fbdev/sm501fb.c
+++ b/drivers/video/fbdev/sm501fb.c
@@ -1737,10 +1737,10 @@ static int sm501fb_init_fb(struct fb_info *fb, enum sm501_controller head,
 
 #if defined(CONFIG_OF)
 #ifdef __BIG_ENDIAN
-	if (of_get_property(info->dev->parent->of_node, "little-endian", NULL))
+	if (of_property_read_bool(info->dev->parent->of_node, "little-endian"))
 		fb->flags |= FBINFO_FOREIGN_ENDIAN;
 #else
-	if (of_get_property(info->dev->parent->of_node, "big-endian", NULL))
+	if (of_property_read_bool(info->dev->parent->of_node, "big-endian"))
 		fb->flags |= FBINFO_FOREIGN_ENDIAN;
 #endif
 #endif
diff --git a/drivers/video/fbdev/tcx.c b/drivers/video/fbdev/tcx.c
index 01d87f53324d..f2eaf6e7fff6 100644
--- a/drivers/video/fbdev/tcx.c
+++ b/drivers/video/fbdev/tcx.c
@@ -379,8 +379,7 @@ static int tcx_probe(struct platform_device *op)
 
 	spin_lock_init(&par->lock);
 
-	par->lowdepth =
-		(of_find_property(dp, "tcx-8-bit", NULL) != NULL);
+	par->lowdepth = of_property_read_bool(dp, "tcx-8-bit");
 
 	sbusfb_fill_var(&info->var, dp, 8);
 	info->var.red.length = 8;
diff --git a/drivers/video/fbdev/xilinxfb.c b/drivers/video/fbdev/xilinxfb.c
index 1ac83900a21c..c17cfffd9a84 100644
--- a/drivers/video/fbdev/xilinxfb.c
+++ b/drivers/video/fbdev/xilinxfb.c
@@ -469,8 +469,7 @@ static int xilinxfb_of_probe(struct platform_device *pdev)
 		pdata.yvirt = prop[1];
 	}
 
-	if (of_find_property(pdev->dev.of_node, "rotate-display", NULL))
-		pdata.rotate_screen = 1;
+	pdata.rotate_screen = of_property_read_bool(pdev->dev.of_node, "rotate-display");
 
 	platform_set_drvdata(pdev, drvdata);
 	return xilinxfb_assign(pdev, drvdata, &pdata);
-- 
2.39.2


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] fbdev: Use of_property_read_bool() for boolean properties
  2023-03-10 14:47 [PATCH] fbdev: Use of_property_read_bool() for boolean properties Rob Herring
@ 2023-03-11 12:02 ` Helge Deller
  0 siblings, 0 replies; 2+ messages in thread
From: Helge Deller @ 2023-03-11 12:02 UTC (permalink / raw)
  To: Rob Herring, Michal Simek
  Cc: devicetree, linux-fbdev, dri-devel, linux-kernel,
	linux-arm-kernel

On 3/10/23 15:47, Rob Herring wrote:
> It is preferred to use typed property access functions (i.e.
> of_property_read_<type> functions) rather than low-level
> of_get_property/of_find_property functions for reading properties.
> Convert reading boolean properties to to of_property_read_bool().
>
> Signed-off-by: Rob Herring <robh@kernel.org>

applied.

Thanks,
Helge

> ---
>   drivers/video/fbdev/offb.c     | 4 ++--
>   drivers/video/fbdev/sm501fb.c  | 4 ++--
>   drivers/video/fbdev/tcx.c      | 3 +--
>   drivers/video/fbdev/xilinxfb.c | 3 +--
>   4 files changed, 6 insertions(+), 8 deletions(-)
>
> diff --git a/drivers/video/fbdev/offb.c b/drivers/video/fbdev/offb.c
> index f7ad6bc9d02d..b97d251d894b 100644
> --- a/drivers/video/fbdev/offb.c
> +++ b/drivers/video/fbdev/offb.c
> @@ -549,10 +549,10 @@ static void offb_init_nodriver(struct platform_device *parent, struct device_nod
>   	int foreign_endian = 0;
>
>   #ifdef __BIG_ENDIAN
> -	if (of_get_property(dp, "little-endian", NULL))
> +	if (of_property_read_bool(dp, "little-endian"))
>   		foreign_endian = FBINFO_FOREIGN_ENDIAN;
>   #else
> -	if (of_get_property(dp, "big-endian", NULL))
> +	if (of_property_read_bool(dp, "big-endian"))
>   		foreign_endian = FBINFO_FOREIGN_ENDIAN;
>   #endif
>
> diff --git a/drivers/video/fbdev/sm501fb.c b/drivers/video/fbdev/sm501fb.c
> index f743bfbde2a6..1f3cbe723def 100644
> --- a/drivers/video/fbdev/sm501fb.c
> +++ b/drivers/video/fbdev/sm501fb.c
> @@ -1737,10 +1737,10 @@ static int sm501fb_init_fb(struct fb_info *fb, enum sm501_controller head,
>
>   #if defined(CONFIG_OF)
>   #ifdef __BIG_ENDIAN
> -	if (of_get_property(info->dev->parent->of_node, "little-endian", NULL))
> +	if (of_property_read_bool(info->dev->parent->of_node, "little-endian"))
>   		fb->flags |= FBINFO_FOREIGN_ENDIAN;
>   #else
> -	if (of_get_property(info->dev->parent->of_node, "big-endian", NULL))
> +	if (of_property_read_bool(info->dev->parent->of_node, "big-endian"))
>   		fb->flags |= FBINFO_FOREIGN_ENDIAN;
>   #endif
>   #endif
> diff --git a/drivers/video/fbdev/tcx.c b/drivers/video/fbdev/tcx.c
> index 01d87f53324d..f2eaf6e7fff6 100644
> --- a/drivers/video/fbdev/tcx.c
> +++ b/drivers/video/fbdev/tcx.c
> @@ -379,8 +379,7 @@ static int tcx_probe(struct platform_device *op)
>
>   	spin_lock_init(&par->lock);
>
> -	par->lowdepth =
> -		(of_find_property(dp, "tcx-8-bit", NULL) != NULL);
> +	par->lowdepth = of_property_read_bool(dp, "tcx-8-bit");
>
>   	sbusfb_fill_var(&info->var, dp, 8);
>   	info->var.red.length = 8;
> diff --git a/drivers/video/fbdev/xilinxfb.c b/drivers/video/fbdev/xilinxfb.c
> index 1ac83900a21c..c17cfffd9a84 100644
> --- a/drivers/video/fbdev/xilinxfb.c
> +++ b/drivers/video/fbdev/xilinxfb.c
> @@ -469,8 +469,7 @@ static int xilinxfb_of_probe(struct platform_device *pdev)
>   		pdata.yvirt = prop[1];
>   	}
>
> -	if (of_find_property(pdev->dev.of_node, "rotate-display", NULL))
> -		pdata.rotate_screen = 1;
> +	pdata.rotate_screen = of_property_read_bool(pdev->dev.of_node, "rotate-display");
>
>   	platform_set_drvdata(pdev, drvdata);
>   	return xilinxfb_assign(pdev, drvdata, &pdata);


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2023-03-11 12:02 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-03-10 14:47 [PATCH] fbdev: Use of_property_read_bool() for boolean properties Rob Herring
2023-03-11 12:02 ` Helge Deller

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).