Commit 1f817b86 authored by David Howells's avatar David Howells Committed by Al Viro

comedi: Don't use create_proc_read_entry()

Don't use create_proc_read_entry() as that is deprecated, but rather use
proc_create_data() and seq_file instead.
Signed-off-by: default avatarDavid Howells <dhowells@redhat.com>
cc: David Schleef <ds@schleef.org>
cc: Ian Abbott <abbotti@mev.co.uk>
cc: Mori Hess <fmhess@users.sourceforge.net>
cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
cc: H Hartley Sweeten <hsweeten@visionengravers.com>
cc: devel@driverdev.osuosl.org
Signed-off-by: default avatarAl Viro <viro@zeniv.linux.org.uk>
parent 207e3909
...@@ -31,17 +31,15 @@ ...@@ -31,17 +31,15 @@
#include "comedidev.h" #include "comedidev.h"
#include "comedi_internal.h" #include "comedi_internal.h"
#include <linux/proc_fs.h> #include <linux/proc_fs.h>
#include <linux/string.h> #include <linux/seq_file.h>
static int comedi_read(char *buf, char **start, off_t offset, int len, static int comedi_read(struct seq_file *m, void *v)
int *eof, void *data)
{ {
int i; int i;
int devices_q = 0; int devices_q = 0;
int l = 0;
struct comedi_driver *driv; struct comedi_driver *driv;
l += sprintf(buf + l, seq_printf(m,
"comedi version " COMEDI_RELEASE "\n" "comedi version " COMEDI_RELEASE "\n"
"format string: %s\n", "format string: %s\n",
"\"%2d: %-20s %-20s %4d\", i, " "\"%2d: %-20s %-20s %4d\", i, "
...@@ -49,39 +47,51 @@ static int comedi_read(char *buf, char **start, off_t offset, int len, ...@@ -49,39 +47,51 @@ static int comedi_read(char *buf, char **start, off_t offset, int len,
for (i = 0; i < COMEDI_NUM_BOARD_MINORS; i++) { for (i = 0; i < COMEDI_NUM_BOARD_MINORS; i++) {
struct comedi_device *dev = comedi_dev_from_minor(i); struct comedi_device *dev = comedi_dev_from_minor(i);
if (!dev) if (!dev)
continue; continue;
if (dev->attached) { if (dev->attached) {
devices_q = 1; devices_q = 1;
l += sprintf(buf + l, "%2d: %-20s %-20s %4d\n", seq_printf(m, "%2d: %-20s %-20s %4d\n",
i, i, dev->driver->driver_name,
dev->driver->driver_name, dev->board_name, dev->n_subdevices);
dev->board_name, dev->n_subdevices);
} }
} }
if (!devices_q) if (!devices_q)
l += sprintf(buf + l, "no devices\n"); seq_puts(m, "no devices\n");
for (driv = comedi_drivers; driv; driv = driv->next) { for (driv = comedi_drivers; driv; driv = driv->next) {
l += sprintf(buf + l, "%s:\n", driv->driver_name); seq_printf(m, "%s:\n", driv->driver_name);
for (i = 0; i < driv->num_names; i++) { for (i = 0; i < driv->num_names; i++)
l += sprintf(buf + l, " %s\n", seq_printf(m, " %s\n",
*(char **)((char *)driv->board_name + *(char **)((char *)driv->board_name +
i * driv->offset)); i * driv->offset));
}
if (!driv->num_names) if (!driv->num_names)
l += sprintf(buf + l, " %s\n", driv->driver_name); seq_printf(m, " %s\n", driv->driver_name);
} }
return l; return 0;
}
/*
* seq_file wrappers for procfile show routines.
*/
static int comedi_proc_open(struct inode *inode, struct file *file)
{
return single_open(file, comedi_read, NULL);
} }
static const struct file_operations comedi_proc_fops = {
.open = comedi_proc_open,
.read = seq_read,
.llseek = seq_lseek,
.release = seq_release,
};
void comedi_proc_init(void) void comedi_proc_init(void)
{ {
create_proc_read_entry("comedi", S_IFREG | S_IRUGO, NULL, proc_create("comedi", 0644, NULL, &comedi_proc_fops);
comedi_read, NULL);
} }
void comedi_proc_cleanup(void) void comedi_proc_cleanup(void)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment