All of lore.kernel.org
 help / color / mirror / Atom feed
From: Alexandru Ardelean <alexandru.ardelean@analog.com>
To: <linux-iio@vger.kernel.org>, <linux-kernel@vger.kernel.org>
Cc: <jic23@kernel.org>, <eugen.hristev@microchip.com>,
	<nicolas.ferre@microchip.com>, <ludovic.desroches@microchip.com>,
	<bleung@chromium.org>, <enric.balletbo@collabora.com>,
	<groeck@chromium.org>, <srinivas.pandruvada@linux.intel.com>,
	<andy.shevchenko@gmail.com>, <gwendal@chromium.org>,
	Alexandru Ardelean <alexandru.ardelean@analog.com>
Subject: [PATCH v2 8/9] iio: hid-sensors: use iio_triggered_buffer_setup_ext()
Date: Tue, 29 Sep 2020 10:09:07 +0300	[thread overview]
Message-ID: <20200929070908.10456-9-alexandru.ardelean@analog.com> (raw)
In-Reply-To: <20200929070908.10456-1-alexandru.ardelean@analog.com>

This change switches to the new iio_triggered_buffer_setup_ext()
function and removes the iio_buffer_set_attrs() call, for assigning the
HW FIFO attributes to the buffer.

Signed-off-by: Alexandru Ardelean <alexandru.ardelean@analog.com>
---
 .../common/hid-sensors/hid-sensor-trigger.c   | 22 ++++++++-----------
 1 file changed, 9 insertions(+), 13 deletions(-)

diff --git a/drivers/iio/common/hid-sensors/hid-sensor-trigger.c b/drivers/iio/common/hid-sensors/hid-sensor-trigger.c
index ff375790b7e8..064c32bec9c7 100644
--- a/drivers/iio/common/hid-sensors/hid-sensor-trigger.c
+++ b/drivers/iio/common/hid-sensors/hid-sensor-trigger.c
@@ -84,15 +84,6 @@ static const struct attribute *hid_sensor_fifo_attributes[] = {
 	NULL,
 };
 
-static void hid_sensor_setup_batch_mode(struct iio_dev *indio_dev,
-					struct hid_sensor_common *st)
-{
-	if (!hid_sensor_batch_mode_supported(st))
-		return;
-
-	iio_buffer_set_attrs(indio_dev->buffer, hid_sensor_fifo_attributes);
-}
-
 static int _hid_sensor_power_state(struct hid_sensor_common *st, bool state)
 {
 	int state_val;
@@ -247,11 +238,18 @@ static const struct iio_trigger_ops hid_sensor_trigger_ops = {
 int hid_sensor_setup_trigger(struct iio_dev *indio_dev, const char *name,
 				struct hid_sensor_common *attrb)
 {
+	const struct attribute **fifo_attrs;
 	int ret;
 	struct iio_trigger *trig;
 
-	ret = iio_triggered_buffer_setup(indio_dev, &iio_pollfunc_store_time,
-					 NULL, NULL);
+	if (hid_sensor_batch_mode_supported(attrb))
+		fifo_attrs = hid_sensor_fifo_attributes;
+	else
+		fifo_attrs = NULL;
+
+	ret = iio_triggered_buffer_setup_ext(indio_dev,
+					     &iio_pollfunc_store_time,
+					     NULL, NULL, fifo_attrs);
 	if (ret) {
 		dev_err(&indio_dev->dev, "Triggered Buffer Setup Failed\n");
 		return ret;
@@ -276,8 +274,6 @@ int hid_sensor_setup_trigger(struct iio_dev *indio_dev, const char *name,
 	attrb->trigger = trig;
 	indio_dev->trig = iio_trigger_get(trig);
 
-	hid_sensor_setup_batch_mode(indio_dev, attrb);
-
 	ret = pm_runtime_set_active(&indio_dev->dev);
 	if (ret)
 		goto error_unreg_trigger;
-- 
2.17.1


  parent reply	other threads:[~2020-09-29  7:10 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-09-29  7:08 [PATCH v2 0/9] iio: remove iio_buffer_set_attrs() and assign buffer attrs during alloc Alexandru Ardelean
2020-09-29  7:09 ` [PATCH v2 1/9] iio: buffer: dmaengine: unwrap the use of iio_buffer_set_attrs() Alexandru Ardelean
2020-09-29  7:48   ` Andy Shevchenko
2020-09-29  8:13     ` Alexandru Ardelean
2020-09-29  7:09 ` [PATCH v2 2/9] iio: adc: at91-sama5d2_adc: merge buffer & trigger init into a function Alexandru Ardelean
2020-09-29  7:09 ` [PATCH v2 3/9] iio: triggered-buffer: add {devm_}iio_triggered_buffer_setup_ext variants Alexandru Ardelean
2020-09-29  7:09 ` [PATCH v2 4/9] iio: accel: adxl372: use devm_iio_triggered_buffer_setup_ext() Alexandru Ardelean
2020-09-29  7:09 ` [PATCH v2 5/9] iio: accel: bmc150: use iio_triggered_buffer_setup_ext() Alexandru Ardelean
2020-09-29  7:09 ` [PATCH v2 6/9] iio: adc: at91-sama5d2_adc: use devm_iio_triggered_buffer_setup_ext() Alexandru Ardelean
2020-09-29  7:09 ` [PATCH v2 7/9] iio: cros_ec: " Alexandru Ardelean
2020-09-29  7:09 ` Alexandru Ardelean [this message]
2020-09-29  7:09 ` [PATCH v2 9/9] iio: buffer: remove iio_buffer_set_attrs() helper Alexandru Ardelean

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=20200929070908.10456-9-alexandru.ardelean@analog.com \
    --to=alexandru.ardelean@analog.com \
    --cc=andy.shevchenko@gmail.com \
    --cc=bleung@chromium.org \
    --cc=enric.balletbo@collabora.com \
    --cc=eugen.hristev@microchip.com \
    --cc=groeck@chromium.org \
    --cc=gwendal@chromium.org \
    --cc=jic23@kernel.org \
    --cc=linux-iio@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=ludovic.desroches@microchip.com \
    --cc=nicolas.ferre@microchip.com \
    --cc=srinivas.pandruvada@linux.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.