Messages in this thread | | | Date | Wed, 11 Jan 2023 07:25:51 +0100 | From | Greg Kroah-Hartman <> | Subject | Re: [PATCH] debugfs: allow to use regmap for print regs |
| |
On Wed, Jan 11, 2023 at 02:15:41PM +0800, Li Chen wrote: > Currently, debugfs_regset32 only contains void __iomem *base, > and it is not friendly to regmap user. > > Let's add regmap to debugfs_regset32, and add regmap > support to debugfs_print_reg32. > > Signed-off-by: Li Chen <me@linux.beauty> > --- > fs/debugfs/file.c | 23 +++++++++++++++++++---- > include/linux/debugfs.h | 10 +++++++--- > 2 files changed, 26 insertions(+), 7 deletions(-) > > diff --git a/fs/debugfs/file.c b/fs/debugfs/file.c > index b54f470e0d03..c4663cfc20b6 100644 > --- a/fs/debugfs/file.c > +++ b/fs/debugfs/file.c > @@ -1112,8 +1112,10 @@ EXPORT_SYMBOL_GPL(debugfs_create_u32_array); > * @regs: an array if struct debugfs_reg32 structures > * @nregs: the length of the above array > * @base: the base address to be used in reading the registers > + * @regmap: regmap to be used in reading the registers > * @prefix: a string to be prefixed to every output line > * > + * user should pick one of two from base and regmap > * This function outputs a text block describing the current values of > * some 32-bit hardware registers. It is meant to be used within debugfs > * files based on seq_file that need to show registers, intermixed with other > @@ -1122,15 +1124,27 @@ EXPORT_SYMBOL_GPL(debugfs_create_u32_array); > * for example configuration of dma channels > */ > void debugfs_print_regs32(struct seq_file *s, const struct debugfs_reg32 *regs, > - int nregs, void __iomem *base, char *prefix) > + int nregs, void __iomem *base, struct regmap *regmap, > + char *prefix)
This is confusing, please just provide a new function for regmap instead of trying to overload this function. You can use the same function inside the debugfs core like this, but never export such a complex set of parameters to actual users, that's just painful.
thanks,
greg k-h
| |