Linux IIO development
 help / color / mirror / Atom feed
From: Jonathan Cameron <jic23@kernel.org>
To: Angel Iglesias <ang.iglesiasg@gmail.com>
Cc: linux-iio@vger.kernel.org,
	"Biju Das" <biju.das.jz@bp.renesas.com>,
	linux-kernel@vger.kernel.org,
	"Lars-Peter Clausen" <lars@metafoo.de>,
	"Andy Shevchenko" <andriy.shevchenko@linux.intel.com>,
	"Uwe Kleine-König" <u.kleine-koenig@pengutronix.de>
Subject: Re: [PATCH 3/5] iio: pressure: bmp280: Rearrange vars in reverse xmas tree order
Date: Mon, 16 Oct 2023 09:40:18 +0100	[thread overview]
Message-ID: <20231016094018.6f89eee9@jic23-huawei> (raw)
In-Reply-To: <7db5fe65a78513137206ae6b33abb1e48d356fbf.1697381932.git.ang.iglesiasg@gmail.com>

On Sun, 15 Oct 2023 17:16:25 +0200
Angel Iglesias <ang.iglesiasg@gmail.com> wrote:

> Small cleanup reordering local variable declarations following reverse
> christmas tree convention.
> 
> Signed-off-by: Angel Iglesias <ang.iglesiasg@gmail.com>
> 
> diff --git a/drivers/iio/pressure/bmp280-core.c b/drivers/iio/pressure/bmp280-core.c
> index 6089f3f9d8f4..ea02a623bb58 100644
> --- a/drivers/iio/pressure/bmp280-core.c
> +++ b/drivers/iio/pressure/bmp280-core.c
> @@ -766,8 +766,8 @@ static const struct iio_info bmp280_info = {
>  
>  static int bmp280_chip_config(struct bmp280_data *data)
>  {
> -	u8 osrs = FIELD_PREP(BMP280_OSRS_TEMP_MASK, data->oversampling_temp + 1) |
> -		  FIELD_PREP(BMP280_OSRS_PRESS_MASK, data->oversampling_press + 1);
> +	u8 osrs = FIELD_PREP(BMP280_OSRS_PRESS_MASK, data->oversampling_press + 1) |
> +		  FIELD_PREP(BMP280_OSRS_TEMP_MASK, data->oversampling_temp + 1);

For fields within a register, don't bother.
Normally the order is dictated by someone reading the fields on a datasheet.  
Feels like reorganzing them is just noise to me.

The rest look like good little tidy ups to me.

>  	int ret;
>  
>  	ret = regmap_write_bits(data->regmap, BMP280_REG_CTRL_MEAS,
> diff --git a/drivers/iio/pressure/bmp280-i2c.c b/drivers/iio/pressure/bmp280-i2c.c
> index b3e069730f97..34e3bc758493 100644
> --- a/drivers/iio/pressure/bmp280-i2c.c
> +++ b/drivers/iio/pressure/bmp280-i2c.c
> @@ -7,9 +7,9 @@
>  
>  static int bmp280_i2c_probe(struct i2c_client *client)
>  {
> -	struct regmap *regmap;
> -	const struct bmp280_chip_info *chip_info;
>  	const struct i2c_device_id *id = i2c_client_get_device_id(client);
> +	const struct bmp280_chip_info *chip_info;
> +	struct regmap *regmap;
>  
>  	chip_info = i2c_get_match_data(client);
>  
> diff --git a/drivers/iio/pressure/bmp280-spi.c b/drivers/iio/pressure/bmp280-spi.c
> index 2eed483a8cc4..433d6fac83c4 100644
> --- a/drivers/iio/pressure/bmp280-spi.c
> +++ b/drivers/iio/pressure/bmp280-spi.c
> @@ -14,8 +14,7 @@
>  static int bmp280_regmap_spi_write(void *context, const void *data,
>                                     size_t count)
>  {
> -	struct device *dev = context;
> -	struct spi_device *spi = to_spi_device(dev);
> +	struct spi_device *spi = to_spi_device(context);
>  	u8 buf[2];
>  
>  	memcpy(buf, data, 2);
> @@ -31,8 +30,7 @@ static int bmp280_regmap_spi_write(void *context, const void *data,
>  static int bmp280_regmap_spi_read(void *context, const void *reg,
>                                    size_t reg_size, void *val, size_t val_size)
>  {
> -	struct device *dev = context;
> -	struct spi_device *spi = to_spi_device(dev);
> +	struct spi_device *spi = to_spi_device(context);
>  
>  	return spi_write_then_read(spi, reg, reg_size, val, val_size);
>  }


  reply	other threads:[~2023-10-16  8:40 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-10-15 15:16 [PATCH 0/5] Add support for BMP390 and various driver cleanups Angel Iglesias
2023-10-15 15:16 ` [PATCH 1/5] iio: pressure: bmp280: Use i2c_get_match_data() Angel Iglesias
2023-10-15 15:16 ` [PATCH 2/5] iio: pressure: bmp280: Use spi_get_device_match_data() Angel Iglesias
2023-10-15 15:16 ` [PATCH 3/5] iio: pressure: bmp280: Rearrange vars in reverse xmas tree order Angel Iglesias
2023-10-16  8:40   ` Jonathan Cameron [this message]
2023-10-15 15:16 ` [PATCH 4/5] iio: pressure: bmp280: Allow multiple chips id per family of devices Angel Iglesias
2023-10-16  7:53   ` Andy Shevchenko
2023-10-16  8:38   ` Jonathan Cameron
2023-10-15 15:16 ` [PATCH 5/5] iio: pressure: bmp280: Add support for BMP390 Angel Iglesias
2023-10-16  7:54 ` [PATCH 0/5] Add support for BMP390 and various driver cleanups Andy Shevchenko

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=20231016094018.6f89eee9@jic23-huawei \
    --to=jic23@kernel.org \
    --cc=andriy.shevchenko@linux.intel.com \
    --cc=ang.iglesiasg@gmail.com \
    --cc=biju.das.jz@bp.renesas.com \
    --cc=lars@metafoo.de \
    --cc=linux-iio@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=u.kleine-koenig@pengutronix.de \
    /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