xref: /openbmc/linux/include/linux/comedi/comedi_usb.h (revision 03ab8e6297acd1bc0eedaa050e2a1635c576fd11)
1*df0e68c1SIan Abbott /* SPDX-License-Identifier: GPL-2.0+ */
2*df0e68c1SIan Abbott /* comedi_usb.h
3*df0e68c1SIan Abbott  * header file for USB Comedi drivers
4*df0e68c1SIan Abbott  *
5*df0e68c1SIan Abbott  * COMEDI - Linux Control and Measurement Device Interface
6*df0e68c1SIan Abbott  * Copyright (C) 1997-2000 David A. Schleef <ds@schleef.org>
7*df0e68c1SIan Abbott  */
8*df0e68c1SIan Abbott 
9*df0e68c1SIan Abbott #ifndef _COMEDI_USB_H
10*df0e68c1SIan Abbott #define _COMEDI_USB_H
11*df0e68c1SIan Abbott 
12*df0e68c1SIan Abbott #include <linux/usb.h>
13*df0e68c1SIan Abbott #include <linux/comedi/comedidev.h>
14*df0e68c1SIan Abbott 
15*df0e68c1SIan Abbott struct usb_interface *comedi_to_usb_interface(struct comedi_device *dev);
16*df0e68c1SIan Abbott struct usb_device *comedi_to_usb_dev(struct comedi_device *dev);
17*df0e68c1SIan Abbott 
18*df0e68c1SIan Abbott int comedi_usb_auto_config(struct usb_interface *intf,
19*df0e68c1SIan Abbott 			   struct comedi_driver *driver, unsigned long context);
20*df0e68c1SIan Abbott void comedi_usb_auto_unconfig(struct usb_interface *intf);
21*df0e68c1SIan Abbott 
22*df0e68c1SIan Abbott int comedi_usb_driver_register(struct comedi_driver *comedi_driver,
23*df0e68c1SIan Abbott 			       struct usb_driver *usb_driver);
24*df0e68c1SIan Abbott void comedi_usb_driver_unregister(struct comedi_driver *comedi_driver,
25*df0e68c1SIan Abbott 				  struct usb_driver *usb_driver);
26*df0e68c1SIan Abbott 
27*df0e68c1SIan Abbott /**
28*df0e68c1SIan Abbott  * module_comedi_usb_driver() - Helper macro for registering a comedi USB driver
29*df0e68c1SIan Abbott  * @__comedi_driver: comedi_driver struct
30*df0e68c1SIan Abbott  * @__usb_driver: usb_driver struct
31*df0e68c1SIan Abbott  *
32*df0e68c1SIan Abbott  * Helper macro for comedi USB drivers which do not do anything special
33*df0e68c1SIan Abbott  * in module init/exit. This eliminates a lot of boilerplate. Each
34*df0e68c1SIan Abbott  * module may only use this macro once, and calling it replaces
35*df0e68c1SIan Abbott  * module_init() and module_exit()
36*df0e68c1SIan Abbott  */
37*df0e68c1SIan Abbott #define module_comedi_usb_driver(__comedi_driver, __usb_driver) \
38*df0e68c1SIan Abbott 	module_driver(__comedi_driver, comedi_usb_driver_register, \
39*df0e68c1SIan Abbott 			comedi_usb_driver_unregister, &(__usb_driver))
40*df0e68c1SIan Abbott 
41*df0e68c1SIan Abbott #endif /* _COMEDI_USB_H */
42