diff options
| -rw-r--r-- | arch/alpha/config.in | 1 | ||||
| -rw-r--r-- | arch/i386/config.in | 1 | ||||
| -rw-r--r-- | arch/m68k/config.in | 1 | ||||
| -rw-r--r-- | arch/mips/config.in | 1 | ||||
| -rw-r--r-- | arch/mips64/config.in | 1 | ||||
| -rw-r--r-- | arch/parisc/config.in | 1 | ||||
| -rw-r--r-- | arch/ppc/config.in | 1 | ||||
| -rw-r--r-- | arch/sh/config.in | 1 | ||||
| -rw-r--r-- | arch/sparc/config.in | 1 | ||||
| -rw-r--r-- | arch/sparc64/config.in | 1 | ||||
| -rw-r--r-- | fs/proc/proc_misc.c | 8 | ||||
| -rw-r--r-- | kernel/Makefile | 5 | ||||
| -rw-r--r-- | kernel/dma.c | 85 | ||||
| -rw-r--r-- | kernel/ksyms.c | 7 |
14 files changed, 79 insertions, 36 deletions
diff --git a/arch/alpha/config.in b/arch/alpha/config.in index ee9ac56c4701..e4cf0a6850d6 100644 --- a/arch/alpha/config.in +++ b/arch/alpha/config.in @@ -7,6 +7,7 @@ define_bool CONFIG_ALPHA y define_bool CONFIG_UID16 n define_bool CONFIG_RWSEM_GENERIC_SPINLOCK n define_bool CONFIG_RWSEM_XCHGADD_ALGORITHM y +define_bool CONFIG_GENERIC_ISA_DMA y source init/Config.in diff --git a/arch/i386/config.in b/arch/i386/config.in index de59f559ee7b..45a94723913a 100644 --- a/arch/i386/config.in +++ b/arch/i386/config.in @@ -9,6 +9,7 @@ define_bool CONFIG_ISA y define_bool CONFIG_SBUS n define_bool CONFIG_UID16 y +define_bool CONFIG_GENERIC_ISA_DMA y source init/Config.in diff --git a/arch/m68k/config.in b/arch/m68k/config.in index 8a46861a2ded..d3ce9e6638e9 100644 --- a/arch/m68k/config.in +++ b/arch/m68k/config.in @@ -6,6 +6,7 @@ define_bool CONFIG_UID16 y define_bool CONFIG_RWSEM_GENERIC_SPINLOCK y define_bool CONFIG_RWSEM_XCHGADD_ALGORITHM n +define_bool CONFIG_GENERIC_ISA_DMA y mainmenu_name "Linux/68k Kernel Configuration" diff --git a/arch/mips/config.in b/arch/mips/config.in index 93d4b4b55f06..8579193f7f88 100644 --- a/arch/mips/config.in +++ b/arch/mips/config.in @@ -4,6 +4,7 @@ # define_bool CONFIG_MIPS y define_bool CONFIG_SMP n +define_bool CONFIG_GENERIC_ISA_DMA y mainmenu_name "Linux Kernel Configuration" diff --git a/arch/mips64/config.in b/arch/mips64/config.in index ca2afb6638ab..877922fc21e5 100644 --- a/arch/mips64/config.in +++ b/arch/mips64/config.in @@ -26,6 +26,7 @@ endmenu define_bool CONFIG_RWSEM_GENERIC_SPINLOCK y define_bool CONFIG_RWSEM_XCHGADD_ALGORITHM n +define_bool CONFIG_GENERIC_ISA_DMA y # # Select some configuration options automatically based on user selections diff --git a/arch/parisc/config.in b/arch/parisc/config.in index 4bc67f405b5b..016628d2db6f 100644 --- a/arch/parisc/config.in +++ b/arch/parisc/config.in @@ -9,6 +9,7 @@ define_bool CONFIG_PARISC y define_bool CONFIG_UID16 n define_bool CONFIG_RWSEM_GENERIC_SPINLOCK y define_bool CONFIG_RWSEM_XCHGADD_ALGORITHM n +define_bool CONFIG_GENERIC_ISA_DMA y source init/Config.in diff --git a/arch/ppc/config.in b/arch/ppc/config.in index fbf83c18b7c1..386bf135f1b5 100644 --- a/arch/ppc/config.in +++ b/arch/ppc/config.in @@ -7,6 +7,7 @@ define_bool CONFIG_UID16 n define_bool CONFIG_RWSEM_GENERIC_SPINLOCK n define_bool CONFIG_RWSEM_XCHGADD_ALGORITHM y define_bool CONFIG_HAVE_DEC_LOCK y +define_bool CONFIG_GENERIC_ISA_DMA y mainmenu_name "Linux/PowerPC Kernel Configuration" diff --git a/arch/sh/config.in b/arch/sh/config.in index b7a953e906ba..f956fae61abe 100644 --- a/arch/sh/config.in +++ b/arch/sh/config.in @@ -9,6 +9,7 @@ define_bool CONFIG_SUPERH y define_bool CONFIG_UID16 y define_bool CONFIG_RWSEM_GENERIC_SPINLOCK y define_bool CONFIG_RWSEM_XCHGADD_ALGORITHM n +define_bool CONFIG_GENERIC_ISA_DMA y source init/Config.in diff --git a/arch/sparc/config.in b/arch/sparc/config.in index 00b6e1e5d96f..2810a503a8e6 100644 --- a/arch/sparc/config.in +++ b/arch/sparc/config.in @@ -6,6 +6,7 @@ mainmenu_name "Linux/SPARC Kernel Configuration" define_bool CONFIG_UID16 y define_bool CONFIG_HIGHMEM y +define_bool CONFIG_GENERIC_ISA_DMA y source init/Config.in diff --git a/arch/sparc64/config.in b/arch/sparc64/config.in index c6443bcf7b47..7ff56c408258 100644 --- a/arch/sparc64/config.in +++ b/arch/sparc64/config.in @@ -26,6 +26,7 @@ bool 'Support for hot-pluggable devices' CONFIG_HOTPLUG define_bool CONFIG_HAVE_DEC_LOCK y define_bool CONFIG_RWSEM_GENERIC_SPINLOCK n define_bool CONFIG_RWSEM_XCHGADD_ALGORITHM y +define_bool CONFIG_GENERIC_ISA_DMA y define_bool CONFIG_ISA n define_bool CONFIG_ISAPNP n define_bool CONFIG_EISA n diff --git a/fs/proc/proc_misc.c b/fs/proc/proc_misc.c index 31d44ce37122..86bb2a59e994 100644 --- a/fs/proc/proc_misc.c +++ b/fs/proc/proc_misc.c @@ -430,13 +430,6 @@ static int filesystems_read_proc(char *page, char **start, off_t off, return proc_calc_metrics(page, start, off, count, eof, len); } -static int dma_read_proc(char *page, char **start, off_t off, - int count, int *eof, void *data) -{ - int len = get_dma_list(page); - return proc_calc_metrics(page, start, off, count, eof, len); -} - static int ioports_read_proc(char *page, char **start, off_t off, int count, int *eof, void *data) { @@ -589,7 +582,6 @@ void __init proc_misc_init(void) {"stat", kstat_read_proc}, {"devices", devices_read_proc}, {"filesystems", filesystems_read_proc}, - {"dma", dma_read_proc}, {"ioports", ioports_read_proc}, {"cmdline", cmdline_read_proc}, #ifdef CONFIG_SGI_DS1286 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); |
