Paul Fertser
d7e1cad012
hwmon: (tmp421) fix rounding for negative values
...
[ Upstream commit 724e8af85854c4d3401313b6dd7d79cf792d8990 ]
Old code produces -24999 for 0b1110011100000000 input in standard format due to
always rounding up rather than "away from zero".
Use the common macro for division, unify and simplify the conversion code along
the way.
Fixes: 9410700b881f ("hwmon: Add driver for Texas Instruments TMP421/422/423 sensor chips")
Signed-off-by: Paul Fertser <fercerpav@gmail.com>
Link: https://lore.kernel.org/r/20210924093011.26083-3-fercerpav@gmail.com
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2021-10-06 10:23:41 +02:00
..
2020-02-28 15:42:14 +01:00
2014-10-03 08:19:02 -07:00
2014-10-20 16:20:36 +02:00
2014-10-20 16:20:36 +02:00
2015-10-14 07:57:14 -07:00
2020-07-09 09:35:56 +02:00
2016-06-27 18:58:03 -07:00
2014-08-04 07:01:35 -07:00
2014-08-04 07:01:35 -07:00
2015-01-25 21:24:00 -08:00
2015-10-28 10:30:17 +09:00
2014-08-04 07:01:36 -07:00
2014-08-05 19:44:36 -07:00
2014-08-05 19:44:36 -07:00
2014-08-04 07:01:35 -07:00
2014-08-04 07:01:37 -07:00
2016-10-17 10:16:20 -07:00
2016-02-18 19:14:04 -08:00
2016-04-19 06:30:28 -07:00
2016-06-27 18:58:03 -07:00
2015-10-28 10:30:17 +09:00
2016-09-08 21:34:14 -07:00
2020-03-11 07:53:13 +01:00
2016-09-18 10:10:26 -07:00
2020-01-29 10:24:37 +01:00
2017-01-12 11:39:25 +01:00
2020-09-12 11:47:32 +02:00
2014-08-05 19:44:36 -07:00
2014-08-04 07:01:38 -07:00
2017-12-25 14:23:40 +01:00
2015-05-31 22:58:36 -07:00
2018-02-22 15:43:55 +01:00
2014-10-20 16:20:36 +02:00
2014-10-20 16:20:36 +02:00
2016-09-05 13:52:41 +02:00
2014-10-20 16:20:36 +02:00
2017-01-12 11:39:25 +01:00
2014-08-28 11:18:47 -07:00
2016-06-27 18:58:03 -07:00
2014-08-04 07:01:35 -07:00
2020-07-22 09:10:53 +02:00
2019-05-31 06:48:24 -07:00
2015-08-09 13:44:26 -07:00
2013-10-13 16:16:27 -07:00
2016-06-07 20:11:10 -07:00
2016-09-08 21:34:16 -07:00
2014-08-04 07:01:37 -07:00
2017-01-12 11:39:26 +01:00
2014-08-04 07:01:36 -07:00
2017-10-08 10:26:04 +02:00
2016-02-19 17:14:25 -08:00
2014-08-05 19:40:27 -07:00
2018-02-22 15:43:55 +01:00
2020-01-29 10:24:38 +01:00
2014-10-20 16:20:36 +02:00
2015-01-24 14:16:22 +01:00
2016-01-04 08:56:22 -08:00
2015-03-09 09:59:35 -07:00
2018-11-27 16:09:39 +01:00
2016-09-08 21:34:17 -07:00
2018-12-17 09:38:32 +01:00
2013-10-18 09:11:57 -07:00
2019-11-25 09:53:51 +01:00
2017-05-14 14:00:13 +02:00
2020-05-02 17:23:18 +02:00
2016-06-27 18:58:03 -07:00
2018-02-22 15:43:55 +01:00
2018-02-22 15:43:55 +01:00
2016-09-13 07:27:34 -07:00
2014-08-04 07:01:37 -07:00
2014-08-04 07:01:36 -07:00
2015-10-28 10:30:17 +09:00
2013-10-13 16:16:28 -07:00
2020-01-29 10:24:30 +01:00
2014-07-31 09:41:46 -07:00
2014-10-20 16:20:36 +02:00
2021-05-26 11:29:07 +02:00
2014-05-21 16:02:26 -07:00
2015-04-17 09:03:55 -04:00
2014-08-05 19:44:42 -07:00
2021-03-17 16:10:18 +01:00
2014-08-05 17:48:52 -07:00
2014-08-04 07:01:36 -07:00
2014-12-02 06:11:53 -08:00
2016-09-13 07:28:01 -07:00
2016-09-08 21:34:18 -07:00
2014-08-04 07:01:35 -07:00
2016-03-05 06:25:34 -08:00
2016-09-08 21:34:16 -07:00
2014-03-03 08:01:05 -08:00
2014-08-04 07:01:35 -07:00
2016-09-08 21:34:18 -07:00
2014-08-04 07:01:35 -07:00
2013-10-18 09:12:00 -07:00
2016-09-08 21:34:16 -07:00
2015-05-31 22:58:36 -07:00
2016-03-27 10:37:48 -07:00
2014-05-21 16:02:25 -07:00
2014-08-04 07:01:39 -07:00
2014-08-04 07:01:39 -07:00
2014-01-29 20:40:08 +01:00
2016-09-08 21:34:17 -07:00
2020-07-09 09:35:56 +02:00
2014-08-04 07:01:38 -07:00
2021-07-20 16:21:01 +02:00
2021-07-20 16:21:01 +02:00
2014-10-20 16:20:36 +02:00
2015-07-01 13:56:27 -07:00
2014-11-03 19:53:56 -08:00
2016-01-09 07:31:58 -08:00
2019-08-25 10:51:24 +02:00
2020-01-29 10:24:39 +01:00
2016-09-08 21:34:18 -07:00
2016-03-08 18:40:49 -08:00
2016-09-08 21:34:15 -07:00
2014-10-20 16:20:36 +02:00
2019-05-31 06:48:24 -07:00
2014-01-29 20:40:08 +01:00
2014-08-04 07:01:33 -07:00
2019-11-25 09:53:51 +01:00
2014-10-20 16:20:36 +02:00
2015-12-29 20:36:04 +01:00
2014-10-20 16:20:36 +02:00
2016-04-25 07:26:29 -07:00
2017-01-12 11:39:25 +01:00
2016-07-31 14:56:36 -07:00
2015-08-10 23:00:10 -07:00
2014-08-04 07:01:38 -07:00
2020-01-29 10:24:31 +01:00
2014-10-20 16:20:36 +02:00
2014-08-04 07:01:37 -07:00
2019-05-31 06:48:24 -07:00
2019-05-31 06:48:24 -07:00
2014-08-04 07:01:39 -07:00
2015-06-21 22:54:53 -07:00
2014-08-04 07:01:39 -07:00
2016-09-08 21:34:17 -07:00
2014-09-22 11:11:48 -07:00
2016-06-27 18:58:03 -07:00
2021-10-06 10:23:41 +02:00
2014-10-20 16:20:36 +02:00
2014-10-20 16:20:36 +02:00
2016-03-05 06:25:33 -08:00
2014-10-20 16:20:36 +02:00
2014-10-20 16:20:36 +02:00
2019-05-31 06:48:23 -07:00
2014-10-20 16:20:36 +02:00
2014-04-04 18:01:34 +02:00
2014-08-04 07:01:34 -07:00
2015-07-03 14:39:06 +02:00
2020-01-29 10:24:21 +01:00
2014-10-20 16:20:36 +02:00
2014-08-05 19:44:42 -07:00
2015-07-03 14:39:05 +02:00
2014-08-05 19:44:42 -07:00
2018-12-17 09:38:32 +01:00
2014-10-20 16:20:36 +02:00
2014-10-20 16:20:36 +02:00
2016-09-09 14:54:53 -07:00