Skip to content

Commit

Permalink
backlight: lp855x_bl: simplify bl_get_brightness()
Browse files Browse the repository at this point in the history
Getting the brightness value is not critical, no need to read the actual
register value.  To simplify it, just return the 'bl->props.brightness'
value.  Then, lp855x_read_byte() can be removed, not used any more.

Signed-off-by: Milo(Woogyom) Kim <[email protected]>
Acked-by: Jingoo Han <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
  • Loading branch information
Kim, Milo authored and torvalds committed Feb 22, 2013
1 parent 26e8ccc commit 9e9cdc8
Showing 1 changed file with 0 additions and 24 deletions.
24 changes: 0 additions & 24 deletions drivers/video/backlight/lp855x_bl.c
Original file line number Diff line number Diff line change
Expand Up @@ -66,20 +66,6 @@ struct lp855x {
struct pwm_device *pwm;
};

static int lp855x_read_byte(struct lp855x *lp, u8 reg, u8 *data)
{
int ret;

ret = i2c_smbus_read_byte_data(lp->client, reg);
if (ret < 0) {
dev_err(lp->dev, "failed to read 0x%.2x\n", reg);
return ret;
}

*data = (u8)ret;
return 0;
}

static int lp855x_write_byte(struct lp855x *lp, u8 reg, u8 data)
{
return i2c_smbus_write_byte_data(lp->client, reg, data);
Expand Down Expand Up @@ -274,16 +260,6 @@ static int lp855x_bl_update_status(struct backlight_device *bl)

static int lp855x_bl_get_brightness(struct backlight_device *bl)
{
struct lp855x *lp = bl_get_data(bl);
enum lp855x_brightness_ctrl_mode mode = lp->pdata->mode;

if (mode == REGISTER_BASED) {
u8 val = 0;

lp855x_read_byte(lp, lp->cfg->reg_brightness, &val);
bl->props.brightness = val;
}

return bl->props.brightness;
}

Expand Down

0 comments on commit 9e9cdc8

Please sign in to comment.