]> git.karo-electronics.de Git - karo-tx-linux.git/commitdiff
staging: iio: tsl2583: updated code comment to match what the code does
authorBrian Masney <masneyb@onstation.org>
Sat, 12 Nov 2016 18:19:29 +0000 (13:19 -0500)
committerJonathan Cameron <jic23@kernel.org>
Sun, 13 Nov 2016 13:07:25 +0000 (13:07 +0000)
If channel 0 does not have any data, then the code sets the lux to zero.
The corresponding comment says that the last value is returned. This
updates the comment to correctly reflect what the code does. It also
clarifies the comment about why 0 is returned.

Signed-off-by: Brian Masney <masneyb@onstation.org>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
drivers/staging/iio/light/tsl2583.c

index abd0663f9691b03811bae4fd1169fbae559523ae..e11820e8c710aa60d9dae9f39c85810f0a438843 100644 (file)
@@ -221,7 +221,11 @@ static int tsl2583_get_lux(struct iio_dev *indio_dev)
                goto return_max;
 
        if (!ch0) {
-               /* have no data, so return LAST VALUE */
+               /*
+                * The sensor appears to be in total darkness so set the
+                * calculated lux to 0 and return early to avoid a division by
+                * zero below when calculating the ratio.
+                */
                ret = 0;
                chip->als_cur_info.lux = 0;
                goto done;