Commit 889c5e9b authored by Harald Geyer's avatar Harald Geyer Committed by Jonathan Cameron

iio: dht11: whitespace changes to make checkpatch.pl --strict happy

* add spaces around binary operators in cases where it reduces readability
* align multiline statements around opening parenthesis
Reported-by: default avatarHartmut Knaack <knaack.h@gmx.de>
	in Message-ID: <55919E72.3010807@gmx.de>
Signed-off-by: default avatarHarald Geyer <harald@ccbib.org>
Signed-off-by: default avatarJonathan Cameron <jic23@kernel.org>
parent 5e9972cd
...@@ -46,7 +46,8 @@ ...@@ -46,7 +46,8 @@
* Note that when reading the sensor actually 84 edges are detected, but * Note that when reading the sensor actually 84 edges are detected, but
* since the last edge is not significant, we only store 83: * since the last edge is not significant, we only store 83:
*/ */
#define DHT11_EDGES_PER_READ (2*DHT11_BITS_PER_READ + DHT11_EDGES_PREAMBLE + 1) #define DHT11_EDGES_PER_READ (2 * DHT11_BITS_PER_READ + \
DHT11_EDGES_PREAMBLE + 1)
/* Data transmission timing (nano seconds) */ /* Data transmission timing (nano seconds) */
#define DHT11_START_TRANSMISSION 18 /* ms */ #define DHT11_START_TRANSMISSION 18 /* ms */
...@@ -95,24 +96,24 @@ static int dht11_decode(struct dht11 *dht11, int offset) ...@@ -95,24 +96,24 @@ static int dht11_decode(struct dht11 *dht11, int offset)
/* Calculate timestamp resolution */ /* Calculate timestamp resolution */
for (i = 1; i < dht11->num_edges; ++i) { for (i = 1; i < dht11->num_edges; ++i) {
t = dht11->edges[i].ts - dht11->edges[i-1].ts; t = dht11->edges[i].ts - dht11->edges[i - 1].ts;
if (t > 0 && t < timeres) if (t > 0 && t < timeres)
timeres = t; timeres = t;
} }
if (2*timeres > DHT11_DATA_BIT_HIGH) { if (2 * timeres > DHT11_DATA_BIT_HIGH) {
pr_err("dht11: timeresolution %d too bad for decoding\n", pr_err("dht11: timeresolution %d too bad for decoding\n",
timeres); timeres);
return -EIO; return -EIO;
} }
threshold = DHT11_DATA_BIT_HIGH / timeres; threshold = DHT11_DATA_BIT_HIGH / timeres;
if (DHT11_DATA_BIT_LOW/timeres + 1 >= threshold) if (DHT11_DATA_BIT_LOW / timeres + 1 >= threshold)
pr_err("dht11: WARNING: decoding ambiguous\n"); pr_err("dht11: WARNING: decoding ambiguous\n");
/* scale down with timeres and check validity */ /* scale down with timeres and check validity */
for (i = 0; i < DHT11_BITS_PER_READ; ++i) { for (i = 0; i < DHT11_BITS_PER_READ; ++i) {
t = dht11->edges[offset + 2*i + 2].ts - t = dht11->edges[offset + 2 * i + 2].ts -
dht11->edges[offset + 2*i + 1].ts; dht11->edges[offset + 2 * i + 1].ts;
if (!dht11->edges[offset + 2*i + 1].value) if (!dht11->edges[offset + 2 * i + 1].value)
return -EIO; /* lost synchronisation */ return -EIO; /* lost synchronisation */
timing[i] = t / timeres; timing[i] = t / timeres;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment