All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/5] Staging: iio: cdc: Checkpatch cleanups
@ 2015-12-29 11:27 Shraddha Barke
  2015-12-29 11:27 ` [PATCH 1/5] Staging: iio: cdc: ad7746: Prefer using the BIT macro Shraddha Barke
                   ` (4 more replies)
  0 siblings, 5 replies; 11+ messages in thread
From: Shraddha Barke @ 2015-12-29 11:27 UTC (permalink / raw)
  To: Lars-Peter Clausen, Michael Hennerich, Jonathan Cameron,
	Greg Kroah-Hartman
  Cc: linux-iio, Shraddha Barke

These patches fix warnings detected by checkpatch.

Shraddha Barke (5):
  Staging: iio: cdc: Prefer using the BIT macro
  Staging: iio: cdc: Prefer using the BIT macro
  Staging: iio: cdc: Fix alignment should match open parenthesis
  Staging: iio: cdc: Prefer using the BIT macro
  Staging: iio: cdc: Fix alignment should match open parenthesis

 drivers/staging/iio/cdc/ad7150.c | 34 ++++++++++++++++---------------
 drivers/staging/iio/cdc/ad7152.c | 44 ++++++++++++++++++++--------------------
 drivers/staging/iio/cdc/ad7746.c | 22 ++++++++++----------
 3 files changed, 51 insertions(+), 49 deletions(-)

-- 
2.1.4


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

* [PATCH 1/5] Staging: iio: cdc: ad7746: Prefer using the BIT macro
  2015-12-29 11:27 [PATCH 0/5] Staging: iio: cdc: Checkpatch cleanups Shraddha Barke
@ 2015-12-29 11:27 ` Shraddha Barke
  2016-01-04 12:00   ` Jonathan Cameron
  2015-12-29 11:27 ` [PATCH 2/5] Staging: iio: cdc: ad7152: " Shraddha Barke
                   ` (3 subsequent siblings)
  4 siblings, 1 reply; 11+ messages in thread
From: Shraddha Barke @ 2015-12-29 11:27 UTC (permalink / raw)
  To: Lars-Peter Clausen, Michael Hennerich, Jonathan Cameron,
	Greg Kroah-Hartman
  Cc: linux-iio, Shraddha Barke

Replace bit shifting on 1 with the BIT(x) macro

Signed-off-by: Shraddha Barke <shraddha.6596@gmail.com>
---
 drivers/staging/iio/cdc/ad7746.c | 22 +++++++++++-----------
 1 file changed, 11 insertions(+), 11 deletions(-)

diff --git a/drivers/staging/iio/cdc/ad7746.c b/drivers/staging/iio/cdc/ad7746.c
index 2c5d277..a4ad2f1 100644
--- a/drivers/staging/iio/cdc/ad7746.c
+++ b/drivers/staging/iio/cdc/ad7746.c
@@ -45,20 +45,20 @@
 #define AD7746_STATUS_RDYCAP		BIT(0)
 
 /* Capacitive Channel Setup Register Bit Designations (AD7746_REG_CAP_SETUP) */
-#define AD7746_CAPSETUP_CAPEN		(1 << 7)
-#define AD7746_CAPSETUP_CIN2		(1 << 6) /* AD7746 only */
-#define AD7746_CAPSETUP_CAPDIFF		(1 << 5)
-#define AD7746_CAPSETUP_CACHOP		(1 << 0)
+#define AD7746_CAPSETUP_CAPEN		BIT(7)
+#define AD7746_CAPSETUP_CIN2		BIT(6) /* AD7746 only */
+#define AD7746_CAPSETUP_CAPDIFF		BIT(5)
+#define AD7746_CAPSETUP_CACHOP		BIT(0)
 
 /* Voltage/Temperature Setup Register Bit Designations (AD7746_REG_VT_SETUP) */
-#define AD7746_VTSETUP_VTEN		(1 << 7)
+#define AD7746_VTSETUP_VTEN		BIT(7)
 #define AD7746_VTSETUP_VTMD_INT_TEMP	(0 << 5)
-#define AD7746_VTSETUP_VTMD_EXT_TEMP	(1 << 5)
+#define AD7746_VTSETUP_VTMD_EXT_TEMP	BIT(5)
 #define AD7746_VTSETUP_VTMD_VDD_MON	(2 << 5)
 #define AD7746_VTSETUP_VTMD_EXT_VIN	(3 << 5)
-#define AD7746_VTSETUP_EXTREF		(1 << 4)
-#define AD7746_VTSETUP_VTSHORT		(1 << 1)
-#define AD7746_VTSETUP_VTCHOP		(1 << 0)
+#define AD7746_VTSETUP_EXTREF		BIT(4)
+#define AD7746_VTSETUP_VTSHORT		BIT(1)
+#define AD7746_VTSETUP_VTCHOP		BIT(0)
 
 /* Excitation Setup Register Bit Designations (AD7746_REG_EXC_SETUP) */
 #define AD7746_EXCSETUP_CLKCTRL		BIT(7)
@@ -73,14 +73,14 @@
 #define AD7746_CONF_VTFS(x)		((x) << 6)
 #define AD7746_CONF_CAPFS(x)		((x) << 3)
 #define AD7746_CONF_MODE_IDLE		(0 << 0)
