aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--arch/sh/drivers/dma/dma-api.c28
1 files changed, 19 insertions, 9 deletions
diff --git a/arch/sh/drivers/dma/dma-api.c b/arch/sh/drivers/dma/dma-api.c
index f46848f088e4..851e5106e580 100644
--- a/arch/sh/drivers/dma/dma-api.c
+++ b/arch/sh/drivers/dma/dma-api.c
@@ -13,6 +13,7 @@
13#include <linux/module.h> 13#include <linux/module.h>
14#include <linux/spinlock.h> 14#include <linux/spinlock.h>
15#include <linux/proc_fs.h> 15#include <linux/proc_fs.h>
16#include <linux/seq_file.h>
16#include <linux/list.h> 17#include <linux/list.h>
17#include <linux/platform_device.h> 18#include <linux/platform_device.h>
18#include <linux/mm.h> 19#include <linux/mm.h>
@@ -308,11 +309,9 @@ int dma_extend(unsigned int chan, unsigned long op, void *param)
308} 309}
309EXPORT_SYMBOL(dma_extend); 310EXPORT_SYMBOL(dma_extend);
310 311
311static int dma_read_proc(char *buf, char **start, off_t off, 312static int dma_proc_show(struct seq_file *m, void *v)
312 int len, int *eof, void *data)
313{ 313{
314 struct dma_info *info; 314 struct dma_info *info = v;
315 char *p = buf;
316 315
317 if (list_empty(&registered_dmac_list)) 316 if (list_empty(&registered_dmac_list))
318 return 0; 317 return 0;
@@ -332,14 +331,26 @@ static int dma_read_proc(char *buf, char **start, off_t off,
332 if (!(channel->flags & DMA_CONFIGURED)) 331 if (!(channel->flags & DMA_CONFIGURED))
333 continue; 332 continue;
334 333
335 p += sprintf(p, "%2d: %14s %s\n", i, 334 seq_printf(m, "%2d: %14s %s\n", i,
336 info->name, channel->dev_id); 335 info->name, channel->dev_id);
337 } 336 }
338 } 337 }
339 338
340 return p - buf; 339 return 0;
340}
341
342static int dma_proc_open(struct inode *inode, struct file *file)
343{
344 return single_open(file, dma_proc_show, NULL);
341} 345}
342 346
347static const struct file_operations dma_proc_fops = {
348 .open = dma_proc_open,
349 .read = seq_read,
350 .llseek = seq_lseek,
351 .release = seq_release,
352};
353
343int register_dmac(struct dma_info *info) 354int register_dmac(struct dma_info *info)
344{ 355{
345 unsigned int total_channels, i; 356 unsigned int total_channels, i;
@@ -412,8 +423,7 @@ EXPORT_SYMBOL(unregister_dmac);
412static int __init dma_api_init(void) 423static int __init dma_api_init(void)
413{ 424{
414 printk(KERN_NOTICE "DMA: Registering DMA API.\n"); 425 printk(KERN_NOTICE "DMA: Registering DMA API.\n");
415 return create_proc_read_entry("dma", 0, 0, dma_read_proc, 0) 426 return proc_create("dma", 0, NULL, &dma_proc_fops) ? 0 : -ENOMEM;
416 ? 0 : -ENOMEM;
417} 427}
418subsys_initcall(dma_api_init); 428subsys_initcall(dma_api_init);
419 429