History log of /linux-master/drivers/base/regmap/regmap-debugfs.c
Revision Date Author Comments
# 5e0a760b 28-Dec-2023 Kirill A. Shutemov <kirill.shutemov@linux.intel.com>

mm, treewide: rename MAX_ORDER to MAX_PAGE_ORDER

commit 23baf831a32c ("mm, treewide: redefine MAX_ORDER sanely") has
changed the definition of MAX_ORDER to be inclusive. This has caused
issues with code that was not yet upstream and depended on the previous
definition.

To draw attention to the altered meaning of the define, rename MAX_ORDER
to MAX_PAGE_ORDER.

Link: https://lkml.kernel.org/r/20231228144704.14033-2-kirill.shutemov@linux.intel.com
Signed-off-by: Kirill A. Shutemov <kirill.shutemov@linux.intel.com>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>


# d3601857 04-Sep-2023 Christophe JAILLET <christophe.jaillet@wanadoo.fr>

regmap: debugfs: Fix a erroneous check after snprintf()

This error handling looks really strange.
Check if the string has been truncated instead.

Fixes: f0c2319f9f19 ("regmap: Expose the driver name in debugfs")
Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
Link: https://lore.kernel.org/r/8595de2462c490561f70020a6d11f4d6b652b468.1693857825.git.christophe.jaillet@wanadoo.fr
Signed-off-by: Mark Brown <broonie@kernel.org>


# b629c698 13-Jun-2023 Waqar Hameed <waqar.hameed@axis.com>

regmap: Add debugfs file for forcing field writes

`_regmap_update_bits()` checks if the current register value differs
from the new value, and only writes to the register if they differ. When
testing hardware drivers, it might be desirable to always force a
register write, for example when writing to a `regmap_field`. This
enables and simplifies testing and verification of the hardware
interaction. For example, when using a hardware mock/simulation model,
one can then more easily verify that the driver makes the correct
expected register writes during certain events.

Add a bool variable `force_write_field` and a corresponding debugfs
entry to enable this. Since this feature could interfere with driver
operation, guard it with a macro.

Signed-off-by: Waqar Hameed <waqar.hameed@axis.com>
Link: https://lore.kernel.org/r/pnd1qifa7sj.fsf@axis.com
Signed-off-by: Mark Brown <broonie@kernel.org>


# 23baf831 15-Mar-2023 Kirill A. Shutemov <kirill.shutemov@linux.intel.com>

mm, treewide: redefine MAX_ORDER sanely

MAX_ORDER currently defined as number of orders page allocator supports:
user can ask buddy allocator for page order between 0 and MAX_ORDER-1.

This definition is counter-intuitive and lead to number of bugs all over
the kernel.

Change the definition of MAX_ORDER to be inclusive: the range of orders
user can ask from buddy allocator is 0..MAX_ORDER now.

[kirill@shutemov.name: fix min() warning]
Link: https://lkml.kernel.org/r/20230315153800.32wib3n5rickolvh@box
[akpm@linux-foundation.org: fix another min_t warning]
[kirill@shutemov.name: fixups per Zi Yan]
Link: https://lkml.kernel.org/r/20230316232144.b7ic4cif4kjiabws@box.shutemov.name
[akpm@linux-foundation.org: fix underlining in docs]
Link: https://lore.kernel.org/oe-kbuild-all/202303191025.VRCTk6mP-lkp@intel.com/
Link: https://lkml.kernel.org/r/20230315113133.11326-11-kirill.shutemov@linux.intel.com
Signed-off-by: Kirill A. Shutemov <kirill.shutemov@linux.intel.com>
Reviewed-by: Michael Ellerman <mpe@ellerman.id.au> [powerpc]
Cc: "Kirill A. Shutemov" <kirill@shutemov.name>
Cc: Zi Yan <ziy@nvidia.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>


# b56a7cbf 07-Jan-2022 Mark Brown <broonie@kernel.org>

regmap: debugfs: Fix indentation

Signed-off-by: Mark Brown <broonie@kernel.org>
Link: https://lore.kernel.org/r/20220107191145.813876-1-broonie@kernel.org
Signed-off-by: Mark Brown <broonie@kernel.org>


# d63aa09f 28-Jun-2021 Jinchao Wang <wjc@cdjrlc.com>

regmap: Prefer unsigned int to bare use of unsigned

Fix checkpatch warnings:
WARNING: Prefer 'unsigned int' to bare use of 'unsigned'

Signed-off-by: Jinchao Wang <wjc@cdjrlc.com>
Link: https://lore.kernel.org/r/20210628171907.63646-1-wjc@cdjrlc.com
Signed-off-by: Mark Brown <broonie@kernel.org>


# e41a962f 25-Feb-2021 Meng Li <Meng.Li@windriver.com>

regmap: set debugfs_name to NULL after it is freed

