]> Git Repo - linux.git/commitdiff
backlight: lm3630a: Fix return code of .update_status() callback
authorUwe Kleine-König <[email protected]>
Mon, 21 Jun 2021 12:21:47 +0000 (14:21 +0200)
committerLee Jones <[email protected]>
Tue, 22 Jun 2021 13:10:19 +0000 (14:10 +0100)
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 <[email protected]>
Reviewed-by: Daniel Thompson <[email protected]>
Signed-off-by: Lee Jones <[email protected]>
drivers/video/backlight/lm3630a_bl.c

index 662029d6a3dc9705d073ddfaf75557bb608dccd8..419b0334cf0879b71aa180d59f3af8b94f934fb6 100644 (file)
@@ -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)
@@ -267,7 +267,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 */
@@ -287,8 +287,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)
This page took 0.059018 seconds and 4 git commands to generate.