staging: iio: light: Remove explicit comparisons
authorCristina Moraru <cristina.moraru09@gmail.com>
Tue, 20 Oct 2015 19:55:40 +0000 (22:55 +0300)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sun, 25 Oct 2015 02:32:09 +0000 (19:32 -0700)
Remove comparisons to 0 or NULL

Signed-off-by: Cristina Moraru <cristina.moraru09@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/staging/iio/light/isl29018.c
drivers/staging/iio/light/tsl2583.c
drivers/staging/iio/light/tsl2x7x_core.c

index 019ba5245c2363ac2e671dcde9c4378eb19dcc02..73109dd4011419fe57c6917e6a8b29088fd1a1a6 100644 (file)
@@ -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;
        }
index df602038a4bd062549b1dd50cc637dc66ddf7874..3100d960fe2c6dc57a49361dcbd5ce53c00e9ef0 100644 (file)
@@ -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);
index bf9627ea2ffb03e611dbd93b48497b1eeff2af4c..9dfd04855a1b0edb769866686ce505e30339a324 100644 (file)
@@ -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;