[PATCH 4/9] w1: cleanup whitespaces according to coding style document

From: Steffen Vogel
Date: Sun Oct 28 2018 - 18:20:24 EST


These changes fix several warnings emitted by the checkpatch tool.

Signed-off-by: Steffen Vogel <post@xxxxxxxxxxxxxxx>
---
drivers/w1/w1.c | 20 +++++++++-----------
drivers/w1/w1_family.c | 2 +-
drivers/w1/w1_io.c | 17 +++++++++--------
drivers/w1/w1_netlink.c | 2 +-
4 files changed, 20 insertions(+), 21 deletions(-)

diff --git a/drivers/w1/w1.c b/drivers/w1/w1.c
index 812186ce35d6..f64da16dbec9 100644
--- a/drivers/w1/w1.c
+++ b/drivers/w1/w1.c
@@ -775,7 +775,7 @@ int w1_attach_slave_device(struct w1_master *dev, struct w1_reg_num *rn)
spin_lock(&w1_flock);
f = w1_family_registered(rn->family);
if (!f) {
- f= &w1_default_family;
+ f = &w1_default_family;
dev_info(&dev->dev, "Family %x for %02x.%012llx.%02x is not registered.\n",
rn->family, rn->family,
(unsigned long long)rn->id, rn->crc);
@@ -997,7 +997,7 @@ void w1_search(struct w1_master *dev, u8 search_type,

desc_bit = 64;

- while ( !last_device && (slave_count++ < dev->max_slave_count) ) {
+ while (!last_device && (slave_count++ < dev->max_slave_count)) {
last_rn = rn;
rn = 0;

@@ -1045,7 +1045,7 @@ void w1_search(struct w1_master *dev, u8 search_type,
triplet_ret = w1_triplet(dev, search_bit);

/* quit if no device responded */
- if ( (triplet_ret & 0x03) == 0x03 )
+ if ((triplet_ret & 0x03) == 0x03)
break;

/* If both directions were valid, and we took the 0 path */
@@ -1064,13 +1064,12 @@ void w1_search(struct w1_master *dev, u8 search_type,
}
mutex_unlock(&dev->bus_mutex);

- if ( (triplet_ret & 0x03) != 0x03 ) {
+ if ((triplet_ret & 0x03) != 0x03) {
if ((desc_bit == last_zero) || (last_zero < 0)) {
last_device = 1;
dev->search_id = 0;
- } else {
+ } else
dev->search_id = rn;
- }
desc_bit = last_zero;
cb(dev, rn);
}
@@ -1109,8 +1108,7 @@ void w1_search_process_cb(struct w1_master *dev, u8 search_type,
mutex_unlock(&dev->list_mutex);
w1_slave_detach(sl);
mutex_lock(&dev->list_mutex);
- }
- else if (test_bit(W1_SLAVE_ACTIVE, &sl->flags))
+ } else if (test_bit(W1_SLAVE_ACTIVE, &sl->flags))
sl->ttl = dev->slave_ttl;
}
mutex_unlock(&dev->list_mutex);
@@ -1142,7 +1140,8 @@ int w1_process_callbacks(struct w1_master *dev)
list_for_each_entry_safe(async_cmd, async_n, &dev->async_list,
async_entry) {
/* drop the lock, if it is a search it can take a long
- * time */
+ * time
+ */
mutex_unlock(&dev->list_mutex);
async_cmd->cb(dev, async_cmd);
ret = 1;
@@ -1199,8 +1198,7 @@ int w1_process(void *data)
if (!jremain)
jremain = jtime;
jremain = schedule_timeout(jremain);
- }
- else
+ } else
schedule();
}

diff --git a/drivers/w1/w1_family.c b/drivers/w1/w1_family.c
index ee90a6733472..5abbeb86de6e 100644
--- a/drivers/w1/w1_family.c
+++ b/drivers/w1/w1_family.c
@@ -83,7 +83,7 @@ EXPORT_SYMBOL(w1_unregister_family);
/*
* Should be called under w1_flock held.
*/
-struct w1_family * w1_family_registered(u8 fid)
+struct w1_family *w1_family_registered(u8 fid)
{
struct list_head *ent, *n;
struct w1_family *f = NULL;
diff --git a/drivers/w1/w1_io.c b/drivers/w1/w1_io.c
index 2626a61852e9..283c89708c7c 100644
--- a/drivers/w1/w1_io.c
+++ b/drivers/w1/w1_io.c
@@ -140,13 +140,13 @@ void w1_write_8(struct w1_master *dev, u8 byte)
if (dev->bus_master->write_byte) {
w1_pre_write(dev);
dev->bus_master->write_byte(dev->bus_master->data, byte);
- }
- else
+ } else {
for (i = 0; i < 8; ++i) {
if (i == 7)
w1_pre_write(dev);
w1_touch_bit(dev, (byte >> i) & 0x1);
}
+ }
w1_post_write(dev);
}
EXPORT_SYMBOL_GPL(w1_write_8);
@@ -236,9 +236,10 @@ u8 w1_read_8(struct w1_master *dev)

if (dev->bus_master->read_byte)
res = dev->bus_master->read_byte(dev->bus_master->data);
- else
+ else {
for (i = 0; i < 8; ++i)
- res |= (w1_touch_bit(dev,1) << i);
+ res |= (w1_touch_bit(dev, 1) << i);
+ }

return res;
}
@@ -257,10 +258,10 @@ void w1_write_block(struct w1_master *dev, const u8 *buf, int len)
if (dev->bus_master->write_block) {
w1_pre_write(dev);
dev->bus_master->write_block(dev->bus_master->data, buf, len);
- }
- else
+ } else {
for (i = 0; i < len; ++i)
w1_write_8(dev, buf[i]); /* calls w1_pre_write */
+ }
w1_post_write(dev);
}
EXPORT_SYMBOL_GPL(w1_write_block);
@@ -358,7 +359,7 @@ int w1_reset_bus(struct w1_master *dev)
}
EXPORT_SYMBOL_GPL(w1_reset_bus);

-u8 w1_calc_crc8(u8 * data, int len)
+u8 w1_calc_crc8(u8 *data, int len)
{
u8 crc = 0;

@@ -400,7 +401,7 @@ int w1_reset_select_slave(struct w1_slave *sl)
w1_write_8(sl->master, W1_SKIP_ROM);
else {
u8 match[9] = {W1_MATCH_ROM, };
- u64 rn = le64_to_cpu(*((u64*)&sl->reg_num));
+ u64 rn = le64_to_cpu(*((u64 *)&sl->reg_num));

memcpy(&match[1], &rn, 8);
w1_write_block(sl->master, match, 9);
diff --git a/drivers/w1/w1_netlink.c b/drivers/w1/w1_netlink.c
index ff858bf4a94d..b0c7abddd091 100644
--- a/drivers/w1/w1_netlink.c
+++ b/drivers/w1/w1_netlink.c
@@ -606,7 +606,7 @@ static void w1_cn_callback(struct cn_msg *cn, struct netlink_skb_parms *nsp)
* space for replies which is the original message size plus
* space for any list slave data and status messages
* cn->len doesn't include itself which is part of the block
- * */
+ */
size = /* block + original message */
sizeof(struct w1_cb_block) + sizeof(*cn) + cn->len +
/* space for nodes */
--
2.11.0