]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
backlight: lm3630a: Fix return code of .update_status() callback
authorUwe Kleine-König <u.kleine-koenig@pengutronix.de>
Mon, 21 Jun 2021 12:21:47 +0000 (14:21 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Tue, 20 Jul 2021 14:22:42 +0000 (16:22 +0200)
[ Upstream commit b9481a667a90ec739995e85f91f3672ca44d6ffa ]

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() and lm3630a_bank_b_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>
Reviewed-by: Daniel Thompson <daniel.thompson@linaro.org>
Signed-off-by: Lee Jones <lee.jones@linaro.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/video/backlight/lm3630a_bl.c

index 5ef6f9d420a235117f0534d779a746b87141e3ad..ab882c04f975c5a1cbacb58419e635fd1edf1c33 100644 (file)
@@ -183,7 +183,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 */
@@ -203,8 +203,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)
@@ -260,7 +260,7 @@ static int lm3630a_bank_b_update_status(struct backlight_device *bl)
        if ((pwm_ctrl & LM3630A_PWM_BANK_B) != 0) {
                lm3630a_pwm_ctrl(pchip, bl->props.brightness,
                                 bl->props.max_brightness);
-               return bl->props.brightness;
+               return 0;
        }
 
        /* disable sleep */
@@ -280,8 +280,8 @@ static int lm3630a_bank_b_update_status(struct backlight_device *bl)
        return 0;
 
 out_i2c_err:
-       dev_err(pchip->dev, "i2c failed to access REG_CTRL\n");
-       return bl->props.brightness;
+       dev_err(pchip->dev, "i2c failed to access (%pe)\n", ERR_PTR(ret));
+       return ret;
 }
 
 static int lm3630a_bank_b_get_brightness(struct backlight_device *bl)