All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jonathan Cameron <jic23@kernel.org>
To: Hartmut Knaack <knaack.h@gmx.de>, linux-iio@vger.kernel.org
Cc: Lars-Peter Clausen <lars@metafoo.de>,
	Peter Meerwald <pmeerw@pmeerw.net>,
	Tiberiu Breana <tiberiu.a.breana@intel.com>
Subject: Re: [PATCH v2 4/7] iio:accel:stk8312: rework macro definitions
Date: Sat, 8 Aug 2015 12:22:31 +0100	[thread overview]
Message-ID: <55C5E677.2070800@kernel.org> (raw)
In-Reply-To: <85ebbe977981145ab175742de362d050e38be955.1438204273.git.knaack.h@gmx.de>

On 29/07/15 22:39, Hartmut Knaack wrote:
> Make use of BIT to describe register bits, GENMASK for consecutive
> bitmasks, rename and sort existing definitions, replace magic value with
> an expressive definition, drop an unused definition.
> 
> Signed-off-by: Hartmut Knaack <knaack.h@gmx.de>
> Reviewed-by: Tiberiu Breana <tiberiu.a.breana@intel.com>
Applied to the togreg branch of iio.git.

Thanks,

Jonathan
> ---
>  drivers/iio/accel/stk8312.c | 25 +++++++++++++------------
>  1 file changed, 13 insertions(+), 12 deletions(-)
> 
> diff --git a/drivers/iio/accel/stk8312.c b/drivers/iio/accel/stk8312.c
> index 4e1dda7e896d..8807927d4d0b 100644
> --- a/drivers/iio/accel/stk8312.c
> +++ b/drivers/iio/accel/stk8312.c
> @@ -37,16 +37,16 @@
>  #define STK8312_REG_OTPDATA		0x3E
>  #define STK8312_REG_OTPCTRL		0x3F
>  
> -#define STK8312_MODE_ACTIVE		0x01
> +#define STK8312_MODE_ACTIVE		BIT(0)
>  #define STK8312_MODE_STANDBY		0x00
> -#define STK8312_DREADY_BIT		0x10
> -#define STK8312_INT_MODE		0xC0
> -#define STK8312_RNG_MASK		0xC0
> -#define STK8312_SR_MASK			0x07
> -#define STK8312_SR_400HZ_IDX		0
> +#define STK8312_MODE_INT_AH_PP		0xC0	/* active-high, push-pull */
> +#define STK8312_DREADY_BIT		BIT(4)
> +#define STK8312_RNG_6G			1
>  #define STK8312_RNG_SHIFT		6
> -#define STK8312_READ_RETRIES		16
> -#define STK8312_ALL_CHANNEL_MASK	7
> +#define STK8312_RNG_MASK		GENMASK(7, 6)
> +#define STK8312_SR_MASK			GENMASK(2, 0)
> +#define STK8312_SR_400HZ_IDX		0
> +#define STK8312_ALL_CHANNEL_MASK	GENMASK(2, 0)
>  #define STK8312_ALL_CHANNEL_SIZE	3
>  
>  #define STK8312_DRIVER_NAME		"stk8312"
> @@ -144,7 +144,7 @@ static int stk8312_otp_init(struct stk8312_data *data)
>  		if (ret < 0)
>  			goto exit_err;
>  		count--;
> -	} while (!(ret & 0x80) && count > 0);
> +	} while (!(ret & BIT(7)) && count > 0);
>  
>  	if (count == 0) {
>  		ret = -ETIMEDOUT;
> @@ -565,11 +565,12 @@ static int stk8312_probe(struct i2c_client *client,
>  		return ret;
>  	}
>  	data->sample_rate_idx = STK8312_SR_400HZ_IDX;
> -	ret = stk8312_set_range(data, 1);
> +	ret = stk8312_set_range(data, STK8312_RNG_6G);
>  	if (ret < 0)
>  		return ret;
>  
> -	ret = stk8312_set_mode(data, STK8312_INT_MODE | STK8312_MODE_ACTIVE);
> +	ret = stk8312_set_mode(data,
> +			       STK8312_MODE_INT_AH_PP | STK8312_MODE_ACTIVE);
>  	if (ret < 0)
>  		return ret;
>  
> @@ -690,7 +691,7 @@ MODULE_DEVICE_TABLE(acpi, stk8312_acpi_id);
>  
>  static struct i2c_driver stk8312_driver = {
>  	.driver = {
> -		.name = "stk8312",
> +		.name = STK8312_DRIVER_NAME,
>  		.pm = STK8312_PM_OPS,
>  		.acpi_match_table = ACPI_PTR(stk8312_acpi_id),
>  	},
> 


  reply	other threads:[~2015-08-08 11:22 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-07-29 21:39 [PATCH v2 0/7] stk8312 fixes and cleanup Hartmut Knaack
2015-07-29 21:39 ` [PATCH v2 1/7] iio:accel:stk8312: add triggered buffer dependency Hartmut Knaack
2015-07-29 21:39 ` [PATCH v2 2/7] iio:accel:stk8312: check for invalid value Hartmut Knaack
2015-07-30  7:09   ` Crt Mori
2015-07-31 22:54     ` Hartmut Knaack
2015-08-01  7:35       ` Crt Mori
2015-08-06 22:23         ` Hartmut Knaack
2015-08-08 11:18           ` Jonathan Cameron
2015-08-10  9:24             ` Breana, Tiberiu A
2015-08-11 18:32               ` Hartmut Knaack
2015-07-29 21:39 ` [PATCH v2 3/7] iio:accel:stk8312: improve error handling Hartmut Knaack
2015-07-30  7:04   ` Crt Mori
2015-07-30  9:07     ` Breana, Tiberiu A
2015-07-30  9:39       ` Crt Mori
2015-07-31 23:45       ` Hartmut Knaack
2015-08-01  7:40         ` Crt Mori
2015-08-03  8:05           ` Breana, Tiberiu A
2015-08-08 11:21             ` Jonathan Cameron
2015-07-29 21:39 ` [PATCH v2 4/7] iio:accel:stk8312: rework macro definitions Hartmut Knaack
2015-08-08 11:22   ` Jonathan Cameron [this message]
2015-07-29 21:39 ` [PATCH v2 5/7] iio:accel:stk8312: use appropriate variable types Hartmut Knaack
2015-08-08 11:23   ` Jonathan Cameron
2015-07-29 21:39 ` [PATCH v2 6/7] iio:accel:stk8312: code style cleanup Hartmut Knaack
2015-08-08 11:24   ` Jonathan Cameron
2015-07-29 21:39 ` [PATCH v2 7/7] iio:accel:stk8312: drop local buffer Hartmut Knaack
2015-08-08 11:25   ` 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=55C5E677.2070800@kernel.org \
    --to=jic23@kernel.org \
    --cc=knaack.h@gmx.de \
    --cc=lars@metafoo.de \
    --cc=linux-iio@vger.kernel.org \
    --cc=pmeerw@pmeerw.net \
    --cc=tiberiu.a.breana@intel.com \
    /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 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.