staging: iio: resolver: fix coding style issues
Subsystems (4)
cover staging: iio: resolver: fix coding style issues
Address checkpatch checks on iio/resolver.
Eva Rachel Retuya (7):
staging: iio: resolver: align to match open parenthesis
staging: iio: resolver: add spaces around operators
staging: iio: resolver: use blank line after array declaration
staging: iio: resolver: add missing braces on if-else statements
staging: iio: resolver: delete space after a cast
staging: iio: resolver: remove unnecessary blank line
staging: iio: resolver: fix comparison to NULL
drivers/staging/iio/resolver/ad2s1200.c | 12 +++++----- drivers/staging/iio/resolver/ad2s1210.c | 39 ++++++++++++++++++--------------- 2 files changed, 27 insertions(+), 24 deletions(-)
Signature · 1 line
1.9.1
PATCH 1/7 staging: iio: resolver: align to match open parenthesis
Use a combination of tabs and spaces to align parameters to its corresponding open parenthesis. Checkpatch found this issue.
--- drivers/staging/iio/resolver/ad2s1200.c | 10 +++++----- drivers/staging/iio/resolver/ad2s1210.c | 18 ++++++++++-------- 2 files changed, 15 insertions(+), 13 deletions(-)
drivers/staging/iio/resolver/ad2s1200.c +5 -5
@@ -42,10 +42,10 @@ struct ad2s1200_state { };static int ad2s1200_read_raw (struct iio_dev *indio_dev, -struct iio_chan_spec const *chan, -int *val, -int *val2, -long m) +struct iio_chan_spec const *chan, +int *val, +int *val2, +long m) {int ret =0 ;s16 vel;
@@ -113,7 +113,7 @@ static int ad2s1200_probe(struct spi_device *spi) DRV_NAME);if (ret) {dev_err (&spi->dev,"request gpio pin %d failed\n" , - pins[pn]); + pins[pn]);return ret; } }
drivers/staging/iio/resolver/ad2s1210.c +10 -8
@@ -123,7 +123,7 @@ static int ad2s1210_config_write(struct ad2s1210_state *st, u8 data)/* read value from one of the registers */ static int ad2s1210_config_read (struct ad2s1210_state *st, -unsigned char address) +unsigned char address) {struct spi_transfer xfer = { .len =2 ,
@@ -282,8 +282,8 @@ static ssize_t ad2s1210_show_control(struct device *dev, }static ssize_t ad2s1210_store_control (struct device *dev, -struct device_attribute *attr, -const char *buf,size_t len) +struct device_attribute *attr, +const char *buf,size_t len) {struct ad2s1210_state *st =iio_priv (dev_to_iio_dev (dev));unsigned char udata;
@@ -330,7 +330,8 @@ error_ret: }static ssize_t ad2s1210_show_resolution (struct device *dev, -struct device_attribute *attr,char *buf) +struct device_attribute *attr, +char *buf) {struct ad2s1210_state *st =iio_priv (dev_to_iio_dev (dev));
@@ -338,8 +339,8 @@ static ssize_t ad2s1210_show_resolution(struct device *dev, }static ssize_t ad2s1210_store_resolution (struct device *dev, -struct device_attribute *attr, -const char *buf,size_t len) +struct device_attribute *attr, +const char *buf,size_t len) {struct ad2s1210_state *st =iio_priv (dev_to_iio_dev (dev));unsigned char data;
@@ -389,7 +390,7 @@ error_ret:/* read the fault register since last sample */ static ssize_t ad2s1210_show_fault (struct device *dev, -struct device_attribute *attr,char *buf) +struct device_attribute *attr,char *buf) {struct ad2s1210_state *st =iio_priv (dev_to_iio_dev (dev));int ret;
@@ -441,7 +442,8 @@ static ssize_t ad2s1210_show_reg(struct device *dev, }static ssize_t ad2s1210_store_reg (struct device *dev, -struct device_attribute *attr,const char *buf,size_t len) +struct device_attribute *attr, +const char *buf,size_t len) {struct ad2s1210_state *st =iio_priv (dev_to_iio_dev (dev));unsigned char data;
Signature · 1 line
1.9.1
PATCH 2/7 staging: iio: resolver: add spaces around operators
In reply to Eva Rachel RetuyaAdd spaces around operators to improve readability and to address the checkpatch issue:
CHECK: spaces preferred around that '/' (ctx:VxV)
--- drivers/staging/iio/resolver/ad2s1200.c | 2 +- drivers/staging/iio/resolver/ad2s1210.c | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-)
drivers/staging/iio/resolver/ad2s1200.c +1 -1
@@ -31,7 +31,7 @@/* input clock on serial interface */ #define AD2S1200_HZ 8192000/* clock period in nano second */ -#define AD2S1200_TSCLK (1000000000/AD2S1200_HZ) +#define AD2S1200_TSCLK (1000000000 / AD2S1200_HZ)struct ad2s1200_state {struct mutex lock;
drivers/staging/iio/resolver/ad2s1210.c +3 -3
@@ -67,7 +67,7 @@/* default input clock on serial interface */ #define AD2S1210_DEF_CLKIN 8192000/* clock period in nano second */ -#define AD2S1210_DEF_TCK (1000000000/AD2S1210_DEF_CLKIN) +#define AD2S1210_DEF_TCK (1000000000 / AD2S1210_DEF_CLKIN)#define AD2S1210_DEF_EXCIT 10000enum ad2s1210_mode {
@@ -176,9 +176,9 @@ static const int ad2s1210_res_pins[4][2] = {static inline void ad2s1210_set_resolution_pin (struct ad2s1210_state *st) {gpio_set_value (st->pdata->res[0 ], - ad2s1210_res_pins[(st->resolution -10 )/2 ][0 ]); + ad2s1210_res_pins[(st->resolution -10 ) /2 ][0 ]);gpio_set_value (st->pdata->res[1 ], - ad2s1210_res_pins[(st->resolution -10 )/2 ][1 ]); + ad2s1210_res_pins[(st->resolution -10 ) /2 ][1 ]); }static inline int ad2s1210_soft_reset (struct ad2s1210_state *st)
Signature · 1 line
1.9.1
PATCH 3/7 staging: iio: resolver: use blank line after array declaration
In reply to Eva Rachel RetuyaAdd a blank line after array declaration. This clears the checkpatch check:
CHECK: Please use a blank line after function/struct/union/enum declarations
--- drivers/staging/iio/resolver/ad2s1210.c | 1 + 1 file changed, 1 insertion(+)
drivers/staging/iio/resolver/ad2s1210.c +1 -0
@@ -98,6 +98,7 @@ static const int ad2s1210_mode_vals[4][2] = { [MOD_VEL] = { 0, 1 }, [MOD_CONFIG] = { 1, 0 }, }; +static inline void ad2s1210_set_mode (enum ad2s1210_mode mode,struct ad2s1210_state *st) {
Signature · 1 line
1.9.1
PATCH 4/7 staging: iio: resolver: add missing braces on if-else statements
In reply to Eva Rachel RetuyaAdd braces around the else clause to adhere to kernel coding style. This clears the following checkpatch issue:
CHECK: braces {} should be used on all arms of this statement
--- drivers/staging/iio/resolver/ad2s1210.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-)
drivers/staging/iio/resolver/ad2s1210.c +4 -3
@@ -319,9 +319,9 @@ static ssize_t ad2s1210_store_control(struct device *dev, data =ad2s1210_read_resolution_pin (st);if (data != st->resolution)dev_warn (dev,"ad2s1210: resolution settings not match\n" ); - }else + }else {ad2s1210_set_resolution_pin (st); - + } ret = len; st->hysteresis = !!(data &AD2S1210_ENABLE_HYSTERESIS );
@@ -381,8 +381,9 @@ static ssize_t ad2s1210_store_resolution(struct device *dev, data =ad2s1210_read_resolution_pin (st);if (data != st->resolution)dev_warn (dev,"ad2s1210: resolution settings not match\n" ); - }else + }else {ad2s1210_set_resolution_pin (st); + } ret = len; error_ret:mutex_unlock (&st->lock);
Signature · 1 line
1.9.1
PATCH 5/7 staging: iio: resolver: delete space after a cast
In reply to Eva Rachel RetuyaDelete unwanted whitespace after casting. Issue pointed out by checkpatch.
--- drivers/staging/iio/resolver/ad2s1210.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/staging/iio/resolver/ad2s1210.c +2 -2
@@ -501,7 +501,7 @@ static int ad2s1210_read_raw(struct iio_dev *indio_dev,switch (chan->type) {case IIO_ANGL : - pos =be16_to_cpup ((__be16 *) st->rx); + pos =be16_to_cpup ((__be16 *)st->rx);if (st->hysteresis) pos >>=16 - st->resolution; *val = pos;
@@ -509,7 +509,7 @@ static int ad2s1210_read_raw(struct iio_dev *indio_dev,break ;case IIO_ANGL_VEL : negative = st->rx[0 ] &0x80 ; - vel =be16_to_cpup ((__be16 *) st->rx); + vel =be16_to_cpup ((__be16 *)st->rx); vel >>=16 - st->resolution;if (vel &0x8000 ) { negative = (0xffff >> st->resolution) << st->resolution;
Signature · 1 line
1.9.1
PATCH 6/7 staging: iio: resolver: remove unnecessary blank line
In reply to Eva Rachel RetuyaDelete the excess newline. Issue found by checkpatch.
CHECK: Please don't use multiple blank lines
--- drivers/staging/iio/resolver/ad2s1210.c | 1 - 1 file changed, 1 deletion(-)
drivers/staging/iio/resolver/ad2s1210.c +0 -1
@@ -564,7 +564,6 @@ static IIO_DEVICE_ATTR(lot_low_thrd, S_IRUGO | S_IWUSR, ad2s1210_show_reg, ad2s1210_store_reg, AD2S1210_REG_LOT_LOW_THRD); -static const struct iio_chan_spec ad2s1210_channels[] = { { .type =IIO_ANGL ,
Signature · 1 line
1.9.1
PATCH 7/7 staging: iio: resolver: fix comparison to NULL
In reply to Eva Rachel RetuyaRemove comparison of spi->dev.platform_data to NULL by replacing it with '!spi->dev.platform_data' as checkpatch suggested:
CHECK: Comparison to NULL could be written "!spi->dev.platform_data"
--- drivers/staging/iio/resolver/ad2s1210.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/staging/iio/resolver/ad2s1210.c +1 -1
@@ -675,7 +675,7 @@ static int ad2s1210_probe(struct spi_device *spi)struct ad2s1210_state *st;int ret; -if (spi->dev.platform_data ==NULL ) +if (!spi->dev.platform_data)return -EINVAL ; indio_dev =devm_iio_device_alloc (&spi->dev,sizeof (*st));
Signature · 1 line
1.9.1
Quoted 11 lines · Eva Rachel Retuya
Address checkpatch checks on iio/resolver.
Eva Rachel Retuya (7):
staging: iio: resolver: align to match open parenthesis
staging: iio: resolver: add spaces around operators
staging: iio: resolver: use blank line after array declaration
staging: iio: resolver: add missing braces on if-else statements
staging: iio: resolver: delete space after a cast
staging: iio: resolver: remove unnecessary blank line
staging: iio: resolver: fix comparison to NULL
Quoted 3 lines
drivers/staging/iio/resolver/ad2s1200.c | 12 +++++----- drivers/staging/iio/resolver/ad2s1210.c | 39 ++++++++++++++++++--------------- 2 files changed, 27 insertions(+), 24 deletions(-)
For the patchset,
Thanks.
Signature · 1 line
tejun