Skip to contentSkip to conversation

debugfs: allow to use regmap for print regs

PATCH Greg Kroah-Hartman 2 participants 2 messages Jan 11, 2023 1 message not in the archive

lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): [email protected]

#1 lore raw
Quoted 28 lines · Li Chen

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.

---
 fs/debugfs/file.c       | 23 +++++++++++++++++++----
 include/linux/debugfs.h | 10 +++++++---
 2 files changed, 26 insertions(+), 7 deletions(-)
fs/debugfs/file.c +2 -0
index b54f470e0d03..c4663cfc20b6 100644
@@ -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

fs/debugfs/file.c EXPORT_SYMBOL_GPL(debugfs_create_u32_array); · line 1128

Quoted 6 lines
fs/debugfs/file.c +2 -1
@@ -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

#2 lore raw

Hi Greg,

Quoted 9 lines
Quoted 4 lines

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 for your review, updated in v2.

Regards,
Li