aboutsummaryrefslogtreecommitdiff
path: root/drivers/base/regmap/regmap-debugfs.c
AgeCommit message (Collapse)Author
2013-02-08regmap: debugfs: Fix reading in register field unitsDimitris Papastamos
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>
2013-01-27regmap: regmap: avoid spurious warning in regmap_read_debugfsRussell King
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>
2013-01-17regmap: debugfs: Fix seeking from the cacheMark Brown
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>
2013-01-08regmap: debugfs: Make sure we store the last entry in the offset cacheMark Brown
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2013-01-08regmap: debugfs: Ensure a correct return value for empty cachesMark Brown
This should never happen in the real world. Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2013-01-08regmap: debugfs: Discard the cache if we fail to allocate an entryMark Brown
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>
2013-01-08regmap: debugfs: Fix check for block start in cached seeksMark Brown
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>
2013-01-08regmap: debugfs: Fix attempts to read nonexistant register blocksMark Brown
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>
2012-12-11regmap: debugfs: Cache offsets of valid regions for dumpMark Brown
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>
2012-12-11regmap: debugfs: Factor out initial seekMark Brown
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>
2012-12-11regmap: debugfs: Avoid overflows for very small readsMark Brown
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
2012-12-06regmap: Cache register and value sizes for debugfsMark Brown
No point in calculating them every time. Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2012-10-15regmap: Provide debugfs read of register rangesMark Brown
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>
2012-10-15regmap: Factor out debugfs register readMark Brown
This will allow the use of the same code for reading register ranges. Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2012-04-10regmap: implement register stridingStephen Warren
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>
2012-04-10Merge branches 'regmap-core', 'regmap-mmio' and 'regmap-naming' into ↵Mark Brown
regmap-stride
2012-04-10regmap: allow regmap instances to be namedStephen Warren
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>
2012-04-05simple_open: automatically convert to simple_open()Stephen Boyd
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>
2012-03-24Merge tag 'device-for-3.4' of ↵Linus Torvalds
git://git.kernel.org/pub/scm/linux/kernel/git/paulg/linux Pull <linux/device.h> avoidance patches from Paul Gortmaker: "Nearly every subsystem has some kind of header with a proto like: void foo(struct device *dev); and yet there is no reason for most of these guys to care about the sub fields within the device struct. This allows us to significantly reduce the scope of headers including headers. For this instance, a reduction of about 40% is achieved by replacing the include with the simple fact that the device is some kind of a struct. Unlike the much larger module.h cleanup, this one is simply two commits. One to fix the implicit <linux/device.h> users, and then one to delete the device.h includes from the linux/include/ dir wherever possible." * tag 'device-for-3.4' of git://git.kernel.org/pub/scm/linux/kernel/git/paulg/linux: device.h: audit and cleanup users in main include dir device.h: cleanup users outside of linux/include (C files)
2012-03-11device.h: cleanup users outside of linux/include (C files)Paul Gortmaker
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>
2012-03-01regmap: delete unused module.h from drivers/base/regmap filesPaul Gortmaker
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>
2012-02-22regmap: Expose the driver name in debugfsDimitris Papastamos
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>
2012-02-22regmap: Add support for writing to regmap registers via debugfsDimitris Papastamos
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>
2012-02-06regmap: Add debugfs information for the cache statusMark Brown
Show all the cache status flags in debugfs if we have a cache. Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2011-09-05regmap: Include the last register in debugfs outputMark Brown
Off by one in the array iteration. Reported-by: Jonathan Cameron <jic23@cam.ac.uk> Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2011-08-14regmap: Provide access information via debugfsMark Brown
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>
2011-08-14regmap: Share some of the debugfs infrastructure ready for more filesMark Brown
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2011-08-14regmap: Add functions to check for access on registersMark Brown
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>
2011-08-10regmap: Fix type of field width specifiers for x86_64Mark Brown
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>
2011-08-08regmap: Skip precious registers when dumping registers via debugfsMark Brown
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2011-08-08regmap: Provide register map dump via debugfsMark Brown
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>