Merge branch 'omap-fixes-for-linus' of git://git.kernel.org/pub/scm/linux/kernel...
[deliverable/linux.git] / drivers / staging / usbip / stub.h
1 /*
2 * Copyright (C) 2003-2008 Takahiro Hirofuchi
3 *
4 * This is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; either version 2 of the License, or
7 * (at your option) any later version.
8 *
9 * This is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write to the Free Software
16 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
17 * USA.
18 */
19
20 #include <linux/kernel.h>
21 #include <linux/list.h>
22 #include <linux/spinlock.h>
23 #include <linux/slab.h>
24 #include <linux/string.h>
25 #include <linux/module.h>
26 #include <linux/net.h>
27
28 #define STUB_BUSID_OTHER 0
29 #define STUB_BUSID_REMOV 1
30 #define STUB_BUSID_ADDED 2
31 #define STUB_BUSID_ALLOC 3
32
33 struct stub_device {
34 struct usb_interface *interface;
35 struct usb_device *udev;
36 struct list_head list;
37
38 struct usbip_device ud;
39 __u32 devid;
40
41 /*
42 * stub_priv preserves private data of each urb.
43 * It is allocated as stub_priv_cache and assigned to urb->context.
44 *
45 * stub_priv is always linked to any one of 3 lists;
46 * priv_init: linked to this until the comletion of a urb.
47 * priv_tx : linked to this after the completion of a urb.
48 * priv_free: linked to this after the sending of the result.
49 *
50 * Any of these list operations should be locked by priv_lock.
51 */
52 spinlock_t priv_lock;
53 struct list_head priv_init;
54 struct list_head priv_tx;
55 struct list_head priv_free;
56
57 /* see comments for unlinking in stub_rx.c */
58 struct list_head unlink_tx;
59 struct list_head unlink_free;
60
61
62 wait_queue_head_t tx_waitq;
63 };
64
65 /* private data into urb->priv */
66 struct stub_priv {
67 unsigned long seqnum;
68 struct list_head list;
69 struct stub_device *sdev;
70 struct urb *urb;
71
72 int unlinking;
73 };
74
75 struct stub_unlink {
76 unsigned long seqnum;
77 struct list_head list;
78 __u32 status;
79 };
80
81 #define BUSID_SIZE 20
82 struct bus_id_priv {
83 char name[BUSID_SIZE];
84 char status;
85 int interf_count;
86 struct stub_device *sdev;
87 char shutdown_busid;
88 };
89
90 extern struct kmem_cache *stub_priv_cache;
91
92
93 /*-------------------------------------------------------------------------*/
94 /* prototype declarations */
95
96 /* stub_tx.c */
97 void stub_complete(struct urb *);
98 void stub_tx_loop(struct usbip_task *);
99
100 /* stub_dev.c */
101 extern struct usb_driver stub_driver;
102
103 /* stub_rx.c */
104 void stub_rx_loop(struct usbip_task *);
105 void stub_enqueue_ret_unlink(struct stub_device *, __u32, __u32);
106
107 /* stub_main.c */
108 struct bus_id_priv *get_busid_priv(const char *busid);
109 int del_match_busid(char *busid);
110
111 void stub_device_cleanup_urbs(struct stub_device *sdev);
This page took 0.041998 seconds and 5 git commands to generate.