]> git.karo-electronics.de Git - karo-tx-linux.git/blob - drivers/staging/comedi/comedidev.h
staging: unisys: Remove visorchannel stub
[karo-tx-linux.git] / drivers / staging / comedi / comedidev.h
1 /*
2     include/linux/comedidev.h
3     header file for kernel-only structures, variables, and constants
4
5     COMEDI - Linux Control and Measurement Device Interface
6     Copyright (C) 1997-2000 David A. Schleef <ds@schleef.org>
7
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.
12
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.
17 */
18
19 #ifndef _COMEDIDEV_H
20 #define _COMEDIDEV_H
21
22 #include <linux/dma-mapping.h>
23 #include <linux/mutex.h>
24 #include <linux/spinlock_types.h>
25 #include <linux/rwsem.h>
26 #include <linux/kref.h>
27
28 #include "comedi.h"
29
30 #define COMEDI_VERSION(a, b, c) (((a) << 16) + ((b) << 8) + (c))
31 #define COMEDI_VERSION_CODE COMEDI_VERSION(COMEDI_MAJORVERSION, \
32         COMEDI_MINORVERSION, COMEDI_MICROVERSION)
33 #define COMEDI_RELEASE VERSION
34
35 #define COMEDI_NUM_BOARD_MINORS 0x30
36
37 struct comedi_subdevice {
38         struct comedi_device *device;
39         int index;
40         int type;
41         int n_chan;
42         int subdev_flags;
43         int len_chanlist;       /* maximum length of channel/gain list */
44
45         void *private;
46
47         struct comedi_async *async;
48
49         void *lock;
50         void *busy;
51         unsigned runflags;
52         spinlock_t spin_lock;
53
54         unsigned int io_bits;
55
56         unsigned int maxdata;   /* if maxdata==0, use list */
57         const unsigned int *maxdata_list;       /* list is channel specific */
58
59         const struct comedi_lrange *range_table;
60         const struct comedi_lrange *const *range_table_list;
61
62         unsigned int *chanlist; /* driver-owned chanlist (not used) */
63
64         int (*insn_read)(struct comedi_device *, struct comedi_subdevice *,
65                          struct comedi_insn *, unsigned int *);
66         int (*insn_write)(struct comedi_device *, struct comedi_subdevice *,
67                           struct comedi_insn *, unsigned int *);
68         int (*insn_bits)(struct comedi_device *, struct comedi_subdevice *,
69                          struct comedi_insn *, unsigned int *);
70         int (*insn_config)(struct comedi_device *, struct comedi_subdevice *,
71                            struct comedi_insn *, unsigned int *);
72
73         int (*do_cmd)(struct comedi_device *, struct comedi_subdevice *);
74         int (*do_cmdtest)(struct comedi_device *, struct comedi_subdevice *,
75                           struct comedi_cmd *);
76         int (*poll)(struct comedi_device *, struct comedi_subdevice *);
77         int (*cancel)(struct comedi_device *, struct comedi_subdevice *);
78
79         /* called when the buffer changes */
80         int (*buf_change)(struct comedi_device *, struct comedi_subdevice *);
81
82         void (*munge)(struct comedi_device *dev, struct comedi_subdevice *s,
83                       void *data, unsigned int num_bytes,
84                       unsigned int start_chan_index);
85         enum dma_data_direction async_dma_dir;
86
87         unsigned int state;
88
89         struct device *class_dev;
90         int minor;
91
92         unsigned int *readback;
93 };
94
95 struct comedi_buf_page {
96         void *virt_addr;
97         dma_addr_t dma_addr;
98 };
99
100 struct comedi_buf_map {
101         struct device *dma_hw_dev;
102         struct comedi_buf_page *page_list;
103         unsigned int n_pages;
104         enum dma_data_direction dma_dir;
105         struct kref refcount;
106 };
107
108 /**
109  * struct comedi_async - control data for asynchronous comedi commands
110  * @prealloc_buf:       preallocated buffer
111  * @prealloc_bufsz:     buffer size (in bytes)
112  * @buf_map:            map of buffer pages
113  * @max_bufsize:        maximum buffer size (in bytes)
114  * @buf_write_count:    "write completed" count (in bytes, modulo 2**32)
115  * @buf_write_alloc_count: "allocated for writing" count (in bytes,
116  *                      modulo 2**32)
117  * @buf_read_count:     "read completed" count (in bytes, modulo 2**32)
118  * @buf_read_alloc_count: "allocated for reading" count (in bytes,
119  *                      modulo 2**32)
120  * @buf_write_ptr:      buffer position for writer
121  * @buf_read_ptr:       buffer position for reader
122  * @cur_chan:           current position in chanlist for scan (for those
123  *                      drivers that use it)
124  * @scans_done:         the number of scans completed (COMEDI_CB_EOS)
125  * @scan_progress:      amount received or sent for current scan (in bytes)
126  * @munge_chan:         current position in chanlist for "munging"
127  * @munge_count:        "munge" count (in bytes, modulo 2**32)
128  * @munge_ptr:          buffer position for "munging"
129  * @events:             bit-vector of events that have occurred
130  * @cmd:                details of comedi command in progress
131  * @wait_head:          task wait queue for file reader or writer
132  * @cb_mask:            bit-vector of events that should wake waiting tasks
133  * @inttrig:            software trigger function for command, or NULL
134  *
135  * Note about the ..._count and ..._ptr members:
136  *
137  * Think of the _Count values being integers of unlimited size, indexing
138  * into a buffer of infinite length (though only an advancing portion
139  * of the buffer of fixed length prealloc_bufsz is accessible at any time).
140  * Then:
141  *
142  *   Buf_Read_Count <= Buf_Read_Alloc_Count <= Munge_Count <=
143  *   Buf_Write_Count <= Buf_Write_Alloc_Count <=
144  *   (Buf_Read_Count + prealloc_bufsz)
145  *
146  * (Those aren't the actual members, apart from prealloc_bufsz.) When
147  * the buffer is reset, those _Count values start at 0 and only increase
148  * in value, maintaining the above inequalities until the next time the
149  * buffer is reset.  The buffer is divided into the following regions by
150  * the inequalities:
151  *
152  *   [0, Buf_Read_Count):
153  *     old region no longer accessible
154  *   [Buf_Read_Count, Buf_Read_Alloc_Count):
155  *     filled and munged region allocated for reading but not yet read
156  *   [Buf_Read_Alloc_Count, Munge_Count):
157  *     filled and munged region not yet allocated for reading
158  *   [Munge_Count, Buf_Write_Count):
159  *     filled region not yet munged
160  *   [Buf_Write_Count, Buf_Write_Alloc_Count):
161  *     unfilled region allocated for writing but not yet written
162  *   [Buf_Write_Alloc_Count, Buf_Read_Count + prealloc_bufsz):
163  *     unfilled region not yet allocated for writing
164  *   [Buf_Read_Count + prealloc_bufsz, infinity):
165  *     unfilled region not yet accessible
166  *
167  * Data needs to be written into the buffer before it can be read out,
168  * and may need to be converted (or "munged") between the two
169  * operations.  Extra unfilled buffer space may need to allocated for
170  * writing (advancing Buf_Write_Alloc_Count) before new data is written.
171  * After writing new data, the newly filled space needs to be released
172  * (advancing Buf_Write_Count).  This also results in the new data being
173  * "munged" (advancing Munge_Count).  Before data is read out of the
174  * buffer, extra space may need to be allocated for reading (advancing
175  * Buf_Read_Alloc_Count).  After the data has been read out, the space
176  * needs to be released (advancing Buf_Read_Count).
177  *
178  * The actual members, buf_read_count, buf_read_alloc_count,
179  * munge_count, buf_write_count, and buf_write_alloc_count take the
180  * value of the corresponding capitalized _Count values modulo 2^32
181  * (UINT_MAX+1).  Subtracting a "higher" _count value from a "lower"
182  * _count value gives the same answer as subtracting a "higher" _Count
183  * value from a lower _Count value because prealloc_bufsz < UINT_MAX+1.
184  * The modulo operation is done implicitly.
185  *
186  * The buf_read_ptr, munge_ptr, and buf_write_ptr members take the value
187  * of the corresponding capitalized _Count values modulo prealloc_bufsz.
188  * These correspond to byte indices in the physical buffer.  The modulo
189  * operation is done by subtracting prealloc_bufsz when the value
190  * exceeds prealloc_bufsz (assuming prealloc_bufsz plus the increment is
191  * less than or equal to UINT_MAX).
192  */
193 struct comedi_async {
194         void *prealloc_buf;
195         unsigned int prealloc_bufsz;
196         struct comedi_buf_map *buf_map;
197         unsigned int max_bufsize;
198         unsigned int buf_write_count;
199         unsigned int buf_write_alloc_count;
200         unsigned int buf_read_count;
201         unsigned int buf_read_alloc_count;
202         unsigned int buf_write_ptr;
203         unsigned int buf_read_ptr;
204         unsigned int cur_chan;
205         unsigned int scans_done;
206         unsigned int scan_progress;
207         unsigned int munge_chan;
208         unsigned int munge_count;
209         unsigned int munge_ptr;
210         unsigned int events;
211         struct comedi_cmd cmd;
212         wait_queue_head_t wait_head;
213         unsigned int cb_mask;
214         int (*inttrig)(struct comedi_device *dev, struct comedi_subdevice *s,
215                        unsigned int x);
216 };
217
218 /**
219  * comedi_async callback "events"
220  * @COMEDI_CB_EOS:              end-of-scan
221  * @COMEDI_CB_EOA:              end-of-acquisition/output
222  * @COMEDI_CB_BLOCK:            data has arrived, wakes up read() / write()
223  * @COMEDI_CB_EOBUF:            DEPRECATED: end of buffer
224  * @COMEDI_CB_ERROR:            card error during acquisition
225  * @COMEDI_CB_OVERFLOW:         buffer overflow/underflow
226  *
227  * @COMEDI_CB_ERROR_MASK:       events that indicate an error has occurred
228  * @COMEDI_CB_CANCEL_MASK:      events that will cancel an async command
229  */
230 #define COMEDI_CB_EOS           (1 << 0)
231 #define COMEDI_CB_EOA           (1 << 1)
232 #define COMEDI_CB_BLOCK         (1 << 2)
233 #define COMEDI_CB_EOBUF         (1 << 3)
234 #define COMEDI_CB_ERROR         (1 << 4)
235 #define COMEDI_CB_OVERFLOW      (1 << 5)
236
237 #define COMEDI_CB_ERROR_MASK    (COMEDI_CB_ERROR | COMEDI_CB_OVERFLOW)
238 #define COMEDI_CB_CANCEL_MASK   (COMEDI_CB_EOA | COMEDI_CB_ERROR_MASK)
239
240 struct comedi_driver {
241         struct comedi_driver *next;
242
243         const char *driver_name;
244         struct module *module;
245         int (*attach)(struct comedi_device *, struct comedi_devconfig *);
246         void (*detach)(struct comedi_device *);
247         int (*auto_attach)(struct comedi_device *, unsigned long);
248
249         /* number of elements in board_name and board_id arrays */
250         unsigned int num_names;
251         const char *const *board_name;
252         /* offset in bytes from one board name pointer to the next */
253         int offset;
254 };
255
256 struct comedi_device {
257         int use_count;
258         struct comedi_driver *driver;
259         struct comedi_8254 *pacer;
260         void *private;
261
262         struct device *class_dev;
263         int minor;
264         unsigned int detach_count;
265         /* hw_dev is passed to dma_alloc_coherent when allocating async buffers
266          * for subdevices that have async_dma_dir set to something other than
267          * DMA_NONE */
268         struct device *hw_dev;
269
270         const char *board_name;
271         const void *board_ptr;
272         bool attached:1;
273         bool ioenabled:1;
274         spinlock_t spinlock;
275         struct mutex mutex;
276         struct rw_semaphore attach_lock;
277         struct kref refcount;
278
279         int n_subdevices;
280         struct comedi_subdevice *subdevices;
281
282         /* dumb */
283         void __iomem *mmio;
284         unsigned long iobase;
285         unsigned long iolen;
286         unsigned int irq;
287
288         struct comedi_subdevice *read_subdev;
289         struct comedi_subdevice *write_subdev;
290
291         struct fasync_struct *async_queue;
292
293         int (*open)(struct comedi_device *dev);
294         void (*close)(struct comedi_device *dev);
295 };
296
297 /*
298  * function prototypes
299  */
300
301 void comedi_event(struct comedi_device *dev, struct comedi_subdevice *s);
302
303 struct comedi_device *comedi_dev_get_from_minor(unsigned minor);
304 int comedi_dev_put(struct comedi_device *dev);
305
306 bool comedi_is_subdevice_running(struct comedi_subdevice *s);
307
308 void *comedi_alloc_spriv(struct comedi_subdevice *s, size_t size);
309 void comedi_set_spriv_auto_free(struct comedi_subdevice *s);
310
311 int comedi_check_chanlist(struct comedi_subdevice *s,
312                           int n,
313                           unsigned int *chanlist);
314
315 /* range stuff */
316
317 #define RANGE(a, b)             {(a)*1e6, (b)*1e6, 0}
318 #define RANGE_ext(a, b)         {(a)*1e6, (b)*1e6, RF_EXTERNAL}
319 #define RANGE_mA(a, b)          {(a)*1e6, (b)*1e6, UNIT_mA}
320 #define RANGE_unitless(a, b)    {(a)*1e6, (b)*1e6, 0}
321 #define BIP_RANGE(a)            {-(a)*1e6, (a)*1e6, 0}
322 #define UNI_RANGE(a)            {0, (a)*1e6, 0}
323
324 extern const struct comedi_lrange range_bipolar10;
325 extern const struct comedi_lrange range_bipolar5;
326 extern const struct comedi_lrange range_bipolar2_5;
327 extern const struct comedi_lrange range_unipolar10;
328 extern const struct comedi_lrange range_unipolar5;
329 extern const struct comedi_lrange range_unipolar2_5;
330 extern const struct comedi_lrange range_0_20mA;
331 extern const struct comedi_lrange range_4_20mA;
332 extern const struct comedi_lrange range_0_32mA;
333 extern const struct comedi_lrange range_unknown;
334
335 #define range_digital           range_unipolar5
336
337 #if __GNUC__ >= 3
338 #define GCC_ZERO_LENGTH_ARRAY
339 #else
340 #define GCC_ZERO_LENGTH_ARRAY 0
341 #endif
342
343 struct comedi_lrange {
344         int length;
345         struct comedi_krange range[GCC_ZERO_LENGTH_ARRAY];
346 };
347
348 static inline bool comedi_range_is_bipolar(struct comedi_subdevice *s,
349                                            unsigned int range)
350 {
351         return s->range_table->range[range].min < 0;
352 }
353
354 static inline bool comedi_range_is_unipolar(struct comedi_subdevice *s,
355                                             unsigned int range)
356 {
357         return s->range_table->range[range].min >= 0;
358 }
359
360 static inline bool comedi_range_is_external(struct comedi_subdevice *s,
361                                             unsigned int range)
362 {
363         return !!(s->range_table->range[range].flags & RF_EXTERNAL);
364 }
365
366 static inline bool comedi_chan_range_is_bipolar(struct comedi_subdevice *s,
367                                                 unsigned int chan,
368                                                 unsigned int range)
369 {
370         return s->range_table_list[chan]->range[range].min < 0;
371 }
372
373 static inline bool comedi_chan_range_is_unipolar(struct comedi_subdevice *s,
374                                                  unsigned int chan,
375                                                  unsigned int range)
376 {
377         return s->range_table_list[chan]->range[range].min >= 0;
378 }
379
380 static inline bool comedi_chan_range_is_external(struct comedi_subdevice *s,
381                                                  unsigned int chan,
382                                                  unsigned int range)
383 {
384         return !!(s->range_table_list[chan]->range[range].flags & RF_EXTERNAL);
385 }
386
387 /* munge between offset binary and two's complement values */
388 static inline unsigned int comedi_offset_munge(struct comedi_subdevice *s,
389                                                unsigned int val)
390 {
391         return val ^ s->maxdata ^ (s->maxdata >> 1);
392 }
393
394 /**
395  * comedi_bytes_per_sample - determine subdevice sample size
396  * @s:          comedi_subdevice struct
397  *
398  * The sample size will be 4 (sizeof int) or 2 (sizeof short) depending on
399  * whether the SDF_LSAMPL subdevice flag is set or not.
400  *
401  * Returns the subdevice sample size.
402  */
403 static inline unsigned int comedi_bytes_per_sample(struct comedi_subdevice *s)
404 {
405         return s->subdev_flags & SDF_LSAMPL ? sizeof(int) : sizeof(short);
406 }
407
408 /**
409  * comedi_sample_shift - determine log2 of subdevice sample size
410  * @s:          comedi_subdevice struct
411  *
412  * The sample size will be 4 (sizeof int) or 2 (sizeof short) depending on
413  * whether the SDF_LSAMPL subdevice flag is set or not.  The log2 of the
414  * sample size will be 2 or 1 and can be used as the right operand of a
415  * bit-shift operator to multiply or divide something by the sample size.
416  *
417  * Returns log2 of the subdevice sample size.
418  */
419 static inline unsigned int comedi_sample_shift(struct comedi_subdevice *s)
420 {
421         return s->subdev_flags & SDF_LSAMPL ? 2 : 1;
422 }
423
424 /**
425  * comedi_bytes_to_samples - converts a number of bytes to a number of samples
426  * @s:          comedi_subdevice struct
427  * @nbytes:     number of bytes
428  *
429  * Returns the number of bytes divided by the subdevice sample size.
430  */
431 static inline unsigned int comedi_bytes_to_samples(struct comedi_subdevice *s,
432                                                    unsigned int nbytes)
433 {
434         return nbytes >> comedi_sample_shift(s);
435 }
436
437 /**
438  * comedi_samples_to_bytes - converts a number of samples to a number of bytes
439  * @s:          comedi_subdevice struct
440  * @nsamples:   number of samples
441  *
442  * Returns the number of samples multiplied by the subdevice sample size.
443  * Does not check for arithmetic overflow.
444  */
445 static inline unsigned int comedi_samples_to_bytes(struct comedi_subdevice *s,
446                                                    unsigned int nsamples)
447 {
448         return nsamples << comedi_sample_shift(s);
449 }
450
451 /**
452  * comedi_check_trigger_src() - trivially validate a comedi_cmd trigger source
453  * @src: pointer to the trigger source to validate
454  * @flags: bitmask of valid TRIG_* for the trigger
455  *
456  * This is used in "step 1" of the do_cmdtest functions of comedi drivers
457  * to vaildate the comedi_cmd triggers. The mask of the @src against the
458  * @flags allows the userspace comedilib to pass all the comedi_cmd
459  * triggers as TRIG_ANY and get back a bitmask of the valid trigger sources.
460  */
461 static inline int comedi_check_trigger_src(unsigned int *src,
462                                            unsigned int flags)
463 {
464         unsigned int orig_src = *src;
465
466         *src = orig_src & flags;
467         if (*src == TRIG_INVALID || *src != orig_src)
468                 return -EINVAL;
469         return 0;
470 }
471
472 /**
473  * comedi_check_trigger_is_unique() - make sure a trigger source is unique
474  * @src: the trigger source to check
475  */
476 static inline int comedi_check_trigger_is_unique(unsigned int src)
477 {
478         /* this test is true if more than one _src bit is set */
479         if ((src & (src - 1)) != 0)
480                 return -EINVAL;
481         return 0;
482 }
483
484 /**
485  * comedi_check_trigger_arg_is() - trivially validate a trigger argument
486  * @arg: pointer to the trigger arg to validate
487  * @val: the value the argument should be
488  */
489 static inline int comedi_check_trigger_arg_is(unsigned int *arg,
490                                               unsigned int val)
491 {
492         if (*arg != val) {
493                 *arg = val;
494                 return -EINVAL;
495         }
496         return 0;
497 }
498
499 /**
500  * comedi_check_trigger_arg_min() - trivially validate a trigger argument
501  * @arg: pointer to the trigger arg to validate
502  * @val: the minimum value the argument should be
503  */
504 static inline int comedi_check_trigger_arg_min(unsigned int *arg,
505                                                unsigned int val)
506 {
507         if (*arg < val) {
508                 *arg = val;
509                 return -EINVAL;
510         }
511         return 0;
512 }
513
514 /**
515  * comedi_check_trigger_arg_max() - trivially validate a trigger argument
516  * @arg: pointer to the trigger arg to validate
517  * @val: the maximum value the argument should be
518  */
519 static inline int comedi_check_trigger_arg_max(unsigned int *arg,
520                                                unsigned int val)
521 {
522         if (*arg > val) {
523                 *arg = val;
524                 return -EINVAL;
525         }
526         return 0;
527 }
528
529 /*
530  * Must set dev->hw_dev if you wish to dma directly into comedi's buffer.
531  * Also useful for retrieving a previously configured hardware device of
532  * known bus type.  Set automatically for auto-configured devices.
533  * Automatically set to NULL when detaching hardware device.
534  */
535 int comedi_set_hw_dev(struct comedi_device *dev, struct device *hw_dev);
536
537 static inline unsigned int comedi_buf_n_bytes_ready(struct comedi_subdevice *s)
538 {
539         return s->async->buf_write_count - s->async->buf_read_count;
540 }
541
542 unsigned int comedi_buf_write_alloc(struct comedi_subdevice *s, unsigned int n);
543 unsigned int comedi_buf_write_free(struct comedi_subdevice *s, unsigned int n);
544
545 unsigned int comedi_buf_read_n_available(struct comedi_subdevice *s);
546 unsigned int comedi_buf_read_alloc(struct comedi_subdevice *s, unsigned int n);
547 unsigned int comedi_buf_read_free(struct comedi_subdevice *s, unsigned int n);
548
549 unsigned int comedi_buf_write_samples(struct comedi_subdevice *s,
550                                       const void *data, unsigned int nsamples);
551 unsigned int comedi_buf_read_samples(struct comedi_subdevice *s,
552                                      void *data, unsigned int nsamples);
553
554 /* drivers.c - general comedi driver functions */
555
556 #define COMEDI_TIMEOUT_MS       1000
557
558 int comedi_timeout(struct comedi_device *, struct comedi_subdevice *,
559                    struct comedi_insn *,
560                    int (*cb)(struct comedi_device *, struct comedi_subdevice *,
561                              struct comedi_insn *, unsigned long context),
562                    unsigned long context);
563
564 unsigned int comedi_handle_events(struct comedi_device *dev,
565                                   struct comedi_subdevice *s);
566
567 int comedi_dio_insn_config(struct comedi_device *, struct comedi_subdevice *,
568                            struct comedi_insn *, unsigned int *data,
569                            unsigned int mask);
570 unsigned int comedi_dio_update_state(struct comedi_subdevice *,
571                                      unsigned int *data);
572 unsigned int comedi_bytes_per_scan(struct comedi_subdevice *s);
573 unsigned int comedi_nscans_left(struct comedi_subdevice *s,
574                                 unsigned int nscans);
575 unsigned int comedi_nsamples_left(struct comedi_subdevice *s,
576                                   unsigned int nsamples);
577 void comedi_inc_scan_progress(struct comedi_subdevice *s,
578                               unsigned int num_bytes);
579
580 void *comedi_alloc_devpriv(struct comedi_device *, size_t);
581 int comedi_alloc_subdevices(struct comedi_device *, int);
582 int comedi_alloc_subdev_readback(struct comedi_subdevice *);
583
584 int comedi_readback_insn_read(struct comedi_device *, struct comedi_subdevice *,
585                               struct comedi_insn *, unsigned int *data);
586
587 int comedi_load_firmware(struct comedi_device *, struct device *,
588                          const char *name,
589                          int (*cb)(struct comedi_device *,
590                                    const u8 *data, size_t size,
591                                    unsigned long context),
592                          unsigned long context);
593
594 int __comedi_request_region(struct comedi_device *,
595                             unsigned long start, unsigned long len);
596 int comedi_request_region(struct comedi_device *,
597                           unsigned long start, unsigned long len);
598 void comedi_legacy_detach(struct comedi_device *);
599
600 int comedi_auto_config(struct device *, struct comedi_driver *,
601                        unsigned long context);
602 void comedi_auto_unconfig(struct device *);
603
604 int comedi_driver_register(struct comedi_driver *);
605 void comedi_driver_unregister(struct comedi_driver *);
606
607 /**
608  * module_comedi_driver() - Helper macro for registering a comedi driver
609  * @__comedi_driver: comedi_driver struct
610  *
611  * Helper macro for comedi drivers which do not do anything special in module
612  * init/exit. This eliminates a lot of boilerplate. Each module may only use
613  * this macro once, and calling it replaces module_init() and module_exit().
614  */
615 #define module_comedi_driver(__comedi_driver) \
616         module_driver(__comedi_driver, comedi_driver_register, \
617                         comedi_driver_unregister)
618
619 #endif /* _COMEDIDEV_H */