There is a upstream commit cffa4b2122f5("regmap:debugfs:
Fix a memory leak when calling regmap_attach_dev") that
adds a if condition when create name for debugfs_name.
With below function invoking logical, debugfs_name is
freed in regmap_debugfs_exit(), but it is not created again
because of the if condition introduced by above commit.
regmap_reinit_cache()
regmap_debugfs_exit()
...
regmap_debugfs_init()
So, set debugfs_name to NULL after it is freed.

Fixes: cffa4b2122f5 ("regmap: debugfs: Fix a memory leak when calling regmap_attach_dev")
Signed-off-by: Meng Li <Meng.Li@windriver.com>
Link: https://lore.kernel.org/r/20210226021737.7690-1-Meng.Li@windriver.com
Signed-off-by: Mark Brown <broonie@kernel.org>


# f6bcb4c7 05-Jan-2021 Dan Carpenter <dan.carpenter@oracle.com>

regmap: debugfs: Fix a reversed if statement in regmap_debugfs_init()

This code will leak "map->debugfs_name" because the if statement is
reversed so it only frees NULL pointers instead of non-NULL. In
fact the if statement is not required and should just be removed
because kfree() accepts NULL pointers.

Fixes: cffa4b2122f5 ("regmap: debugfs: Fix a memory leak when calling regmap_attach_dev")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Link: https://lore.kernel.org/r/X/RQpfAwRdLg0GqQ@mwanda
Signed-off-by: Mark Brown <broonie@kernel.org>


# cffa4b21 29-Dec-2020 Xiaolei Wang <xiaolei.wang@windriver.com>

regmap: debugfs: Fix a memory leak when calling regmap_attach_dev

After initializing the regmap through
syscon_regmap_lookup_by_compatible, then regmap_attach_dev to the
device, because the debugfs_name has been allocated, there is no
need to redistribute it again

unreferenced object 0xd8399b80 (size 64):
comm "swapper/0", pid 1, jiffies 4294937641 (age 278.590s)
hex dump (first 32 bytes):
64 75 6d 6d 79 2d 69 6f 6d 75 78 63 2d 67 70 72
dummy-iomuxc-gpr
40 32 30 65 34 30 30 30 00 7f 52 5b d8 7e 42 69
@20e4000..R[.~Bi
backtrace:
[<ca384d6f>] kasprintf+0x2c/0x54
[<6ad3bbc2>] regmap_debugfs_init+0xdc/0x2fc
[<bc4181da>] __regmap_init+0xc38/0xd88
[<1f7e0609>] of_syscon_register+0x168/0x294
[<735e8766>] device_node_get_regmap+0x6c/0x98
[<d96c8982>] imx6ul_init_machine+0x20/0x88
[<0456565b>] customize_machine+0x1c/0x30
[<d07393d8>] do_one_initcall+0x80/0x3ac
[<7e584867>] kernel_init_freeable+0x170/0x1f0
[<80074741>] kernel_init+0x8/0x120
[<285d6f28>] ret_from_fork+0x14/0x20
[<00000000>] 0x0

Fixes: 9b947a13e7f6 ("regmap: use debugfs even when no device")
Signed-off-by: Xiaolei Wang <xiaolei.wang@windriver.com>
Link: https://lore.kernel.org/r/20201229105046.41984-1-xiaolei.wang@windriver.com
Signed-off-by: Mark Brown <broonie@kernel.org>


# ee490677 27-Sep-2020 Julia Lawall <Julia.Lawall@inria.fr>

regmap: debugfs: use semicolons rather than commas to separate statements

Replace commas with semicolons. What is done is essentially described by
the following Coccinelle semantic patch (http://coccinelle.lip6.fr/):

// <smpl>
@@ expression e1,e2; @@
e1
-,
+;
e2
... when any
// </smpl>

Signed-off-by: Julia Lawall <Julia.Lawall@inria.fr>
Link: https://lore.kernel.org/r/1601233948-11629-15-git-send-email-Julia.Lawall@inria.fr
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# 7f4a122d 27-Sep-2020 Julia Lawall <Julia.Lawall@inria.fr>

regmap: debugfs: use semicolons rather than commas to separate statements

Replace commas with semicolons. What is done is essentially described by
the following Coccinelle semantic patch (http://coccinelle.lip6.fr/):

// <smpl>
@@ expression e1,e2; @@
e1
-,
+;
e2
... when any
// </smpl>

Signed-off-by: Julia Lawall <Julia.Lawall@inria.fr>
Link: https://lore.kernel.org/r/1601233948-11629-15-git-send-email-Julia.Lawall@inria.fr
Signed-off-by: Mark Brown <broonie@kernel.org>


# 94cc89eb 17-Sep-2020 Charles Keepax <ckeepax@opensource.cirrus.com>

regmap: debugfs: Fix handling of name string for debugfs init delays

In regmap_debugfs_init the initialisation of the debugfs is delayed
if the root node isn't ready yet. Most callers of regmap_debugfs_init
pass the name from the regmap_config, which is considered temporary
ie. may be unallocated after the regmap_init call returns. This leads
to a potential use after free, where config->name has been freed by
the time it is used in regmap_debugfs_initcall.

This situation can be seen on Zynq, where the architecture init_irq
callback registers a syscon device, using a local variable for the
regmap_config. As init_irq is very early in the platform bring up the
regmap debugfs root isn't ready yet. Although this doesn't crash it
does result in the debugfs entry not having the correct name.

Regmap already sets map->name from config->name on the regmap_init
path and the fact that a separate field is used to pass the name
to regmap_debugfs_init appears to be an artifact of the debugfs
name being added before the map name. As such this patch updates
regmap_debugfs_init to use map->name, which is already duplicated from
the config avoiding the issue.

This does however leave two lose ends, both regmap_attach_dev and
regmap_reinit_cache can be called after a regmap is registered and
would have had the effect of applying a new name to the debugfs
entries. In both of these cases it was chosen to update the map
name. In the case of regmap_attach_dev there are 3 users that
currently use this function to update the name, thus doing so avoids
changes for those users and it seems reasonable that attaching
a device would want to set the name of the map. In the case of
regmap_reinit_cache the primary use-case appears to be devices that
need some register access to identify the device (for example devices
in the same family) and then update the cache to match the exact
hardware. Whilst no users do currently update the name here, given the
use-case it seemed reasonable the name might want to be updated once
the device is better identified.

Signed-off-by: Charles Keepax <ckeepax@opensource.cirrus.com>
Link: https://lore.kernel.org/r/20200917120828.12987-1-ckeepax@opensource.cirrus.com
Signed-off-by: Mark Brown <broonie@kernel.org>


# 299632e5 15-Jul-2020 Douglas Anderson <dianders@chromium.org>

regmap: debugfs: Don't sleep while atomic for fast_io regmaps

If a regmap has "fast_io" set then its lock function uses a spinlock.
That doesn't work so well with the functions:
* regmap_cache_only_write_file()
* regmap_cache_bypass_write_file()

Both of the above functions have the pattern:
1. Lock the regmap.
2. Call:
debugfs_write_file_bool()
copy_from_user()
__might_fault()
__might_sleep()

Let's reorder things a bit so that we do all of our sleepable
functions before we grab the lock.

Fixes: d3dc5430d68f ("regmap: debugfs: Allow writes to cache state settings")
Signed-off-by: Douglas Anderson <dianders@chromium.org>
Link: https://lore.kernel.org/r/20200715164611.1.I35b3533e8a80efde0cec1cc70f71e1e74b2fa0da@changeid
Signed-off-by: Mark Brown <broonie@kernel.org>


# 74edd08a 12-Mar-2020 Peng Fan <peng.fan@nxp.com>

regmap: debugfs: check count when read regmap file

When executing the following command, we met kernel dump.
dmesg -c > /dev/null; cd /sys;
for i in `ls /sys/kernel/debug/regmap/* -d`; do
echo "Checking regmap in $i";
cat $i/registers;
done && grep -ri "0x02d0" *;

It is because the count value is too big, and kmalloc fails. So add an
upper bound check to allow max size `PAGE_SIZE << (MAX_ORDER - 1)`.

Signed-off-by: Peng Fan <peng.fan@nxp.com>
Link: https://lore.kernel.org/r/1584064687-12964-1-git-send-email-peng.fan@nxp.com
Signed-off-by: Mark Brown <broonie@kernel.org>


# 9d52a35e 31-Jul-2019 Greg Kroah-Hartman <gregkh@linuxfoundation.org>

regmap: no need to check return value of debugfs_create functions

When calling debugfs functions, there is no need to ever check the
return value. The function can work or not, but the code logic should
never do something different based on this.

The debugfs core will warn if a file or directory can not be created, so
there's no need to duplicate the warning, nor really do anything else.

Cc: Mark Brown <broonie@kernel.org>
Cc: "Rafael J. Wysocki" <rafael@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Link: https://lore.kernel.org/r/20190731132923.GA13829@kroah.com
Signed-off-by: Mark Brown <broonie@kernel.org>


# 2899872b 17-May-2019 Daniel Baluta <daniel.baluta@nxp.com>

regmap: debugfs: Fix memory leak in regmap_debugfs_init

As detected by kmemleak running on i.MX6ULL board:

nreferenced object 0xd8366600 (size 64):
comm "swapper/0", pid 1, jiffies 4294937370 (age 933.220s)
hex dump (first 32 bytes):
64 75 6d 6d 79 2d 69 6f 6d 75 78 63 2d 67 70 72 dummy-iomuxc-gpr
40 32 30 65 34 30 30 30 00 e3 f3 ab fe d1 1b dd @20e4000........
backtrace:
[<b0402aec>] kasprintf+0x2c/0x54
[<a6fbad2c>] regmap_debugfs_init+0x7c/0x31c
[<9c8d91fa>] __regmap_init+0xb5c/0xcf4
[<5b1c3d2a>] of_syscon_register+0x164/0x2c4
[<596a5d80>] syscon_node_to_regmap+0x64/0x90
[<49bd597b>] imx6ul_init_machine+0x34/0xa0
[<250a4dac>] customize_machine+0x1c/0x30
[<2d19fdaf>] do_one_initcall+0x7c/0x398
[<e6084469>] kernel_init_freeable+0x328/0x448
[<168c9101>] kernel_init+0x8/0x114
[<913268aa>] ret_from_fork+0x14/0x20
[<ce7b131a>] 0x0

Root cause is that map->debugfs_name is allocated using kasprintf
and then the pointer is lost by assigning it other memory address.

Reported-by: Stefan Wahren <stefan.wahren@i2se.com>
Signed-off-by: Daniel Baluta <daniel.baluta@nxp.com>
Signed-off-by: Mark Brown <broonie@kernel.org>


# 37613fa5 25-Apr-2019 Greg Kroah-Hartman <gregkh@linuxfoundation.org>

regmap: add proper SPDX identifiers on files that did not have them.

There were a few files in the regmap code that did not have SPDX
identifiers on them, so fix that up. At the same time, remove the "free
form" text that specified the license of the file, as that is impossible
for any tool to properly parse.

Also, as Mark loves // comment markers, convert all of the headers to be
the same to make things look consistent :)

Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Mark Brown <broonie@kernel.org>


# cc6a8d69 19-Mar-2019 Lucas Tanure <tanureal@opensource.cirrus.com>

regmap: debugfs: Jump to the next readable register

Improve the speed of the loop jumping to the next
available register

Signed-off-by: Lucas Tanure <tanureal@opensource.cirrus.com>
Reviewed-by: Charles Keepax <ckeepax@opensource.cirrus.com>
Tested-by: Charles Keepax <ckeepax@opensource.cirrus.com>
Signed-off-by: Mark Brown <broonie@kernel.org>


# a1c67d65 19-Mar-2019 Lucas Tanure <tanureal@opensource.cirrus.com>

regmap: debugfs: Replace code by already existing function

Signed-off-by: Lucas Tanure <tanureal@opensource.cirrus.com>
Signed-off-by: Mark Brown <broonie@kernel.org>


# 580d4857 15-Dec-2018 Yangtao Li <tiny.windzz@gmail.com>

regmap: debugfs: convert to DEFINE_SHOW_ATTRIBUTE

Use DEFINE_SHOW_ATTRIBUTE macro to simplify the code.

Signed-off-by: Yangtao Li <tiny.windzz@gmail.com>
Signed-off-by: Mark Brown <broonie@kernel.org>


# 59dd2a85 05-Mar-2018 Fabio Estevam <fabio.estevam@nxp.com>

regmap: debugfs: Improve warning message on debugfs_create_dir() failure

Currently when debugfs_create_dir() fails we receive a warning message
that provides no indication as to what was the directory entry that
failed to be created.

Improve the warning message by printing the directory name that failed
in order to help debugging.

Signed-off-by: Fabio Estevam <fabio.estevam@nxp.com>
Signed-off-by: Mark Brown <broonie@kernel.org>


# 17cf46cf 06-Mar-2018 Jeffy Chen <jeffy.chen@rock-chips.com>

regmap: debugfs: Free map->debugfs_name when debugfs_create_dir() failed

Free map->debugfs_name when debugfs_create_dir() failed to avoid memory
leak.

Signed-off-by: Jeffy Chen <jeffy.chen@rock-chips.com>
Signed-off-by: Mark Brown <broonie@kernel.org>


# 46589e9c 05-Mar-2018 Mark Brown <broonie@kernel.org>

regmap: debugfs: Don't leak dummy names

When allocating dummy names we need to store a pointer to the string we
allocate so that we don't leak it on free.

Signed-off-by: Mark Brown <broonie@kernel.org>


# a430ab20 05-Mar-2018 Fabio Estevam <fabio.estevam@nxp.com>

regmap: debugfs: Disambiguate dummy debugfs file name

Since commit 9b947a13e7f6 ("regmap: use debugfs even when no device")
allows the usage of regmap debugfs even when there is no device
associated, which causes several warnings like this:

(NULL device *): Failed to create debugfs directory

This happens when the debugfs file name is 'dummy'.

The first dummy debugfs creation works fine, but subsequent creations
fail as they have all the same name.

Disambiguate the 'dummy' debugfs file name by adding a suffix entry,
so that the names become dummy0, dummy1, dummy2, etc.

Signed-off-by: Fabio Estevam <fabio.estevam@nxp.com>
Signed-off-by: Mark Brown <broonie@kernel.org>


# 12ae3808 19-Feb-2018 David Lechner <david@lechnology.com>

regmap: Allow missing device in regmap_name_read_file()

This fixes a possible NULL pointer dereference oops in
regmap_name_read_file() when the regmap does not have a device
associated with it. For example syscon regmaps retrieved with
syscon_regmap_lookup_by_compatible() don't have a device.

Signed-off-by: David Lechner <david@lechnology.com>
Signed-off-by: Mark Brown <broonie@kernel.org>


# 078711d7 22-Dec-2017 Bartosz Golaszewski <brgl@bgdev.pl>

regmap: debugfs: document why we don't create the debugfs entries

This is a follow-up to commit a5ba91c380b8 ("regmap: debugfs: emit a
debug message when locking is disabled"). I figured that a user may
see this message, grep the code, come to this place and he still won't
know why we actually disabled debugfs.

Add a comment explaining the reason.

Signed-off-by: Bartosz Golaszewski <brgl@bgdev.pl>
Signed-off-by: Mark Brown <broonie@kernel.org>


# a5ba91c3 20-Dec-2017 Bartosz Golaszewski <brgl@bgdev.pl>

regmap: debugfs: emit a debug message when locking is disabled

We currently silently omit creating the debugfs entries when regmap
locking is disabled. Users may not be aware of the reason for which
regmap files don't show up in debugfs. Add a dev_dbg() message
explaining that.

Signed-off-by: Bartosz Golaszewski <brgl@bgdev.pl>
Signed-off-by: Mark Brown <broonie@kernel.org>


# 72465736 12-Dec-2017 Mark Brown <broonie@kernel.org>

regmap: Disable debugfs when locking is disabled

The recently added support for disabling the regmap internal locking left
debugfs enabled for devices with the locking disabled. This is a problem
since debugfs allows userspace to do things like initiate reads from the
hardware which will use the scratch buffers protected by the regmap locking
so could cause data corruption.

For safety address this by just disabling debugfs for these devices. That
is overly conservative since some of the debugfs files just read internal
data structures but it's much simpler to implmement and less likely to
lead to problems with tooling that works with debugfs.

Reported-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Mark Brown <broonie@kernel.org>


# 359a2f17 08-Aug-2016 Cristian Birsan <cristian.birsan@microchip.com>

regmap: debugfs: Add support for dumping write only device registers

Add support for dumping write only device registers in debugfs. This is
useful for audio codecs that have write only registers (like WM8731).
The logic that decides if a value can be printed is moved to
regmap_printable() function to allow for easier future updates.

Signed-off-by: Cristian Birsan <cristian.birsan@microchip.com>
Signed-off-by: Mark Brown <broonie@kernel.org>


# 8da61f24 20-Oct-2015 Mark Brown <broonie@kernel.org>

regmap: debugfs: Use seq_file for the access map

Unlike the registers file we don't have any substantial performance
concerns rendering the entire file (it involves no device accesses) so
just use seq_printf() to simplify the code.

Signed-off-by: Mark Brown <broonie@kernel.org>


# ca07e9f3 30-Sep-2015 Rasmus Villemoes <linux@rasmusvillemoes.dk>

regmap: debugfs: simplify regmap_reg_ranges_read_file() slightly

By printing the newline character to entry, we can avoid accounting
for it manually in several places.

Signed-off-by: Rasmus Villemoes <linux@rasmusvillemoes.dk>
Signed-off-by: Mark Brown <broonie@kernel.org>


# 20991cdb 30-Sep-2015 Rasmus Villemoes <linux@rasmusvillemoes.dk>

regmap: debugfs: use memcpy instead of snprintf

Since we know the length of entry and that there's room enough in the
output buffer, using memcpy instead of snprintf is simpler and
cheaper.

Signed-off-by: Rasmus Villemoes <linux@rasmusvillemoes.dk>
Signed-off-by: Mark Brown <broonie@kernel.org>


# e34dc490 30-Sep-2015 Rasmus Villemoes <linux@rasmusvillemoes.dk>

regmap: debugfs: use snprintf return value in regmap_reg_ranges_read_file()

Calling strlen() no less than three times on entry is silly. Since
we're formatting into a buffer with plenty of room, there's no chance
of truncation, so snprintf() has actually returned the value we want,
meaning we don't even have to call strlen once.

Signed-off-by: Rasmus Villemoes <linux@rasmusvillemoes.dk>
Signed-off-by: Mark Brown <broonie@kernel.org>


# 9ae3109d 19-Sep-2015 Mark Brown <broonie@kernel.org>

regmap: debugfs: Remove scratch buffer for register length calculation

Now we no longer use the scratch buffer for register length calculation
there is no need for callers to supply one.

Signed-off-by: Mark Brown <broonie@kernel.org>


# 176fc2d5 19-Sep-2015 Mark Brown <broonie@kernel.org>

regmap: debugfs: Don't bother actually printing when calculating max length

The in kernel snprintf() will conveniently return the actual length of
the printed string even if not given an output beffer at all so just do
that rather than relying on the user to pass in a suitable buffer,
ensuring that we don't need to worry if the buffer was truncated due to
the size of the buffer passed in.

Reported-by: Rasmus Villemoes <linux@rasmusvillemoes.dk>
Signed-off-by: Mark Brown <broonie@kernel.org>
Cc: stable@vger.kernel.org


# b763ec17 19-Sep-2015 Mark Brown <broonie@kernel.org>

regmap: debugfs: Ensure we don't underflow when printing access masks

If a read is attempted which is smaller than the line length then we may
underflow the subtraction we're doing with the unsigned size_t type so
move some of the calculation to be additions on the right hand side
instead in order to avoid this.

Reported-by: Rasmus Villemoes <linux@rasmusvillemoes.dk>
Signed-off-by: Mark Brown <broonie@kernel.org>
Cc: stable@vger.kernel.org


# 1635e888 05-Aug-2015 Axel Lin <axel.lin@ingics.com>

regmap: debugfs: Fix misuse of IS_ENABLED

IS_ENABLED should only be used for CONFIG_* symbols.

I have done a small test:
#define REGMAP_ALLOW_WRITE_DEBUGFS
IS_ENABLED(REGMAP_ALLOW_WRITE_DEBUGFS) returns 0.

#define REGMAP_ALLOW_WRITE_DEBUGFS 0
IS_ENABLED(REGMAP_ALLOW_WRITE_DEBUGFS) returns 0.

#define REGMAP_ALLOW_WRITE_DEBUGFS 1
IS_ENABLED(REGMAP_ALLOW_WRITE_DEBUGFS) returns 1.

#define REGMAP_ALLOW_WRITE_DEBUGFS 2
IS_ENABLED(REGMAP_ALLOW_WRITE_DEBUGFS) returns 0.

So fix the misuse of IS_ENABLED(REGMAP_ALLOW_WRITE_DEBUGFS) and switch to
use #if defined(REGMAP_ALLOW_WRITE_DEBUGFS) instead.

Signed-off-by: Axel Lin <axel.lin@ingics.com>
Signed-off-by: Mark Brown <broonie@kernel.org>


# d3dc5430 23-Jun-2015 Richard Fitzgerald <rf@opensource.wolfsonmicro.com>

regmap: debugfs: Allow writes to cache state settings

Allow the user to write the cache_only and cache_bypass settings.
This can be useful for debugging.

Since this can lead to the hardware getting out-of-sync with the
cache, at least for the period that the cache state is forced, the
kernel is tainted and the action is recorded in the kernel log.

When disabling cache_only through debugfs a cache sync will be performed.

Signed-off-by: Richard Fitzgerald <rf@opensource.wolfsonmicro.com>
Signed-off-by: Mark Brown <broonie@kernel.org>


# 18c0301f 08-Sep-2014 Markus Pargmann <mpa@pengutronix.de>

regmap: Fix debugfs-file 'registers' mode

The macro "REGMAP_ALLOW_WRITE_DEBUGFS" can be used to enable write
support on the registers file in the debugfs. The mode of the file is
fixed to 0400 so it is not possible to write the file ever.

This patch fixes the mode by setting it to the correct value depending
on the macro.

Signed-off-by: Markus Pargmann <mpa@pengutronix.de>
Signed-off-by: Mark Brown <broonie@kernel.org>


# 2c98e0c1 27-Sep-2014 Xiubo Li <Li.Xiubo@freescale.com>

regmap: debugfs: fix possbile NULL pointer dereference

If 'map->dev' is NULL and there will lead dev_name() to be NULL pointer
dereference. So before dev_name(), we need to have check of the map->dev
pionter.

We also should make sure that the 'name' pointer shouldn't be NULL for
debugfs_create_dir(). So here using one default "dummy" debugfs name when
the 'name' pointer and 'map->dev' are both NULL.

Signed-off-by: Xiubo Li <Li.Xiubo@freescale.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
Cc: stable@vger.kernel.org


# ffff7a12a 08-Sep-2014 Markus Pargmann <mpa@pengutronix.de>

regmap: Fix debugfs-file 'registers' mode

The macro "REGMAP_ALLOW_WRITE_DEBUGFS" can be used to enable write
support on the registers file in the debugfs. The mode of the file is
fixed to 0400 so it is not possible to write the file ever.

This patch fixes the mode by setting it to the correct value depending
on the macro.

Signed-off-by: Markus Pargmann <mpa@pengutronix.de>
Signed-off-by: Mark Brown <broonie@kernel.org>


# 5e0cbe78 24-Aug-2014 Lars-Peter Clausen <lars@metafoo.de>

regmap: Fix regcache debugfs initialization

Commit 6cfec04bcc05 ("regmap: Separate regmap dev initialization") moved the
regmap debugfs initialization after regcache initialization. This means
that the regmap debugfs directory is not created yet when the cache
initialization runs and so any debugfs files registered by the regcache are
created in the debugfs root directory rather than the debugfs directory of
the regmap instance. Fix this by adding a separate callback for the
regcache debugfs initialization which will be called after the parent
debugfs entry has been created.

Fixes: 6cfec04bcc05 (regmap: Separate regmap dev initialization)
Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Mark Brown <broonie@linaro.org>
Cc: stable@vger.kernel.org


# 676970da 30-Jan-2014 Pawel Moll <pawel.moll@arm.com>

regmap: debugfs: "registers" & "access" for single register maps

When a map covers a single register, max_register is equal
to 0, so the "registers" & "access" files were not created.
Now they will be, as register 0 must be readable for such
map to make sense.

Signed-off-by: Pawel Moll <pawel.moll@arm.com>
Signed-off-by: Mark Brown <broonie@linaro.org>


# a52eaeb1 24-Oct-2013 Tero Kristo <t-kristo@ti.com>

regmap: debugfs: Fix a boot time crash with early regmap init

If called early enough, regmap_debugfs_init causes a crash, if the
fs subsystem does not have its mount cache created yet. Even if this
would work, the root node for the regmap debugfs is still missing,
thus postpone the regmap_debugfs_init in this case until the root
node is created. A special regmap_debugfs_early list is created for
this purpose which is parsed later in the boot.

Signed-off-by: Tero Kristo <t-kristo@ti.com>
Signed-off-by: Mark Brown <broonie@linaro.org>


# 26ee4741 28-Aug-2013 Lars-Peter Clausen <lars@metafoo.de>

regmap: debugfs: Fix continued read from registers file

The regmap_debugfs_get_dump_start() function maps from a file offset to the
register that can be found at that position in the file. This is done using a
look-up table. Commit d6814a7d ("regmap: debugfs: Suppress cache for partial
register files") added a check to bypass the look-up table for partial register
files, since the offsets in that table are only correct for the full register
file. The check incorrectly uses the file offset instead of the register base
address and returns it. This will cause the file offset to be interpreted as a
register address which will result in a incorrect output from the registers file
for all reads except at position 0.

The issue can easily be reproduced by doing small reads the registers file, e.g.
`dd if=registers bs=10 count=5`.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Mark Brown <broonie@linaro.org>
Cc: stable@vger.kernel.org


# 34da5e67 25-Jul-2013 Jingoo Han <jg1.han@samsung.com>

driver core: replace strict_strto*() with kstrto*()

The usage of strict_strto*() is not preferred, because
strict_strto*() is obsolete. Thus, kstrto*() should be
used.

Signed-off-by: Jingoo Han <jg1.han@samsung.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# d6814a7d 29-May-2013 Mark Brown <broonie@opensource.wolfsonmicro.com>

regmap: debugfs: Suppress cache for partial register files

The cache is based on the full register map so confuses things if used
for a partial map.

Reported-by: Bard Liao <bardliao@realtek.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>


# 213fa5d9 14-May-2013 Srinivas Kandagatla <srinivas.kandagatla@st.com>

regmap: debugfs: Fix return from regmap_debugfs_get_dump_start

regmap_debugfs_get_dump_start should return the offset of the register
it should start reading from, However in the current code at one point
the code does not return correct register offset.

With this patch all the returns from this function takes reg_stride in
to consideration to return correct offset.

Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@st.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>


# f9e464a5 09-May-2013 Mark Brown <broonie@opensource.wolfsonmicro.com>

regmap: debugfs: Don't mark lockdep as broken due to debugfs write

A register write to hardware is reasonably unlikely to cause locking
dependency issues, the reason we're tainting is that unexpected changes
in the hardware configuration may confuse drivers.

Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>


# 68e850d8 08-May-2013 Dimitris Papastamos <dp@opensource.wolfsonmicro.com>

regmap: debugfs: Check return value of regmap_write()

Signed-off-by: Dimitris Papastamos <dp@opensource.wolfsonmicro.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>


# 065b4c58 19-Feb-2013 Dimitris Papastamos <dp@opensource.wolfsonmicro.com>

regmap: debugfs: Add a registers `range' file

This file lists the register ranges in the register map. The condition
to split the range is based on whether the block is readable or not.

Ensure that we lock the `debugfs_off_cache' list whenever we access
and modify the list. There is a possible race otherwise between the
read() operations of the `registers' file and the `range' file.

Signed-off-by: Dimitris Papastamos <dp@opensource.wolfsonmicro.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>


# 480738de 19-Feb-2013 Dimitris Papastamos <dp@opensource.wolfsonmicro.com>

regmap: debugfs: Simplify calculation of `c->max_reg'

We don't need to use any of the file position information
to calculate the base and max register of each block. Just
use the counter directly.

Set `i = base' at the top to avoid GCC flow analysis bugs. The
value of `i' can never be undefined or 0 in the if (c) { ... }.

Signed-off-by: Dimitris Papastamos <dp@opensource.wolfsonmicro.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>


# 4dd7c553 11-Feb-2013 Dimitris Papastamos <dp@opensource.wolfsonmicro.com>

regmap: debugfs: Factor out debugfs_tot_len calc into a function

In preparation to support the regmap debugfs ranges functionality
factor this code out to a separate function. We'll need to ensure
that the value has been correctly calculated from two separate places
in the code.

Signed-off-by: Dimitris Papastamos <dp@opensource.wolfsonmicro.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>


# cf57d607 07-Feb-2013 Dimitris Papastamos <dp@opensource.wolfsonmicro.com>

regmap: debugfs: Optimize seeking within blocks of registers

Optimize this so that we can better guess where to start scanning
from. We know the length of the register field format, therefore
given the file pointer position align to the nearest register
field and scan from there onwards. We round down in this calculation
and we let the rest of the code figure out where to start scanning
from.

Signed-off-by: Dimitris Papastamos <dp@opensource.wolfsonmicro.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>


# c2c1ee66 07-Feb-2013 Dimitris Papastamos <dp@opensource.wolfsonmicro.com>

regmap: debugfs: Add a `max_reg' member in struct regmap_debugfs_off_cache

We are keeping track of the maximum register as well, this will make
things easier for us in sharing this code with the code implementing
the register ranges functionality. It also simplifies a bit the
calculations when looking for the relevant block:offset from within
the cache.

Signed-off-by: Dimitris Papastamos <dp@opensource.wolfsonmicro.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>


# f3eb8399 07-Feb-2013 Dimitris Papastamos <dp@opensource.wolfsonmicro.com>

regmap: debugfs: Fix reading in register field units

At the moment, if the length of the register field format is
N bytes, we can only get anything meaningful back to userspace
by providing a buffer that is N + 2 bytes large. Fix this
so we that we only need to provide a buffer of N bytes.

Signed-off-by: Dimitris Papastamos <dp@opensource.wolfsonmicro.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>


# a3471469 26-Jan-2013 Russell King <rmk+kernel@arm.linux.org.uk>

regmap: regmap: avoid spurious warning in regmap_read_debugfs

Gcc warns about the case where regmap_read_debugfs tries to walk an
empty map->debugfs_off_cache list, which would results in uninitialized
variable getting returned, if we hadn't checked the same condition
just before that.

After an originally suggested inferior patch from Arnd Bergmann,
this is the solution that Russell King came up with, sidestepping
the problem by merging the error case for an empty list with the
normal path.

Without this patch, building mxs_defconfig results in:

drivers/base/regmap/regmap-debugfs.c: In function 'regmap_read_debugfs':
drivers/base/regmap/regmap-debugfs.c:147:9: : warning: 'ret' may be used uninitialized in this function [-Wmaybe-uninitialized]

Reported-by: Vincent Stehle <v-stehle@ti.com>
Cc: Mark Brown <broonie@opensource.wolfsonmicro.com>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>


# 373d4d09 20-Jan-2013 Rusty Russell <rusty@rustcorp.com.au>

taint: add explicit flag to show whether lock dep is still OK.

Fix up all callers as they were before, with make one change: an
unsigned module taints the kernel, but doesn't turn off lockdep.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>


# f32ca3db 16-Jan-2013 Mark Brown <broonie@opensource.wolfsonmicro.com>

regmap: debugfs: Fix seeking from the cache

We don't want to bomb out early if we failed to get the cache any more,
just soldier on instead and we won't get confused and always return the
first block.

Reported-by: Philipp Zabel <p.zabel@pengutronix.de
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>


# e8d6539c 08-Jan-2013 Mark Brown <broonie@opensource.wolfsonmicro.com>

regmap: debugfs: Make sure we store the last entry in the offset cache

Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>


# 5bd9f4bb 08-Jan-2013 Mark Brown <broonie@opensource.wolfsonmicro.com>

regmap: debugfs: Ensure a correct return value for empty caches

This should never happen in the real world.

Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>


# 95f971c7 08-Jan-2013 Mark Brown <broonie@opensource.wolfsonmicro.com>

regmap: debugfs: Discard the cache if we fail to allocate an entry

Rather than trying to soldier on with a partially allocated cache just
throw the cache away and pretend we don't have one in case we can get a
full cache next time around.

Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>


# 5a1d6d17 08-Jan-2013 Mark Brown <broonie@opensource.wolfsonmicro.com>

regmap: debugfs: Fix check for block start in cached seeks

Check for the block we were asked to start from, not the position we're
in.

Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>


# 120f8051 02-Jan-2013 Mark Brown <broonie@opensource.wolfsonmicro.com>

regmap: debugfs: Fix attempts to read nonexistant register blocks

Return the start of the last block we tried to read rather than a position,
and also make sure we update the byte position while we're at it. Without
this reads that go into nonexistant areas get confused.

Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>


# 5166b7c0 10-Dec-2012 Mark Brown <broonie@opensource.wolfsonmicro.com>

regmap: debugfs: Cache offsets of valid regions for dump

Avoid doing a linear scan of the entire register map for each read() of
the debugfs register dump by recording the offsets where valid registers
exist when we first read the registers file. This assumes the set of
valid registers never changes, if this is not the case invalidation of
the cache will be required.

This could be further improved for large blocks of contiguous registers
by calculating the register we will read from within the block - currently
we do a linear scan of the block. An rbtree may also be worthwhile.

Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>


# afab2f7b 09-Dec-2012 Mark Brown <broonie@opensource.wolfsonmicro.com>

regmap: debugfs: Factor out initial seek

In preparation for doing things a bit more quickly than a linear scan
factor out the initial seek from the debugfs register dump.

Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>


# db04328c1 10-Dec-2012 Mark Brown <broonie@opensource.wolfsonmicro.com>

regmap: debugfs: Avoid overflows for very small reads

If count is less than the size of a register then we may hit integer
wraparound when trying to move backwards to check if we're still in
the buffer. Instead move the position forwards to check if it's still
in the buffer, we are unlikely to be able to allocate a buffer
sufficiently big to overflow here.

Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Cc: stable@vger.kernel.org


# cbc1938b 05-Dec-2012 Mark Brown <broonie@opensource.wolfsonmicro.com>

regmap: Cache register and value sizes for debugfs

No point in calculating them every time.

Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>


# 4b020b3f 03-Oct-2012 Mark Brown <broonie@opensource.wolfsonmicro.com>

regmap: Provide debugfs read of register ranges

If a register range is named then provide a debugfs file showing the
contents of the range separately.

Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>


# bd9cc12f 02-Oct-2012 Mark Brown <broonie@opensource.wolfsonmicro.com>

regmap: Factor out debugfs register read

This will allow the use of the same code for reading register ranges.

Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>


# edc9ae42 09-Apr-2012 Stephen Warren <swarren@nvidia.com>

regmap: implement register striding

regmap_config.reg_stride is introduced. All extant register addresses
are a multiple of this value. Users of serial-oriented regmap busses will
typically set this to 1. Users of the MMIO regmap bus will typically set
this based on the value size of their registers, in bytes, so 4 for a
32-bit register.

Throughout the regmap code, actual register addresses are used. Wherever
the register address is used to index some array of values, the address
is divided by the stride to determine the index, or vice-versa. Error-
checking is added to all entry-points for register address data to ensure
that register addresses actually satisfy the specified stride. The MMIO
bus ensures that the specified stride is large enough for the register
size.

Signed-off-by: Stephen Warren <swarren@nvidia.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>


# 4b5c0186 04-Apr-2012 Stephen Warren <swarren@nvidia.com>

regmap: allow regmap instances to be named

Some devices have multiple separate register regions. Logically, one
regmap would be created per region. One issue that prevents this is that
each instance will attempt to create the same debugfs files. Avoid this
by allowing regmaps to be named, and use the name to construct the
debugfs directory name.

Signed-off-by: Stephen Warren <swarren@nvidia.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>


# f01ee60f 09-Apr-2012 Stephen Warren <swarren@nvidia.com>

regmap: implement register striding

regmap_config.reg_stride is introduced. All extant register addresses
are a multiple of this value. Users of serial-oriented regmap busses will
typically set this to 1. Users of the MMIO regmap bus will typically set
this based on the value size of their registers, in bytes, so 4 for a
32-bit register.

Throughout the regmap code, actual register addresses are used. Wherever
the register address is used to index some array of values, the address
is divided by the stride to determine the index, or vice-versa. Error-
checking is added to all entry-points for register address data to ensure
that register addresses actually satisfy the specified stride. The MMIO
bus ensures that the specified stride is large enough for the register
size.

Signed-off-by: Stephen Warren <swarren@nvidia.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>


# d3c242e1 04-Apr-2012 Stephen Warren <swarren@nvidia.com>

regmap: allow regmap instances to be named

Some devices have multiple separate register regions. Logically, one
regmap would be created per region. One issue that prevents this is that
each instance will attempt to create the same debugfs files. Avoid this
by allowing regmaps to be named, and use the name to construct the
debugfs directory name.

Signed-off-by: Stephen Warren <swarren@nvidia.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>


# 234e3405 05-Apr-2012 Stephen Boyd <sboyd@codeaurora.org>

simple_open: automatically convert to simple_open()

Many users of debugfs copy the implementation of default_open() when
they want to support a custom read/write function op. This leads to a
proliferation of the default_open() implementation across the entire
tree.

Now that the common implementation has been consolidated into libfs we
can replace all the users of this function with simple_open().

This replacement was done with the following semantic patch:

<smpl>
@ open @
identifier open_f != simple_open;
identifier i, f;
@@
-int open_f(struct inode *i, struct file *f)
-{
(
-if (i->i_private)
-f->private_data = i->i_private;
|
-f->private_data = i->i_private;
)
-return 0;
-}

@ has_open depends on open @
identifier fops;
identifier open.open_f;
@@
struct file_operations fops = {
...
-.open = open_f,
+.open = simple_open,
...
};
</smpl>

[akpm@linux-foundation.org: checkpatch fixes]
Signed-off-by: Stephen Boyd <sboyd@codeaurora.org>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: Al Viro <viro@zeniv.linux.org.uk>
Cc: Julia Lawall <Julia.Lawall@lip6.fr>
Acked-by: Ingo Molnar <mingo@elte.hu>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>


# 51990e82 22-Jan-2012 Paul Gortmaker <paul.gortmaker@windriver.com>

device.h: cleanup users outside of linux/include (C files)

For files that are actively using linux/device.h, make sure
that they call it out. This will allow us to clean up some
of the implicit uses of linux/device.h within include/*
without introducing build regressions.

Yes, this was created by "cheating" -- i.e. the headers were
cleaned up, and then the fallout was found and fixed, and then
the two commits were reordered. This ensures we don't introduce
build regressions into the git history.

Signed-off-by: Paul Gortmaker <paul.gortmaker@windriver.com>


# 19694b5e 28-Feb-2012 Paul Gortmaker <paul.gortmaker@windriver.com>

regmap: delete unused module.h from drivers/base/regmap files

Remove unused module.h and/or replace with export.h
as required.

Signed-off-by: Paul Gortmaker <paul.gortmaker@windriver.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>


# f0c2319f 22-Feb-2012 Dimitris Papastamos <dp@opensource.wolfsonmicro.com>

regmap: Expose the driver name in debugfs

Add a file called 'name' containing the name of the driver.

Signed-off-by: Dimitris Papastamos <dp@opensource.wolfsonmicro.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>


# 09c6ecd3 21-Feb-2012 Dimitris Papastamos <dp@opensource.wolfsonmicro.com>

regmap: Add support for writing to regmap registers via debugfs

To enable writing to the regmap debugfs registers file users will
need to modify the source directly and #define REGMAP_ALLOW_WRITE_DEBUGFS.
The reason for this is that it is dangerous to expose this
functionality in general where clients could potentially be PMICs.

[A couple of minor style updates -- broonie]

Signed-off-by: Dimitris Papastamos <dp@opensource.wolfsonmicro.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>


# 028a01e6 06-Feb-2012 Mark Brown <broonie@opensource.wolfsonmicro.com>

regmap: Add debugfs information for the cache status

Show all the cache status flags in debugfs if we have a cache.

Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>


# d813ae9a 05-Sep-2011 Mark Brown <broonie@opensource.wolfsonmicro.com>

regmap: Include the last register in debugfs output

Off by one in the array iteration.

Reported-by: Jonathan Cameron <jic23@cam.ac.uk>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>


# 449e3842 10-Aug-2011 Mark Brown <broonie@opensource.wolfsonmicro.com>

regmap: Provide access information via debugfs

Let userspace know what the access map for the device is. This is helpful
for verifying that the access map is correctly configured and could also
be useful for programs that try to work with the data. File format is:

register: R W V P

where R, W, V and P are 'y' or 'n' showing readable, writable, volatile
and precious respectively.

Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>


# 21f55544 10-Aug-2011 Mark Brown <broonie@opensource.wolfsonmicro.com>

regmap: Share some of the debugfs infrastructure ready for more files

Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>


# 8de2f081 10-Aug-2011 Mark Brown <broonie@opensource.wolfsonmicro.com>

regmap: Add functions to check for access on registers

We're going to be using these in quite a few places so factor out the
readable/writable/volatile/precious checks.

Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>


# cb3c2dcf 09-Aug-2011 Mark Brown <broonie@opensource.wolfsonmicro.com>

regmap: Fix type of field width specifiers for x86_64

x86_64 size_t is not an int but the printf format specifier for size_t
should be an int.

Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Reported-by: Stephen Rothwell <sfr@canb.auug.org.au>


# 2efe1642 08-Aug-2011 Mark Brown <broonie@opensource.wolfsonmicro.com>

regmap: Skip precious registers when dumping registers via debugfs

Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>


# 31244e39 20-Jul-2011 Mark Brown <broonie@opensource.wolfsonmicro.com>

regmap: Provide register map dump via debugfs

Copy over the read parts of the ASoC debugfs implementation into regmap,
allowing users to see what the register values the device has are at
runtime. The implementation, especially the support for seeking, is
mostly due to Dimitris Papastamos' work in ASoC.

Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>