linux-iio.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 5/6] staging:iio:ad7291 faciliate ad7291_read_event_config()
@ 2014-07-08 11:06 Hartmut Knaack
  2014-07-08 20:14 ` Jonathan Cameron
  0 siblings, 1 reply; 2+ messages in thread
From: Hartmut Knaack @ 2014-07-08 11:06 UTC (permalink / raw)
  To: linux-iio; +Cc: Jonathan Cameron, Lars-Peter Clausen

Save some lines in returning a voltage event.

Signed-off-by: Hartmut Knaack <knaack.h@gmx.de>
---
diff --git a/drivers/staging/iio/adc/ad7291.c b/drivers/staging/iio/adc/ad7291.c
index 654b39e..06eb0c0 100644
--- a/drivers/staging/iio/adc/ad7291.c
+++ b/drivers/staging/iio/adc/ad7291.c
@@ -242,10 +242,7 @@ static int ad7291_read_event_config(struct iio_dev *indio_dev,
 
 	switch (chan->type) {
 	case IIO_VOLTAGE:
-		if (chip->c_mask & BIT(15 - chan->channel))
-			return 1;
-		else
-			return 0;
+		return !!(chip->c_mask & BIT(15 - chan->channel));
 	case IIO_TEMP:
 		/* always on */
 		return 1;

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

* Re: [PATCH 5/6] staging:iio:ad7291 faciliate ad7291_read_event_config()
  2014-07-08 11:06 [PATCH 5/6] staging:iio:ad7291 faciliate ad7291_read_event_config() Hartmut Knaack
@ 2014-07-08 20:14 ` Jonathan Cameron
  0 siblings, 0 replies; 2+ messages in thread
From: Jonathan Cameron @ 2014-07-08 20:14 UTC (permalink / raw)
  To: Hartmut Knaack, linux-iio; +Cc: Lars-Peter Clausen

On 08/07/14 12:06, Hartmut Knaack wrote:
> Save some lines in returning a voltage event.
>
> Signed-off-by: Hartmut Knaack <knaack.h@gmx.de>
Applied to the togreg branch of iio.git

Thanks
> ---
> diff --git a/drivers/staging/iio/adc/ad7291.c b/drivers/staging/iio/adc/ad7291.c
> index 654b39e..06eb0c0 100644
> --- a/drivers/staging/iio/adc/ad7291.c
> +++ b/drivers/staging/iio/adc/ad7291.c
> @@ -242,10 +242,7 @@ static int ad7291_read_event_config(struct iio_dev *indio_dev,
>
>   	switch (chan->type) {
>   	case IIO_VOLTAGE:
> -		if (chip->c_mask & BIT(15 - chan->channel))
> -			return 1;
> -		else
> -			return 0;
> +		return !!(chip->c_mask & BIT(15 - chan->channel));
>   	case IIO_TEMP:
>   		/* always on */
>   		return 1;
> --
> To unsubscribe from this list: send the line "unsubscribe linux-iio" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
>


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

end of thread, other threads:[~2014-07-08 20:12 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-07-08 11:06 [PATCH 5/6] staging:iio:ad7291 faciliate ad7291_read_event_config() Hartmut Knaack
2014-07-08 20:14 ` Jonathan Cameron

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).