From: Akinobu Mita <akinobu.mita@gmail.com>
To: linux-iio@vger.kernel.org
Cc: Akinobu Mita <akinobu.mita@gmail.com>,
Daniel Baluta <daniel.baluta@gmail.com>,
Jonathan Cameron <jic23@kernel.org>
Subject: [PATCH v3 09/11] iio: adc: ti-ads1015: use devm_iio_triggered_buffer_setup
Date: Mon, 31 Jul 2017 00:12:53 +0900 [thread overview]
Message-ID: <1501427575-31045-10-git-send-email-akinobu.mita@gmail.com> (raw)
In-Reply-To: <1501427575-31045-1-git-send-email-akinobu.mita@gmail.com>
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>
---
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);
}
--
2.7.4
next prev parent reply other threads:[~2017-07-30 15:13 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-07-30 15:12 [PATCH v3 00/11] iio: adc: ti-ads1015: fixes, cleanups, and threshold event support Akinobu Mita
2017-07-30 15:12 ` [PATCH v3 01/11] iio: adc: ti-ads1015: fix incorrect data rate setting update Akinobu Mita
2017-07-30 16:57 ` Jonathan Cameron
2017-07-30 15:12 ` [PATCH v3 02/11] iio: adc: ti-ads1015: fix scale information for ADS1115 Akinobu Mita
2017-07-30 16:58 ` Jonathan Cameron
2017-07-30 15:12 ` [PATCH v3 03/11] iio: adc: ti-ads1015: enable conversion when CONFIG_PM is not set Akinobu Mita
2017-07-30 16:59 ` Jonathan Cameron
2017-07-30 15:12 ` [PATCH v3 04/11] iio: adc: ti-ads1015: avoid getting stale result after runtime resume Akinobu Mita
2017-07-30 17:00 ` Jonathan Cameron
2017-07-30 15:12 ` [PATCH v3 05/11] iio: adc: ti-ads1015: don't return invalid value from buffer setup callbacks Akinobu Mita
2017-07-30 17:01 ` Jonathan Cameron
2017-07-30 15:12 ` [PATCH v3 06/11] iio: adc: ti-ads1015: add adequate wait time to get correct conversion Akinobu Mita
2017-07-30 17:03 ` Jonathan Cameron
2017-07-30 15:12 ` [PATCH v3 07/11] iio: adc: ti-ads1015: remove unnecessary config register update Akinobu Mita
2017-07-30 15:12 ` [PATCH v3 08/11] iio: adc: ti-ads1015: add helper to set conversion mode Akinobu Mita
2017-07-30 15:12 ` Akinobu Mita [this message]
2017-07-30 15:12 ` [PATCH v3 10/11] iio: adc: ti-ads1015: use iio_device_claim_direct_mode() Akinobu Mita
2017-07-30 15:12 ` [PATCH v3 11/11] iio: adc: ti-ads1015: add threshold event support Akinobu Mita
2017-07-30 16:58 ` Jonathan Cameron
2017-09-30 17:32 ` Jonathan Cameron
2017-10-02 13:30 ` Akinobu Mita
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=1501427575-31045-10-git-send-email-akinobu.mita@gmail.com \
--to=akinobu.mita@gmail.com \
--cc=daniel.baluta@gmail.com \
--cc=jic23@kernel.org \
--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).