From: Alexandru Ardelean <alexandru.ardelean@analog.com>
To: <linux-iio@vger.kernel.org>, <linux-kernel@vger.kernel.org>
Cc: <jic23@kernel.org>, <lars@metafoo.de>,
Alexandru Ardelean <alexandru.ardelean@analog.com>
Subject: [RFC PATCH 1/5] iio: core: initialize 'modes' to INDIO_DIRECT_MODE by default
Date: Thu, 3 Dec 2020 12:04:19 +0200 [thread overview]
Message-ID: <20201203100423.77270-2-alexandru.ardelean@analog.com> (raw)
In-Reply-To: <20201203100423.77270-1-alexandru.ardelean@analog.com>
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 --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
next prev parent reply other threads:[~2020-12-03 10:05 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-12-03 10:04 [RFC PATCH 0/5] iio: move 'modes' initialization to core Alexandru Ardelean
2020-12-03 10:04 ` Alexandru Ardelean [this message]
2020-12-03 10:04 ` [RFC PATCH 3/5] iio: remove modes init for INDIO_DIRECT_MODE only drivers (manual) Alexandru Ardelean
2020-12-03 10:04 ` [RFC PATCH 4/5] iio: adc: ad7768-1: remove explicit modes initialization Alexandru Ardelean
2020-12-03 10:04 ` [RFC PATCH 5/5] iio: magnetometer: rm3100: " Alexandru Ardelean
2020-12-05 16:59 ` [RFC PATCH 0/5] iio: move 'modes' initialization to core Jonathan Cameron
2020-12-21 7:39 ` Alexandru Ardelean
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20201203100423.77270-2-alexandru.ardelean@analog.com \
--to=alexandru.ardelean@analog.com \
--cc=jic23@kernel.org \
--cc=lars@metafoo.de \
--cc=linux-iio@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).