From: Jonathan Cameron <jic23@kernel.org>
To: Akinobu Mita <akinobu.mita@gmail.com>
Cc: linux-iio@vger.kernel.org, Daniel Baluta <daniel.baluta@gmail.com>
Subject: Re: [PATCH v2 09/11] iio: adc: ti-ads1015: use devm_iio_triggered_buffer_setup
Date: Sun, 20 Aug 2017 12:00:05 +0100 [thread overview]
Message-ID: <20170820120005.58c0a617@archlinux> (raw)
In-Reply-To: <1500564267-8613-10-git-send-email-akinobu.mita@gmail.com>
On Fri, 21 Jul 2017 00:24:25 +0900
Akinobu Mita <akinobu.mita@gmail.com> wrote:
> Use devm_iio_triggered_buffer_setup to simplify the error path in the
> probe() and remove() function.
>
> This changes the remove order, but the end result of remove function
> actually does the reverse of probe.
>
> Cc: Daniel Baluta <daniel.baluta@gmail.com>
> Cc: Jonathan Cameron <jic23@kernel.org>
> Signed-off-by: Akinobu Mita <akinobu.mita@gmail.com>
Applied.
Thanks,
Joanthan
> ---
> drivers/iio/adc/ti-ads1015.c | 17 +++++------------
> 1 file changed, 5 insertions(+), 12 deletions(-)
>
> diff --git a/drivers/iio/adc/ti-ads1015.c b/drivers/iio/adc/ti-ads1015.c
> index 9f3f0c9..da25780 100644
> --- a/drivers/iio/adc/ti-ads1015.c
> +++ b/drivers/iio/adc/ti-ads1015.c
> @@ -627,9 +627,9 @@ static int ads1015_probe(struct i2c_client *client,
> return PTR_ERR(data->regmap);
> }
>
> - ret = iio_triggered_buffer_setup(indio_dev, NULL,
> - ads1015_trigger_handler,
> - &ads1015_buffer_setup_ops);
> + ret = devm_iio_triggered_buffer_setup(&client->dev, indio_dev, NULL,
> + ads1015_trigger_handler,
> + &ads1015_buffer_setup_ops);
> if (ret < 0) {
> dev_err(&client->dev, "iio triggered buffer setup failed\n");
> return ret;
> @@ -643,7 +643,7 @@ static int ads1015_probe(struct i2c_client *client,
>
> ret = pm_runtime_set_active(&client->dev);
> if (ret)
> - goto err_buffer_cleanup;
> + return ret;
> pm_runtime_set_autosuspend_delay(&client->dev, ADS1015_SLEEP_DELAY_MS);
> pm_runtime_use_autosuspend(&client->dev);
> pm_runtime_enable(&client->dev);
> @@ -651,15 +651,10 @@ static int ads1015_probe(struct i2c_client *client,
> ret = iio_device_register(indio_dev);
> if (ret < 0) {
> dev_err(&client->dev, "Failed to register IIO device\n");
> - goto err_buffer_cleanup;
> + return ret;
> }
>
> return 0;
> -
> -err_buffer_cleanup:
> - iio_triggered_buffer_cleanup(indio_dev);
> -
> - return ret;
> }
>
> static int ads1015_remove(struct i2c_client *client)
> @@ -673,8 +668,6 @@ static int ads1015_remove(struct i2c_client *client)
> pm_runtime_set_suspended(&client->dev);
> pm_runtime_put_noidle(&client->dev);
>
> - iio_triggered_buffer_cleanup(indio_dev);
> -
> /* power down single shot mode */
> return ads1015_set_conv_mode(data, ADS1015_SINGLESHOT);
> }
next prev parent reply other threads:[~2017-08-20 11:05 UTC|newest]
Thread overview: 33+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-07-20 15:24 [PATCH v2 00/11] iio: adc: ti-ads1015: fixes, cleanups, and threshold event support Akinobu Mita
2017-07-20 15:24 ` [PATCH v2 01/11] iio: adc: ti-ads1015: fix incorrect data rate setting update Akinobu Mita
2017-07-23 11:32 ` Jonathan Cameron
2017-08-20 10:51 ` Jonathan Cameron
2017-07-20 15:24 ` [PATCH v2 02/11] iio: adc: ti-ads1015: fix scale information for ADS1115 Akinobu Mita
2017-08-20 10:53 ` Jonathan Cameron
2017-07-20 15:24 ` [PATCH v2 03/11] iio: adc: ti-ads1015: enable conversion when CONFIG_PM is not set Akinobu Mita
2017-08-20 10:54 ` Jonathan Cameron
2017-07-20 15:24 ` [PATCH v2 04/11] iio: adc: ti-ads1015: avoid getting stale result after runtime resume Akinobu Mita
2017-08-20 10:55 ` Jonathan Cameron
2017-07-20 15:24 ` [PATCH v2 05/11] iio: adc: ti-ads1015: don't return invalid value from buffer setup callbacks Akinobu Mita
2017-08-20 10:56 ` Jonathan Cameron
2017-07-20 15:24 ` [PATCH v2 06/11] iio: adc: ti-ads1015: add adequate wait time to get correct conversion Akinobu Mita
2017-07-23 11:36 ` Jonathan Cameron
2017-08-20 10:57 ` Jonathan Cameron
2017-08-21 21:00 ` Ladislav Michl
2017-08-22 10:03 ` Akinobu Mita
2017-08-22 14:36 ` Ladislav Michl
2017-08-23 13:57 ` Akinobu Mita
2017-07-20 15:24 ` [PATCH v2 07/11] iio: adc: ti-ads1015: remove unnecessary config register update Akinobu Mita
2017-08-20 10:58 ` Jonathan Cameron
2017-07-20 15:24 ` [PATCH v2 08/11] iio: adc: ti-ads1015: add helper to set conversion mode Akinobu Mita
2017-08-20 10:59 ` Jonathan Cameron
2017-07-20 15:24 ` [PATCH v2 09/11] iio: adc: ti-ads1015: use devm_iio_triggered_buffer_setup Akinobu Mita
2017-08-20 11:00 ` Jonathan Cameron [this message]
2017-07-20 15:24 ` [PATCH v2 10/11] iio: adc: ti-ads1015: use iio_device_claim_direct_mode() Akinobu Mita
2017-08-20 11:00 ` Jonathan Cameron
2017-07-20 15:24 ` [PATCH v2 11/11] iio: adc: ti-ads1015: add threshold event support Akinobu Mita
2017-07-23 12:01 ` Jonathan Cameron
2017-08-20 11:05 ` Jonathan Cameron
2017-08-22 10:20 ` Akinobu Mita
2017-08-22 12:35 ` Jonathan Cameron
2017-08-22 12:38 ` 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=20170820120005.58c0a617@archlinux \
--to=jic23@kernel.org \
--cc=akinobu.mita@gmail.com \
--cc=daniel.baluta@gmail.com \
--cc=linux-iio@vger.kernel.org \
/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).