1
0
Fork 0
alistair23-linux/drivers/iio/chemical
Lars-Peter Clausen 166549bb1e iio: bme680: Use DIV_ROUND_CLOSEST() instead of open-coding it
Use DIV_ROUND_CLOSEST() instead of open-coding it. This documents intent
and makes it more clear what is going on for the casual reviewer.

Generated using the following the Coccinelle semantic patch.

// <smpl>
@r1@
expression x;
constant C1;
constant C2;
@@
 ((x) + C1) / C2

@script:python@
C1 << r1.C1;
C2 << r1.C2;
@@
try:
	if int(C1) * 2 != int(C2):
		cocci.include_match(False)
except:
	cocci.include_match(False)

@@
expression r1.x;
constant r1.C1;
constant r1.C2;
@@
-(((x) + C1) / C2)
+DIV_ROUND_CLOSEST(x, C2)
// </smpl>

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Link: https://lore.kernel.org/r/20201227171126.28216-2-lars@metafoo.de
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2021-01-09 21:52:45 +00:00
..
Kconfig iio: chemical: scd30: add serial interface driver 2020-06-27 14:52:38 +01:00
Makefile iio: chemical: scd30: add serial interface driver 2020-06-27 14:52:38 +01:00
ams-iaq-core.c iio:chemical:ams-iaq-core: Drop of_match_ptr protection 2020-09-21 18:41:31 +01:00
atlas-ezo-sensor.c iio: chemical: atlas-ezo-sensor: add humidity sensor support 2020-09-03 19:40:48 +01:00
atlas-sensor.c iio:chemical:atlas-sensor: Drop of_match_ptr and use generic fw accessors 2020-09-21 18:41:31 +01:00
bme680.h iio:chemical:bme680: Fix SPI read interface 2019-03-09 17:27:36 +00:00
bme680_core.c iio: bme680: Use DIV_ROUND_CLOSEST() instead of open-coding it 2021-01-09 21:52:45 +00:00
bme680_i2c.c iio:chemical:bme680: Fix SPI read interface 2019-03-09 17:27:36 +00:00
bme680_spi.c iio:chemical:bme680: Fix SPI read interface 2019-03-09 17:27:36 +00:00
ccs811.c iio:chemical:ccs811: Fix timestamp alignment and prevent data leak. 2020-08-22 11:38:55 +01:00
pms7003.c iio: chemical: pms7003: convert comma to semicolon 2021-01-09 14:25:28 +00:00
scd30.h iio: chemical: scd30: add core driver 2020-06-27 14:46:44 +01:00
scd30_core.c iio: chemical: scd30: Simplify with dev_err_probe() 2020-09-03 19:40:50 +01:00
scd30_i2c.c iio: chemical: scd30: add I2C interface driver 2020-06-27 14:50:30 +01:00
scd30_serial.c iio: chemical: scd30: add serial interface driver 2020-06-27 14:52:38 +01:00
sgp30.c iio: chemical: sgp30: Add description for sgp_read_cmd()'s 'duration_us' 2020-09-21 18:41:37 +01:00
sps30.c treewide: Use fallthrough pseudo-keyword 2020-08-23 17:36:59 -05:00
vz89x.c iio:chemical:vz89x: Drop of_match_ptr protection and use generic fw accessors 2020-09-21 18:41:32 +01:00