From: Marek Vasut <marex@denx.de>
To: linux-iio@vger.kernel.org
Cc: Marek Vasut <marex@denx.de>,
Andy Shevchenko <andriy.shevchenko@linux.intel.com>,
Andy Shevchenko <andy.shevchenko@gmail.com>,
Daniel Baluta <daniel.baluta@nxp.com>,
Jonathan Cameron <Jonathan.Cameron@huawei.com>
Subject: [PATCH 3/6] iio: adc: ti-ads1015: Switch to static const writeable ranges table
Date: Thu, 10 Mar 2022 01:33:59 +0100 [thread overview]
Message-ID: <20220310003402.490478-3-marex@denx.de> (raw)
In-Reply-To: <20220310003402.490478-1-marex@denx.de>
Switch the driver from code implementing test whether a regmap register
is writeable to static const tables describing the test. No functional
change.
Signed-off-by: Marek Vasut <marex@denx.de>
Cc: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Cc: Andy Shevchenko <andy.shevchenko@gmail.com>
Cc: Daniel Baluta <daniel.baluta@nxp.com>
Cc: Jonathan Cameron <Jonathan.Cameron@huawei.com>
---
drivers/iio/adc/ti-ads1015.c | 21 +++++++++------------
1 file changed, 9 insertions(+), 12 deletions(-)
diff --git a/drivers/iio/adc/ti-ads1015.c b/drivers/iio/adc/ti-ads1015.c
index 068efbce17103..85932b9dc166a 100644
--- a/drivers/iio/adc/ti-ads1015.c
+++ b/drivers/iio/adc/ti-ads1015.c
@@ -273,23 +273,20 @@ static void ads1015_event_channel_disable(struct ads1015_data *data, int chan)
data->event_channel = ADS1015_CHANNELS;
}
-static bool ads1015_is_writeable_reg(struct device *dev, unsigned int reg)
-{
- switch (reg) {
- case ADS1015_CFG_REG:
- case ADS1015_LO_THRESH_REG:
- case ADS1015_HI_THRESH_REG:
- return true;
- default:
- return false;
- }
-}
+static const struct regmap_range ads1015_writeable_ranges[] = {
+ regmap_reg_range(ADS1015_CFG_REG, ADS1015_HI_THRESH_REG),
+};
+
+static const struct regmap_access_table ads1015_writeable_table = {
+ .yes_ranges = ads1015_writeable_ranges,
+ .n_yes_ranges = ARRAY_SIZE(ads1015_writeable_ranges),
+};
static const struct regmap_config ads1015_regmap_config = {
.reg_bits = 8,
.val_bits = 16,
.max_register = ADS1015_HI_THRESH_REG,
- .writeable_reg = ads1015_is_writeable_reg,
+ .wr_table = &ads1015_writeable_table,
};
static const struct iio_chan_spec ads1015_channels[] = {
--
2.34.1
next prev parent reply other threads:[~2022-03-10 0:34 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-03-10 0:33 [PATCH 1/6] dt-bindings: iio: adc: ti,ads1015: Add missing ADS1115 compatible string Marek Vasut
2022-03-10 0:33 ` [PATCH 2/6] dt-bindings: iio: adc: ti,ads1015: Add TLA2024 " Marek Vasut
2022-03-10 12:52 ` Krzysztof Kozlowski
2022-03-10 0:33 ` Marek Vasut [this message]
2022-03-10 0:34 ` [PATCH 4/6] iio: adc: ti-ads1015: Deduplicate channel macros Marek Vasut
2022-03-10 14:25 ` Andy Shevchenko
2022-03-10 23:29 ` Marek Vasut
2022-03-11 11:29 ` Andy Shevchenko
2022-03-11 11:33 ` Marek Vasut
2022-03-11 17:03 ` Andy Shevchenko
2022-03-11 18:51 ` Marek Vasut
2022-03-20 13:22 ` Jonathan Cameron
2022-03-10 0:34 ` [PATCH 5/6] iio: adc: ti-ads1015: Make channel event_spec optional Marek Vasut
2022-03-10 0:34 ` [PATCH 6/6] iio: adc: ti-ads1015: Add TLA2024 support Marek Vasut
2022-03-10 12:51 ` [PATCH 1/6] dt-bindings: iio: adc: ti,ads1015: Add missing ADS1115 compatible string Krzysztof Kozlowski
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=20220310003402.490478-3-marex@denx.de \
--to=marex@denx.de \
--cc=Jonathan.Cameron@huawei.com \
--cc=andriy.shevchenko@linux.intel.com \
--cc=andy.shevchenko@gmail.com \
--cc=daniel.baluta@nxp.com \
--cc=linux-iio@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