dri-devel.lists.freedesktop.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] backlight: ktz8866: Correct the check for of_property_read_u32
@ 2024-01-29 12:28 Jianhua Lu
  2024-01-31 14:34 ` Daniel Thompson
  2024-02-08 10:34 ` (subset) " Lee Jones
  0 siblings, 2 replies; 3+ messages in thread
From: Jianhua Lu @ 2024-01-29 12:28 UTC (permalink / raw)
  To: Jianhua Lu, Lee Jones, Daniel Thompson, Jingoo Han, Helge Deller
  Cc: linux-fbdev, linux-kernel, dri-devel

of_property_read_u32 returns 0 when success, so reverse the
return value to get the true value.

Fixes: f8449c8f7355 ("backlight: ktz8866: Add support for Kinetic KTZ8866 backlight")
Signed-off-by: Jianhua Lu <lujianhua000@gmail.com>
---
 drivers/video/backlight/ktz8866.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/video/backlight/ktz8866.c b/drivers/video/backlight/ktz8866.c
index 9c980f2571ee..014877b5a984 100644
--- a/drivers/video/backlight/ktz8866.c
+++ b/drivers/video/backlight/ktz8866.c
@@ -97,20 +97,20 @@ static void ktz8866_init(struct ktz8866 *ktz)
 {
 	unsigned int val = 0;
 
-	if (of_property_read_u32(ktz->client->dev.of_node, "current-num-sinks", &val))
+	if (!of_property_read_u32(ktz->client->dev.of_node, "current-num-sinks", &val))
 		ktz8866_write(ktz, BL_EN, BIT(val) - 1);
 	else
 		/* Enable all 6 current sinks if the number of current sinks isn't specified. */
 		ktz8866_write(ktz, BL_EN, BIT(6) - 1);
 
-	if (of_property_read_u32(ktz->client->dev.of_node, "kinetic,current-ramp-delay-ms", &val)) {
+	if (!of_property_read_u32(ktz->client->dev.of_node, "kinetic,current-ramp-delay-ms", &val)) {
 		if (val <= 128)
 			ktz8866_write(ktz, BL_CFG2, BIT(7) | (ilog2(val) << 3) | PWM_HYST);
 		else
 			ktz8866_write(ktz, BL_CFG2, BIT(7) | ((5 + val / 64) << 3) | PWM_HYST);
 	}
 
-	if (of_property_read_u32(ktz->client->dev.of_node, "kinetic,led-enable-ramp-delay-ms", &val)) {
+	if (!of_property_read_u32(ktz->client->dev.of_node, "kinetic,led-enable-ramp-delay-ms", &val)) {
 		if (val == 0)
 			ktz8866_write(ktz, BL_DIMMING, 0);
 		else {
-- 
2.43.0


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

* Re: [PATCH] backlight: ktz8866: Correct the check for of_property_read_u32
  2024-01-29 12:28 [PATCH] backlight: ktz8866: Correct the check for of_property_read_u32 Jianhua Lu
@ 2024-01-31 14:34 ` Daniel Thompson
  2024-02-08 10:34 ` (subset) " Lee Jones
  1 sibling, 0 replies; 3+ messages in thread
From: Daniel Thompson @ 2024-01-31 14:34 UTC (permalink / raw)
  To: Jianhua Lu
  Cc: linux-fbdev, Jingoo Han, Helge Deller, Lee Jones, linux-kernel,
	dri-devel

On Mon, Jan 29, 2024 at 08:28:29PM +0800, Jianhua Lu wrote:
> of_property_read_u32 returns 0 when success, so reverse the
> return value to get the true value.
>
> Fixes: f8449c8f7355 ("backlight: ktz8866: Add support for Kinetic KTZ8866 backlight")
> Signed-off-by: Jianhua Lu <lujianhua000@gmail.com>

Reviewed-by: Daniel Thompson <daniel.thompson@linaro.org>


Daniel.

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

* Re: (subset) [PATCH] backlight: ktz8866: Correct the check for of_property_read_u32
  2024-01-29 12:28 [PATCH] backlight: ktz8866: Correct the check for of_property_read_u32 Jianhua Lu
  2024-01-31 14:34 ` Daniel Thompson
@ 2024-02-08 10:34 ` Lee Jones
  1 sibling, 0 replies; 3+ messages in thread
From: Lee Jones @ 2024-02-08 10:34 UTC (permalink / raw)
  To: Lee Jones, Daniel Thompson, Jingoo Han, Helge Deller, Jianhua Lu
  Cc: dri-devel, linux-fbdev, linux-kernel

On Mon, 29 Jan 2024 20:28:29 +0800, Jianhua Lu wrote:
> of_property_read_u32 returns 0 when success, so reverse the
> return value to get the true value.
> 
> 

Applied, thanks!

[1/1] backlight: ktz8866: Correct the check for of_property_read_u32
      commit: 7c0ff4ae24bf4589b5bb460e4b31817c61fa2bef

--
Lee Jones [李琼斯]


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

end of thread, other threads:[~2024-02-08 10:34 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-01-29 12:28 [PATCH] backlight: ktz8866: Correct the check for of_property_read_u32 Jianhua Lu
2024-01-31 14:34 ` Daniel Thompson
2024-02-08 10:34 ` (subset) " Lee Jones

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).