From 76aad392f75e6ce5be3f106554e16f7ff96543e5 Mon Sep 17 00:00:00 2001 From: Davide Ciminaghi Date: Tue, 20 Nov 2012 15:20:30 +0100 Subject: regmap: introduce tables for readable/writeable/volatile/precious checks Many of the regmap enabled drivers implementing one or more of the readable, writeable, volatile and precious methods use the same code pattern: return ((reg >= X && reg <= Y) || (reg >= W && reg <= Z) || ...) Switch to a data driven approach, using tables to describe readable/writeable/volatile and precious registers ranges instead. The table based check can still be overridden by passing the usual function pointers via struct regmap_config. Signed-off-by: Davide Ciminaghi Signed-off-by: Mark Brown --- drivers/base/regmap/internal.h | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'drivers/base/regmap/internal.h') diff --git a/drivers/base/regmap/internal.h b/drivers/base/regmap/internal.h index 2cd01b5..288e135 100644 --- a/drivers/base/regmap/internal.h +++ b/drivers/base/regmap/internal.h @@ -55,6 +55,10 @@ struct regmap { bool (*readable_reg)(struct device *dev, unsigned int reg); bool (*volatile_reg)(struct device *dev, unsigned int reg); bool (*precious_reg)(struct device *dev, unsigned int reg); + const struct regmap_access_table *wr_table; + const struct regmap_access_table *rd_table; + const struct regmap_access_table *volatile_table; + const struct regmap_access_table *precious_table; u8 read_flag_mask; u8 write_flag_mask; -- cgit v1.1