goto return_max;
}
- if (ch0 == 0) {
+ if (!ch0) {
/* have no data, so return LAST VALUE */
ret = chip->als_cur_info.lux;
goto out_unlock;
if (p->ratio == 0) {
lux = 0;
} else {
- ch0lux = DIV_ROUND_UP((ch0 * p->ch0),
+ ch0lux = DIV_ROUND_UP(ch0 * p->ch0,
tsl2X7X_als_gainadj[chip->tsl2x7x_settings.als_gain]);
- ch1lux = DIV_ROUND_UP((ch1 * p->ch1),
+ ch1lux = DIV_ROUND_UP(ch1 * p->ch1,
tsl2X7X_als_gainadj[chip->tsl2x7x_settings.als_gain]);
lux = ch0lux - ch1lux;
}
/* determine als integration register */
als_count = (chip->tsl2x7x_settings.als_time * 100 + 135) / 270;
- if (als_count == 0)
+ if (!als_count)
als_count = 1; /* ensure at least one cycle */
/* convert back to time (encompasses overrides) */
int sample_sum;
int tmp;
- if (length == 0)
+ if (!length)
length = 1;
sample_sum = 0;
z = y * TSL2X7X_MIN_ITIME;
filter_delay =
- DIV_ROUND_UP(((result.integer * 1000) + result.fract), z);
+ DIV_ROUND_UP((result.integer * 1000) + result.fract, z);
chip->tsl2x7x_settings.persistence &= 0xF0;
chip->tsl2x7x_settings.persistence |= (filter_delay & 0x0F);
z = y * TSL2X7X_MIN_ITIME;
filter_delay =
- DIV_ROUND_UP(((result.integer * 1000) + result.fract), z);
+ DIV_ROUND_UP((result.integer * 1000) + result.fract, z);
chip->tsl2x7x_settings.persistence &= 0x0F;
chip->tsl2x7x_settings.persistence |= ((filter_delay << 4) & 0xF0);