PM / sleep: Asynchronous threads for suspend_noirq
[linux/fpc-iii.git] / drivers / staging / comedi / proc.c
blobda6bc5855ebc5e08530515cfb8799dbaeb4deaa6
1 /*
2 module/proc.c
3 /proc interface for comedi
5 COMEDI - Linux Control and Measurement Device Interface
6 Copyright (C) 1998 David A. Schleef <ds@schleef.org>
8 This program is free software; you can redistribute it and/or modify
9 it under the terms of the GNU General Public License as published by
10 the Free Software Foundation; either version 2 of the License, or
11 (at your option) any later version.
13 This program is distributed in the hope that it will be useful,
14 but WITHOUT ANY WARRANTY; without even the implied warranty of
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 GNU General Public License for more details.
20 This is some serious bloatware.
22 Taken from Dave A.'s PCL-711 driver, 'cuz I thought it
23 was cool.
26 #include "comedidev.h"
27 #include "comedi_internal.h"
28 #include <linux/proc_fs.h>
29 #include <linux/seq_file.h>
31 static int comedi_read(struct seq_file *m, void *v)
33 int i;
34 int devices_q = 0;
35 struct comedi_driver *driv;
37 seq_printf(m,
38 "comedi version " COMEDI_RELEASE "\n"
39 "format string: %s\n",
40 "\"%2d: %-20s %-20s %4d\", i, "
41 "driver_name, board_name, n_subdevices");
43 for (i = 0; i < COMEDI_NUM_BOARD_MINORS; i++) {
44 struct comedi_device *dev = comedi_dev_get_from_minor(i);
46 if (!dev)
47 continue;
49 down_read(&dev->attach_lock);
50 if (dev->attached) {
51 devices_q = 1;
52 seq_printf(m, "%2d: %-20s %-20s %4d\n",
53 i, dev->driver->driver_name,
54 dev->board_name, dev->n_subdevices);
56 up_read(&dev->attach_lock);
57 comedi_dev_put(dev);
59 if (!devices_q)
60 seq_puts(m, "no devices\n");
62 mutex_lock(&comedi_drivers_list_lock);
63 for (driv = comedi_drivers; driv; driv = driv->next) {
64 seq_printf(m, "%s:\n", driv->driver_name);
65 for (i = 0; i < driv->num_names; i++)
66 seq_printf(m, " %s\n",
67 *(char **)((char *)driv->board_name +
68 i * driv->offset));
70 if (!driv->num_names)
71 seq_printf(m, " %s\n", driv->driver_name);
73 mutex_unlock(&comedi_drivers_list_lock);
75 return 0;
79 * seq_file wrappers for procfile show routines.
81 static int comedi_proc_open(struct inode *inode, struct file *file)
83 return single_open(file, comedi_read, NULL);
86 static const struct file_operations comedi_proc_fops = {
87 .open = comedi_proc_open,
88 .read = seq_read,
89 .llseek = seq_lseek,
90 .release = single_release,
93 void comedi_proc_init(void)
95 proc_create("comedi", 0644, NULL, &comedi_proc_fops);
98 void comedi_proc_cleanup(void)
100 remove_proc_entry("comedi", NULL);