162306a36Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0+ */
262306a36Sopenharmony_ci/* comedi_usb.h
362306a36Sopenharmony_ci * header file for USB Comedi drivers
462306a36Sopenharmony_ci *
562306a36Sopenharmony_ci * COMEDI - Linux Control and Measurement Device Interface
662306a36Sopenharmony_ci * Copyright (C) 1997-2000 David A. Schleef <ds@schleef.org>
762306a36Sopenharmony_ci */
862306a36Sopenharmony_ci
962306a36Sopenharmony_ci#ifndef _COMEDI_USB_H
1062306a36Sopenharmony_ci#define _COMEDI_USB_H
1162306a36Sopenharmony_ci
1262306a36Sopenharmony_ci#include <linux/usb.h>
1362306a36Sopenharmony_ci#include <linux/comedi/comedidev.h>
1462306a36Sopenharmony_ci
1562306a36Sopenharmony_cistruct usb_interface *comedi_to_usb_interface(struct comedi_device *dev);
1662306a36Sopenharmony_cistruct usb_device *comedi_to_usb_dev(struct comedi_device *dev);
1762306a36Sopenharmony_ci
1862306a36Sopenharmony_ciint comedi_usb_auto_config(struct usb_interface *intf,
1962306a36Sopenharmony_ci			   struct comedi_driver *driver, unsigned long context);
2062306a36Sopenharmony_civoid comedi_usb_auto_unconfig(struct usb_interface *intf);
2162306a36Sopenharmony_ci
2262306a36Sopenharmony_ciint comedi_usb_driver_register(struct comedi_driver *comedi_driver,
2362306a36Sopenharmony_ci			       struct usb_driver *usb_driver);
2462306a36Sopenharmony_civoid comedi_usb_driver_unregister(struct comedi_driver *comedi_driver,
2562306a36Sopenharmony_ci				  struct usb_driver *usb_driver);
2662306a36Sopenharmony_ci
2762306a36Sopenharmony_ci/**
2862306a36Sopenharmony_ci * module_comedi_usb_driver() - Helper macro for registering a comedi USB driver
2962306a36Sopenharmony_ci * @__comedi_driver: comedi_driver struct
3062306a36Sopenharmony_ci * @__usb_driver: usb_driver struct
3162306a36Sopenharmony_ci *
3262306a36Sopenharmony_ci * Helper macro for comedi USB drivers which do not do anything special
3362306a36Sopenharmony_ci * in module init/exit. This eliminates a lot of boilerplate. Each
3462306a36Sopenharmony_ci * module may only use this macro once, and calling it replaces
3562306a36Sopenharmony_ci * module_init() and module_exit()
3662306a36Sopenharmony_ci */
3762306a36Sopenharmony_ci#define module_comedi_usb_driver(__comedi_driver, __usb_driver) \
3862306a36Sopenharmony_ci	module_driver(__comedi_driver, comedi_usb_driver_register, \
3962306a36Sopenharmony_ci			comedi_usb_driver_unregister, &(__usb_driver))
4062306a36Sopenharmony_ci
4162306a36Sopenharmony_ci#endif /* _COMEDI_USB_H */
42