Skip to content

Commit

Permalink
backlight: lm3630a: Fix return code of .update_status() callback
Browse files Browse the repository at this point in the history
[ Upstream commit b9481a6 ]

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>
  • Loading branch information
ukleinek authored and gregkh committed Jul 20, 2021
1 parent 18fbea6 commit eff67a0
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions drivers/video/backlight/lm3630a_bl.c
Expand Up @@ -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 */
Expand All @@ -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)
Expand Down Expand Up @@ -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 */
Expand All @@ -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)
Expand Down

0 comments on commit eff67a0

Please sign in to comment.