public inbox for linux-iio@vger.kernel.org
 help / color / mirror / Atom feed
From: Jonathan Cameron <jic23@kernel.org>
To: Linus Walleij <linus.walleij@linaro.org>
Cc: linux-iio@vger.kernel.org, Hartmut Knaack <knaack.h@gmx.de>,
	Lars-Peter Clausen <lars@metafoo.de>,
	Peter Meerwald-Stadler <pmeerw@pmeerw.net>,
	Oleksandr Kravchenko <o.v.kravchenko@globallogic.com>
Subject: Re: [PATCH 1/4] iio: accel: bma180: Add dev helper variable
Date: Mon, 23 Dec 2019 17:18:11 +0000	[thread overview]
Message-ID: <20191223171811.634e10b7@archlinux> (raw)
In-Reply-To: <20191211213819.14024-1-linus.walleij@linaro.org>

On Wed, 11 Dec 2019 22:38:16 +0100
Linus Walleij <linus.walleij@linaro.org> wrote:

> Having a shorthand "dev" instead of &client->dev everywhere
> makes the code easier to read (more compact).
> 
> Cc: Peter Meerwald <pmeerw@pmeerw.net>
> Cc: Oleksandr Kravchenko <o.v.kravchenko@globallogic.com>
> Signed-off-by: Linus Walleij <linus.walleij@linaro.org>

Seems sensible to me.

Applied to the togreg branch of iio.git and pushed out as testing for
the autobuilders to play with it.

Thanks,

Jonathan

> ---
>  drivers/iio/accel/bma180.c | 19 ++++++++++---------
>  1 file changed, 10 insertions(+), 9 deletions(-)
> 
> diff --git a/drivers/iio/accel/bma180.c b/drivers/iio/accel/bma180.c
> index 1574e4604a4f..518efbe4eaf6 100644
> --- a/drivers/iio/accel/bma180.c
> +++ b/drivers/iio/accel/bma180.c
> @@ -712,12 +712,13 @@ static const struct iio_trigger_ops bma180_trigger_ops = {
>  static int bma180_probe(struct i2c_client *client,
>  		const struct i2c_device_id *id)
>  {
> +	struct device *dev = &client->dev;
>  	struct bma180_data *data;
>  	struct iio_dev *indio_dev;
>  	enum chip_ids chip;
>  	int ret;
>  
> -	indio_dev = devm_iio_device_alloc(&client->dev, sizeof(*data));
> +	indio_dev = devm_iio_device_alloc(dev, sizeof(*data));
>  	if (!indio_dev)
>  		return -ENOMEM;
>  
> @@ -725,12 +726,12 @@ static int bma180_probe(struct i2c_client *client,
>  	i2c_set_clientdata(client, indio_dev);
>  	data->client = client;
>  	if (client->dev.of_node)
> -		chip = (enum chip_ids)of_device_get_match_data(&client->dev);
> +		chip = (enum chip_ids)of_device_get_match_data(dev);
>  	else
>  		chip = id->driver_data;
>  	data->part_info = &bma180_part_info[chip];
>  
> -	ret = iio_read_mount_matrix(&client->dev, "mount-matrix",
> +	ret = iio_read_mount_matrix(dev, "mount-matrix",
>  				&data->orientation);
>  	if (ret)
>  		return ret;
> @@ -740,7 +741,7 @@ static int bma180_probe(struct i2c_client *client,
>  		goto err_chip_disable;
>  
>  	mutex_init(&data->mutex);
> -	indio_dev->dev.parent = &client->dev;
> +	indio_dev->dev.parent = dev;
>  	indio_dev->channels = data->part_info->channels;
>  	indio_dev->num_channels = data->part_info->num_channels;
>  	indio_dev->name = id->name;
> @@ -755,15 +756,15 @@ static int bma180_probe(struct i2c_client *client,
>  			goto err_chip_disable;
>  		}
>  
> -		ret = devm_request_irq(&client->dev, client->irq,
> +		ret = devm_request_irq(dev, client->irq,
>  			iio_trigger_generic_data_rdy_poll, IRQF_TRIGGER_RISING,
>  			"bma180_event", data->trig);
>  		if (ret) {
> -			dev_err(&client->dev, "unable to request IRQ\n");
> +			dev_err(dev, "unable to request IRQ\n");
>  			goto err_trigger_free;
>  		}
>  
> -		data->trig->dev.parent = &client->dev;
> +		data->trig->dev.parent = dev;
>  		data->trig->ops = &bma180_trigger_ops;
>  		iio_trigger_set_drvdata(data->trig, indio_dev);
>  		indio_dev->trig = iio_trigger_get(data->trig);
> @@ -776,13 +777,13 @@ static int bma180_probe(struct i2c_client *client,
>  	ret = iio_triggered_buffer_setup(indio_dev, NULL,
>  			bma180_trigger_handler, NULL);
>  	if (ret < 0) {
> -		dev_err(&client->dev, "unable to setup iio triggered buffer\n");
> +		dev_err(dev, "unable to setup iio triggered buffer\n");
>  		goto err_trigger_unregister;
>  	}
>  
>  	ret = iio_device_register(indio_dev);
>  	if (ret < 0) {
> -		dev_err(&client->dev, "unable to register iio device\n");
> +		dev_err(dev, "unable to register iio device\n");
>  		goto err_buffer_cleanup;
>  	}
>  


      parent reply	other threads:[~2019-12-23 17:18 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-12-11 21:38 [PATCH 1/4] iio: accel: bma180: Add dev helper variable Linus Walleij
2019-12-11 21:38 ` [PATCH 2/4] iio: accel: bma180: Basic regulator support Linus Walleij
2019-12-23 17:20   ` Jonathan Cameron
2019-12-11 21:38 ` [PATCH 3/4] iio: accel: bma180: Use explicit member assignment Linus Walleij
2019-12-23 17:22   ` Jonathan Cameron
2019-12-11 21:38 ` [PATCH 4/4] iio: accel: bma180: BMA254 support Linus Walleij
2019-12-19 21:49   ` Rob Herring
2019-12-23 17:28   ` Jonathan Cameron
2019-12-23 20:18     ` Linus Walleij
2019-12-23 17:18 ` Jonathan Cameron [this message]

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=20191223171811.634e10b7@archlinux \
    --to=jic23@kernel.org \
    --cc=knaack.h@gmx.de \
    --cc=lars@metafoo.de \
    --cc=linus.walleij@linaro.org \
    --cc=linux-iio@vger.kernel.org \
    --cc=o.v.kravchenko@globallogic.com \
    --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