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

From: Alexandru Ardelean
Date: Thu Dec 03 2020 - 05:06:00 EST


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@xxxxxxxxxx>
---
drivers/iio/industrialio-core.c | 1 +
1 file changed, 1 insertion(+)

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);
--
2.27.0