linux-iio.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jonathan Cameron <jic23@kernel.org>
To: Peter Meerwald <pmeerw@pmeerw.net>, linux-iio@vger.kernel.org
Subject: Re: [PATCH v2 03/12] iio:adc:ad7887: Use BIT() and GENMASK() macros
Date: Sat, 14 Jun 2014 16:03:36 +0100	[thread overview]
Message-ID: <539C6448.9000704@kernel.org> (raw)
In-Reply-To: <1402549229-4449-4-git-send-email-pmeerw@pmeerw.net>

On 12/06/14 06:00, Peter Meerwald wrote:
> Signed-off-by: Peter Meerwald <pmeerw@pmeerw.net>
> Acked-by: Lars-Peter Clausen <lars@metafoo.de>
Applied to the togreg branch of iio.git

thanks
> ---
>   drivers/iio/adc/ad7887.c | 21 ++++++++++-----------
>   1 file changed, 10 insertions(+), 11 deletions(-)
>
> diff --git a/drivers/iio/adc/ad7887.c b/drivers/iio/adc/ad7887.c
> index 749a6ca..2fd012e 100644
> --- a/drivers/iio/adc/ad7887.c
> +++ b/drivers/iio/adc/ad7887.c
> @@ -15,6 +15,7 @@
>   #include <linux/err.h>
>   #include <linux/module.h>
>   #include <linux/interrupt.h>
> +#include <linux/bitops.h>
>
>   #include <linux/iio/iio.h>
>   #include <linux/iio/sysfs.h>
> @@ -25,14 +26,14 @@
>
>   #include <linux/platform_data/ad7887.h>
>
> -#define AD7887_REF_DIS		(1 << 5) /* on-chip reference disable */
> -#define AD7887_DUAL		(1 << 4) /* dual-channel mode */
> -#define AD7887_CH_AIN1		(1 << 3) /* convert on channel 1, DUAL=1 */
> -#define AD7887_CH_AIN0		(0 << 3) /* convert on channel 0, DUAL=0,1 */
> -#define AD7887_PM_MODE1		(0)	 /* CS based shutdown */
> -#define AD7887_PM_MODE2		(1)	 /* full on */
> -#define AD7887_PM_MODE3		(2)	 /* auto shutdown after conversion */
> -#define AD7887_PM_MODE4		(3)	 /* standby mode */
> +#define AD7887_REF_DIS		BIT(5)	/* on-chip reference disable */
> +#define AD7887_DUAL		BIT(4)	/* dual-channel mode */
> +#define AD7887_CH_AIN1		BIT(3)	/* convert on channel 1, DUAL=1 */
> +#define AD7887_CH_AIN0		0	/* convert on channel 0, DUAL=0,1 */
> +#define AD7887_PM_MODE1		0	/* CS based shutdown */
> +#define AD7887_PM_MODE2		1	/* full on */
> +#define AD7887_PM_MODE3		2	/* auto shutdown after conversion */
> +#define AD7887_PM_MODE4		3	/* standby mode */
>
>   enum ad7887_channels {
>   	AD7887_CH0,
> @@ -40,8 +41,6 @@ enum ad7887_channels {
>   	AD7887_CH1,
>   };
>
> -#define RES_MASK(bits)	((1 << (bits)) - 1)
> -
>   /**
>    * struct ad7887_chip_info - chip specifc information
>    * @int_vref_mv:	the internal reference voltage
> @@ -167,7 +166,7 @@ static int ad7887_read_raw(struct iio_dev *indio_dev,
>   		if (ret < 0)
>   			return ret;
>   		*val = ret >> chan->scan_type.shift;
> -		*val &= RES_MASK(chan->scan_type.realbits);
> +		*val &= GENMASK(chan->scan_type.realbits - 1, 0);
>   		return IIO_VAL_INT;
>   	case IIO_CHAN_INFO_SCALE:
>   		if (st->reg) {
>


  reply	other threads:[~2014-06-14 15:01 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-06-12  5:00 [PATCH v2 00/12] misc IIO cleanup Peter Meerwald
2014-06-12  5:00 ` [PATCH v2 01/12] iio:adc:ad5791: Use BIT() and GENMASK() macros Peter Meerwald
2014-06-14 14:46   ` Jonathan Cameron
2014-06-12  5:00 ` [PATCH v2 02/12] iio:adc:ad5504: " Peter Meerwald
2014-06-14 14:49   ` Jonathan Cameron
2014-06-12  5:00 ` [PATCH v2 03/12] iio:adc:ad7887: " Peter Meerwald
2014-06-14 15:03   ` Jonathan Cameron [this message]
2014-06-12  5:00 ` [PATCH v2 04/12] iio:adc:ad7476: Use GENMASK() macro Peter Meerwald
2014-06-14 15:04   ` Jonathan Cameron
2014-06-12  5:00 ` [PATCH v2 05/12] iio:adc:ad7298: Use BIT() and GENMASK() macros Peter Meerwald
2014-06-14 15:04   ` Jonathan Cameron
2014-06-12  5:00 ` [PATCH v2 06/12] iio: Move documentation of iio-trig-sysfs to ABI/testing Peter Meerwald
2014-06-14 15:05   ` Jonathan Cameron
2014-06-12  5:00 ` [PATCH v2 07/12] staging:iio: Update iio_event_monitor program Peter Meerwald
2014-06-14 15:08   ` Jonathan Cameron
2014-06-12  5:00 ` [PATCH v2 08/12] staging:iio: Fix iio_utils.h function prototypes Peter Meerwald
2014-06-14 15:08   ` Jonathan Cameron
2014-06-12  5:00 ` [PATCH v2 09/12] staging:iio: Fix mention of INDIO_RING_TRIGGERED to INDIO_BUFFER_TRIGGERED Peter Meerwald
2014-06-14 15:08   ` Jonathan Cameron
2014-06-12  5:00 ` [PATCH v2 10/12] staging:iio: Fix error handling in generic_buffer example Peter Meerwald
2014-06-14 15:09   ` Jonathan Cameron
2014-06-12  5:00 ` [PATCH v2 11/12] staging:iio-trig-periodic-rtc: Cleanup Peter Meerwald
2014-06-14 15:11   ` Jonathan Cameron
2014-06-12  5:00 ` [PATCH v2 12/12] staging:iio-trig-periodic-rtc: Allow to reset frequency to 0 Peter Meerwald
2014-06-14 15:12   ` Jonathan Cameron

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=539C6448.9000704@kernel.org \
    --to=jic23@kernel.org \
    --cc=linux-iio@vger.kernel.org \
    --cc=pmeerw@pmeerw.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).