Commit d59b7b68 authored by Cristina Moraru's avatar Cristina Moraru Committed by Greg Kroah-Hartman

staging: iio: light: Remove explicit comparisons

Remove comparisons to 0 or NULL
Signed-off-by: default avatarCristina Moraru <cristina.moraru09@gmail.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 9efbbfad
...@@ -370,7 +370,7 @@ static int isl29018_write_raw(struct iio_dev *indio_dev, ...@@ -370,7 +370,7 @@ static int isl29018_write_raw(struct iio_dev *indio_dev,
break; break;
case IIO_CHAN_INFO_INT_TIME: case IIO_CHAN_INFO_INT_TIME:
if (chan->type == IIO_LIGHT) { if (chan->type == IIO_LIGHT) {
if (val != 0) { if (val) {
mutex_unlock(&chip->lock); mutex_unlock(&chip->lock);
return -EINVAL; return -EINVAL;
} }
...@@ -716,7 +716,7 @@ static int isl29018_probe(struct i2c_client *client, ...@@ -716,7 +716,7 @@ static int isl29018_probe(struct i2c_client *client,
int dev_id = 0; int dev_id = 0;
indio_dev = devm_iio_device_alloc(&client->dev, sizeof(*chip)); 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"); dev_err(&client->dev, "iio allocation fails\n");
return -ENOMEM; return -ENOMEM;
} }
......
...@@ -263,7 +263,7 @@ static int taos_get_lux(struct iio_dev *indio_dev) ...@@ -263,7 +263,7 @@ static int taos_get_lux(struct iio_dev *indio_dev)
if ((ch0 >= chip->als_saturation) || (ch1 >= chip->als_saturation)) if ((ch0 >= chip->als_saturation) || (ch1 >= chip->als_saturation))
goto return_max; goto return_max;
if (ch0 == 0) { if (!ch0) {
/* have no data, so return LAST VALUE */ /* have no data, so return LAST VALUE */
ret = chip->als_cur_info.lux = 0; ret = chip->als_cur_info.lux = 0;
goto out_unlock; goto out_unlock;
...@@ -415,7 +415,7 @@ static int taos_chip_on(struct iio_dev *indio_dev) ...@@ -415,7 +415,7 @@ static int taos_chip_on(struct iio_dev *indio_dev)
/* determine als integration register */ /* determine als integration register */
als_count = (chip->taos_settings.als_time * 100 + 135) / 270; 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 */ als_count = 1; /* ensure at least one cycle */
/* convert back to time (encompasses overrides) */ /* convert back to time (encompasses overrides) */
...@@ -499,7 +499,7 @@ static ssize_t taos_power_state_store(struct device *dev, ...@@ -499,7 +499,7 @@ static ssize_t taos_power_state_store(struct device *dev,
if (kstrtoint(buf, 0, &value)) if (kstrtoint(buf, 0, &value))
return -EINVAL; return -EINVAL;
if (value == 0) if (!value)
taos_chip_off(indio_dev); taos_chip_off(indio_dev);
else else
taos_chip_on(indio_dev); taos_chip_on(indio_dev);
......
...@@ -403,7 +403,7 @@ static int tsl2x7x_get_lux(struct iio_dev *indio_dev) ...@@ -403,7 +403,7 @@ static int tsl2x7x_get_lux(struct iio_dev *indio_dev)
goto return_max; goto return_max;
} }
if (ch0 == 0) { if (!ch0) {
/* have no data, so return LAST VALUE */ /* have no data, so return LAST VALUE */
ret = chip->als_cur_info.lux; ret = chip->als_cur_info.lux;
goto out_unlock; goto out_unlock;
...@@ -678,7 +678,7 @@ static int tsl2x7x_chip_on(struct iio_dev *indio_dev) ...@@ -678,7 +678,7 @@ static int tsl2x7x_chip_on(struct iio_dev *indio_dev)
/* determine als integration register */ /* determine als integration register */
als_count = (chip->tsl2x7x_settings.als_time * 100 + 135) / 270; 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 */ als_count = 1; /* ensure at least one cycle */
/* convert back to time (encompasses overrides) */ /* convert back to time (encompasses overrides) */
...@@ -825,7 +825,7 @@ void tsl2x7x_prox_calculate(int *data, int length, ...@@ -825,7 +825,7 @@ void tsl2x7x_prox_calculate(int *data, int length,
int sample_sum; int sample_sum;
int tmp; int tmp;
if (length == 0) if (!length)
length = 1; length = 1;
sample_sum = 0; sample_sum = 0;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment