summaryrefslogtreecommitdiff
path: root/drivers/w1/slaves
diff options
context:
space:
mode:
authorKrzysztof Kozlowski <krzysztof.kozlowski@linaro.org>2023-04-15 13:42:52 +0300
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2023-04-20 15:15:06 +0300
commitad9c36be1f78f2990310cdcf902eba64cd2b2cf3 (patch)
treee60a7d4217504ada686967f341371d54fb41ab4f /drivers/w1/slaves
parenta2809664ca296ca89c6c8cc52ce728c1088d5af1 (diff)
downloadlinux-ad9c36be1f78f2990310cdcf902eba64cd2b2cf3.tar.xz
w1: minor white-space and code style fixes
Correct several coding convention violations around white-spaces: ERROR: spaces required around that '=' (ctx:VxV) WARNING: Missing a blank line after declarations ERROR: "foo* bar" should be "foo *bar" ERROR: "(foo*)" should be "(foo *)" WARNING: Block comments use * on subsequent lines WARNING: Block comments use a trailing */ on a separate line WARNING: please, no space before tabs WARNING: Missing a blank line after declarations ERROR: open brace '{' following struct go on the same line ERROR: that open brace { should be on the previous line Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org> Link: https://lore.kernel.org/r/20230415104304.104134-4-krzysztof.kozlowski@linaro.org Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/w1/slaves')
-rw-r--r--drivers/w1/slaves/w1_ds2406.c31
-rw-r--r--drivers/w1/slaves/w1_ds2408.c10
-rw-r--r--drivers/w1/slaves/w1_ds2413.c6
-rw-r--r--drivers/w1/slaves/w1_ds2433.c2
-rw-r--r--drivers/w1/slaves/w1_ds2780.c1
-rw-r--r--drivers/w1/slaves/w1_ds2781.c1
-rw-r--r--drivers/w1/slaves/w1_ds28e04.c6
-rw-r--r--drivers/w1/slaves/w1_ds28e17.c2
8 files changed, 33 insertions, 26 deletions
diff --git a/drivers/w1/slaves/w1_ds2406.c b/drivers/w1/slaves/w1_ds2406.c
index 6c269af73c80..3bb88b51fe2b 100644
--- a/drivers/w1/slaves/w1_ds2406.c
+++ b/drivers/w1/slaves/w1_ds2406.c
@@ -27,11 +27,11 @@ static ssize_t w1_f12_read_state(
struct bin_attribute *bin_attr,
char *buf, loff_t off, size_t count)
{
- u8 w1_buf[6]={W1_F12_FUNC_READ_STATUS, 7, 0, 0, 0, 0};
+ u8 w1_buf[6] = {W1_F12_FUNC_READ_STATUS, 7, 0, 0, 0, 0};
struct w1_slave *sl = kobj_to_w1_slave(kobj);
- u16 crc=0;
+ u16 crc = 0;
int i;
- ssize_t rtnval=1;
+ ssize_t rtnval = 1;
if (off != 0)
return 0;
@@ -47,12 +47,12 @@ static ssize_t w1_f12_read_state(
w1_write_block(sl->master, w1_buf, 3);
w1_read_block(sl->master, w1_buf+3, 3);
- for (i=0; i<6; i++)
- crc=crc16_byte(crc, w1_buf[i]);
- if (crc==0xb001) /* good read? */
- *buf=((w1_buf[3]>>5)&3)|0x30;
+ for (i = 0; i < 6; i++)
+ crc = crc16_byte(crc, w1_buf[i]);
+ if (crc == 0xb001) /* good read? */
+ *buf = ((w1_buf[3]>>5)&3)|0x30;
else
- rtnval=-EIO;
+ rtnval = -EIO;
mutex_unlock(&sl->master->bus_mutex);
@@ -65,10 +65,10 @@ static ssize_t w1_f12_write_output(
char *buf, loff_t off, size_t count)
{
struct w1_slave *sl = kobj_to_w1_slave(kobj);
- u8 w1_buf[6]={W1_F12_FUNC_WRITE_STATUS, 7, 0, 0, 0, 0};
- u16 crc=0;
+ u8 w1_buf[6] = {W1_F12_FUNC_WRITE_STATUS, 7, 0, 0, 0, 0};
+ u16 crc = 0;
int i;
- ssize_t rtnval=1;
+ ssize_t rtnval = 1;
if (count != 1 || off != 0)
return -EFAULT;
@@ -83,12 +83,12 @@ static ssize_t w1_f12_write_output(
w1_buf[3] = (((*buf)&3)<<5)|0x1F;
w1_write_block(sl->master, w1_buf, 4);
w1_read_block(sl->master, w1_buf+4, 2);
- for (i=0; i<6; i++)
- crc=crc16_byte(crc, w1_buf[i]);
- if (crc==0xb001) /* good read? */
+ for (i = 0; i < 6; i++)
+ crc = crc16_byte(crc, w1_buf[i]);
+ if (crc == 0xb001) /* good read? */
w1_write_8(sl->master, 0xFF);
else
- rtnval=-EIO;
+ rtnval = -EIO;
mutex_unlock(&sl->master->bus_mutex);
return rtnval;
@@ -133,6 +133,7 @@ static int w1_f12_add_slave(struct w1_slave *sl)
static void w1_f12_remove_slave(struct w1_slave *sl)
{
int i;
+
for (i = NB_SYSFS_BIN_FILES - 1; i >= 0; --i)
sysfs_remove_bin_file(&sl->dev.kobj,
&(w1_f12_sysfs_bin_files[i]));
diff --git a/drivers/w1/slaves/w1_ds2408.c b/drivers/w1/slaves/w1_ds2408.c
index 7fa911989193..56f822a1dfdb 100644
--- a/drivers/w1/slaves/w1_ds2408.c
+++ b/drivers/w1/slaves/w1_ds2408.c
@@ -35,12 +35,12 @@
#define W1_F29_SUCCESS_CONFIRM_BYTE 0xAA
-static int _read_reg(struct w1_slave *sl, u8 address, unsigned char* buf)
+static int _read_reg(struct w1_slave *sl, u8 address, unsigned char *buf)
{
u8 wrbuf[3];
- dev_dbg(&sl->dev,
- "Reading with slave: %p, reg addr: %0#4x, buff addr: %p",
- sl, (unsigned int)address, buf);
+
+ dev_dbg(&sl->dev, "Reading with slave: %p, reg addr: %0#4x, buff addr: %p",
+ sl, (unsigned int)address, buf);
if (!buf)
return -EINVAL;
@@ -292,7 +292,7 @@ static int w1_f29_disable_test_mode(struct w1_slave *sl)
{
int res;
u8 magic[10] = {0x96, };
- u64 rn = le64_to_cpu(*((u64*)&sl->reg_num));
+ u64 rn = le64_to_cpu(*((u64 *)&sl->reg_num));
memcpy(&magic[1], &rn, 8);
magic[9] = 0x3C;
diff --git a/drivers/w1/slaves/w1_ds2413.c b/drivers/w1/slaves/w1_ds2413.c
index c8cfac555b48..bf4a72aae28a 100644
--- a/drivers/w1/slaves/w1_ds2413.c
+++ b/drivers/w1/slaves/w1_ds2413.c
@@ -99,8 +99,10 @@ static ssize_t output_write(struct file *filp, struct kobject *kobj,
if (w1_reset_select_slave(sl))
goto out;
- /* according to the DS2413 datasheet the most significant 6 bits
- should be set to "1"s, so do it now */
+ /*
+ * according to the DS2413 datasheet the most significant 6 bits
+ * should be set to "1"s, so do it now
+ */
*buf = *buf | 0xFC;
while (retries--) {
diff --git a/drivers/w1/slaves/w1_ds2433.c b/drivers/w1/slaves/w1_ds2433.c
index 6134ca2f37fe..23cd099d032b 100644
--- a/drivers/w1/slaves/w1_ds2433.c
+++ b/drivers/w1/slaves/w1_ds2433.c
@@ -115,7 +115,7 @@ static ssize_t eeprom_read(struct file *filp, struct kobject *kobj,
}
memcpy(buf, &data->memory[off], count);
-#else /* CONFIG_W1_SLAVE_DS2433_CRC */
+#else /* CONFIG_W1_SLAVE_DS2433_CRC */
/* read directly from the EEPROM */
if (w1_reset_select_slave(sl)) {
diff --git a/drivers/w1/slaves/w1_ds2780.c b/drivers/w1/slaves/w1_ds2780.c
index 9dcb5a54f7fc..3cde1bb1886b 100644
--- a/drivers/w1/slaves/w1_ds2780.c
+++ b/drivers/w1/slaves/w1_ds2780.c
@@ -91,6 +91,7 @@ static ssize_t w1_slave_read(struct file *filp, struct kobject *kobj,
loff_t off, size_t count)
{
struct device *dev = kobj_to_dev(kobj);
+
return w1_ds2780_io(dev, buf, off, count, 0);
}
diff --git a/drivers/w1/slaves/w1_ds2781.c b/drivers/w1/slaves/w1_ds2781.c
index 2cb7c020b607..e418484b4a49 100644
--- a/drivers/w1/slaves/w1_ds2781.c
+++ b/drivers/w1/slaves/w1_ds2781.c
@@ -88,6 +88,7 @@ static ssize_t w1_slave_read(struct file *filp, struct kobject *kobj,
loff_t off, size_t count)
{
struct device *dev = kobj_to_dev(kobj);
+
return w1_ds2781_io(dev, buf, off, count, 0);
}
diff --git a/drivers/w1/slaves/w1_ds28e04.c b/drivers/w1/slaves/w1_ds28e04.c
index f54d6afd79c3..2854b8b9e93f 100644
--- a/drivers/w1/slaves/w1_ds28e04.c
+++ b/drivers/w1/slaves/w1_ds28e04.c
@@ -198,8 +198,10 @@ static int w1_f1C_write(struct w1_slave *sl, int addr, int len, const u8 *data)
wrbuf[3] = es;
for (i = 0; i < sizeof(wrbuf); ++i) {
- /* issue 10ms strong pullup (or delay) on the last byte
- for writing the data from the scratchpad to EEPROM */
+ /*
+ * issue 10ms strong pullup (or delay) on the last byte
+ * for writing the data from the scratchpad to EEPROM
+ */
if (w1_strong_pullup && i == sizeof(wrbuf)-1)
w1_next_pullup(sl->master, tm);
diff --git a/drivers/w1/slaves/w1_ds28e17.c b/drivers/w1/slaves/w1_ds28e17.c
index aed10b72fc99..fdbaf77620ac 100644
--- a/drivers/w1/slaves/w1_ds28e17.c
+++ b/drivers/w1/slaves/w1_ds28e17.c
@@ -59,7 +59,7 @@ MODULE_PARM_DESC(stretch, "Default I2C stretch value to be set when a DS28E17 is
/*
* Maximum number of I2C bytes to transfer within one CRC16 protected onewire
* command.
- * */
+ */
#define W1_F19_WRITE_DATA_LIMIT 255
/* Maximum number of I2C bytes to read with one onewire command. */