All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/7] staging: iio: resolver: fix coding style issues
@ 2016-02-18 10:59 Eva Rachel Retuya
  2016-02-18 10:59 ` [PATCH 1/7] staging: iio: resolver: align to match open parenthesis Eva Rachel Retuya
                   ` (7 more replies)
  0 siblings, 8 replies; 9+ messages in thread
From: Eva Rachel Retuya @ 2016-02-18 10:59 UTC (permalink / raw)
  To: outreachy-kernel; +Cc: 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

 drivers/staging/iio/resolver/ad2s1200.c | 12 +++++-----
 drivers/staging/iio/resolver/ad2s1210.c | 39 ++++++++++++++++++---------------
 2 files changed, 27 insertions(+), 24 deletions(-)

-- 
1.9.1



^ permalink raw reply	[flat|nested] 9+ messages in thread

* [PATCH 1/7] staging: iio: resolver: align to match open parenthesis
  2016-02-18 10:59 [PATCH 0/7] staging: iio: resolver: fix coding style issues Eva Rachel Retuya
@ 2016-02-18 10:59 ` Eva Rachel Retuya
  2016-02-18 10:59 ` [PATCH 2/7] staging: iio: resolver: add spaces around operators Eva Rachel Retuya
                   ` (6 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: Eva Rachel Retuya @ 2016-02-18 10:59 UTC (permalink / raw)
  To: outreachy-kernel; +Cc: Eva Rachel Retuya

Use a combination of tabs and spaces to align parameters to its
corresponding open parenthesis. Checkpatch found this issue.

Signed-off-by: Eva Rachel Retuya <eraretuya@gmail.com>
---
 drivers/staging/iio/resolver/ad2s1200.c | 10 +++++-----
 drivers/staging/iio/resolver/ad2s1210.c | 18 ++++++++++--------
 2 files changed, 15 insertions(+), 13 deletions(-)

diff --git a/drivers/staging/iio/resolver/ad2s1200.c b/drivers/staging/iio/resolver/ad2s1200.c
index 595e711..77fa7911 100644
--- a/drivers/staging/iio/resolver/ad2s1200.c
+++ b/drivers/staging/iio/resolver/ad2s1200.c
@@ -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;
 		}
 	}
diff --git a/drivers/staging/iio/resolver/ad2s1210.c b/drivers/staging/iio/resolver/ad2s1210.c
index d97aa28..f11832c 100644
--- a/drivers/staging/iio/resolver/ad2s1210.c
+++ b/drivers/staging/iio/resolver/ad2s1210.c
@@ -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;
-- 
1.9.1



^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [PATCH 2/7] staging: iio: resolver: add spaces around operators
  2016-02-18 10:59 [PATCH 0/7] staging: iio: resolver: fix coding style issues Eva Rachel Retuya
  2016-02-18 10:59 ` [PATCH 1/7] staging: iio: resolver: align to match open parenthesis Eva Rachel Retuya