-#define AD7746_CONF_MODE_CONT_CONV	(1 << 0)
+#define AD7746_CONF_MODE_CONT_CONV	BIT(0)
 #define AD7746_CONF_MODE_SINGLE_CONV	(2 << 0)
 #define AD7746_CONF_MODE_PWRDN		(3 << 0)
 #define AD7746_CONF_MODE_OFFS_CAL	(5 << 0)
 #define AD7746_CONF_MODE_GAIN_CAL	(6 << 0)
 
 /* CAPDAC Register Bit Designations (AD7746_REG_CAPDACx) */
-#define AD7746_CAPDAC_DACEN		(1 << 7)
+#define AD7746_CAPDAC_DACEN		BIT(7)
 #define AD7746_CAPDAC_DACP(x)		((x) & 0x7F)
 
 /*
-- 
2.1.4


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

* [PATCH 2/5] Staging: iio: cdc: ad7152: Prefer using the BIT macro
  2015-12-29 11:27 [PATCH 0/5] Staging: iio: cdc: Checkpatch cleanups Shraddha Barke
  2015-12-29 11:27 ` [PATCH 1/5] Staging: iio: cdc: ad7746: Prefer using the BIT macro Shraddha Barke
@ 2015-12-29 11:27 ` Shraddha Barke
  2016-01-04 12:02   ` Jonathan Cameron
  2015-12-29 11:27 ` [PATCH 3/5] Staging: iio: cdc: ad7152: Fix alignment should match open parenthesis Shraddha Barke
                   ` (2 subsequent siblings)
  4 siblings, 1 reply; 11+ messages in thread
From: Shraddha Barke @ 2015-12-29 11:27 UTC (permalink / raw)
  To: Lars-Peter Clausen, Michael Hennerich, Jonathan Cameron,
	Greg Kroah-Hartman
  Cc: linux-iio, Shraddha Barke

Replace bit shifting on 1 with the BIT(x) macro

Signed-off-by: Shraddha Barke <shraddha.6596@gmail.com>
---
 drivers/staging/iio/cdc/ad7152.c | 20 ++++++++++----------
 1 file changed, 10 insertions(+), 10 deletions(-)

diff --git a/drivers/staging/iio/cdc/ad7152.c b/drivers/staging/iio/cdc/ad7152.c
index 485d0a5..472836d 100644
--- a/drivers/staging/iio/cdc/ad7152.c
+++ b/drivers/staging/iio/cdc/ad7152.c
@@ -41,30 +41,30 @@
 #define AD7152_REG_CFG2			26
 
 /* Status Register Bit Designations (AD7152_REG_STATUS) */
-#define AD7152_STATUS_RDY1		(1 << 0)
-#define AD7152_STATUS_RDY2		(1 << 1)
-#define AD7152_STATUS_C1C2		(1 << 2)
-#define AD7152_STATUS_PWDN		(1 << 7)
+#define AD7152_STATUS_RDY1		BIT(0)
+#define AD7152_STATUS_RDY2		BIT(1)
+#define AD7152_STATUS_C1C2		BIT(2)
+#define AD7152_STATUS_PWDN		BIT(7)
 
 /* Setup Register Bit Designations (AD7152_REG_CHx_SETUP) */
-#define AD7152_SETUP_CAPDIFF		(1 << 5)
+#define AD7152_SETUP_CAPDIFF		BIT(5)
 #define AD7152_SETUP_RANGE_2pF		(0 << 6)
-#define AD7152_SETUP_RANGE_0_5pF	(1 << 6)
+#define AD7152_SETUP_RANGE_0_5pF	BIT(6)
 #define AD7152_SETUP_RANGE_1pF		(2 << 6)
 #define AD7152_SETUP_RANGE_4pF		(3 << 6)
 #define AD7152_SETUP_RANGE(x)		((x) << 6)
 
 /* Config Register Bit Designations (AD7152_REG_CFG) */
-#define AD7152_CONF_CH2EN		(1 << 3)
-#define AD7152_CONF_CH1EN		(1 << 4)
+#define AD7152_CONF_CH2EN		BIT(3)
+#define AD7152_CONF_CH1EN		BIT(4)
 #define AD7152_CONF_MODE_IDLE		(0 << 0)
-#define AD7152_CONF_MODE_CONT_CONV	(1 << 0)
+#define AD7152_CONF_MODE_CONT_CONV	BIT(0)
 #define AD7152_CONF_MODE_SINGLE_CONV	(2 << 0)
 #define AD7152_CONF_MODE_OFFS_CAL	(5 << 0)
 #define AD7152_CONF_MODE_GAIN_CAL	(6 << 0)
 
 /* Capdac Register Bit Designations (AD7152_REG_CAPDAC_XXX) */
-#define AD7152_CAPDAC_DACEN		(1 << 7)
+#define AD7152_CAPDAC_DACEN		BIT(7)
 #define AD7152_CAPDAC_DACP(x)		((x) & 0x1F)
 
 /* CFG2 Register Bit Designations (AD7152_REG_CFG2) */
-- 
2.1.4


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

* [PATCH 3/5] Staging: iio: cdc: ad7152: Fix alignment should match open parenthesis
  2015-12-29 11:27 [PATCH 0/5] Staging: iio: cdc: Checkpatch cleanups Shraddha Barke
  2015-12-29 11:27 ` [PATCH 1/5] Staging: iio: cdc: ad7746: Prefer using the BIT macro Shraddha Barke
  2015-12-29 11:27 ` [PATCH 2/5] Staging: iio: cdc: ad7152: " Shraddha Barke
