On 12/11/16 18:19, Brian Masney wrote: > 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 <[email protected]> Applied. > --- > drivers/staging/iio/light/tsl2583.c | 6 +++++- > 1 file changed, 5 insertions(+), 1 deletion(-) > > diff --git a/drivers/staging/iio/light/tsl2583.c > b/drivers/staging/iio/light/tsl2583.c > index 52a39a6..dbb7f6a 100644 > --- a/drivers/staging/iio/light/tsl2583.c > +++ b/drivers/staging/iio/light/tsl2583.c > @@ -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; >
- [PATCH v4 13/26] staging: iio: tsl2583: fix multiline com... Brian Masney
- Re: [PATCH v4 13/26] staging: iio: tsl2583: fix mult... Jonathan Cameron
- [PATCH v4 02/26] staging: iio: tsl2583: remove unnecessar... Brian Masney
- Re: [PATCH v4 02/26] staging: iio: tsl2583: remove u... Jonathan Cameron
- [PATCH v4 18/26] staging: iio: tsl2583: don't assume an u... Brian Masney
- [PATCH v4 01/26] staging: iio: tsl2583: check if chip is ... Brian Masney
- Re: [PATCH v4 01/26] staging: iio: tsl2583: check if... Jonathan Cameron
- [PATCH v4 08/26] staging: iio: tsl2583: unify function an... Brian Masney
- Re: [PATCH v4 08/26] staging: iio: tsl2583: unify fu... Jonathan Cameron
- [PATCH v4 14/26] staging: iio: tsl2583: updated code comm... Brian Masney
- Re: [PATCH v4 14/26] staging: iio: tsl2583: updated ... Jonathan Cameron
- [PATCH v4 17/26] staging: iio: tsl2583: remove unnecessar... Brian Masney
- Re: [PATCH v4 17/26] staging: iio: tsl2583: remove u... Jonathan Cameron
- [PATCH v4 10/26] staging: iio: tsl2583: fix comparison be... Brian Masney
- Re: [PATCH v4 10/26] staging: iio: tsl2583: fix comp... Jonathan Cameron
- [PATCH v4 11/26] staging: iio: tsl2583: change newlines t... Brian Masney
- Re: [PATCH v4 11/26] staging: iio: tsl2583: change n... Jonathan Cameron
- [PATCH v4 12/26] staging: iio: tsl2583: combine sysfs doc... Brian Masney
- Re: [PATCH v4 12/26] staging: iio: tsl2583: combine ... Jonathan Cameron
- [PATCH v4 04/26] staging: iio: tsl2583: change current ch... Brian Masney
- Re: [PATCH v4 04/26] staging: iio: tsl2583: change c... Jonathan Cameron

