mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH v2 1/2] drm/omap/dss: Use of_property_present() to test existence of DT property
@ 2025-01-14 14:58 Krzysztof Kozlowski
  2025-01-14 14:58 ` [PATCH v2 2/2] drm/omap/dss: Use syscon_regmap_lookup_by_phandle_args Krzysztof Kozlowski
  2025-01-24  7:22 ` [PATCH v2 1/2] drm/omap/dss: Use of_property_present() to test existence of DT property Tomi Valkeinen
  0 siblings, 2 replies; 3+ messages in thread
From: Krzysztof Kozlowski @ 2025-01-14 14:58 UTC (permalink / raw)
  To: Tomi Valkeinen, Maarten Lankhorst, Maxime Ripard,
	Thomas Zimmermann, David Airlie, Simona Vetter, dri-devel,
	linux-kernel
  Cc: Krzysztof Kozlowski

of_property_read_bool() should be used only on boolean properties.

Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>

---

Changes in v2:
1. New patch - split from the next one.
---
 drivers/gpu/drm/omapdrm/dss/dss.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/omapdrm/dss/dss.c b/drivers/gpu/drm/omapdrm/dss/dss.c
index 7b2df3185de4..319f0a1d23a7 100644
--- a/drivers/gpu/drm/omapdrm/dss/dss.c
+++ b/drivers/gpu/drm/omapdrm/dss/dss.c
@@ -1236,7 +1236,7 @@ static int dss_video_pll_probe(struct dss_device *dss)
 	if (!np)
 		return 0;
 
