@@ -197,7 +197,7 @@ static const char * const iio_chan_info_postfix[] = {
*
* Returns: Unique ID for the device.
*/
-int iio_device_id(struct iio_dev *indio_dev)
+int iio_device_id(const struct iio_dev *indio_dev)
{
struct iio_dev_opaque *iio_dev_opaque = to_iio_dev_opaque(indio_dev);
@@ -211,7 +211,7 @@ EXPORT_SYMBOL_GPL(iio_device_id);
*
* Returns: True, if the buffer is enabled.
*/
-bool iio_buffer_enabled(struct iio_dev *indio_dev)
+bool iio_buffer_enabled(const struct iio_dev *indio_dev)
{
struct iio_dev_opaque *iio_dev_opaque = to_iio_dev_opaque(indio_dev);
@@ -2227,7 +2227,7 @@ EXPORT_SYMBOL_GPL(iio_device_release_buffer_mode);
* the opaque @currentmode variable
* @indio_dev: IIO device structure for device
*/
-int iio_device_get_current_mode(struct iio_dev *indio_dev)
+int iio_device_get_current_mode(const struct iio_dev *indio_dev)
{
struct iio_dev_opaque *iio_dev_opaque = to_iio_dev_opaque(indio_dev);
@@ -627,9 +627,9 @@ struct iio_dev {
void *__private priv;
};
-int iio_device_id(struct iio_dev *indio_dev);
-int iio_device_get_current_mode(struct iio_dev *indio_dev);
-bool iio_buffer_enabled(struct iio_dev *indio_dev);
+int iio_device_id(const struct iio_dev *indio_dev);
+int iio_device_get_current_mode(const struct iio_dev *indio_dev);
+bool iio_buffer_enabled(const struct iio_dev *indio_dev);
const struct iio_chan_spec
*iio_find_channel_from_si(struct iio_dev *indio_dev, int si);
get_current_scan_type read-only method allows to support multiple scan types per channel, which may also depend on a buffer enabled state. Mark iio_dev as const in iio_device_id, iio_device_get_current_mode, iio_buffer_enabled read-only methods so they can be used from other read-only methods. Signed-off-by: Jorge Marques <jorge.marques@analog.com> --- drivers/iio/industrialio-core.c | 6 +++--- include/linux/iio/iio.h | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) --- base-commit: 7eb172143d5508b4da468ed59ee857c6e5e01da6 change-id: 20250303-b4-iio-dev-const-cc26bac40292 Best regards,