Merge branch 'i2c-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jdelvare/staging

* 'i2c-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jdelvare/staging:
i2c/tsl2550: Fix lux value in dark environment

+10 -7
+10 -7
drivers/i2c/chips/tsl2550.c
··· 27 27 #include <linux/delay.h> 28 28 29 29 #define TSL2550_DRV_NAME "tsl2550" 30 - #define DRIVER_VERSION "1.1.1" 30 + #define DRIVER_VERSION "1.1.2" 31 31 32 32 /* 33 33 * Defines ··· 189 189 u8 r = 128; 190 190 191 191 /* Avoid division by 0 and count 1 cannot be greater than count 0 */ 192 - if (c0 && (c1 <= c0)) 193 - r = c1 * 128 / c0; 194 - else 195 - return -1; 192 + if (c1 <= c0) 193 + if (c0) { 194 + r = c1 * 128 / c0; 196 195 197 - /* Calculate LUX */ 198 - lux = ((c0 - c1) * ratio_lut[r]) / 256; 196 + /* Calculate LUX */ 197 + lux = ((c0 - c1) * ratio_lut[r]) / 256; 198 + } else 199 + lux = 0; 200 + else 201 + return -EAGAIN; 199 202 200 203 /* LUX range check */ 201 204 return lux > TSL2550_MAX_LUX ? TSL2550_MAX_LUX : lux;