aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/staging/rt2860/link_list.h
diff options
context:
space:
mode:
authorGreg Kroah-Hartman <gregkh@suse.de>2008-10-28 17:48:09 -0400
committerGreg Kroah-Hartman <gregkh@suse.de>2009-01-06 16:52:11 -0500
commit91980990527258a075361490cecadbb7356fc0d2 (patch)
treea50d4f8765c85210062cbfe011b4367f87f81ec0 /drivers/staging/rt2860/link_list.h
parentf4f85ff7255836122fc03f69957cdb02e2530faa (diff)
Staging: add rt2860 wireless driver
This is the Ralink RT2860 driver from the company that does horrible things like reading a config file from /etc. However, the driver that is currently under development from the wireless development community is not working at all yet, so distros and users are using this version instead (quite common hardware on a lot of netbook machines). So here is this driver, for now, until the wireless developers get a "clean" version into the main tree, or until this version is cleaned up sufficiently to move out of the staging tree. Ported to the Linux build system and cleaned up a bit already by me. Cc: Linux wireless <linux-wireless@vger.kernel.org> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'drivers/staging/rt2860/link_list.h')
-rw-r--r--drivers/staging/rt2860/link_list.h134
1 files changed, 134 insertions, 0 deletions
diff --git a/drivers/staging/rt2860/link_list.h b/drivers/staging/rt2860/link_list.h
new file mode 100644
index 00000000000..f6521133fd5
--- /dev/null
+++ b/drivers/staging/rt2860/link_list.h
@@ -0,0 +1,134 @@
1/*
2 *************************************************************************
3 * Ralink Tech Inc.
4 * 5F., No.36, Taiyuan St., Jhubei City,
5 * Hsinchu County 302,
6 * Taiwan, R.O.C.
7 *
8 * (c) Copyright 2002-2007, Ralink Technology, Inc.
9 *
10 * This program is free software; you can redistribute it and/or modify *
11 * it under the terms of the GNU General Public License as published by *
12 * the Free Software Foundation; either version 2 of the License, or *
13 * (at your option) any later version. *
14 * *
15 * This program is distributed in the hope that it will be useful, *
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
18 * GNU General Public License for more details. *
19 * *
20 * You should have received a copy of the GNU General Public License *
21 * along with this program; if not, write to the *
22 * Free Software Foundation, Inc., *
23 * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
24 * *
25 *************************************************************************
26 */
27
28#ifndef __LINK_LIST_H__
29#define __LINK_LIST_H__
30
31typedef struct _LIST_ENTRY
32{
33 struct _LIST_ENTRY *pNext;
34} LIST_ENTRY, *PLIST_ENTRY;
35
36typedef struct _LIST_HEADR
37{
38 PLIST_ENTRY pHead;
39 PLIST_ENTRY pTail;
40 UCHAR size;
41} LIST_HEADER, *PLIST_HEADER;
42
43static inline VOID initList(
44 IN PLIST_HEADER pList)
45{
46 pList->pHead = pList->pTail = NULL;
47 pList->size = 0;
48 return;
49}
50
51static inline VOID insertTailList(
52 IN PLIST_HEADER pList,
53 IN PLIST_ENTRY pEntry)
54{
55 pEntry->pNext = NULL;
56 if (pList->pTail)
57 pList->pTail->pNext = pEntry;
58 else
59 pList->pHead = pEntry;
60 pList->pTail = pEntry;
61 pList->size++;
62
63 return;
64}
65
66static inline PLIST_ENTRY removeHeadList(
67 IN PLIST_HEADER pList)
68{
69 PLIST_ENTRY pNext;
70 PLIST_ENTRY pEntry;
71
72 pEntry = pList->pHead;
73 if (pList->pHead != NULL)
74 {
75 pNext = pList->pHead->pNext;
76 pList->pHead = pNext;
77 if (pNext == NULL)
78 pList->pTail = NULL;
79 pList->size--;
80 }
81 return pEntry;
82}
83
84static inline int getListSize(
85 IN PLIST_HEADER pList)
86{
87 return pList->size;
88}
89
90static inline PLIST_ENTRY delEntryList(
91 IN PLIST_HEADER pList,
92 IN PLIST_ENTRY pEntry)
93{
94 PLIST_ENTRY pCurEntry;
95 PLIST_ENTRY pPrvEntry;
96
97 if(pList->pHead == NULL)
98 return NULL;
99
100 if(pEntry == pList->pHead)
101 {
102 pCurEntry = pList->pHead;
103 pList->pHead = pCurEntry->pNext;
104
105 if(pList->pHead == NULL)
106 pList->pTail = NULL;
107
108 pList->size--;
109 return pCurEntry;
110 }
111
112 pPrvEntry = pList->pHead;
113 pCurEntry = pPrvEntry->pNext;
114 while(pCurEntry != NULL)
115 {
116 if (pEntry == pCurEntry)
117 {
118 pPrvEntry->pNext = pCurEntry->pNext;
119
120 if(pEntry == pList->pTail)
121 pList->pTail = pPrvEntry;
122
123 pList->size--;
124 break;
125 }
126 pPrvEntry = pCurEntry;
127 pCurEntry = pPrvEntry->pNext;
128 }
129
130 return pCurEntry;
131}
132
133#endif // ___LINK_LIST_H__ //
134