[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20240730084640.1307938-3-olivier.moysan@foss.st.com>
Date: Tue, 30 Jul 2024 10:46:32 +0200
From: Olivier Moysan <olivier.moysan@...s.st.com>
To: <fabrice.gasnier@...s.st.com>, Nuno Sa <nuno.sa@...log.com>,
Olivier
Moysan <olivier.moysan@...s.st.com>,
Jonathan Cameron <jic23@...nel.org>,
Lars-Peter Clausen <lars@...afoo.de>
CC: <linux-iio@...r.kernel.org>, <linux-kernel@...r.kernel.org>
Subject: [PATCH v6 2/9] iio: add enable and disable services to iio backend framework
Add iio_backend_disable() and iio_backend_enable() APIs to allow
IIO backend consumer to request backend disabling and enabling.
Signed-off-by: Olivier Moysan <olivier.moysan@...s.st.com>
Reviewed-by: Nuno Sa <nuno.sa@...log.com>
---
drivers/iio/industrialio-backend.c | 25 ++++++++++++++++++++++++-
include/linux/iio/backend.h | 2 ++
2 files changed, 26 insertions(+), 1 deletion(-)
diff --git a/drivers/iio/industrialio-backend.c b/drivers/iio/industrialio-backend.c
index 72dc82a42d8f..b53904b03464 100644
--- a/drivers/iio/industrialio-backend.c
+++ b/drivers/iio/industrialio-backend.c
@@ -150,6 +150,29 @@ static void __iio_backend_disable(void *back)
iio_backend_void_op_call(back, disable);
}
+/**
+ * iio_backend_disable - Backend disable
+ * @back: Backend device
+ */
+void iio_backend_disable(struct iio_backend *back)
+{
+ __iio_backend_disable(back);
+}
+EXPORT_SYMBOL_NS_GPL(iio_backend_disable, IIO_BACKEND);
+
+/**
+ * iio_backend_enable - Backend enable
+ * @back: Backend device
+ *
+ * RETURNS:
+ * 0 on success, negative error number on failure.
+ */
+int iio_backend_enable(struct iio_backend *back)
+{
+ return iio_backend_op_call(back, enable);
+}
+EXPORT_SYMBOL_NS_GPL(iio_backend_enable, IIO_BACKEND);
+
/**
* devm_iio_backend_enable - Device managed backend enable
* @dev: Consumer device for the backend
@@ -162,7 +185,7 @@ int devm_iio_backend_enable(struct device *dev, struct iio_backend *back)
{
int ret;
- ret = iio_backend_op_call(back, enable);
+ ret = iio_backend_enable(back);
if (ret)
return ret;
diff --git a/include/linux/iio/backend.h b/include/linux/iio/backend.h
index 18b20426c25e..25fce30f08d8 100644
--- a/include/linux/iio/backend.h
+++ b/include/linux/iio/backend.h
@@ -123,6 +123,8 @@ struct iio_backend_ops {
int iio_backend_chan_enable(struct iio_backend *back, unsigned int chan);
int iio_backend_chan_disable(struct iio_backend *back, unsigned int chan);
int devm_iio_backend_enable(struct device *dev, struct iio_backend *back);
+int iio_backend_enable(struct iio_backend *back);
+void iio_backend_disable(struct iio_backend *back);
int iio_backend_data_format_set(struct iio_backend *back, unsigned int chan,
const struct iio_backend_data_fmt *data);
int iio_backend_data_source_set(struct iio_backend *back, unsigned int chan,
--
2.25.1
Powered by blists - more mailing lists