-	if (of_property_read_bool(np, "syscon-pll-ctrl")) {
+	if (of_property_present(np, "syscon-pll-ctrl")) {
 		dss->syscon_pll_ctrl = syscon_regmap_lookup_by_phandle(np,
 			"syscon-pll-ctrl");
 		if (IS_ERR(dss->syscon_pll_ctrl)) {
-- 
2.43.0


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

* [PATCH v2 2/2] drm/omap/dss: Use syscon_regmap_lookup_by_phandle_args
  2025-01-14 14:58 [PATCH v2 1/2] drm/omap/dss: Use of_property_present() to test existence of DT property Krzysztof Kozlowski
@ 2025-01-14 14:58 ` Krzysztof Kozlowski
  2025-01-24  7:22 ` [PATCH v2 1/2] drm/omap/dss: Use of_property_present() to test existence of DT property Tomi Valkeinen
  1 sibling, 0 replies; 3+ messages in thread
From: Krzysztof Kozlowski @ 2025-01-14 14:58 UTC (permalink / raw)
  To: Tomi Valkeinen, Maarten Lankhorst, Maxime Ripard,
	Thomas Zimmermann, David Airlie, Simona Vetter, dri-devel,
	linux-kernel
  Cc: Krzysztof Kozlowski

Use syscon_regmap_lookup_by_phandle_args() which is a wrapper over
syscon_regmap_lookup_by_phandle() combined with getting the syscon
argument.  Except simpler code this annotates within one line that given
phandle has arguments, so grepping for code would be easier.

There is also no real benefit in printing errors on missing syscon
argument, because this is done just too late: runtime check on
static/build-time data.  Dtschema and Devicetree bindings offer the
static/build-time check for this already.

Reviewed-by: Tomi Valkeinen <tomi.valkeinen@ideasonboard.com>
Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>

---

Changes in v2:
1. Split of_property_present into previous patch.
2. Add tag.
---
 drivers/gpu/drm/omapdrm/dss/dss.c | 12 +++---------
 1 file changed, 3 insertions(+), 9 deletions(-)

diff --git a/drivers/gpu/drm/omapdrm/dss/dss.c b/drivers/gpu/drm/omapdrm/dss/dss.c
index 319f0a1d23a7..692df747e2ae 100644
--- a/drivers/gpu/drm/omapdrm/dss/dss.c
+++ b/drivers/gpu/drm/omapdrm/dss/dss.c
@@ -1237,20 +1237,14 @@ static int dss_video_pll_probe(struct dss_device *dss)
 		return 0;
 
 	if (of_property_present(np, "syscon-pll-ctrl")) {
-		dss->syscon_pll_ctrl = syscon_regmap_lookup_by_phandle(np,
-			"syscon-pll-ctrl");
+		dss->syscon_pll_ctrl =
+			syscon_regmap_lookup_by_phandle_args(np, "syscon-pll-ctrl",
+							     1, &dss->syscon_pll_ctrl_offset);
 		if (IS_ERR(dss->syscon_pll_ctrl)) {
 			dev_err(&pdev->dev,
 				"failed to get syscon-pll-ctrl regmap\n");
 			return PTR_ERR(dss->syscon_pll_ctrl);
 		}
-
-		if (of_property_read_u32_index(np, "syscon-pll-ctrl", 1,
-				&dss->syscon_pll_ctrl_offset)) {
-			dev_err(&pdev->dev,
-				"failed to get syscon-pll-ctrl offset\n");
-			return -EINVAL;
-		}
 	}
 
 	pll_regulator = devm_regulator_get(&pdev->dev, "vdda_video");
-- 
2.43.0


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

* Re: [PATCH v2 1/2] drm/omap/dss: Use of_property_present() to test existence of DT property
  2025-01-14 14:58 [PATCH v2 1/2] drm/omap/dss: Use of_property_present() to test existence of DT property Krzysztof Kozlowski
  2025-01-14 14:58 ` [PATCH v2 2/2] drm/omap/dss: Use syscon_regmap_lookup_by_phandle_args Krzysztof Kozlowski
@ 2025-01-24  7:22 ` Tomi Valkeinen
  1 sibling, 0 replies; 3+ messages in thread
From: Tomi Valkeinen @ 2025-01-24  7:22 UTC (permalink / raw)
  To: Krzysztof Kozlowski
  Cc: Maarten Lankhorst, Maxime Ripard, Thomas Zimmermann,
	David Airlie, Simona Vetter, dri-devel, linux-kernel

Hi,

On 14/01/2025 16:58, Krzysztof Kozlowski wrote:
> of_property_read_bool() should be used only on boolean properties.
> 
> Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
> 
> ---
> 
> Changes in v2:
> 1. New patch - split from the next one.
> ---
>   drivers/gpu/drm/omapdrm/dss/dss.c | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/gpu/drm/omapdrm/dss/dss.c b/drivers/gpu/drm/omapdrm/dss/dss.c
> index 7b2df3185de4..319f0a1d23a7 100644
> --- a/drivers/gpu/drm/omapdrm/dss/dss.c
> +++ b/drivers/gpu/drm/omapdrm/dss/dss.c
> @@ -1236,7 +1236,7 @@ static int dss_video_pll_probe(struct dss_device *dss)
>   	if (!np)
>   		return 0;
>   
> -	if (of_property_read_bool(np, "syscon-pll-ctrl")) {
> +	if (of_property_present(np, "syscon-pll-ctrl")) {
>   		dss->syscon_pll_ctrl = syscon_regmap_lookup_by_phandle(np,
>   			"syscon-pll-ctrl");
>   		if (IS_ERR(dss->syscon_pll_ctrl)) {

Thanks, applying these to drm-misc-next.

  Tomi


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

end of thread, other threads:[~2025-01-24  7:22 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2025-01-14 14:58 [PATCH v2 1/2] drm/omap/dss: Use of_property_present() to test existence of DT property Krzysztof Kozlowski
2025-01-14 14:58 ` [PATCH v2 2/2] drm/omap/dss: Use syscon_regmap_lookup_by_phandle_args Krzysztof Kozlowski
2025-01-24  7:22 ` [PATCH v2 1/2] drm/omap/dss: Use of_property_present() to test existence of DT property Tomi Valkeinen

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®