staging: iio: light: Remove explicit comparisons
Remove comparisons to 0 or NULL Signed-off-by: Cristina Moraru <cristina.moraru09@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
parent
9efbbfada9
commit
d59b7b6834
|
@ -370,7 +370,7 @@ static int isl29018_write_raw(struct iio_dev *indio_dev,
|
|||
break;
|
||||
case IIO_CHAN_INFO_INT_TIME:
|
||||
if (chan->type == IIO_LIGHT) {
|
||||
if (val != 0) {
|
||||
if (val) {
|
||||
mutex_unlock(&chip->lock);
|
||||
return -EINVAL;
|
||||
}
|
||||
|
@ -716,7 +716,7 @@ static int isl29018_probe(struct i2c_client *client,
|
|||
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;
|
||||
}
|
||||
|
|
|
@ -263,7 +263,7 @@ static int taos_get_lux(struct iio_dev *indio_dev)
|
|||
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;
|
||||
|
@ -415,7 +415,7 @@ static int taos_chip_on(struct iio_dev *indio_dev)
|
|||
|
||||
/* 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) */
|
||||
|
@ -499,7 +499,7 @@ static ssize_t taos_power_state_store(struct device *dev,
|
|||
if (kstrtoint(buf, 0, &value))
|
||||
return -EINVAL;
|
||||
|
||||
if (value == 0)
|
||||
if (!value)
|
||||
taos_chip_off(indio_dev);
|
||||
else
|
||||
taos_chip_on(indio_dev);
|
||||
|
|
|
@ -403,7 +403,7 @@ static int tsl2x7x_get_lux(struct iio_dev *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;
|
||||
|
@ -678,7 +678,7 @@ static int tsl2x7x_chip_on(struct iio_dev *indio_dev)
|
|||
|
||||
/* 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) */
|
||||
|
@ -825,7 +825,7 @@ void tsl2x7x_prox_calculate(int *data, int length,
|
|||
int sample_sum;
|
||||
int tmp;
|
||||
|
||||
if (length == 0)
|
||||
if (!length)
|
||||
length = 1;
|
||||
|
||||
sample_sum = 0;
|
||||
|
|
Loading…
Reference in New Issue