linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] iio: adc: Fix coding style violations
@ 2017-08-08 12:04 Michal Simek
  2017-08-08 15:52 ` Joe Perches
  0 siblings, 1 reply; 3+ messages in thread
From: Michal Simek @ 2017-08-08 12:04 UTC (permalink / raw)
  To: linux-kernel, monstr
  Cc: Sai Krishna Potthuri, Sören Brinkmann, linux-iio,
	Hartmut Knaack, Lars-Peter Clausen, Peter Meerwald-Stadler,
	Jonathan Cameron, linux-arm-kernel

From: Sai Krishna Potthuri <lakshmi.sai.krishna.potthuri@xilinx.com>

This patch fix following checkpatch warnings in xadc driver
1. Prefer 'unsigned int' to bare use of 'unsigned'.
2. else is not generally useful after a break or return.
3. function definition argument 'struct xadc *' should also
have an identifier name.

Signed-off-by: Sai Krishna Potthuri <lakshmis@xilinx.com>
Signed-off-by: Michal Simek <michal.simek@xilinx.com>
---

 drivers/iio/adc/xilinx-xadc-events.c | 38 +++++++++++++++++-------------------
 drivers/iio/adc/xilinx-xadc.h        |  2 +-
 2 files changed, 19 insertions(+), 21 deletions(-)

diff --git a/drivers/iio/adc/xilinx-xadc-events.c b/drivers/iio/adc/xilinx-xadc-events.c
index 6d5c2a6f4e6e..dc0670308253 100644
--- a/drivers/iio/adc/xilinx-xadc-events.c
+++ b/drivers/iio/adc/xilinx-xadc-events.c
@@ -68,7 +68,7 @@ void xadc_handle_events(struct iio_dev *indio_dev, unsigned long events)
 		xadc_handle_event(indio_dev, i);
 }
 
-static unsigned xadc_get_threshold_offset(const struct iio_chan_spec *chan,
+static unsigned int xadc_get_threshold_offset(const struct iio_chan_spec *chan,
 	enum iio_event_direction dir)
 {
 	unsigned int offset;
@@ -90,26 +90,24 @@ static unsigned xadc_get_threshold_offset(const struct iio_chan_spec *chan,
 
 static unsigned int xadc_get_alarm_mask(const struct iio_chan_spec *chan)
 {
-	if (chan->type == IIO_TEMP) {
+	if (chan->type == IIO_TEMP)
 		return XADC_ALARM_OT_MASK;
-	} else {
-		switch (chan->channel) {
-		case 0:
-			return XADC_ALARM_VCCINT_MASK;
-		case 1:
-			return XADC_ALARM_VCCAUX_MASK;
-		case 2:
-			return XADC_ALARM_VCCBRAM_MASK;
-		case 3:
-			return XADC_ALARM_VCCPINT_MASK;
-		case 4:
-			return XADC_ALARM_VCCPAUX_MASK;
-		case 5:
-			return XADC_ALARM_VCCODDR_MASK;
-		default:
-			/* We will never get here */
-			return 0;
-		}
+	switch (chan->channel) {
+	case 0:
+		return XADC_ALARM_VCCINT_MASK;
+	case 1:
+		return XADC_ALARM_VCCAUX_MASK;
+	case 2:
+		return XADC_ALARM_VCCBRAM_MASK;
+	case 3:
+		return XADC_ALARM_VCCPINT_MASK;
+	case 4:
+		return XADC_ALARM_VCCPAUX_MASK;
+	case 5:
+		return XADC_ALARM_VCCODDR_MASK;
+	default:
+		/* We will never get here */
+		return 0;
 	}
 }
 
diff --git a/drivers/iio/adc/xilinx-xadc.h b/drivers/iio/adc/xilinx-xadc.h
index f6f081965647..9069396d7622 100644
--- a/drivers/iio/adc/xilinx-xadc.h
+++ b/drivers/iio/adc/xilinx-xadc.h
@@ -76,7 +76,7 @@ struct xadc_ops {
 	int (*setup)(struct platform_device *pdev, struct iio_dev *indio_dev,
 			int irq);
 	void (*update_alarm)(struct xadc *, unsigned int);
-	unsigned long (*get_dclk_rate)(struct xadc *);
+	unsigned long (*get_dclk_rate)(struct xadc *xadc);
 	irqreturn_t (*interrupt_handler)(int, void *);
 
 	unsigned int flags;
-- 
1.9.1

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

* Re: [PATCH] iio: adc: Fix coding style violations
  2017-08-08 12:04 [PATCH] iio: adc: Fix coding style violations Michal Simek
@ 2017-08-08 15:52 ` Joe Perches
  2017-08-10  6:31   ` Michal Simek
  0 siblings, 1 reply; 3+ messages in thread
From: Joe Perches @ 2017-08-08 15:52 UTC (permalink / raw)
  To: Michal Simek, linux-kernel, monstr
  Cc: Sai Krishna Potthuri, Sören Brinkmann, linux-iio,
	Hartmut Knaack, Lars-Peter Clausen, Peter Meerwald-Stadler,
	Jonathan Cameron, linux-arm-kernel

On Tue, 2017-08-08 at 14:04 +0200, Michal Simek wrote:
> From: Sai Krishna Potthuri <lakshmi.sai.krishna.potthuri@xilinx.com>
[]
> diff --git a/drivers/iio/adc/xilinx-xadc.h b/drivers/iio/adc/xilinx-xadc.h
[]
> @@ -76,7 +76,7 @@ struct xadc_ops {
>  	int (*setup)(struct platform_device *pdev, struct iio_dev *indio_dev,
>  			int irq);
>  	void (*update_alarm)(struct xadc *, unsigned int);
> -	unsigned long (*get_dclk_rate)(struct xadc *);
> +	unsigned long (*get_dclk_rate)(struct xadc *xadc);
>  	irqreturn_t (*interrupt_handler)(int, void *);

Doesn't it seem odd to you that the lines above and below
have the same form?

checkpatch is an imperfect tool.
It will always be imperfect.
Please use your eyes and mind too.

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

* Re: [PATCH] iio: adc: Fix coding style violations
  2017-08-08 15:52 ` Joe Perches
