Patchwork [V2,1/5] regmap: add helper macro to set min/max range of register

login
register
mail settings
Submitter Laxman Dewangan
Date Sept. 20, 2013, 12:30 p.m.
Message ID <1379680214-9143-2-git-send-email-ldewangan@nvidia.com>
Download mbox | patch
Permalink /patch/276386/
State New
Headers show

Comments

Laxman Dewangan - Sept. 20, 2013, 12:30 p.m.
Add helper macro to set the min and max value of the register range.

This is useful when initialising the register ranges of the device like

static const struct regmap_range readable_ranges[] = {
	regmap_reg_range(DEVICE_REG0, DEVICE_REG10),
};

Signed-off-by: Laxman Dewangan <ldewangan@nvidia.com>
---
As per Mark's comment on V1 series, adding the macro in header in place
of defining in driver.
This should go on same tree as 2/5.

 include/linux/regmap.h |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)
Mark Brown - Sept. 20, 2013, 4:56 p.m.
On Fri, Sep 20, 2013 at 06:00:10PM +0530, Laxman Dewangan wrote:
> Add helper macro to set the min and max value of the register range.
> 
> This is useful when initialising the register ranges of the device like

Applied on a branch, thanks - please feel free to pull

 git://git.kernel.org/pub/scm/linux/kernel/git/broonie/regmap.git regmap-range-macro

in for anything that depends on it.

Patch

diff --git a/include/linux/regmap.h b/include/linux/regmap.h
index 4c8c20a..047e8dc 100644
--- a/include/linux/regmap.h
+++ b/include/linux/regmap.h
@@ -70,6 +70,8 @@  struct regmap_range {
 	unsigned int range_max;
 };
 
+#define regmap_reg_range(low, high) { .range_min = low, .range_max = high, }
+
 /*
  * A table of ranges including some yes ranges and some no ranges.
  * If a register belongs to a no_range, the corresponding check function