On 12/11/16 16:59, Brian Masney wrote: > On Sat, Nov 12, 2016 at 04:36:37PM +0000, Jonathan Cameron wrote: >> On 10/11/16 09:25, 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. >>> >>> Signed-off-by: Brian Masney <masn...@onstation.org> >> Better perhaps to just return an error, -EAGAIN perhaps? >> I'm not sure why it would not give a value. > > This check is to avoid a division by zero. Here is the relevant code > that wasn't shown in the diff: > > if (!ch0) { > /* have no data, so return 0 */ > ret = 0; > chip->als_cur_info.lux = 0; > goto done; > } > > /* calculate ratio */ > ratio = (ch1 << 15) / ch0; > > Channel 0 is sensitive to both infrared and visible light. In total > darkness, the sensor should return 0. Correct me if I am wrong, but > I believe that returning 0 here is more correct than -EAGAIN. > > Brian > Fair enough I hadn't understood that. Maybe expand the comment to cover that? _______________________________________________ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
- [PATCH v3 11/28] staging: iio: tsl2583: fix alignment of ... Brian Masney
- [PATCH v3 13/28] staging: iio: tsl2583: change newlines t... Brian Masney
- [PATCH v3 14/28] staging: iio: tsl2583: combine sysfs doc... Brian Masney
- [PATCH v3 17/28] staging: iio: tsl2583: moved code block ... Brian Masney
- [PATCH v3 20/28] staging: iio: tsl2583: don't assume an u... Brian Masney
- Re: [PATCH v3 20/28] staging: iio: tsl2583: don't as... Jonathan Cameron
- [PATCH v3 15/28] staging: iio: tsl2583: fix multiline com... Brian Masney
- [PATCH v3 16/28] staging: iio: tsl2583: updated code comm... Brian Masney
- Re: [PATCH v3 16/28] staging: iio: tsl2583: updated ... Jonathan Cameron
- Re: [PATCH v3 16/28] staging: iio: tsl2583: upda... Brian Masney
- Re: [PATCH v3 16/28] staging: iio: tsl2583: ... Jonathan Cameron
- [PATCH v3 18/28] staging: iio: tsl2583: change tsl2583_al... Brian Masney
- [PATCH v3 21/28] staging: iio: tsl2583: move from a globa... Brian Masney
- Re: [PATCH v3 21/28] staging: iio: tsl2583: move fro... Jonathan Cameron
- [PATCH v3 25/28] staging: iio: tsl2583: remove unnecessar... Brian Masney
- [PATCH v3 22/28] staging: iio: tsl2583: add tsl2583 to li... Brian Masney
- [PATCH v3 23/28] staging: iio: tsl2583: clarified comment... Brian Masney
- [PATCH v3 19/28] staging: iio: tsl2583: remove unnecessar... Brian Masney
- [PATCH v3 26/28] staging: iio: tsl2583: remove unnecessar... Brian Masney
- [PATCH v3 24/28] staging: iio: tsl2583: remove comment fo... Brian Masney
- [PATCH v3 27/28] staging: iio: tsl2583: add copyright and... Brian Masney