aboutsummaryrefslogtreecommitdiffstats
path: root/arch/sparc/kernel/ioport.c
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2009-09-14 10:48:59 -0700
committerLinus Torvalds <torvalds@linux-foundation.org>2009-09-14 10:48:59 -0700
commit99bc47067910f7070e65ee318a6dd79a2371f1e5 (patch)
treed24941285af868b0392a327360ae260a8f50caf1 /arch/sparc/kernel/ioport.c
parentMerge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net-next-2.6 (diff)
parentMerge branch 'master' of /home/davem/src/GIT/linux-2.6/ (diff)
downloadlinux-dev-99bc47067910f7070e65ee318a6dd79a2371f1e5.tar.xz
linux-dev-99bc47067910f7070e65ee318a6dd79a2371f1e5.zip
Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/sparc-next-2.6
* git://git.kernel.org/pub/scm/linux/kernel/git/davem/sparc-next-2.6: (21 commits) sparc64: Initial niagara2 perf counter support. sparc64: Perf counter 'nop' event is not constant. sparc64: Provide a way to specify a perf counter overflow IRQ enable bit. sparc64: Provide hypervisor tracing bit support for perf counters. sparc64: Initial hw perf counter support. sparc64: Implement a real set_perf_counter_pending(). sparc64: Use nmi_enter() and nmi_exit(), as needed. sparc64: Provide extern decls for sparc_??u_type strings. sparc64: Make touch_nmi_watchdog() actually work. sparc64: Kill unnecessary cast in profile_timer_exceptions_notify(). sparc64: Manage NMI watchdog enabling like x86. sparc: add basic support for 'perf' sparc: convert /proc/io_map, /proc/dvma_map to seq_file sparc, leon: sparc-leon specific SRMMU initialization and bootup fixes. sparc,leon: Added support for AMBAPP bus. sparc,leon: Introduce the sparc-leon CPU type. sparc,leon: Redefine MMU register access asi if CONFIG_LEON sparc,leon: CONFIG_SPARC_LEON option and leon specific files. sparc64: cheaper asm/uaccess.h inclusion SPARC: fix duplicate declaration ...
Diffstat (limited to 'arch/sparc/kernel/ioport.c')
-rw-r--r--arch/sparc/kernel/ioport.c32
1 files changed, 20 insertions, 12 deletions
diff --git a/arch/sparc/kernel/ioport.c b/arch/sparc/kernel/ioport.c
index edbea232c617..9f61fd8cbb7b 100644
--- a/arch/sparc/kernel/ioport.c
+++ b/arch/sparc/kernel/ioport.c
@@ -35,6 +35,7 @@
#include <linux/slab.h>
#include <linux/pci.h> /* struct pci_dev */
#include <linux/proc_fs.h>
+#include <linux/seq_file.h>
#include <linux/scatterlist.h>
#include <linux/of_device.h>
@@ -683,26 +684,33 @@ EXPORT_SYMBOL(dma_set_mask);
#ifdef CONFIG_PROC_FS
-static int
-_sparc_io_get_info(char *buf, char **start, off_t fpos, int length, int *eof,
- void *data)
+static int sparc_io_proc_show(struct seq_file *m, void *v)
{
- char *p = buf, *e = buf + length;
- struct resource *r;
+ struct resource *root = m->private, *r;
const char *nm;
- for (r = ((struct resource *)data)->child; r != NULL; r = r->sibling) {
- if (p + 32 >= e) /* Better than nothing */
- break;
+ for (r = root->child; r != NULL; r = r->sibling) {
if ((nm = r->name) == 0) nm = "???";
- p += sprintf(p, "%016llx-%016llx: %s\n",
+ seq_printf(m, "%016llx-%016llx: %s\n",
(unsigned long long)r->start,
(unsigned long long)r->end, nm);
}
- return p-buf;
+ return 0;
}
+static int sparc_io_proc_open(struct inode *inode, struct file *file)
+{
+ return single_open(file, sparc_io_proc_show, PDE(inode)->data);
+}
+
+static const struct file_operations sparc_io_proc_fops = {
+ .owner = THIS_MODULE,
+ .open = sparc_io_proc_open,
+ .read = seq_read,
+ .llseek = seq_lseek,
+ .release = single_release,
+};
#endif /* CONFIG_PROC_FS */
/*
@@ -727,7 +735,7 @@ static struct resource *_sparc_find_resource(struct resource *root,
static void register_proc_sparc_ioport(void)
{
#ifdef CONFIG_PROC_FS
- create_proc_read_entry("io_map",0,NULL,_sparc_io_get_info,&sparc_iomap);
- create_proc_read_entry("dvma_map",0,NULL,_sparc_io_get_info,&_sparc_dvma);
+ proc_create_data("io_map", 0, NULL, &sparc_io_proc_fops, &sparc_iomap);
+ proc_create_data("dvma_map", 0, NULL, &sparc_io_proc_fops, &_sparc_dvma);
#endif
}