diff options
author | André Fabian Silva Delgado <emulatorman@parabola.nu> | 2016-03-25 03:53:42 -0300 |
---|---|---|
committer | André Fabian Silva Delgado <emulatorman@parabola.nu> | 2016-03-25 03:53:42 -0300 |
commit | 03dd4cb26d967f9588437b0fc9cc0e8353322bb7 (patch) | |
tree | fa581f6dc1c0596391690d1f67eceef3af8246dc /drivers/video/backlight/adp8860_bl.c | |
parent | d4e493caf788ef44982e131ff9c786546904d934 (diff) |
Linux-libre 4.5-gnu
Diffstat (limited to 'drivers/video/backlight/adp8860_bl.c')
-rw-r--r-- | drivers/video/backlight/adp8860_bl.c | 18 |
1 files changed, 11 insertions, 7 deletions
diff --git a/drivers/video/backlight/adp8860_bl.c b/drivers/video/backlight/adp8860_bl.c index 98ffe71e8..510e559c0 100644 --- a/drivers/video/backlight/adp8860_bl.c +++ b/drivers/video/backlight/adp8860_bl.c @@ -566,11 +566,13 @@ static ssize_t adp8860_bl_ambient_light_level_show(struct device *dev, mutex_lock(&data->lock); error = adp8860_read(data->client, ADP8860_PH1LEVL, ®_val); - ret_val = reg_val; - error |= adp8860_read(data->client, ADP8860_PH1LEVH, ®_val); + if (!error) { + ret_val = reg_val; + error = adp8860_read(data->client, ADP8860_PH1LEVH, ®_val); + } mutex_unlock(&data->lock); - if (error < 0) + if (error) return error; /* Return 13-bit conversion value for the first light sensor */ @@ -621,10 +623,12 @@ static ssize_t adp8860_bl_ambient_light_zone_store(struct device *dev, /* Set user supplied ambient light zone */ mutex_lock(&data->lock); - adp8860_read(data->client, ADP8860_CFGR, ®_val); - reg_val &= ~(CFGR_BLV_MASK << CFGR_BLV_SHIFT); - reg_val |= (val - 1) << CFGR_BLV_SHIFT; - adp8860_write(data->client, ADP8860_CFGR, reg_val); + ret = adp8860_read(data->client, ADP8860_CFGR, ®_val); + if (!ret) { + reg_val &= ~(CFGR_BLV_MASK << CFGR_BLV_SHIFT); + reg_val |= (val - 1) << CFGR_BLV_SHIFT; + adp8860_write(data->client, ADP8860_CFGR, reg_val); + } mutex_unlock(&data->lock); } |