@ 2015-12-29 11:27 ` Shraddha Barke
  2016-01-04 12:05   ` Jonathan Cameron
  2015-12-29 11:27 ` [PATCH 4/5] Staging: iio: cdc: ad7150: Prefer using the BIT macro Shraddha Barke
  2015-12-29 11:27 ` [PATCH 5/5] Staging: iio: cdc: ad7150: Fix alignment should match open parenthesis Shraddha Barke
  4 siblings, 1 reply; 11+ messages in thread
From: Shraddha Barke @ 2015-12-29 11:27 UTC (permalink / raw)
  To: Lars-Peter Clausen, Michael Hennerich, Jonathan Cameron,
	Greg Kroah-Hartman
  Cc: linux-iio, Shraddha Barke

Fix checkpatch warning of "Alignment should match open parenthesis".

Signed-off-by: Shraddha Barke <shraddha.6596@gmail.com>
---
 drivers/staging/iio/cdc/ad7152.c | 24 ++++++++++++------------
 1 file changed, 12 insertions(+), 12 deletions(-)

diff --git a/drivers/staging/iio/cdc/ad7152.c b/drivers/staging/iio/cdc/ad7152.c
index 472836d..15bbbe5 100644
--- a/drivers/staging/iio/cdc/ad7152.c
+++ b/drivers/staging/iio/cdc/ad7152.c
@@ -166,8 +166,8 @@ static const unsigned char ad7152_filter_rate_table[][2] = {
 };
 
 static ssize_t ad7152_show_filter_rate_setup(struct device *dev,
-		struct device_attribute *attr,
-		char *buf)
+					     struct device_attribute *attr,
+					     char *buf)
 {
 	struct iio_dev *indio_dev = dev_to_iio_dev(dev);
 	struct ad7152_chip_info *chip = iio_priv(indio_dev);
@@ -177,9 +177,9 @@ static ssize_t ad7152_show_filter_rate_setup(struct device *dev,
 }
 
 static ssize_t ad7152_store_filter_rate_setup(struct device *dev,
-		struct device_attribute *attr,
-		const char *buf,
-		size_t len)
+					      struct device_attribute *attr,
+					      const char *buf,
+					      size_t len)
 {
 	struct iio_dev *indio_dev = dev_to_iio_dev(dev);
 	struct ad7152_chip_info *chip = iio_priv(indio_dev);
@@ -199,7 +199,7 @@ static ssize_t ad7152_store_filter_rate_setup(struct device *dev,
 
 	mutex_lock(&indio_dev->mlock);
 	ret = i2c_smbus_write_byte_data(chip->client,
-			AD7152_REG_CFG2, AD7152_CFG2_OSR(i));
+					AD7152_REG_CFG2, AD7152_CFG2_OSR(i));
 	if (ret < 0) {
 		mutex_unlock(&indio_dev->mlock);
 		return ret;
@@ -268,8 +268,8 @@ static int ad7152_write_raw(struct iio_dev *indio_dev,
 		val = (val2 * 1024) / 15625;
 
 		ret = i2c_smbus_write_word_data(chip->client,
-				ad7152_addresses[chan->channel][AD7152_GAIN],
-				swab16(val));
+						ad7152_addresses[chan->channel][AD7152_GAIN],
+						swab16(val));
 		if (ret < 0)
 			goto out;
 
@@ -282,8 +282,8 @@ static int ad7152_write_raw(struct iio_dev *indio_dev,
 			goto out;
 		}
 		ret = i2c_smbus_write_word_data(chip->client,
-				ad7152_addresses[chan->channel][AD7152_OFFS],
-				swab16(val));
+						ad7152_addresses[chan->channel][AD7152_OFFS],
+						swab16(val));
 		if (ret < 0)
 			goto out;
 
@@ -302,8 +302,8 @@ static int ad7152_write_raw(struct iio_dev *indio_dev,
 		chip->setup[chan->channel] |= AD7152_SETUP_RANGE(i);
 
 		ret = i2c_smbus_write_byte_data(chip->client,
-				ad7152_addresses[chan->channel][AD7152_SETUP],
-				chip->setup[chan->channel]);
+						ad7152_addresses[chan->channel][AD7152_SETUP],
+						chip->setup[chan->channel]);
 		if (ret < 0)
 			goto out;
 
-- 
2.1.4


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

* [PATCH 4/5] Staging: iio: cdc: ad7150: Prefer using the BIT macro
  2015-12-29 11:27 [PATCH 0/5] Staging: iio: cdc: Checkpatch cleanups Shraddha Barke
                   ` (2 preceding siblings ...)
  2015-12-29 11:27 ` [PATCH 3/5] Staging: iio: cdc: ad7152: Fix alignment should match open parenthesis Shraddha Barke
@ 2015-12-29 11:27 ` Shraddha Barke
  2016-01-04 12:17   ` Jonathan Cameron
  2015-12-29 11:27 ` [PATCH 5/5] Staging: iio: cdc: ad7150: Fix alignment should match open parenthesis Shraddha Barke
  4 siblings, 1 reply; 11+ messages in thread
From: Shraddha Barke @ 2015-12-29 11:27 UTC (permalink / raw)
  To: Lars-Peter Clausen, Michael Hennerich, Jonathan Cameron,
	Greg Kroah-Hartman
  Cc: linux-iio, Shraddha Barke

Replace bit shifting on 1 with the BIT(x) macro

Signed-off-by: Shraddha Barke <shraddha.6596@gmail.com>
---
 drivers/staging/iio/cdc/ad7150.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/staging/iio/cdc/ad7150.c b/drivers/staging/iio/cdc/ad7150.c
index e8d0ff2..0b934f7 100644
--- a/drivers/staging/iio/cdc/ad7150.c
+++ b/drivers/staging/iio/cdc/ad7150.c
@@ -21,8 +21,8 @@
  */
 
 #define AD7150_STATUS              0
-#define AD7150_STATUS_OUT1         (1 << 3)
-#define AD7150_STATUS_OUT2         (1 << 5)
+#define AD7150_STATUS_OUT1         BIT(3)
+#define AD7150_STATUS_OUT2         BIT(5)
 #define AD7150_CH1_DATA_HIGH       1
 #define AD7150_CH2_DATA_HIGH       3
 #define AD7150_CH1_AVG_HIGH        5
@@ -36,7 +36,7 @@
 #define AD7150_CH2_TIMEOUT         13
 #define AD7150_CH2_SETUP           14
 #define AD7150_CFG                 15
-#define AD7150_CFG_FIX             (1 << 7)
+#define AD7150_CFG_FIX             BIT(7)
 #define AD7150_PD_TIMER            16
 #define AD7150_CH1_CAPDAC          17
 #define AD7150_CH2_CAPDAC          18
-- 
2.1.4


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

* [PATCH 5/5] Staging: iio: cdc: ad7150: Fix alignment should match open parenthesis
  2015-12-29 11:27 [PATCH 0/5] Staging: iio: cdc: Checkpatch cleanups Shraddha Barke
                   ` (3 preceding siblings ...)
  2015-12-29 11:27 ` [PATCH 4/5] Staging: iio: cdc: ad7150: Prefer using the BIT macro Shraddha Barke
@ 2015-12-29 11:27 ` Shraddha Barke
  2016-01-04 12:17   ` Jonathan Cameron
  4 siblings, 1 reply; 11+ messages in thread
From: Shraddha Barke @ 2015-12-29 11:27 UTC (permalink / raw)
  To: Lars-Peter Clausen, Michael Hennerich, Jonathan Cameron,
	Greg Kroah-Hartman
  Cc: linux-iio, Shraddha Barke

Fix the checkpatch warning of alignment should match open
parenthesis.

Signed-off-by: Shraddha Barke <shraddha.6596@gmail.com>
---
 drivers/staging/iio/cdc/ad7150.c | 28 +++++++++++++++-------------
 1 file changed, 15 insertions(+), 13 deletions(-)

diff --git a/drivers/staging/iio/cdc/ad7150.c b/drivers/staging/iio/cdc/ad7150.c
index 0b934f7..f6b9a10 100644
--- a/drivers/staging/iio/cdc/ad7150.c
+++ b/drivers/staging/iio/cdc/ad7150.c
@@ -160,8 +160,9 @@ static int ad7150_read_event_config(struct iio_dev *indio_dev,
 
 /* lock should be held */
 static int ad7150_write_event_params(struct iio_dev *indio_dev,
-	 unsigned int chan, enum iio_event_type type,
-	 enum iio_event_direction dir)
+				     unsigned int chan,
+				     enum iio_event_type type,
+				     enum iio_event_direction dir)
 {
 	int ret;
 	u16 value;
@@ -209,8 +210,9 @@ static int ad7150_write_event_params(struct iio_dev *indio_dev,
 }
 
 static int ad7150_write_event_config(struct iio_dev *indio_dev,
-	const struct iio_chan_spec *chan, enum iio_event_type type,
-	enum iio_event_direction dir, int state)
+				     const struct iio_chan_spec *chan,
+				     enum iio_event_type type,
+				     enum iio_event_direction dir, int state)
 {
 	u8 thresh_type, cfg, adaptive;
 	int ret;
@@ -302,11 +304,11 @@ static int ad7150_read_event_value(struct iio_dev *indio_dev,
 }
 
 static int ad7150_write_event_value(struct iio_dev *indio_dev,
-				   const struct iio_chan_spec *chan,
-				   enum iio_event_type type,
-				   enum iio_event_direction dir,
-				   enum iio_event_info info,
-				   int val, int val2)
+				    const struct iio_chan_spec *chan,
+				    enum iio_event_type type,
+				    enum iio_event_direction dir,
+				    enum iio_event_info info,
+				    int val, int val2)
 {
 	int ret;
 	struct ad7150_chip_info *chip = iio_priv(indio_dev);
@@ -365,9 +367,9 @@ static ssize_t ad7150_show_timeout(struct device *dev,
 }
 
 static ssize_t ad7150_store_timeout(struct device *dev,
-		struct device_attribute *attr,
-		const char *buf,
-		size_t len)
+				    struct device_attribute *attr,
+				    const char *buf,
+				    size_t len)
 {
 	struct iio_dev *indio_dev = dev_to_iio_dev(dev);
 	struct ad7150_chip_info *chip = iio_priv(indio_dev);
@@ -580,7 +582,7 @@ static const struct iio_info ad7150_info = {
  */
 
 static int ad7150_probe(struct i2c_client *client,
-		const struct i2c_device_id *id)
+			const struct i2c_device_id *id)
 {
 	int ret;
 	struct ad7150_chip_info *chip;
-- 
2.1.4


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

* Re: [PATCH 1/5] Staging: iio: cdc: ad7746: Prefer using the BIT macro
  2015-12-29 11:27 ` [PATCH 1/5] Staging: iio: cdc: ad7746: Prefer using the BIT macro Shraddha Barke
@ 2016-01-04 12:00   ` Jonathan Cameron
  0 siblings, 0 replies; 11+ messages in thread
From: Jonathan Cameron @ 2016-01-04 12:00 UTC (permalink / raw)
  To: Shraddha Barke, Lars-Peter Clausen, Michael Hennerich,
	Greg Kroah-Hartman
  Cc: linux-iio

On 29/12/15 11:27, Shraddha Barke wrote:
> Replace bit shifting on 1 with the BIT(x) macro
> 
> Signed-off-by: Shraddha Barke <shraddha.6596@gmail.com>
Hi Shraddha,

Good to see someone looking at these rather neglected drivers ;)

Anyhow, in a few cases here you have converted a single bit write
within a larger field (2 or 3 bits) over to the BIT macro.
This makes the code harder to read so should not be done.

The rest of the changes are good!

Jonathan
> ---
>  drivers/staging/iio/cdc/ad7746.c | 22 +++++++++++-----------
>  1 file changed, 11 insertions(+), 11 deletions(-)
> 
> diff --git a/drivers/staging/iio/cdc/ad7746.c b/drivers/staging/iio/cdc/ad7746.c
> index 2c5d277..a4ad2f1 100644
> --- a/drivers/staging/iio/cdc/ad7746.c
> +++ b/drivers/staging/iio/cdc/ad7746.c
> @@ -45,20 +45,20 @@
>  #define AD7746_STATUS_RDYCAP		BIT(0)
>  
>  /* Capacitive Channel Setup Register Bit Designations (AD7746_REG_CAP_SETUP) */
> -#define AD7746_CAPSETUP_CAPEN		(1 << 7)
> -#define AD7746_CAPSETUP_CIN2		(1 << 6) /* AD7746 only */
> -#define AD7746_CAPSETUP_CAPDIFF		(1 << 5)
> -#define AD7746_CAPSETUP_CACHOP		(1 << 0)
> +#define AD7746_CAPSETUP_CAPEN		BIT(7)
> +#define AD7746_CAPSETUP_CIN2		BIT(6) /* AD7746 only */
> +#define AD7746_CAPSETUP_CAPDIFF		BIT(5)
> +#define AD7746_CAPSETUP_CACHOP		BIT(0)
>  
>  /* Voltage/Temperature Setup Register Bit Designations (AD7746_REG_VT_SETUP) */
> -#define AD7746_VTSETUP_VTEN		(1 << 7)
> +#define AD7746_VTSETUP_VTEN		BIT(7)
>  #define AD7746_VTSETUP_VTMD_INT_TEMP	(0 << 5)
> -#define AD7746_VTSETUP_VTMD_EXT_TEMP	(1 << 5)
> +#define AD7746_VTSETUP_VTMD_EXT_TEMP	BIT(5)
Not this one.  We are writing a 1 to a 2 bit field here so BIT(5) is misleading.

>  #define AD7746_VTSETUP_VTMD_VDD_MON	(2 << 5)
>  #define AD7746_VTSETUP_VTMD_EXT_VIN	(3 << 5)
> -#define AD7746_VTSETUP_EXTREF		(1 << 4)
> -#define AD7746_VTSETUP_VTSHORT		(1 << 1)
> -#define AD7746_VTSETUP_VTCHOP		(1 << 0)
> +#define AD7746_VTSETUP_EXTREF		BIT(4)
> +#define AD7746_VTSETUP_VTSHORT		BIT(1)
> +#define AD7746_VTSETUP_VTCHOP		BIT(0)
>  
>  /* Excitation Setup Register Bit Designations (AD7746_REG_EXC_SETUP) */
>  #define AD7746_EXCSETUP_CLKCTRL		BIT(7)
> @@ -73,14 +73,14 @@
>  #define AD7746_CONF_VTFS(x)		((x) << 6)
>  #define AD7746_CONF_CAPFS(x)		((x) << 3)
>  #define AD7746_CONF_MODE_IDLE		(0 << 0)
> -#define AD7746_CONF_MODE_CONT_CONV	(1 << 0)
> +#define AD7746_CONF_MODE_CONT_CONV	BIT(0)
Again, these are different values being written to a 3 bit field
so don't mix and max.
>  #define AD7746_CONF_MODE_SINGLE_CONV	(2 << 0)
>  #define AD7746_CONF_MODE_PWRDN		(3 << 0)
>  #define AD7746_CONF_MODE_OFFS_CAL	(5 << 0)
>  #define AD7746_CONF_MODE_GAIN_CAL	(6 << 0)
>  
>  /* CAPDAC Register Bit Designations (AD7746_REG_CAPDACx) */
> -#define AD7746_CAPDAC_DACEN		(1 << 7)
> +#define AD7746_CAPDAC_DACEN		BIT(7)
>  #define AD7746_CAPDAC_DACP(x)		((x) & 0x7F)
>  
>  /*
> 


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

* Re: [PATCH 2/5] Staging: iio: cdc: ad7152: Prefer using the BIT macro
  2015-12-29 11:27 ` [PATCH 2/5] Staging: iio: cdc: ad7152: " Shraddha Barke
@ 2016-01-04 12:02   ` Jonathan Cameron
  0 siblings, 0 replies; 11+ messages in thread
From: Jonathan Cameron @ 2016-01-04 12:02 UTC (permalink / raw)
  To: Shraddha Barke, Lars-Peter Clausen, Michael Hennerich,
	Greg Kroah-Hartman
  Cc: linux-iio

On 29/12/15 11:27, Shraddha Barke wrote:
> Replace bit shifting on 1 with the BIT(x) macro
> 
> Signed-off-by: Shraddha Barke <shraddha.6596@gmail.com>
> ---
>  drivers/staging/iio/cdc/ad7152.c | 20 ++++++++++----------
>  1 file changed, 10 insertions(+), 10 deletions(-)
> 
> diff --git a/drivers/staging/iio/cdc/ad7152.c b/drivers/staging/iio/cdc/ad7152.c
> index 485d0a5..472836d 100644
> --- a/drivers/staging/iio/cdc/ad7152.c
> +++ b/drivers/staging/iio/cdc/ad7152.c
> @@ -41,30 +41,30 @@
>  #define AD7152_REG_CFG2			26
>  
>  /* Status Register Bit Designations (AD7152_REG_STATUS) */
> -#define AD7152_STATUS_RDY1		(1 << 0)
> -#define AD7152_STATUS_RDY2		(1 << 1)
> -#define AD7152_STATUS_C1C2		(1 << 2)
> -#define AD7152_STATUS_PWDN		(1 << 7)
> +#define AD7152_STATUS_RDY1		BIT(0)
> +#define AD7152_STATUS_RDY2		BIT(1)
> +#define AD7152_STATUS_C1C2		BIT(2)
> +#define AD7152_STATUS_PWDN		BIT(7)
>  
>  /* Setup Register Bit Designations (AD7152_REG_CHx_SETUP) */
> -#define AD7152_SETUP_CAPDIFF		(1 << 5)
> +#define AD7152_SETUP_CAPDIFF		BIT(5)
>  #define AD7152_SETUP_RANGE_2pF		(0 << 6)
> -#define AD7152_SETUP_RANGE_0_5pF	(1 << 6)
> +#define AD7152_SETUP_RANGE_0_5pF	BIT(6)
Again, don't convert single bit values within a larger field
(in this case 2 bits)
>  #define AD7152_SETUP_RANGE_1pF		(2 << 6)
>  #define AD7152_SETUP_RANGE_4pF		(3 << 6)
>  #define AD7152_SETUP_RANGE(x)		((x) << 6)
>  
>  /* Config Register Bit Designations (AD7152_REG_CFG) */
> -#define AD7152_CONF_CH2EN		(1 << 3)
> -#define AD7152_CONF_CH1EN		(1 << 4)
> +#define AD7152_CONF_CH2EN		BIT(3)
> +#define AD7152_CONF_CH1EN		BIT(4)
>  #define AD7152_CONF_MODE_IDLE		(0 << 0)
> -#define AD7152_CONF_MODE_CONT_CONV	(1 << 0)
> +#define AD7152_CONF_MODE_CONT_CONV	BIT(0)
Leave this one alone as well - again a multiple bit field (in this case 3)
>  #define AD7152_CONF_MODE_SINGLE_CONV	(2 << 0)
>  #define AD7152_CONF_MODE_OFFS_CAL	(5 << 0)
>  #define AD7152_CONF_MODE_GAIN_CAL	(6 << 0)
>  
>  /* Capdac Register Bit Designations (AD7152_REG_CAPDAC_XXX) */
> -#define AD7152_CAPDAC_DACEN		(1 << 7)
> +#define AD7152_CAPDAC_DACEN		BIT(7)
>  #define AD7152_CAPDAC_DACP(x)		((x) & 0x1F)
>  
>  /* CFG2 Register Bit Designations (AD7152_REG_CFG2) */
> 


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

* Re: [PATCH 3/5] Staging: iio: cdc: ad7152: Fix alignment should match open parenthesis
  2015-12-29 11:27 ` [PATCH 3/5] Staging: iio: cdc: ad7152: Fix alignment should match open parenthesis Shraddha Barke
@ 2016-01-04 12:05   ` Jonathan Cameron
  0 siblings, 0 replies; 11+ messages in thread
From: Jonathan Cameron @ 2016-01-04 12:05 UTC (permalink / raw)
  To: Shraddha Barke, Lars-Peter Clausen, Michael Hennerich,
	Greg Kroah-Hartman
  Cc: linux-iio

On 29/12/15 11:27, Shraddha Barke wrote:
> Fix checkpatch warning of "Alignment should match open parenthesis".
> 
> Signed-off-by: Shraddha Barke <shraddha.6596@gmail.com>
This is always a fun one.  Making the alignment fixes promptly breaks
the 80 character guidance (which is often why the alignment is deliberately wrong)
If it can't be done without breaking that rule, I'd argue that the code is more
readable with the shortened alignment.

Always take checkpath suggestions as advice rather than a rule as
sometimes they can be less than helpful!

Jonathan
> ---
>  drivers/staging/iio/cdc/ad7152.c | 24 ++++++++++++------------
>  1 file changed, 12 insertions(+), 12 deletions(-)
> 
> diff --git a/drivers/staging/iio/cdc/ad7152.c b/drivers/staging/iio/cdc/ad7152.c
> index 472836d..15bbbe5 100644
> --- a/drivers/staging/iio/cdc/ad7152.c
> +++ b/drivers/staging/iio/cdc/ad7152.c
> @@ -166,8 +166,8 @@ static const unsigned char ad7152_filter_rate_table[][2] = {
>  };
>  
>  static ssize_t ad7152_show_filter_rate_setup(struct device *dev,
> -		struct device_attribute *attr,
> -		char *buf)
> +					     struct device_attribute *attr,
> +					     char *buf)
>  {
>  	struct iio_dev *indio_dev = dev_to_iio_dev(dev);
>  	struct ad7152_chip_info *chip = iio_priv(indio_dev);
> @@ -177,9 +177,9 @@ static ssize_t ad7152_show_filter_rate_setup(struct device *dev,
>  }
>  
>  static ssize_t ad7152_store_filter_rate_setup(struct device *dev,
> -		struct device_attribute *attr,
> -		const char *buf,
> -		size_t len)
> +					      struct device_attribute *attr,
> +					      const char *buf,
> +					      size_t len)
>  {
>  	struct iio_dev *indio_dev = dev_to_iio_dev(dev);
>  	struct ad7152_chip_info *chip = iio_priv(indio_dev);
> @@ -199,7 +199,7 @@ static ssize_t ad7152_store_filter_rate_setup(struct device *dev,
>  
>  	mutex_lock(&indio_dev->mlock);
>  	ret = i2c_smbus_write_byte_data(chip->client,
> -			AD7152_REG_CFG2, AD7152_CFG2_OSR(i));
> +					AD7152_REG_CFG2, AD7152_CFG2_OSR(i));
>  	if (ret < 0) {
>  		mutex_unlock(&indio_dev->mlock);
>  		return ret;
> @@ -268,8 +268,8 @@ static int ad7152_write_raw(struct iio_dev *indio_dev,
>  		val = (val2 * 1024) / 15625;
>  
>  		ret = i2c_smbus_write_word_data(chip->client,
> -				ad7152_addresses[chan->channel][AD7152_GAIN],
> -				swab16(val));
> +						ad7152_addresses[chan->channel][AD7152_GAIN],
> +						swab16(val));
>  		if (ret < 0)
>  			goto out;
>  
> @@ -282,8 +282,8 @@ static int ad7152_write_raw(struct iio_dev *indio_dev,
>  			goto out;
>  		}
>  		ret = i2c_smbus_write_word_data(chip->client,
> -				ad7152_addresses[chan->channel][AD7152_OFFS],
> -				swab16(val));
> +						ad7152_addresses[chan->channel][AD7152_OFFS],
> +						swab16(val));
>  		if (ret < 0)
>  			goto out;
>  
> @@ -302,8 +302,8 @@ static int ad7152_write_raw(struct iio_dev *indio_dev,
>  		chip->setup[chan->channel] |= AD7152_SETUP_RANGE(i);
>  
>  		ret = i2c_smbus_write_byte_data(chip->client,
> -				ad7152_addresses[chan->channel][AD7152_SETUP],
> -				chip->setup[chan->channel]);
> +						ad7152_addresses[chan->channel][AD7152_SETUP],
> +						chip->setup[chan->channel]);
>  		if (ret < 0)
>  			goto out;
>  
> 


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

* Re: [PATCH 4/5] Staging: iio: cdc: ad7150: Prefer using the BIT macro
  2015-12-29 11:27 ` [PATCH 4/5] Staging: iio: cdc: ad7150: Prefer using the BIT macro Shraddha Barke
@ 2016-01-04 12:17   ` Jonathan Cameron
  0 siblings, 0 replies; 11+ messages in thread
From: Jonathan Cameron @ 2016-01-04 12:17 UTC (permalink / raw)
  To: Shraddha Barke, Lars-Peter Clausen, Michael Hennerich,
	Greg Kroah-Hartman
  Cc: linux-iio

On 29/12/15 11:27, Shraddha Barke wrote:
> Replace bit shifting on 1 with the BIT(x) macro
> 
> Signed-off-by: Shraddha Barke <shraddha.6596@gmail.com>
Applied.
> ---
>  drivers/staging/iio/cdc/ad7150.c | 6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/staging/iio/cdc/ad7150.c b/drivers/staging/iio/cdc/ad7150.c
> index e8d0ff2..0b934f7 100644
> --- a/drivers/staging/iio/cdc/ad7150.c
> +++ b/drivers/staging/iio/cdc/ad7150.c
> @@ -21,8 +21,8 @@
>   */
>  
>  #define AD7150_STATUS              0
> -#define AD7150_STATUS_OUT1         (1 << 3)
> -#define AD7150_STATUS_OUT2         (1 << 5)
> +#define AD7150_STATUS_OUT1         BIT(3)
> +#define AD7150_STATUS_OUT2         BIT(5)
>  #define AD7150_CH1_DATA_HIGH       1
>  #define AD7150_CH2_DATA_HIGH       3
>  #define AD7150_CH1_AVG_HIGH        5
> @@ -36,7 +36,7 @@
>  #define AD7150_CH2_TIMEOUT         13
>  #define AD7150_CH2_SETUP           14
>  #define AD7150_CFG                 15
> -#define AD7150_CFG_FIX             (1 << 7)
> +#define AD7150_CFG_FIX             BIT(7)
>  #define AD7150_PD_TIMER            16
>  #define AD7150_CH1_CAPDAC          17
>  #define AD7150_CH2_CAPDAC          18
> 


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

* Re: [PATCH 5/5] Staging: iio: cdc: ad7150: Fix alignment should match open parenthesis
  2015-12-29 11:27 ` [PATCH 5/5] Staging: iio: cdc: ad7150: Fix alignment should match open parenthesis Shraddha Barke
@ 2016-01-04 12:17   ` Jonathan Cameron
  0 siblings, 0 replies; 11+ messages in thread
From: Jonathan Cameron @ 2016-01-04 12:17 UTC (permalink / raw)
  To: Shraddha Barke, Lars-Peter Clausen, Michael Hennerich,
	Greg Kroah-Hartman
  Cc: linux-iio

On 29/12/15 11:27, Shraddha Barke wrote:
> Fix the checkpatch warning of alignment should match open
> parenthesis.
> 
> Signed-off-by: Shraddha Barke <shraddha.6596@gmail.com>
Applied to the togreg branch of iio.git - initially pushed out as testing
for the autobuilders to play with it.

Thanks,

Jonathan
> ---
>  drivers/staging/iio/cdc/ad7150.c | 28 +++++++++++++++-------------
>  1 file changed, 15 insertions(+), 13 deletions(-)
> 
> diff --git a/drivers/staging/iio/cdc/ad7150.c b/drivers/staging/iio/cdc/ad7150.c
> index 0b934f7..f6b9a10 100644
> --- a/drivers/staging/iio/cdc/ad7150.c
> +++ b/drivers/staging/iio/cdc/ad7150.c
> @@ -160,8 +160,9 @@ static int ad7150_read_event_config(struct iio_dev *indio_dev,
>  
>  /* lock should be held */
>  static int ad7150_write_event_params(struct iio_dev *indio_dev,
> -	 unsigned int chan, enum iio_event_type type,
> -	 enum iio_event_direction dir)
> +				     unsigned int chan,
> +				     enum iio_event_type type,
> +				     enum iio_event_direction dir)
>  {
>  	int ret;
>  	u16 value;
> @@ -209,8 +210,9 @@ static int ad7150_write_event_params(struct iio_dev *indio_dev,
>  }
>  
>  static int ad7150_write_event_config(struct iio_dev *indio_dev,
> -	const struct iio_chan_spec *chan, enum iio_event_type type,
> -	enum iio_event_direction dir, int state)
> +				     const struct iio_chan_spec *chan,
> +				     enum iio_event_type type,
> +				     enum iio_event_direction dir, int state)
>  {
>  	u8 thresh_type, cfg, adaptive;
>  	int ret;
> @@ -302,11 +304,11 @@ static int ad7150_read_event_value(struct iio_dev *indio_dev,
>  }
>  
>  static int ad7150_write_event_value(struct iio_dev *indio_dev,
> -				   const struct iio_chan_spec *chan,
> -				   enum iio_event_type type,
> -				   enum iio_event_direction dir,
> -				   enum iio_event_info info,
> -				   int val, int val2)
> +				    const struct iio_chan_spec *chan,
> +				    enum iio_event_type type,
> +				    enum iio_event_direction dir,
> +				    enum iio_event_info info,
> +				    int val, int val2)
>  {
>  	int ret;
>  	struct ad7150_chip_info *chip = iio_priv(indio_dev);
> @@ -365,9 +367,9 @@ static ssize_t ad7150_show_timeout(struct device *dev,
>  }
>  
>  static ssize_t ad7150_store_timeout(struct device *dev,
> -		struct device_attribute *attr,
> -		const char *buf,
> -		size_t len)
> +				    struct device_attribute *attr,
> +				    const char *buf,
> +				    size_t len)
>  {
>  	struct iio_dev *indio_dev = dev_to_iio_dev(dev);
>  	struct ad7150_chip_info *chip = iio_priv(indio_dev);
> @@ -580,7 +582,7 @@ static const struct iio_info ad7150_info = {
>   */
>  
>  static int ad7150_probe(struct i2c_client *client,
> -		const struct i2c_device_id *id)
> +			const struct i2c_device_id *id)
>  {
>  	int ret;
>  	struct ad7150_chip_info *chip;
> 


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

end of thread, other threads:[~2016-01-04 12:17 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-12-29 11:27 [PATCH 0/5] Staging: iio: cdc: Checkpatch cleanups Shraddha Barke
2015-12-29 11:27 ` [PATCH 1/5] Staging: iio: cdc: ad7746: Prefer using the BIT macro Shraddha Barke
2016-01-04 12:00   ` Jonathan Cameron
2015-12-29 11:27 ` [PATCH 2/5] Staging: iio: cdc: ad7152: " Shraddha Barke
2016-01-04 12:02   ` Jonathan Cameron
2015-12-29 11:27 ` [PATCH 3/5] Staging: iio: cdc: ad7152: Fix alignment should match open parenthesis Shraddha Barke
2016-01-04 12:05   ` Jonathan Cameron
2015-12-29 11:27 ` [PATCH 4/5] Staging: iio: cdc: ad7150: Prefer using the BIT macro Shraddha Barke
2016-01-04 12:17   ` Jonathan Cameron
2015-12-29 11:27 ` [PATCH 5/5] Staging: iio: cdc: ad7150: Fix alignment should match open parenthesis Shraddha Barke
2016-01-04 12:17   ` Jonathan Cameron

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.