linux/drivers/iio
Gregor Boirie d91d35de32 iio:core: fix IIO_VAL_FRACTIONAL sign handling
commit 171c009183 upstream.

7985e7c100 ("iio: Introduce a new fractional value type") introduced a
new IIO_VAL_FRACTIONAL value type meant to represent rational type numbers
expressed by a numerator and denominator combination.

Formating of IIO_VAL_FRACTIONAL values relies upon do_div() usage. This
fails handling negative values properly since parameters are reevaluated
as unsigned values.
Fix this by using div_s64_rem() instead. Computed integer part will carry
properly signed value. Formatted fractional part will always be positive.

Fixes: 7985e7c100 ("iio: Introduce a new fractional value type")
Signed-off-by: Gregor Boirie <gregor.boirie@parrot.com>
Reviewed-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
History 2016-11-20 01:17:23 +00:00
..
accel iio: accel: kxsd9: Fix scaling bug 2016-11-20 01:17:22 +00:00
adc iio: adc: ti_am335x_adc: Protect FIFO1 from concurrent access 2016-11-20 01:17:15 +00:00
amplifiers iio: amplifiers: ad8366: Remove regulator_put 2013-09-28 11:49:45 +01:00
common iio: fix pressure data output unit in hid-sensor-attributes 2016-11-20 01:17:22 +00:00
dac iio: dac: mcp4725: set iio name property in sysfs 2016-02-25 00:18:34 +00:00
frequency Merge 3.12-rc6 into staging-next. 2013-10-19 13:14:34 -07:00
gyro iio:st_sensors: Fix oops when probing SPI devices 2015-05-28 09:59:58 +01:00
humidity iio: Add si7005 relative humidity and temperature sensor driver 2014-01-11 11:12:44 +00:00
imu iio: adis_buffer: Fix out-of-bounds memory access 2016-02-16 19:50:01 +00:00
light iio: light: hid-sensor-prox: Fix modifier 2015-05-28 09:59:56 +01:00
magnetometer iio: ak8975: Fix NULL pointer exception on early interrupt 2016-06-15 21:29:24 +01:00
orientation iio: hid-sensors: Inclinometer 3D: Raw read support 2014-05-05 10:59:52 +01:00
pressure iio:st_pressure: fix sampling gains (bring inline with ABI) 2016-08-22 22:38:11 +01:00
proximity iio: proximity: as3935: set up buffer timestamps for non-zero values 2016-11-20 01:17:11 +00:00
temperature iio: tmp006: Check channel info on write 2015-08-10 09:54:08 +01:00
trigger iio:trigger: fix sysfs name on list mutex 2013-09-28 11:51:16 +01:00
buffer_cb.c iio get rid of unneccessary error_ret 2014-02-18 08:46:36 +00:00
iio_core.h IIO: core: Introduce read_raw_multi 2014-04-29 22:05:32 +01:00
iio_core_trigger.h iio: fix semicolon in io_core_trigger.h 2013-08-03 18:40:32 +01:00
industrialio-buffer.c iio: fix some warning messages 2016-01-11 10:50:15 +00:00
industrialio-core.c iio:core: fix IIO_VAL_FRACTIONAL sign handling 2016-11-20 01:17:23 +00:00
industrialio-event.c iio: event: Remove negative error code from iio_event_poll 2015-09-28 10:21:38 +01:00
industrialio-trigger.c iio: Fix error handling in iio_trigger_attach_poll_func 2016-08-22 22:38:13 +01:00
industrialio-triggered-buffer.c iio:triggered-buffer: Remove redundant call to iio_sw_buffer_preenable(). 2013-10-16 19:12:47 +01:00
inkern.c iio: inkern: fix a NULL dereference on error 2016-02-25 00:18:38 +00:00
Kconfig iio: always select ANON_INODES 2014-05-10 11:39:57 +01:00
kfifo_buf.c iio: kfifo_buf: Implement data_available() callback 2013-12-03 20:22:28 +00:00
Makefile iio: Add AS3935 lightning sensor support 2014-03-16 18:00:32 +00:00