@ 2017-08-10  6:31   ` Michal Simek
  0 siblings, 0 replies; 3+ messages in thread
From: Michal Simek @ 2017-08-10  6:31 UTC (permalink / raw)
  To: Joe Perches, Michal Simek, linux-kernel, monstr
  Cc: Sai Krishna Potthuri, Sören Brinkmann, linux-iio,
	Hartmut Knaack, Lars-Peter Clausen, Peter Meerwald-Stadler,
	Jonathan Cameron, linux-arm-kernel

On 8.8.2017 17:52, Joe Perches wrote:
> On Tue, 2017-08-08 at 14:04 +0200, Michal Simek wrote:
>> From: Sai Krishna Potthuri <lakshmi.sai.krishna.potthuri@xilinx.com>
> []
>> diff --git a/drivers/iio/adc/xilinx-xadc.h b/drivers/iio/adc/xilinx-xadc.h
> []
>> @@ -76,7 +76,7 @@ struct xadc_ops {
>>  	int (*setup)(struct platform_device *pdev, struct iio_dev *indio_dev,
>>  			int irq);
>>  	void (*update_alarm)(struct xadc *, unsigned int);
>> -	unsigned long (*get_dclk_rate)(struct xadc *);
>> +	unsigned long (*get_dclk_rate)(struct xadc *xadc);
>>  	irqreturn_t (*interrupt_handler)(int, void *);
> 
> Doesn't it seem odd to you that the lines above and below
> have the same form?
> 
> checkpatch is an imperfect tool.
> It will always be imperfect.
> Please use your eyes and mind too.

You are right. I have missed that in internal review. Fixed in v2.

Thanks,
Michal

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

end of thread, other threads:[~2017-08-10  6:31 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-08-08 12:04 [PATCH] iio: adc: Fix coding style violations Michal Simek
2017-08-08 15:52 ` Joe Perches
2017-08-10  6:31   ` Michal Simek

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).