temp revert rk change
[firefly-linux-kernel-4.4.55.git] / drivers / net / usb / qcusbnet / structs.h
1 /* structs.h - shared structures
2  * Copyright (c) 2010, Code Aurora Forum. All rights reserved.
3
4  * This program is free software; you can redistribute it and/or modify
5  * it under the terms of the GNU General Public License version 2 and
6  * only version 2 as published by the Free Software Foundation.
7
8  * This program is distributed in the hope that it will be useful,
9  * but WITHOUT ANY WARRANTY; without even the implied warranty of
10  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
11  * GNU General Public License for more details.
12
13  * You should have received a copy of the GNU General Public License
14  * along with this program; if not, write to the Free Software
15  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
16  * 02110-1301, USA.
17  */
18
19 #ifndef QCUSBNET_STRUCTS_H
20 #define QCUSBNET_STRUCTS_H
21
22 #include <linux/etherdevice.h>
23 #include <linux/ethtool.h>
24 #include <linux/mii.h>
25 #include <linux/usb.h>
26 #include <linux/version.h>
27 #include <linux/cdev.h>
28 #include <linux/kthread.h>
29
30 #include <linux/usb/usbnet.h>
31
32 #include <linux/fdtable.h>
33
34 #define DBG(fmt, arg...)                                                \
35 do {                                                                    \
36         if (debug == 1)                                                 \
37                 printk(KERN_INFO "QCUSBNet2k::%s " fmt, __func__, ##arg); \
38 } while (0)
39
40 #define ERR(fmt, arg...)\
41         printk(KERN_ERR "QCUSBNet2k::%s " fmt, __func__, ##arg)
42
43 struct qcusbnet;
44
45 struct urbreq {
46         struct list_head node;
47         struct urb *urb;
48 };
49
50 #define DEFAULT_READ_URB_LENGTH 0x1000
51
52 struct worker {
53         struct task_struct *thread;
54         struct completion work;
55         struct list_head urbs;
56         spinlock_t urbs_lock;
57         struct urb *active;
58         spinlock_t active_lock;
59         struct usb_interface *iface;
60 };
61
62 struct qmidev {
63         dev_t devnum;
64         struct class *devclass;
65         struct cdev cdev;
66         struct urb *readurb;
67         struct urbsetup *readsetup;
68         void *readbuf;
69         struct urb *inturb;
70         void *intbuf;
71         struct list_head clients;
72         spinlock_t clients_lock;
73         atomic_t qmitid;
74 };
75
76 enum {
77         DOWN_NO_NDIS_CONNECTION = 0,
78         DOWN_CDC_CONNECTION_SPEED = 1,
79         DOWN_DRIVER_SUSPENDED = 2,
80         DOWN_NET_IFACE_STOPPED = 3,
81 };
82
83 struct qcusbnet {
84         struct usbnet *usbnet;
85         struct usb_interface *iface;
86         int (*open)(struct net_device *);
87         int (*stop)(struct net_device *);
88         unsigned long down;
89         bool valid;
90         struct qmidev qmi;
91         char meid[14];
92         struct worker worker;
93 };
94
95 #endif /* !QCUSBNET_STRUCTS_H */