linux-iio.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2] iio: consumer: Mark struct iio_channel parameter to iio_get_channel_type() const
@ 2022-08-21 16:26 Jonathan Cameron
  0 siblings, 0 replies; only message in thread
From: Jonathan Cameron @ 2022-08-21 16:26 UTC (permalink / raw)
  To: linux-iio; +Cc: Jonathan Cameron

From: Jonathan Cameron <Jonathan.Cameron@huawei.com>

This accessor is only reading data via this pointer, so make the fact
it is const explicit.

Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>

---
v2: the content to match the description. ooops.

Used in a clean up to sound/soc/samsung/aries_wm8994 where
the struct iio_channel pointer is marked const.
---
 drivers/iio/inkern.c         | 2 +-
 include/linux/iio/consumer.h | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/iio/inkern.c b/drivers/iio/inkern.c
index 872fd5c24147..ac47cd453d1b 100644
--- a/drivers/iio/inkern.c
+++ b/drivers/iio/inkern.c
@@ -912,7 +912,7 @@ int iio_read_max_channel_raw(struct iio_channel *chan, int *val)
 }
 EXPORT_SYMBOL_GPL(iio_read_max_channel_raw);
 
-int iio_get_channel_type(struct iio_channel *chan, enum iio_chan_type *type)
+int iio_get_channel_type(const struct iio_channel *chan, enum iio_chan_type *type)
 {
 	struct iio_dev_opaque *iio_dev_opaque = to_iio_dev_opaque(chan->indio_dev);
 	int ret = 0;
diff --git a/include/linux/iio/consumer.h b/include/linux/iio/consumer.h
index 6802596b017c..a73c67baae2a 100644
--- a/include/linux/iio/consumer.h
+++ b/include/linux/iio/consumer.h
@@ -335,7 +335,7 @@ int iio_read_avail_channel_attribute(struct iio_channel *chan,
  *
  * returns the enum iio_chan_type of the channel
  */
-int iio_get_channel_type(struct iio_channel *channel,
+int iio_get_channel_type(const struct iio_channel *channel,
 			 enum iio_chan_type *type);
 
 /**
-- 
2.37.2


^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2022-08-21 17:01 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-08-21 16:26 [PATCH v2] iio: consumer: Mark struct iio_channel parameter to iio_get_channel_type() const Jonathan Cameron

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).