linux-fbdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2 1/2] backlight: lm3630a: fix return code of .update_status() callback
@ 2021-06-20 19:39 Uwe Kleine-König
  2021-06-20 19:39 ` [PATCH v2 2/2] backlight: lm3630a: convert to atomic PWM API and check for errors Uwe Kleine-König
  2021-06-21 10:23 ` [PATCH v2 1/2] backlight: lm3630a: fix return code of .update_status() callback Daniel Thompson
  0 siblings, 2 replies; 5+ messages in thread
From: Uwe Kleine-König @ 2021-06-20 19:39 UTC (permalink / raw)
  To: Lee Jones, Daniel Thompson, Jingoo Han
  Cc: linux-fbdev, Thierry Reding, kernel, dri-devel

According to <linux/backlight.h> .update_status() is supposed to
return 0 on success and a negative error code otherwise. Adapt
lm3630a_bank_a_update_status() to actually do it.

While touching that also add the error code to the failure message.

Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
---
 drivers/video/backlight/lm3630a_bl.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/video/backlight/lm3630a_bl.c b/drivers/video/backlight/lm3630a_bl.c
index e88a2b0e5904..16a2658a72e1 100644
--- a/drivers/video/backlight/lm3630a_bl.c
+++ b/drivers/video/backlight/lm3630a_bl.c
@@ -190,7 +190,7 @@ static int lm3630a_bank_a_update_status(struct backlight_device *bl)
 	if ((pwm_ctrl & LM3630A_PWM_BANK_A) != 0) {
 		lm3630a_pwm_ctrl(pchip, bl->props.brightness,
 				 bl->props.max_brightness);
-		return bl->props.brightness;
+		return 0;
 	}
 
 	/* disable sleep */
@@ -210,8 +210,8 @@ static int lm3630a_bank_a_update_status(struct backlight_device *bl)
 	return 0;
 
 out_i2c_err:
-	dev_err(pchip->dev, "i2c failed to access\n");
-	return bl->props.brightness;
+	dev_err(pchip->dev, "i2c failed to access (%pe)\n", ERR_PTR(ret));
+	return ret;
 }
 
 static int lm3630a_bank_a_get_brightness(struct backlight_device *bl)

base-commit: 6efb943b8616ec53a5e444193dccf1af9ad627b5
-- 
2.30.2


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

end of thread, other threads:[~2021-06-21 11:41 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-06-20 19:39 [PATCH v2 1/2] backlight: lm3630a: fix return code of .update_status() callback Uwe Kleine-König
2021-06-20 19:39 ` [PATCH v2 2/2] backlight: lm3630a: convert to atomic PWM API and check for errors Uwe Kleine-König
2021-06-21 10:47   ` Daniel Thompson
2021-06-21 10:23 ` [PATCH v2 1/2] backlight: lm3630a: fix return code of .update_status() callback Daniel Thompson
2021-06-21 11:41   ` Daniel Thompson

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