diff mbox series

[RFC,1/5] iio: core: initialize 'modes' to INDIO_DIRECT_MODE by default

Message ID 20201203100423.77270-2-alexandru.ardelean@analog.com (mailing list archive)
State New, archived
Headers show
Series iio: move 'modes' initialization to core | expand

Commit Message

Alexandru Ardelean Dec. 3, 2020, 10:04 a.m. UTC
Most of the IIO drivers initialize to INDIO_DIRECT_MODE mode. Some
initialize to INDIO_BUFFER_SOFTWARE as a way to create an IIO device that
is just mostly an IIO buffer.

All IIO devices initialize the 'modes' parameter. Since this is
overwritten, might as well make INDIO_DIRECT_MODE the default. This would
not affect any current IIO driver.

Then for the IIO devices that only have direct-mode, this initialization
can be removed, since it becomes boiler-plate code.

Signed-off-by: Alexandru Ardelean <alexandru.ardelean@analog.com>
---
 drivers/iio/industrialio-core.c | 1 +
 1 file changed, 1 insertion(+)
diff mbox series

Patch

diff --git a/drivers/iio/industrialio-core.c b/drivers/iio/industrialio-core.c
index c2e4c267c36b..c1c8bde54444 100644
--- a/drivers/iio/industrialio-core.c
+++ b/drivers/iio/industrialio-core.c
@@ -1558,6 +1558,7 @@  struct iio_dev *iio_device_alloc(struct device *parent, int sizeof_priv)
 	dev->dev.parent = parent;
 	dev->dev.groups = dev->groups;
 	dev->dev.type = &iio_device_type;
+	dev->modes = INDIO_DIRECT_MODE;
 	dev->dev.bus = &iio_bus_type;
 	device_initialize(&dev->dev);
 	dev_set_drvdata(&dev->dev, (void *)dev);