Merge git://git.infradead.org/battery-2.6
[GitHub/mt8127/android_kernel_alcatel_ttab.git] / drivers / staging / usbip / stub.h
CommitLineData
4d7b5c7f
TH
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
28struct stub_device {
29 struct usb_interface *interface;
30 struct list_head list;
31
32 struct usbip_device ud;
33 __u32 devid;
34
35 /*
36 * stub_priv preserves private data of each urb.
37 * It is allocated as stub_priv_cache and assigned to urb->context.
38 *
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.
43 *
44 * Any of these list operations should be locked by priv_lock.
45 */
46 spinlock_t priv_lock;
47 struct list_head priv_init;
48 struct list_head priv_tx;
49 struct list_head priv_free;
50
51 /* see comments for unlinking in stub_rx.c */
52 struct list_head unlink_tx;
53 struct list_head unlink_free;
54
55
56 wait_queue_head_t tx_waitq;
57};
58
59/* private data into urb->priv */
60struct stub_priv {
61 unsigned long seqnum;
62 struct list_head list;
63 struct stub_device *sdev;
64 struct urb *urb;
65
66 int unlinking;
67};
68
69struct stub_unlink {
70 unsigned long seqnum;
71 struct list_head list;
72 __u32 status;
73};
74
75
76extern struct kmem_cache *stub_priv_cache;
77
78
79/*-------------------------------------------------------------------------*/
80/* prototype declarations */
81
82/* stub_tx.c */
83void stub_complete(struct urb *);
84void stub_tx_loop(struct usbip_task *);
85
86/* stub_dev.c */
87extern struct usb_driver stub_driver;
88
89/* stub_rx.c */
90void stub_rx_loop(struct usbip_task *);
91void stub_enqueue_ret_unlink(struct stub_device *, __u32, __u32);
92
93/* stub_main.c */
e9133972 94int match_busid(const char *busid);
4d7b5c7f 95void stub_device_cleanup_urbs(struct stub_device *sdev);