@ 2016-02-18 10:59 ` Eva Rachel Retuya
  2016-02-18 10:59 ` [PATCH 3/7] staging: iio: resolver: use blank line after array declaration Eva Rachel Retuya
                   ` (5 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: Eva Rachel Retuya @ 2016-02-18 10:59 UTC (permalink / raw)
  To: outreachy-kernel; +Cc: Eva Rachel Retuya

Add spaces around operators to improve readability and to address the
checkpatch issue:

CHECK: spaces preferred around that '/' (ctx:VxV)

Signed-off-by: Eva Rachel Retuya <eraretuya@gmail.com>
---
 drivers/staging/iio/resolver/ad2s1200.c | 2 +-
 drivers/staging/iio/resolver/ad2s1210.c | 6 +++---
 2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/staging/iio/resolver/ad2s1200.c b/drivers/staging/iio/resolver/ad2s1200.c
index 77fa7911..82b2d88 100644
--- a/drivers/staging/iio/resolver/ad2s1200.c
+++ b/drivers/staging/iio/resolver/ad2s1200.c
@@ -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;
diff --git a/drivers/staging/iio/resolver/ad2s1210.c b/drivers/staging/iio/resolver/ad2s1210.c
index f11832c..f2a3463 100644
--- a/drivers/staging/iio/resolver/ad2s1210.c
+++ b/drivers/staging/iio/resolver/ad2s1210.c
@@ -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	10000
 
 enum 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)
-- 
1.9.1



^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [PATCH 3/7] staging: iio: resolver: use blank line after array declaration
  2016-02-18 10:59 [PATCH 0/7] staging: iio: resolver: fix coding style issues Eva Rachel Retuya
  2016-02-18 10:59 ` [PATCH 1/7] staging: iio: resolver: align to match open parenthesis Eva Rachel Retuya
  2016-02-18 10:59 ` [PATCH 2/7] staging: iio: resolver: add spaces around operators Eva Rachel Retuya
@ 2016-02-18 10:59 ` Eva Rachel Retuya
  2016-02-18 10:59 ` [PATCH 4/7] staging: iio: resolver: add missing braces on if-else statements Eva Rachel Retuya
                   ` (4 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: Eva Rachel Retuya @ 2016-02-18 10:59 UTC (permalink / raw)
  To: outreachy-kernel; +Cc: Eva Rachel Retuya

Add a blank line after array declaration. This clears the checkpatch
check:

CHECK: Please use a blank line after function/struct/union/enum
declarations

Signed-off-by: Eva Rachel Retuya <eraretuya@gmail.com>
---
 drivers/staging/iio/resolver/ad2s1210.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/staging/iio/resolver/ad2s1210.c b/drivers/staging/iio/resolver/ad2s1210.c
index f2a3463..4cf5e41 100644
--- a/drivers/staging/iio/resolver/ad2s1210.c
+++ b/drivers/staging/iio/resolver/ad2s1210.c
@@ -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)
 {
-- 
1.9.1



^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [PATCH 4/7] staging: iio: resolver: add missing braces on if-else statements
  2016-02-18 10:59 [PATCH 0/7] staging: iio: resolver: fix coding style issues Eva Rachel Retuya
                   ` (2 preceding siblings ...)
  2016-02-18 10:59 ` [PATCH 3/7] staging: iio: resolver: use blank line after array declaration Eva Rachel Retuya
@ 2016-02-18 10:59 ` Eva Rachel Retuya
  2016-02-18 10:59 ` [PATCH 5/7] staging: iio: resolver: delete space after a cast Eva Rachel Retuya
                   ` (3 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: Eva Rachel Retuya @ 2016-02-18 10:59 UTC (permalink / raw)
  To: outreachy-kernel; +Cc: Eva Rachel Retuya

Add 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

Signed-off-by: Eva Rachel Retuya <eraretuya@gmail.com>
---
 drivers/staging/iio/resolver/ad2s1210.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/drivers/staging/iio/resolver/ad2s1210.c b/drivers/staging/iio/resolver/ad2s1210.c
index 4cf5e41..563a01c 100644
--- a/drivers/staging/iio/resolver/ad2s1210.c
+++ b/drivers/staging/iio/resolver/ad2s1210.c
@@ -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);
-- 
1.9.1



^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [PATCH 5/7] staging: iio: resolver: delete space after a cast
  2016-02-18 10:59 [PATCH 0/7] staging: iio: resolver: fix coding style issues Eva Rachel Retuya
                   ` (3 preceding siblings ...)
  2016-02-18 10:59 ` [PATCH 4/7] staging: iio: resolver: add missing braces on if-else statements Eva Rachel Retuya
@ 2016-02-18 10:59 ` Eva Rachel Retuya
  2016-02-18 10:59 ` [PATCH 6/7] staging: iio: resolver: remove unnecessary blank line Eva Rachel Retuya
                   ` (2 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: Eva Rachel Retuya @ 2016-02-18 10:59 UTC (permalink / raw)
  To: outreachy-kernel; +Cc: Eva Rachel Retuya

Delete unwanted whitespace after casting. Issue pointed out by
checkpatch.

Signed-off-by: Eva Rachel Retuya <eraretuya@gmail.com>
---
 drivers/staging/iio/resolver/ad2s1210.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/staging/iio/resolver/ad2s1210.c b/drivers/staging/iio/resolver/ad2s1210.c
index 563a01c..03395d4 100644
--- a/drivers/staging/iio/resolver/ad2s1210.c
+++ b/drivers/staging/iio/resolver/ad2s1210.c
@@ -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;
-- 
1.9.1



^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [PATCH 6/7] staging: iio: resolver: remove unnecessary blank line
  2016-02-18 10:59 [PATCH 0/7] staging: iio: resolver: fix coding style issues Eva Rachel Retuya
                   ` (4 preceding siblings ...)
  2016-02-18 10:59 ` [PATCH 5/7] staging: iio: resolver: delete space after a cast Eva Rachel Retuya
@ 2016-02-18 10:59 ` Eva Rachel Retuya
  2016-02-18 10:59 ` [PATCH 7/7] staging: iio: resolver: fix comparison to NULL Eva Rachel Retuya
  2016-02-28 13:34 ` [Outreachy kernel] [PATCH 0/7] staging: iio: resolver: fix coding style issues Tejun Heo
  7 siblings, 0 replies; 9+ messages in thread
From: Eva Rachel Retuya @ 2016-02-18 10:59 UTC (permalink / raw)
  To: outreachy-kernel; +Cc: Eva Rachel Retuya

Delete the excess newline. Issue found by checkpatch.

CHECK: Please don't use multiple blank lines

Signed-off-by: Eva Rachel Retuya <eraretuya@gmail.com>
---
 drivers/staging/iio/resolver/ad2s1210.c | 1 -
 1 file changed, 1 deletion(-)

diff --git a/drivers/staging/iio/resolver/ad2s1210.c b/drivers/staging/iio/resolver/ad2s1210.c
index 03395d4..477df95 100644
--- a/drivers/staging/iio/resolver/ad2s1210.c
+++ b/drivers/staging/iio/resolver/ad2s1210.c
@@ -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,
-- 
1.9.1



^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [PATCH 7/7] staging: iio: resolver: fix comparison to NULL
  2016-02-18 10:59 [PATCH 0/7] staging: iio: resolver: fix coding style issues Eva Rachel Retuya
                   ` (5 preceding siblings ...)
  2016-02-18 10:59 ` [PATCH 6/7] staging: iio: resolver: remove unnecessary blank line Eva Rachel Retuya
@ 2016-02-18 10:59 ` Eva Rachel Retuya
  2016-02-28 13:34 ` [Outreachy kernel] [PATCH 0/7] staging: iio: resolver: fix coding style issues Tejun Heo
  7 siblings, 0 replies; 9+ messages in thread
From: Eva Rachel Retuya @ 2016-02-18 10:59 UTC (permalink / raw)
  To: outreachy-kernel; +Cc: Eva Rachel Retuya

Remove 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"

Signed-off-by: Eva Rachel Retuya <eraretuya@gmail.com>
---
 drivers/staging/iio/resolver/ad2s1210.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/staging/iio/resolver/ad2s1210.c b/drivers/staging/iio/resolver/ad2s1210.c
index 477df95..6b99263 100644
--- a/drivers/staging/iio/resolver/ad2s1210.c
+++ b/drivers/staging/iio/resolver/ad2s1210.c
@@ -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));
-- 
1.9.1



^ permalink raw reply related	[flat|nested] 9+ messages in thread

* Re: [Outreachy kernel] [PATCH 0/7] staging: iio: resolver: fix coding style issues
  2016-02-18 10:59 [PATCH 0/7] staging: iio: resolver: fix coding style issues Eva Rachel Retuya
                   ` (6 preceding siblings ...)
  2016-02-18 10:59 ` [PATCH 7/7] staging: iio: resolver: fix comparison to NULL Eva Rachel Retuya
@ 2016-02-28 13:34 ` Tejun Heo
  7 siblings, 0 replies; 9+ messages in thread
From: Tejun Heo @ 2016-02-28 13:34 UTC (permalink / raw)
  To: Eva Rachel Retuya; +Cc: outreachy-kernel

On Thu, Feb 18, 2016 at 06:59:32PM +0800, Eva Rachel Retuya wrote:
> 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(-)

For the patchset,

Acked-by: Tejun Heo <tj@kernel.org>

Thanks.

-- 
tejun


^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2016-02-28 13:34 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-02-18 10:59 [PATCH 0/7] staging: iio: resolver: fix coding style issues Eva Rachel Retuya
2016-02-18 10:59 ` [PATCH 1/7] staging: iio: resolver: align to match open parenthesis Eva Rachel Retuya
2016-02-18 10:59 ` [PATCH 2/7] staging: iio: resolver: add spaces around operators Eva Rachel Retuya
2016-02-18 10:59 ` [PATCH 3/7] staging: iio: resolver: use blank line after array declaration Eva Rachel Retuya
2016-02-18 10:59 ` [PATCH 4/7] staging: iio: resolver: add missing braces on if-else statements Eva Rachel Retuya
2016-02-18 10:59 ` [PATCH 5/7] staging: iio: resolver: delete space after a cast Eva Rachel Retuya
2016-02-18 10:59 ` [PATCH 6/7] staging: iio: resolver: remove unnecessary blank line Eva Rachel Retuya
2016-02-18 10:59 ` [PATCH 7/7] staging: iio: resolver: fix comparison to NULL Eva Rachel Retuya
2016-02-28 13:34 ` [Outreachy kernel] [PATCH 0/7] staging: iio: resolver: fix coding style issues Tejun Heo

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.