Skip to content

Commit e193ba2

Browse files
author
Russell King
committed
ARM: dma: add /proc/dma support to arch/arm/kernel/dma.c
We have our own private implementation for ISA-like DMA which has been missing exposure via the /proc/dma interface. Add support for this. Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
1 parent f76348a commit e193ba2

1 file changed

Lines changed: 36 additions & 0 deletions

File tree

‎arch/arm/kernel/dma.c‎

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@
1616
#include <linux/spinlock.h>
1717
#include <linux/errno.h>
1818
#include <linux/scatterlist.h>
19+
#include <linux/seq_file.h>
20+
#include <linux/proc_fs.h>
1921

2022
#include <asm/dma.h>
2123

@@ -264,3 +266,37 @@ int get_dma_residue(unsigned int chan)
264266
return ret;
265267
}
266268
EXPORT_SYMBOL(get_dma_residue);
269+
270+
#ifdef CONFIG_PROC_FS
271+
static int proc_dma_show(struct seq_file *m, void *v)
272+
{
273+
int i;
274+
275+
for (i = 0 ; i < MAX_DMA_CHANNELS ; i++) {
276+
dma_t *dma = dma_channel(i);
277+
if (dma && dma->lock)
278+
seq_printf(m, "%2d: %s\n", i, dma->device_id);
279+
}
280+
return 0;
281+
}
282+
283+
static int proc_dma_open(struct inode *inode, struct file *file)
284+
{
285+
return single_open(file, proc_dma_show, NULL);
286+
}
287+
288+
static const struct file_operations proc_dma_operations = {
289+
.open = proc_dma_open,
290+
.read = seq_read,
291+
.llseek = seq_lseek,
292+
.release = single_release,
293+
};
294+
295+
static int __init proc_dma_init(void)
296+
{
297+
proc_create("dma", 0, NULL, &proc_dma_operations);
298+
return 0;
299+
}
300+
301+
__initcall(proc_dma_init);
302+
#endif

0 commit comments

Comments
 (0)