[RFC 2/7][PATCH] AMBA DMA: Implement /proc/dma for arm DMA

From: Peter Pearse
Date: Mon Oct 30 2006 - 07:01:04 EST


Adds the necessary functions to arch/arm/kernel/dma.c.

Signed-off-by: Peter M Pearse <peter.pearse@xxxxxxx>

---
diff -purN arm_amba/arch/arm/kernel/dma.c
arm_amba_proc_dma/arch/arm/kernel/dma.c
--- arm_amba/arch/arm/kernel/dma.c 2006-10-17 13:28:37.000000000 +0100
+++ arm_amba_proc_dma/arch/arm/kernel/dma.c 2006-10-17
17:05:21.000000000 +0100
@@ -15,6 +15,7 @@
#include <linux/init.h>
#include <linux/spinlock.h>
#include <linux/errno.h>
+#include <linux/proc_fs.h>

#include <asm/dma.h>

@@ -258,6 +259,47 @@ int get_dma_residue(dmach_t channel)
}
EXPORT_SYMBOL(get_dma_residue);

+#ifdef CONFIG_PROC_FS
+static int proc_dma_show(struct seq_file *m, void *v)
+{
+ int i;
+
+ for (i = 0 ; i < MAX_DMA_CHANNELS ; i++) {
+ if (dma_chan[i].lock) {
+ seq_printf(m, "%2d: %14s %s\n", i,
+ dma_chan[i].d_ops->type,
dma_chan[i].device_id);
+ }
+ }
+ return 0;
+}
+static int proc_dma_open(struct inode *inode, struct file *file)
+{
+ return single_open(file, proc_dma_show, NULL);
+}
+
+static struct file_operations proc_dma_operations = {
+ .open = proc_dma_open,
+ .read = seq_read,
+ .llseek = seq_lseek,
+ .release = single_release,
+};
+
+static int __init proc_dma_init(void)
+{
+ if(MAX_DMA_CHANNELS > 0){
+ struct proc_dir_entry *e;
+
+ e = create_proc_entry("dma", 0, NULL);
+ if (e)
+ e->proc_fops = &proc_dma_operations;
+ }
+ return 0;
+}
+
+__initcall(proc_dma_init);
+
+#endif
+
static int __init init_dma(void)
{
arch_dma_init(dma_chan);



-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/