1 // SPDX-License-Identifier: GPL-2.0+
3 * /proc interface for comedi
5 * COMEDI - Linux Control and Measurement Device Interface
6 * Copyright (C) 1998 David A. Schleef <ds@schleef.org>
10 * This is some serious bloatware.
12 * Taken from Dave A.'s PCL-711 driver, 'cuz I thought it
16 #include "comedidev.h"
17 #include "comedi_internal.h"
18 #include <linux/proc_fs.h>
19 #include <linux/seq_file.h>
21 static int comedi_read(struct seq_file *m, void *v)
25 struct comedi_driver *driv;
27 seq_printf(m, "comedi version " COMEDI_RELEASE "\nformat string: %s\n",
28 "\"%2d: %-20s %-20s %4d\", i, driver_name, board_name, n_subdevices");
30 for (i = 0; i < COMEDI_NUM_BOARD_MINORS; i++) {
31 struct comedi_device *dev = comedi_dev_get_from_minor(i);
36 down_read(&dev->attach_lock);
39 seq_printf(m, "%2d: %-20s %-20s %4d\n",
40 i, dev->driver->driver_name,
41 dev->board_name, dev->n_subdevices);
43 up_read(&dev->attach_lock);
47 seq_puts(m, "no devices\n");
49 mutex_lock(&comedi_drivers_list_lock);
50 for (driv = comedi_drivers; driv; driv = driv->next) {
51 seq_printf(m, "%s:\n", driv->driver_name);
52 for (i = 0; i < driv->num_names; i++)
53 seq_printf(m, " %s\n",
54 *(char **)((char *)driv->board_name +
58 seq_printf(m, " %s\n", driv->driver_name);
60 mutex_unlock(&comedi_drivers_list_lock);
65 void __init comedi_proc_init(void)
67 if (!proc_create_single("comedi", 0444, NULL, comedi_read))
68 pr_warn("comedi: unable to create proc entry\n");
71 void comedi_proc_cleanup(void)
73 remove_proc_entry("comedi", NULL);