public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH -next] debugfs: add missing #ifdef HAS_IOMEM
@ 2011-12-27 14:08 Heiko Carstens
  2011-12-27 14:25 ` Alessandro Rubini
  2012-01-04  0:44 ` Greg KH
  0 siblings, 2 replies; 5+ messages in thread
From: Heiko Carstens @ 2011-12-27 14:08 UTC (permalink / raw)
  To: Greg Kroah-Hartman; +Cc: linux-kernel, Heiko Carstens, Alessandro Rubini

"debugfs: add tools to printk 32-bit registers" adds new functions which rely
on IOMEM functionality which is not present on all architectures and therefore
result in compile errors:

fs/debugfs/file.c: In function 'debugfs_print_regs32':
fs/debugfs/file.c:561:7: error: implicit declaration of function 'readl' [-Werror=implicit-function-declaration]

Add an #ifdef CONFIG_HAS_IOMEM to fix this

Signed-off-by: Heiko Carstens <heiko.carstens@de.ibm.com>
Cc: Alessandro Rubini <rubini@gnudd.com>
---
 fs/debugfs/file.c |    4 ++++
 1 files changed, 4 insertions(+), 0 deletions(-)

diff --git a/fs/debugfs/file.c b/fs/debugfs/file.c
index 989f07f..ea62afa 100644
--- a/fs/debugfs/file.c
+++ b/fs/debugfs/file.c
@@ -528,6 +528,8 @@ struct dentry *debugfs_create_blob(const char *name, mode_t mode,
 }
 EXPORT_SYMBOL_GPL(debugfs_create_blob);
 
+#ifdef CONFIG_HAS_IOMEM
+
 /*
  * The regset32 stuff is used to print 32-bit registers using the
  * seq_file utilities. We offer printing a register set in an already-opened
@@ -616,3 +618,5 @@ struct dentry *debugfs_create_regset32(const char *name, mode_t mode,
 	return debugfs_create_file(name, mode, parent, regset, &fops_regset32);
 }
 EXPORT_SYMBOL_GPL(debugfs_create_regset32);
+
+#endif /* CONFIG_HAS_IOMEM */
-- 
1.7.7.3


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH -next] debugfs: add missing #ifdef HAS_IOMEM
  2011-12-27 14:08 [PATCH -next] debugfs: add missing #ifdef HAS_IOMEM Heiko Carstens
@ 2011-12-27 14:25 ` Alessandro Rubini
  2012-01-04  0:44 ` Greg KH
  1 sibling, 0 replies; 5+ messages in thread
From: Alessandro Rubini @ 2011-12-27 14:25 UTC (permalink / raw)
  To: heiko.carstens; +Cc: gregkh, linux-kernel

> "debugfs: add tools to printk 32-bit registers" adds new functions
> which rely on IOMEM functionality which is not present on all
> architectures and therefore result in compile errors:

Ok, my fault. I was thinking everybody has it.

Acked-by: Alessandro Rubini <rubini@gnudd.com>

(on the other hand, maybe the header should have it as well? I hate
ifdef so I'd better avoid it, but I don't know what the policy is in
this case: compile-error for implicit declaration or link error for
missing symbol?  -- maybe a comment in the header is suitable?).

/alessandro

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH -next] debugfs: add missing #ifdef HAS_IOMEM
  2011-12-27 14:08 [PATCH -next] debugfs: add missing #ifdef HAS_IOMEM Heiko Carstens
  2011-12-27 14:25 ` Alessandro Rubini
@ 2012-01-04  0:44 ` Greg KH
  2012-01-04  0:48   ` Al Viro
  1 sibling, 1 reply; 5+ messages in thread
From: Greg KH @ 2012-01-04  0:44 UTC (permalink / raw)
  To: Heiko Carstens; +Cc: Greg Kroah-Hartman, linux-kernel, Alessandro Rubini

On Tue, Dec 27, 2011 at 03:08:28PM +0100, Heiko Carstens wrote:
> "debugfs: add tools to printk 32-bit registers" adds new functions which rely
> on IOMEM functionality which is not present on all architectures and therefore
> result in compile errors:
> 
> fs/debugfs/file.c: In function 'debugfs_print_regs32':
> fs/debugfs/file.c:561:7: error: implicit declaration of function 'readl' [-Werror=implicit-function-declaration]

Who does not have readl()?  Surely there should be a .h file we are just
missing to include?

> Add an #ifdef CONFIG_HAS_IOMEM to fix this

I guess this is ok, thanks for the patch.

greg k-h

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH -next] debugfs: add missing #ifdef HAS_IOMEM
  2012-01-04  0:44 ` Greg KH
