Skip to content

Commit 889c5e9

Browse files
haraldgjic23
authored andcommitted
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: Hartmut Knaack <[email protected]> in Message-ID: <[email protected]> Signed-off-by: Harald Geyer <[email protected]> Signed-off-by: Jonathan Cameron <[email protected]>
1 parent 5e9972c commit 889c5e9

File tree

1 file changed

+13
-12
lines changed

1 file changed

+13
-12
lines changed

drivers/iio/humidity/dht11.c

Lines changed: 13 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,8 @@
4646
* Note that when reading the sensor actually 84 edges are detected, but
4747
* since the last edge is not significant, we only store 83:
4848
*/
49-
#define DHT11_EDGES_PER_READ (2*DHT11_BITS_PER_READ + DHT11_EDGES_PREAMBLE + 1)
49+
#define DHT11_EDGES_PER_READ (2 * DHT11_BITS_PER_READ + \
50+
DHT11_EDGES_PREAMBLE + 1)
5051

5152
/* Data transmission timing (nano seconds) */
5253
#define DHT11_START_TRANSMISSION 18 /* ms */
@@ -95,24 +96,24 @@ static int dht11_decode(struct dht11 *dht11, int offset)
9596

9697
/* Calculate timestamp resolution */
9798
for (i = 1; i < dht11->num_edges; ++i) {
98-
t = dht11->edges[i].ts - dht11->edges[i-1].ts;
99+
t = dht11->edges[i].ts - dht11->edges[i - 1].ts;
99100
if (t > 0 && t < timeres)
100101
timeres = t;
101102
}
102-
if (2*timeres > DHT11_DATA_BIT_HIGH) {
103+
if (2 * timeres > DHT11_DATA_BIT_HIGH) {
103104
pr_err("dht11: timeresolution %d too bad for decoding\n",
104-
timeres);
105+
timeres);
105106
return -EIO;
106107
}
107108
threshold = DHT11_DATA_BIT_HIGH / timeres;
108-
if (DHT11_DATA_BIT_LOW/timeres + 1 >= threshold)
109+
if (DHT11_DATA_BIT_LOW / timeres + 1 >= threshold)
109110
pr_err("dht11: WARNING: decoding ambiguous\n");
110111

111112
/* scale down with timeres and check validity */
112113
for (i = 0; i < DHT11_BITS_PER_READ; ++i) {
113-
t = dht11->edges[offset + 2*i + 2].ts -
114-
dht11->edges[offset + 2*i + 1].ts;
115-
if (!dht11->edges[offset + 2*i + 1].value)
114+
t = dht11->edges[offset + 2 * i + 2].ts -
115+
dht11->edges[offset + 2 * i + 1].ts;
116+
if (!dht11->edges[offset + 2 * i + 1].value)
116117
return -EIO; /* lost synchronisation */
117118
timing[i] = t / timeres;
118119
}
@@ -166,7 +167,7 @@ static irqreturn_t dht11_handle_irq(int irq, void *data)
166167
}
167168

168169
static int dht11_read_raw(struct iio_dev *iio_dev,
169-
const struct iio_chan_spec *chan,
170+
const struct iio_chan_spec *chan,
170171
int *val, int *val2, long m)
171172
{
172173
struct dht11 *dht11 = iio_priv(iio_dev);
@@ -192,21 +193,21 @@ static int dht11_read_raw(struct iio_dev *iio_dev,
192193
goto err;
193194

194195
ret = wait_for_completion_killable_timeout(&dht11->completion,
195-
HZ);
196+
HZ);
196197

197198
free_irq(dht11->irq, iio_dev);
198199

199200
if (ret == 0 && dht11->num_edges < DHT11_EDGES_PER_READ - 1) {
200201
dev_err(&iio_dev->dev,
201-
"Only %d signal edges detected\n",
202+
"Only %d signal edges detected\n",
202203
dht11->num_edges);
203204
ret = -ETIMEDOUT;
204205
}
205206
if (ret < 0)
206207
goto err;
207208

208209
ret = dht11_decode(dht11,
209-
dht11->num_edges == DHT11_EDGES_PER_READ ?
210+
dht11->num_edges == DHT11_EDGES_PER_READ ?
210211
DHT11_EDGES_PREAMBLE :
211212
DHT11_EDGES_PREAMBLE - 2);
212213
if (ret)

0 commit comments

Comments
 (0)