break;
case IIO_CHAN_INFO_INT_TIME:
if (chan->type == IIO_LIGHT) {
- if (val != 0) {
+ if (val) {
mutex_unlock(&chip->lock);
return -EINVAL;
}
int dev_id = 0;
indio_dev = devm_iio_device_alloc(&client->dev, sizeof(*chip));
- if (indio_dev == NULL) {
+ if (!indio_dev) {
dev_err(&client->dev, "iio allocation fails\n");
return -ENOMEM;
}
if ((ch0 >= chip->als_saturation) || (ch1 >= chip->als_saturation))
goto return_max;
- if (ch0 == 0) {
+ if (!ch0) {
/* have no data, so return LAST VALUE */
ret = chip->als_cur_info.lux = 0;
goto out_unlock;
/* determine als integration register */
als_count = (chip->taos_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) */
if (kstrtoint(buf, 0, &value))
return -EINVAL;
- if (value == 0)
+ if (!value)
taos_chip_off(indio_dev);
else
taos_chip_on(indio_dev);
goto return_max;
}
- if (ch0 == 0) {
+ if (!ch0) {
/* have no data, so return LAST VALUE */
ret = chip->als_cur_info.lux;
goto out_unlock;
/* 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;