@ 2012-01-04  0:48   ` Al Viro
  2012-01-04  0:55     ` Greg KH
  0 siblings, 1 reply; 5+ messages in thread
From: Al Viro @ 2012-01-04  0:48 UTC (permalink / raw)
  To: Greg KH; +Cc: Heiko Carstens, Greg Kroah-Hartman, linux-kernel,
	Alessandro Rubini

On Tue, Jan 03, 2012 at 04:44:52PM -0800, Greg KH wrote:
> On Tue, Dec 27, 2011 at 03:08:28PM +0100, Heiko Carstens wrote:
> > "debugfs: add tools to printk 32-bit registers" adds new functions which rely
> > on IOMEM functionality which is not present on all architectures and therefore
> > result in compile errors:
> > 
> > fs/debugfs/file.c: In function 'debugfs_print_regs32':
> > fs/debugfs/file.c:561:7: error: implicit declaration of function 'readl' [-Werror=implicit-function-declaration]
> 
> Who does not have readl()?  Surely there should be a .h file we are just
> missing to include?

s390, uml, etc.  What the hell is that kind of stuff doing in fs/*/*, anyway?

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH -next] debugfs: add missing #ifdef HAS_IOMEM
  2012-01-04  0:48   ` Al Viro
@ 2012-01-04  0:55     ` Greg KH
  0 siblings, 0 replies; 5+ messages in thread
From: Greg KH @ 2012-01-04  0:55 UTC (permalink / raw)
  To: Al Viro; +Cc: Heiko Carstens, Greg Kroah-Hartman, linux-kernel,
	Alessandro Rubini

On Wed, Jan 04, 2012 at 12:48:23AM +0000, Al Viro wrote:
> On Tue, Jan 03, 2012 at 04:44:52PM -0800, Greg KH wrote:
> > On Tue, Dec 27, 2011 at 03:08:28PM +0100, Heiko Carstens wrote:
> > > "debugfs: add tools to printk 32-bit registers" adds new functions which rely
> > > on IOMEM functionality which is not present on all architectures and therefore
> > > result in compile errors:
> > > 
> > > fs/debugfs/file.c: In function 'debugfs_print_regs32':
> > > fs/debugfs/file.c:561:7: error: implicit declaration of function 'readl' [-Werror=implicit-function-declaration]
> > 
> > Who does not have readl()?  Surely there should be a .h file we are just
> > missing to include?
> 
> s390, uml, etc.  What the hell is that kind of stuff doing in fs/*/*, anyway?

It's a debugfs "helper" function, included below, consolidating a number
of duplicated versions of this in other places in the kernel that were
doing the same thing.

thanks,

greg k-h


/**
 * debugfs_print_regs32 - use seq_print to describe a set of registers
 * @s: the seq_file structure being used to generate output
 * @regs: an array if struct debugfs_reg32 structures
 * @mregs: the length of the above array
 * @base: the base address to be used in reading the registers
 * @prefix: a string to be prefixed to every output line
 *
 * 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
 * information. The prefix argument may be used to specify a leading string,
 * because some peripherals have several blocks of identical registers,
 * for example configuration of dma channels
 */
int debugfs_print_regs32(struct seq_file *s, const struct debugfs_reg32 *regs,
                           int nregs, void __iomem *base, char *prefix)
{
        int i, ret = 0;

        for (i = 0; i < nregs; i++, regs++) {
                if (prefix)
                        ret += seq_printf(s, "%s", prefix);
                ret += seq_printf(s, "%s = 0x%08x\n", regs->name,
                                  readl(base + regs->offset));
        }
        return ret;
}
EXPORT_SYMBOL_GPL(debugfs_print_regs32);


^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2012-01-04  0:55 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-12-27 14:08 [PATCH -next] debugfs: add missing #ifdef HAS_IOMEM Heiko Carstens
2011-12-27 14:25 ` Alessandro Rubini
2012-01-04  0:44 ` Greg KH
2012-01-04  0:48   ` Al Viro
2012-01-04  0:55     ` Greg KH

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox