staging: comedi: remove FSF address from boilerplate text
[deliverable/linux.git] / drivers / staging / comedi / comedi_usb.c
CommitLineData
abac8b54
HS
1/*
2 * comedi_usb.c
3 * Comedi USB driver specific functions.
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.
abac8b54
HS
17 */
18
19#include <linux/usb.h>
20
21#include "comedidev.h"
22
23/**
24 * comedi_to_usb_interface() - comedi_device pointer to usb_interface pointer.
25 * @dev: comedi_device struct
26 */
27struct usb_interface *comedi_to_usb_interface(struct comedi_device *dev)
28{
29 return dev->hw_dev ? to_usb_interface(dev->hw_dev) : NULL;
30}
31EXPORT_SYMBOL_GPL(comedi_to_usb_interface);
32
33/**
34 * comedi_usb_auto_config() - Configure/probe a comedi USB driver.
35 * @intf: usb_interface struct
36 * @driver: comedi_driver struct
55ab4f64 37 * @context: driver specific data, passed to comedi_auto_config()
abac8b54
HS
38 *
39 * Typically called from the usb_driver (*probe) function.
40 */
41int comedi_usb_auto_config(struct usb_interface *intf,
55ab4f64
HS
42 struct comedi_driver *driver,
43 unsigned long context)
abac8b54 44{
55ab4f64 45 return comedi_auto_config(&intf->dev, driver, context);
abac8b54
HS
46}
47EXPORT_SYMBOL_GPL(comedi_usb_auto_config);
48
49/**
50 * comedi_pci_auto_unconfig() - Unconfigure/disconnect a comedi USB driver.
51 * @intf: usb_interface struct
52 *
53 * Typically called from the usb_driver (*disconnect) function.
54 */
55void comedi_usb_auto_unconfig(struct usb_interface *intf)
56{
57 comedi_auto_unconfig(&intf->dev);
58}
59EXPORT_SYMBOL_GPL(comedi_usb_auto_unconfig);
60
61/**
62 * comedi_usb_driver_register() - Register a comedi USB driver.
63 * @comedi_driver: comedi_driver struct
64 * @usb_driver: usb_driver struct
65 *
66 * This function is used for the module_init() of comedi USB drivers.
67 * Do not call it directly, use the module_comedi_usb_driver() helper
68 * macro instead.
69 */
70int comedi_usb_driver_register(struct comedi_driver *comedi_driver,
71 struct usb_driver *usb_driver)
72{
73 int ret;
74
75 ret = comedi_driver_register(comedi_driver);
76 if (ret < 0)
77 return ret;
78
79 ret = usb_register(usb_driver);
80 if (ret < 0) {
81 comedi_driver_unregister(comedi_driver);
82 return ret;
83 }
84
85 return 0;
86}
87EXPORT_SYMBOL_GPL(comedi_usb_driver_register);
88
89/**
90 * comedi_usb_driver_unregister() - Unregister a comedi USB driver.
91 * @comedi_driver: comedi_driver struct
92 * @usb_driver: usb_driver struct
93 *
94 * This function is used for the module_exit() of comedi USB drivers.
95 * Do not call it directly, use the module_comedi_usb_driver() helper
96 * macro instead.
97 */
98void comedi_usb_driver_unregister(struct comedi_driver *comedi_driver,
99 struct usb_driver *usb_driver)
100{
101 usb_deregister(usb_driver);
102 comedi_driver_unregister(comedi_driver);
103}
104EXPORT_SYMBOL_GPL(comedi_usb_driver_unregister);
This page took 0.054004 seconds and 5 git commands to generate.