diff options
| author | Russell King <rmk@arm.linux.org.uk> | 2002-08-03 04:28:39 -0700 |
|---|---|---|
| committer | Linus Torvalds <torvalds@home.transmeta.com> | 2002-08-03 04:28:39 -0700 |
| commit | a4d439297fcf2d94764c2c70ed5ce9bc27e949e9 (patch) | |
| tree | a017dab84c363892a1d89ae739397afc1e76867d /kernel | |
| parent | 3a6ecd1b8741e5a000fdda2c5904c7228c9c8721 (diff) | |
[PATCH] 1: 2.5.29-dma
The following patch adds support for CONFIG_GENERIC_ISA_DMA, which went
into the 2.4-ac kernel series prior to 2.5 happening.
The following patch allows architectures to decide whether they want
the generic ISA DMA functionality provided by kernel/dma.c and other
supporting files.
In addition, we move the procfs "/proc/dma" support code out of fs/proc
into kernel/dma.c, and adapt it to use the new seq_file code.
Diffstat (limited to 'kernel')
| -rw-r--r-- | kernel/Makefile | 5 | ||||
| -rw-r--r-- | kernel/dma.c | 85 | ||||
| -rw-r--r-- | kernel/ksyms.c | 7 |
3 files changed, 69 insertions, 28 deletions
diff --git a/kernel/Makefile b/kernel/Makefile index 4834fc454271..b560bc0b2c5c 100644 --- a/kernel/Makefile +++ b/kernel/Makefile @@ -10,13 +10,14 @@ O_TARGET := kernel.o export-objs = signal.o sys.o kmod.o context.o ksyms.o pm.o exec_domain.o \ - printk.o platform.o suspend.o + printk.o platform.o suspend.o dma.o -obj-y = sched.o dma.o fork.o exec_domain.o panic.o printk.o \ +obj-y = sched.o fork.o exec_domain.o panic.o printk.o \ module.o exit.o itimer.o time.o softirq.o resource.o \ sysctl.o capability.o ptrace.o timer.o user.o \ signal.o sys.o kmod.o context.o futex.o platform.o +obj-$(CONFIG_GENERIC_ISA_DMA) += dma.o obj-$(CONFIG_SMP) += cpu.o obj-$(CONFIG_UID16) += uid16.o obj-$(CONFIG_MODULES) += ksyms.o diff --git a/kernel/dma.c b/kernel/dma.c index 8f8586f4235c..39e6f0820f9a 100644 --- a/kernel/dma.c +++ b/kernel/dma.c @@ -9,11 +9,14 @@ * [It also happened to remove the sizeof(char *) == sizeof(int) * assumption introduced because of those /proc/dma patches. -- Hennus] */ - +#include <linux/module.h> #include <linux/kernel.h> #include <linux/errno.h> #include <linux/spinlock.h> #include <linux/string.h> +#include <linux/seq_file.h> +#include <linux/proc_fs.h> +#include <linux/init.h> #include <asm/dma.h> #include <asm/system.h> @@ -65,20 +68,6 @@ static struct dma_chan dma_chan_busy[MAX_DMA_CHANNELS] = { { 0, 0 } }; -int get_dma_list(char *buf) -{ - int i, len = 0; - - for (i = 0 ; i < MAX_DMA_CHANNELS ; i++) { - if (dma_chan_busy[i].lock) { - len += sprintf(buf+len, "%2d: %s\n", - i, - dma_chan_busy[i].device_id); - } - } - return len; -} /* get_dma_list */ - int request_dma(unsigned int dmanr, const char * device_id) { @@ -109,6 +98,19 @@ void free_dma(unsigned int dmanr) } /* free_dma */ +static int proc_dma_show(struct seq_file *m, void *v) +{ + int i; + + for (i = 0 ; i < MAX_DMA_CHANNELS ; i++) { + if (dma_chan_busy[i].lock) { + seq_printf(m, "%2d: %s\n", i, + dma_chan_busy[i].device_id); + } + } + return 0; +} + #else int request_dma(unsigned int dmanr, const char *device_id) @@ -120,9 +122,54 @@ void free_dma(unsigned int dmanr) { } -int get_dma_list(char *buf) -{ - strcpy(buf, "No DMA\n"); - return 7; +static int proc_dma_show(struct seq_file *m, void *v) +{ + seq_puts(m, "No DMA\n"); + return 0; } + #endif + +#ifdef CONFIG_PROC_FS +static int proc_dma_open(struct inode *inode, struct file *file) +{ + char *buf = kmalloc(PAGE_SIZE, GFP_KERNEL); + struct seq_file *m; + int res; + + if (!buf) + return -ENOMEM; + res = single_open(file, proc_dma_show, NULL); + if (!res) { + m = file->private_data; + m->buf = buf; + m->size = PAGE_SIZE; + } else + kfree(buf); + return res; +} + +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) +{ + 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 + +EXPORT_SYMBOL(request_dma); +EXPORT_SYMBOL(free_dma); +EXPORT_SYMBOL(dma_spin_lock); diff --git a/kernel/ksyms.c b/kernel/ksyms.c index e01bd125d378..006e1832a02e 100644 --- a/kernel/ksyms.c +++ b/kernel/ksyms.c @@ -64,9 +64,6 @@ extern void set_device_ro(kdev_t dev,int flag); extern void *sys_call_table; extern struct timezone sys_tz; -extern int request_dma(unsigned int dmanr, const char * deviceID); -extern void free_dma(unsigned int dmanr); -extern spinlock_t dma_spin_lock; #ifdef CONFIG_MODVERSIONS const struct module_symbol __export_Using_Versions @@ -437,10 +434,6 @@ EXPORT_SYMBOL(unlock_kiovec); EXPORT_SYMBOL(brw_kiovec); EXPORT_SYMBOL(kiobuf_wait_for_io); -/* dma handling */ -EXPORT_SYMBOL(request_dma); -EXPORT_SYMBOL(free_dma); -EXPORT_SYMBOL(dma_spin_lock); #ifdef HAVE_DISABLE_HLT EXPORT_SYMBOL(disable_hlt); EXPORT_SYMBOL(enable_hlt); |
