public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Greg KH <greg@kroah.com>
To: Al Viro <viro@ZenIV.linux.org.uk>
Cc: Heiko Carstens <heiko.carstens@de.ibm.com>,
	Greg Kroah-Hartman <gregkh@suse.de>,
	linux-kernel@vger.kernel.org,
	Alessandro Rubini <rubini@gnudd.com>
Subject: Re: [PATCH -next] debugfs: add missing #ifdef HAS_IOMEM
Date: Tue, 3 Jan 2012 16:55:27 -0800	[thread overview]
Message-ID: <20120104005527.GA29102@kroah.com> (raw)
In-Reply-To: <20120104004823.GC23916@ZenIV.linux.org.uk>

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);


      reply	other threads:[~2012-01-04  0:55 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20120104005527.GA29102@kroah.com \
    --to=greg@kroah.com \
    --cc=gregkh@suse.de \
    --cc=heiko.carstens@de.ibm.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=rubini@gnudd.com \
    --cc=viro@ZenIV.linux.org.uk \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox