From: Cristian Birsan <cristian.birsan@microchip.com>
To: <broonie@kernel.org>
Cc: <nicolas.ferre@atmel.com>, <ludovic.desroches@atmel.com>,
<alexandre.belloni@free-electrons.com>,
<boris.brezillon@free-electrons.com>, <ce3a@gmx.de>,
<linux-arm-kernel@lists.infradead.org>,
<linux-kernel@vger.kernel.org>, <cristian.birsan@microchip.com>
Subject: [PATCH 1/2] regmap: Add a function to check if a regmap register is cached
Date: Thu, 4 Aug 2016 17:55:57 +0300 [thread overview]
Message-ID: <1470322558-7501-2-git-send-email-cristian.birsan@microchip.com> (raw)
In-Reply-To: <1470322558-7501-1-git-send-email-cristian.birsan@microchip.com>
Add a function to check if a regmap register is cached. This will be used
in debugfs to dump the cached values of write only registers.
Signed-off-by: Cristian Birsan <cristian.birsan@microchip.com>
---
drivers/base/regmap/internal.h | 1 +
drivers/base/regmap/regmap.c | 14 ++++++++++++++
2 files changed, 15 insertions(+)
diff --git a/drivers/base/regmap/internal.h b/drivers/base/regmap/internal.h
index 3df9770..cae04f4 100644
--- a/drivers/base/regmap/internal.h
+++ b/drivers/base/regmap/internal.h
@@ -171,6 +171,7 @@ struct regcache_ops {
int (*drop)(struct regmap *map, unsigned int min, unsigned int max);
};
+bool regmap_cached(struct regmap *map, unsigned int reg);
bool regmap_writeable(struct regmap *map, unsigned int reg);
bool regmap_readable(struct regmap *map, unsigned int reg);
bool regmap_volatile(struct regmap *map, unsigned int reg);
diff --git a/drivers/base/regmap/regmap.c b/drivers/base/regmap/regmap.c
index 4ac63c0..e07f3a9 100644
--- a/drivers/base/regmap/regmap.c
+++ b/drivers/base/regmap/regmap.c
@@ -92,6 +92,20 @@ bool regmap_writeable(struct regmap *map, unsigned int reg)
return true;
}
+bool regmap_cached(struct regmap *map, unsigned int reg)
+{
+ if (map->cache == REGCACHE_NONE)
+ return false;
+
+ if (!map->cache_ops)
+ return false;
+
+ if (map->max_register && reg > map->max_register)
+ return false;
+
+ return true;
+}
+
bool regmap_readable(struct regmap *map, unsigned int reg)
{
if (!map->reg_read)
--
1.9.1
next prev parent reply other threads:[~2016-08-04 14:58 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-08-04 14:55 [PATCH 0/2] Display regmap values in debugfs for write only registers Cristian Birsan
2016-08-04 14:55 ` Cristian Birsan [this message]
2016-08-04 15:39 ` [PATCH 1/2] regmap: Add a function to check if a regmap register is cached Lars-Peter Clausen
2016-08-04 15:48 ` Mark Brown
2016-08-08 15:44 ` [PATCH v2 0/2] Display regmap values in debugfs for write only registers Cristian Birsan
2016-08-08 15:44 ` [PATCH v2 1/2] regmap: Add a function to check if a regmap register is cached Cristian Birsan
2016-08-09 12:44 ` Applied "regmap: Add a function to check if a regmap register is cached" to the regmap tree Mark Brown
2016-08-08 15:44 ` [PATCH v2 2/2] regmap: debugfs: Add support for dumping write only device registers Cristian Birsan
2016-08-09 12:44 ` Applied "regmap: debugfs: Add support for dumping write only device registers" to the regmap tree Mark Brown
2016-08-09 13:11 ` kbuild test robot
2016-08-09 13:18 ` kbuild test robot
2016-08-10 12:15 ` Cristian Birsan
2016-08-04 14:55 ` [PATCH 2/2] regmap: debugfs: Add support for dumping write only device registers Cristian Birsan
2016-08-04 20:26 ` Mark Brown
2016-08-05 8:26 ` Nicolas Ferre
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=1470322558-7501-2-git-send-email-cristian.birsan@microchip.com \
--to=cristian.birsan@microchip.com \
--cc=alexandre.belloni@free-electrons.com \
--cc=boris.brezillon@free-electrons.com \
--cc=broonie@kernel.org \
--cc=ce3a@gmx.de \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=ludovic.desroches@atmel.com \
--cc=nicolas.ferre@atmel.com \
/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
all inboxes | Powered by JetHome®