summaryrefslogtreecommitdiff
path: root/drivers
diff options
context:
space:
mode:
authorMarek Vasut <marex@denx.de>2022-03-28 22:47:18 +0300
committerJonathan Cameron <Jonathan.Cameron@huawei.com>2022-04-04 11:11:26 +0300
commitc86334652ac66f3e21c04dffbba766c57ff1f050 (patch)
treee545d665570c4afbe7ad06549e08c320962d32f3 /drivers
parent94d9f3cb97f4a2c88d9040504cfcef114adb0741 (diff)
downloadlinux-c86334652ac66f3e21c04dffbba766c57ff1f050.tar.xz
iio: adc: ti-ads1015: Switch to static const writeable ranges table
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> Reviewed-by: Andy Shevchenko <andy@kernel.org> Cc: Daniel Baluta <daniel.baluta@nxp.com> Link: https://lore.kernel.org/r/20220328194725.149150-3-marex@denx.de Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/iio/adc/ti-ads1015.c21
1 files changed, 9 insertions, 12 deletions
diff --git a/drivers/iio/adc/ti-ads1015.c b/drivers/iio/adc/ti-ads1015.c
index 068efbce1710..85932b9dc166 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[] = {