summaryrefslogtreecommitdiff
path: root/packages/hostap/hostap-modules/kernel_updates.patch
blob: 70487a96f8f908d0cf2d1fbdfaaa18a448e9694d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
Index: hostap-driver-0.4.4/driver/modules/hostap_cs.c
===================================================================
--- hostap-driver-0.4.4.orig/driver/modules/hostap_cs.c	2005-08-21 20:23:21.000000000 +0100
+++ hostap-driver-0.4.4/driver/modules/hostap_cs.c	2005-09-17 17:09:05.000000000 +0100
@@ -207,12 +207,17 @@
 #include "hostap_hw.c"
 
 
-
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,15))
 static void prism2_detach(dev_link_t *link);
+#else
+static void prism2_detach(struct pcmcia_device *p_dev);
+#endif
+
 static void prism2_release(u_long arg);
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,15))
 static int prism2_event(event_t event, int priority,
 			event_callback_args_t *args);
-
+#endif
 
 static int prism2_pccard_card_present(local_info_t *local)
 {
@@ -508,25 +513,36 @@
 }
 #endif
 
+static int prism2_config(dev_link_t *link);
 
 /* allocate local data and register with CardServices
  * initialize dev_link structure, but do not configure the card yet */
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,15))
 static dev_link_t *prism2_attach(void)
+#else
+static int prism2_attach(struct pcmcia_device *p_dev)
+#endif
 {
 	dev_link_t *link;
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,15))
 	client_reg_t client_reg;
 	int ret;
+#endif
 
 	link = kmalloc(sizeof(dev_link_t), GFP_KERNEL);
 	if (link == NULL)
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,15))
 		return NULL;
-
+#else
+		return -ENOMEM;
+#endif
 	memset(link, 0, sizeof(dev_link_t));
 
 	PDEBUG(DEBUG_HW, "%s: setting Vcc=33 (constant)\n", dev_info);
 	link->conf.Vcc = 33;
 	link->conf.IntType = INT_MEMORY_AND_IO;
 
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,15))
 	/* register with CardServices */
 	link->next = dev_list;
 	dev_list = link;
@@ -547,12 +563,28 @@
 		prism2_detach(link);
 		return NULL;
 	}
+
 	return link;
-}
+#else
+	link->handle = p_dev;
+	p_dev->instance = link;
+
+	link->state |= DEV_PRESENT | DEV_CONFIG_PENDING;
+	prism2_config(link);
 
+	return 0;
+#endif
+}
 
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,15))
 static void prism2_detach(dev_link_t *link)
+#else
+static void prism2_detach(struct pcmcia_device *p_dev)
+#endif
 {
+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,15))
+	dev_link_t *link = dev_to_instance(p_dev);
+#endif
 	dev_link_t **linkp;
 
 	PDEBUG(DEBUG_FLOW, "prism2_detach\n");
@@ -570,6 +602,7 @@
 		prism2_release((u_long)link);
 	}
 
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,15))
 	if (link->handle) {
 		int res = pcmcia_deregister_client(link->handle);
 		if (res) {
@@ -577,6 +610,7 @@
 			cs_error(link->handle, DeregisterClient, res);
 		}
 	}
+#endif
 
 	*linkp = link->next;
 	/* release net devices */
@@ -855,7 +889,53 @@
 	PDEBUG(DEBUG_FLOW, "release - done\n");
 }
 
+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,15))
+static int prism2_suspend1(struct pcmcia_device *dev)
+{
+	dev_link_t *link = dev_to_instance(dev);
+	struct net_device *ndev = (struct net_device *) link->priv;
+
+	PDEBUG(DEBUG_EXTRA, "%s: CS_EVENT_PM_SUSPEND\n", dev_info);
+	link->state |= DEV_SUSPEND;
+	/* fall through */
 
+	if (link->state & DEV_CONFIG) {
+		if (link->open) {
+			netif_stop_queue(ndev);
+			netif_device_detach(ndev);
+		}
+		prism2_suspend(ndev);
+		pcmcia_release_configuration(link->handle);
+	}
+
+	return 0;
+}
+
+static int prism2_resume1(struct pcmcia_device *dev)
+{
+	dev_link_t *link = dev_to_instance(dev);
+	struct net_device *ndev = (struct net_device *) link->priv;
+
+	PDEBUG(DEBUG_EXTRA, "%s: CS_EVENT_PM_RESUME\n", dev_info);
+
+	link->state &= ~DEV_SUSPEND;
+	/* fall through */
+
+	if (link->state & DEV_CONFIG) {
+		pcmcia_request_configuration(link->handle, &link->conf);
+		prism2_hw_shutdown(ndev, 1);
+		prism2_hw_config(ndev, link->open ? 0 : 1);
+		if (link->open) {
+			netif_device_attach(ndev);
+			netif_start_queue(ndev);
+		}
+	}
+
+	return 0;
+}
+#endif
+
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,15))
 static int prism2_event(event_t event, int priority,
 			event_callback_args_t *args)
 {
@@ -924,7 +1004,7 @@
 	}
 	return 0;
 }
-
+#endif
 
 #if LINUX_VERSION_CODE > KERNEL_VERSION(2,5,67)
 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,13))
@@ -983,11 +1063,20 @@
 	.drv		= {
 		.name	= "hostap_cs",
 	},
+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,15))
+	.probe		= prism2_attach,
+	.remove		= prism2_detach,
+	.suspend	= prism2_suspend1,
+	.resume		= prism2_resume1,
+#else
 	.attach		= prism2_attach,
 	.detach		= prism2_detach,
+#endif
 	.owner		= THIS_MODULE,
 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,13))
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,15))
 	.event		= prism2_event,
+#endif
 	.id_table	= hostap_cs_ids,
 #endif
 };