Commit 2f53b4ad authored by Miquel Raynal's avatar Miquel Raynal Committed by Jonathan Cameron
Browse files

iio: Un-inline iio_buffer_enabled()



As we are going to hide the currentmode inside the opaque structure,
this helper would soon need to call a non-inline function which would
simply drop the benefit of having the helper defined inline in a header.

One alternative is to move this helper in the core as there is no more
interest in defining it inline in a header. We will pay the minor cost
either way.

Let's do like the iio_device_id() helper which also refers to the opaque
structure and gets defined in the core.

Suggested-by: default avatarJonathan Cameron <jic23@kernel.org>
Signed-off-by: default avatarMiquel Raynal <miquel.raynal@bootlin.com>
Link: https://lore.kernel.org/r/20220207143840.707510-10-miquel.raynal@bootlin.com


Signed-off-by: default avatarJonathan Cameron <Jonathan.Cameron@huawei.com>
parent 2da03b43
Loading
Loading
Loading
Loading
+12 −0
Original line number Diff line number Diff line
@@ -184,6 +184,18 @@ int iio_device_id(struct iio_dev *indio_dev)
}
EXPORT_SYMBOL_GPL(iio_device_id);

/**
 * iio_buffer_enabled() - helper function to test if the buffer is enabled
 * @indio_dev:		IIO device structure for device
 */
bool iio_buffer_enabled(struct iio_dev *indio_dev)
{
	return indio_dev->currentmode
		& (INDIO_BUFFER_TRIGGERED | INDIO_BUFFER_HARDWARE |
		   INDIO_BUFFER_SOFTWARE);
}
EXPORT_SYMBOL_GPL(iio_buffer_enabled);

/**
 * iio_sysfs_match_string_with_gaps - matches given string in an array with gaps
 * @array: array of strings
+1 −10
Original line number Diff line number Diff line
@@ -550,6 +550,7 @@ struct iio_dev {
};

int iio_device_id(struct iio_dev *indio_dev);
bool iio_buffer_enabled(struct iio_dev *indio_dev);

const struct iio_chan_spec
*iio_find_channel_from_si(struct iio_dev *indio_dev, int si);
@@ -679,16 +680,6 @@ struct iio_dev *devm_iio_device_alloc(struct device *parent, int sizeof_priv);
__printf(2, 3)
struct iio_trigger *devm_iio_trigger_alloc(struct device *parent,
					   const char *fmt, ...);
/**
 * iio_buffer_enabled() - helper function to test if the buffer is enabled
 * @indio_dev:		IIO device structure for device
 **/
static inline bool iio_buffer_enabled(struct iio_dev *indio_dev)
{
	return indio_dev->currentmode
		& (INDIO_BUFFER_TRIGGERED | INDIO_BUFFER_HARDWARE |
		   INDIO_BUFFER_SOFTWARE);
}

/**
 * iio_get_debugfs_dentry() - helper function to get the debugfs_dentry