Full support for Ginger Console
[linux-ginger.git] / drivers / staging / usbip / stub.h
blob022d0649ac5ee219b67d5b50ad7f95f58432b5d3
1 /*
2 * Copyright (C) 2003-2008 Takahiro Hirofuchi
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.
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.
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.
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>
28 struct stub_device {
29 struct usb_interface *interface;
30 struct list_head list;
32 struct usbip_device ud;
33 __u32 devid;
36 * stub_priv preserves private data of each urb.
37 * It is allocated as stub_priv_cache and assigned to urb->context.
39 * stub_priv is always linked to any one of 3 lists;
40 * priv_init: linked to this until the comletion of a urb.
41 * priv_tx : linked to this after the completion of a urb.
42 * priv_free: linked to this after the sending of the result.
44 * Any of these list operations should be locked by priv_lock.
46 spinlock_t priv_lock;
47 struct list_head priv_init;
48 struct list_head priv_tx;
49 struct list_head priv_free;
51 /* see comments for unlinking in stub_rx.c */
52 struct list_head unlink_tx;
53 struct list_head unlink_free;
56 wait_queue_head_t tx_waitq;
59 /* private data into urb->priv */
60 struct stub_priv {
61 unsigned long seqnum;
62 struct list_head list;
63 struct stub_device *sdev;
64 struct urb *urb;
66 int unlinking;
69 struct stub_unlink {
70 unsigned long seqnum;
71 struct list_head list;
72 __u32 status;
76 extern struct kmem_cache *stub_priv_cache;
79 /*-------------------------------------------------------------------------*/
80 /* prototype declarations */
82 /* stub_tx.c */
83 void stub_complete(struct urb *);
84 void stub_tx_loop(struct usbip_task *);
86 /* stub_dev.c */
87 extern struct usb_driver stub_driver;
89 /* stub_rx.c */
90 void stub_rx_loop(struct usbip_task *);
91 void stub_enqueue_ret_unlink(struct stub_device *, __u32, __u32);
93 /* stub_main.c */
94 int match_busid(const char *busid);
95 void stub_device_cleanup_urbs(struct stub_device *sdev);