GNU Linux-libre 4.14.303-gnu1
[releases.git] / drivers / staging / comedi / comedi_usb.h
1 /*
2  * comedi_usb.h
3  * header file for USB Comedi drivers
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 _COMEDI_USB_H
20 #define _COMEDI_USB_H
21
22 #include <linux/usb.h>
23
24 #include "comedidev.h"
25
26 struct usb_interface *comedi_to_usb_interface(struct comedi_device *dev);
27 struct usb_device *comedi_to_usb_dev(struct comedi_device *dev);
28
29 int comedi_usb_auto_config(struct usb_interface *intf,
30                            struct comedi_driver *driver, unsigned long context);
31 void comedi_usb_auto_unconfig(struct usb_interface *intf);
32
33 int comedi_usb_driver_register(struct comedi_driver *comedi_driver,
34                                struct usb_driver *usb_driver);
35 void comedi_usb_driver_unregister(struct comedi_driver *comedi_driver,
36                                   struct usb_driver *usb_driver);
37
38 /**
39  * module_comedi_usb_driver() - Helper macro for registering a comedi USB driver
40  * @__comedi_driver: comedi_driver struct
41  * @__usb_driver: usb_driver struct
42  *
43  * Helper macro for comedi USB drivers which do not do anything special
44  * in module init/exit. This eliminates a lot of boilerplate. Each
45  * module may only use this macro once, and calling it replaces
46  * module_init() and module_exit()
47  */
48 #define module_comedi_usb_driver(__comedi_driver, __usb_driver) \
49         module_driver(__comedi_driver, comedi_usb_driver_register, \
50                         comedi_usb_driver_unregister, &(__usb_driver))
51
52 #endif /* _COMEDI_USB_H */