aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/isdn/hisax/teles_cs.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/isdn/hisax/teles_cs.c')
-rw-r--r--drivers/isdn/hisax/teles_cs.c54
1 files changed, 24 insertions, 30 deletions
diff --git a/drivers/isdn/hisax/teles_cs.c b/drivers/isdn/hisax/teles_cs.c
index ea16ebfc028a..698e9ec95f0b 100644
--- a/drivers/isdn/hisax/teles_cs.c
+++ b/drivers/isdn/hisax/teles_cs.c
@@ -75,8 +75,8 @@ module_param(protocol, int, 0);
75 handler. 75 handler.
76*/ 76*/
77 77
78static void teles_cs_config(dev_link_t *link); 78static void teles_cs_config(struct pcmcia_device *link);
79static void teles_cs_release(dev_link_t *link); 79static void teles_cs_release(struct pcmcia_device *link);
80 80
81/* 81/*
82 The attach() and detach() entry points are used to create and destroy 82 The attach() and detach() entry points are used to create and destroy
@@ -89,10 +89,10 @@ static void teles_detach(struct pcmcia_device *p_dev);
89/* 89/*
90 A linked list of "instances" of the teles_cs device. Each actual 90 A linked list of "instances" of the teles_cs device. Each actual
91 PCMCIA card corresponds to one device instance, and is described 91 PCMCIA card corresponds to one device instance, and is described
92 by one dev_link_t structure (defined in ds.h). 92 by one struct pcmcia_device structure (defined in ds.h).
93 93
94 You may not want to use a linked list for this -- for example, the 94 You may not want to use a linked list for this -- for example, the
95 memory card driver uses an array of dev_link_t pointers, where minor 95 memory card driver uses an array of struct pcmcia_device pointers, where minor
96 device numbers are used to derive the corresponding array index. 96 device numbers are used to derive the corresponding array index.
97*/ 97*/
98 98
@@ -102,7 +102,7 @@ static void teles_detach(struct pcmcia_device *p_dev);
102 example, ethernet cards, modems). In other cases, there may be 102 example, ethernet cards, modems). In other cases, there may be
103 many actual or logical devices (SCSI adapters, memory cards with 103 many actual or logical devices (SCSI adapters, memory cards with
104 multiple partitions). The dev_node_t structures need to be kept 104 multiple partitions). The dev_node_t structures need to be kept
105 in a linked list starting at the 'dev' field of a dev_link_t 105 in a linked list starting at the 'dev' field of a struct pcmcia_device
106 structure. We allocate them in the card's private data structure, 106 structure. We allocate them in the card's private data structure,
107 because they generally shouldn't be allocated dynamically. 107 because they generally shouldn't be allocated dynamically.
108 In this case, we also provide a flag to indicate if a device is 108 In this case, we also provide a flag to indicate if a device is
@@ -130,10 +130,9 @@ typedef struct local_info_t {
130 130
131======================================================================*/ 131======================================================================*/
132 132
133static int teles_attach(struct pcmcia_device *p_dev) 133static int teles_attach(struct pcmcia_device *link)
134{ 134{
135 local_info_t *local; 135 local_info_t *local;
136 dev_link_t *link = dev_to_instance(p_dev);
137 136
138 DEBUG(0, "teles_attach()\n"); 137 DEBUG(0, "teles_attach()\n");
139 138
@@ -143,7 +142,7 @@ static int teles_attach(struct pcmcia_device *p_dev)
143 memset(local, 0, sizeof(local_info_t)); 142 memset(local, 0, sizeof(local_info_t));
144 local->cardnr = -1; 143 local->cardnr = -1;
145 144
146 local->p_dev = p_dev; 145 local->p_dev = link;
147 link->priv = local; 146 link->priv = local;
148 147
149 /* Interrupt setup */ 148 /* Interrupt setup */
@@ -180,9 +179,8 @@ static int teles_attach(struct pcmcia_device *p_dev)
180 179
181======================================================================*/ 180======================================================================*/
182 181
183static void teles_detach(struct pcmcia_device *p_dev) 182static void teles_detach(struct pcmcia_device *link)
184{ 183{
185 dev_link_t *link = dev_to_instance(p_dev);
186 local_info_t *info = link->priv; 184 local_info_t *info = link->priv;
187 185
188 DEBUG(0, "teles_detach(0x%p)\n", link); 186 DEBUG(0, "teles_detach(0x%p)\n", link);
@@ -203,7 +201,7 @@ static void teles_detach(struct pcmcia_device *p_dev)
203 device available to the system. 201 device available to the system.
204 202
205======================================================================*/ 203======================================================================*/
206static int get_tuple(client_handle_t handle, tuple_t *tuple, 204static int get_tuple(struct pcmcia_device *handle, tuple_t *tuple,
207 cisparse_t *parse) 205 cisparse_t *parse)
208{ 206{
209 int i = pcmcia_get_tuple_data(handle, tuple); 207 int i = pcmcia_get_tuple_data(handle, tuple);
@@ -211,7 +209,7 @@ static int get_tuple(client_handle_t handle, tuple_t *tuple,
211 return pcmcia_parse_tuple(handle, tuple, parse); 209 return pcmcia_parse_tuple(handle, tuple, parse);
212} 210}
213 211
214static int first_tuple(client_handle_t handle, tuple_t *tuple, 212static int first_tuple(struct pcmcia_device *handle, tuple_t *tuple,
215 cisparse_t *parse) 213 cisparse_t *parse)
216{ 214{
217 int i = pcmcia_get_first_tuple(handle, tuple); 215 int i = pcmcia_get_first_tuple(handle, tuple);
@@ -219,7 +217,7 @@ static int first_tuple(client_handle_t handle, tuple_t *tuple,
219 return get_tuple(handle, tuple, parse); 217 return get_tuple(handle, tuple, parse);
220} 218}
221 219
222static int next_tuple(client_handle_t handle, tuple_t *tuple, 220static int next_tuple(struct pcmcia_device *handle, tuple_t *tuple,
223 cisparse_t *parse) 221 cisparse_t *parse)
224{ 222{
225 int i = pcmcia_get_next_tuple(handle, tuple); 223 int i = pcmcia_get_next_tuple(handle, tuple);
@@ -227,9 +225,8 @@ static int next_tuple(client_handle_t handle, tuple_t *tuple,
227 return get_tuple(handle, tuple, parse); 225 return get_tuple(handle, tuple, parse);
228} 226}
229 227
230static void teles_cs_config(dev_link_t *link) 228static void teles_cs_config(struct pcmcia_device *link)
231{ 229{
232 client_handle_t handle;
233 tuple_t tuple; 230 tuple_t tuple;
234 cisparse_t parse; 231 cisparse_t parse;
235 local_info_t *dev; 232 local_info_t *dev;
@@ -239,7 +236,6 @@ static void teles_cs_config(dev_link_t *link)
239 IsdnCard_t icard; 236 IsdnCard_t icard;
240 237
241 DEBUG(0, "teles_config(0x%p)\n", link); 238 DEBUG(0, "teles_config(0x%p)\n", link);
242 handle = link->handle;
243 dev = link->priv; 239 dev = link->priv;
244 240
245 /* 241 /*
@@ -251,7 +247,7 @@ static void teles_cs_config(dev_link_t *link)
251 tuple.TupleDataMax = 255; 247 tuple.TupleDataMax = 255;
252 tuple.TupleOffset = 0; 248 tuple.TupleOffset = 0;
253 tuple.Attributes = 0; 249 tuple.Attributes = 0;
254 i = first_tuple(handle, &tuple, &parse); 250 i = first_tuple(link, &tuple, &parse);
255 if (i != CS_SUCCESS) { 251 if (i != CS_SUCCESS) {
256 last_fn = ParseTuple; 252 last_fn = ParseTuple;
257 goto cs_failed; 253 goto cs_failed;
@@ -266,25 +262,25 @@ static void teles_cs_config(dev_link_t *link)
266 tuple.TupleOffset = 0; tuple.TupleDataMax = 255; 262 tuple.TupleOffset = 0; tuple.TupleDataMax = 255;
267 tuple.Attributes = 0; 263 tuple.Attributes = 0;
268 tuple.DesiredTuple = CISTPL_CFTABLE_ENTRY; 264 tuple.DesiredTuple = CISTPL_CFTABLE_ENTRY;
269 i = first_tuple(handle, &tuple, &parse); 265 i = first_tuple(link, &tuple, &parse);
270 while (i == CS_SUCCESS) { 266 while (i == CS_SUCCESS) {
271 if ( (cf->io.nwin > 0) && cf->io.win[0].base) { 267 if ( (cf->io.nwin > 0) && cf->io.win[0].base) {
272 printk(KERN_INFO "(teles_cs: looks like the 96 model)\n"); 268 printk(KERN_INFO "(teles_cs: looks like the 96 model)\n");
273 link->conf.ConfigIndex = cf->index; 269 link->conf.ConfigIndex = cf->index;
274 link->io.BasePort1 = cf->io.win[0].base; 270 link->io.BasePort1 = cf->io.win[0].base;
275 i = pcmcia_request_io(link->handle, &link->io); 271 i = pcmcia_request_io(link, &link->io);
276 if (i == CS_SUCCESS) break; 272 if (i == CS_SUCCESS) break;
277 } else { 273 } else {
278 printk(KERN_INFO "(teles_cs: looks like the 97 model)\n"); 274 printk(KERN_INFO "(teles_cs: looks like the 97 model)\n");
279 link->conf.ConfigIndex = cf->index; 275 link->conf.ConfigIndex = cf->index;
280 for (i = 0, j = 0x2f0; j > 0x100; j -= 0x10) { 276 for (i = 0, j = 0x2f0; j > 0x100; j -= 0x10) {
281 link->io.BasePort1 = j; 277 link->io.BasePort1 = j;
282 i = pcmcia_request_io(link->handle, &link->io); 278 i = pcmcia_request_io(link, &link->io);
283 if (i == CS_SUCCESS) break; 279 if (i == CS_SUCCESS) break;
284 } 280 }
285 break; 281 break;
286 } 282 }
287 i = next_tuple(handle, &tuple, &parse); 283 i = next_tuple(link, &tuple, &parse);
288 } 284 }
289 285
290 if (i != CS_SUCCESS) { 286 if (i != CS_SUCCESS) {
@@ -292,14 +288,14 @@ static void teles_cs_config(dev_link_t *link)
292 goto cs_failed; 288 goto cs_failed;
293 } 289 }
294 290
295 i = pcmcia_request_irq(link->handle, &link->irq); 291 i = pcmcia_request_irq(link, &link->irq);
296 if (i != CS_SUCCESS) { 292 if (i != CS_SUCCESS) {
297 link->irq.AssignedIRQ = 0; 293 link->irq.AssignedIRQ = 0;
298 last_fn = RequestIRQ; 294 last_fn = RequestIRQ;
299 goto cs_failed; 295 goto cs_failed;
300 } 296 }
301 297
302 i = pcmcia_request_configuration(link->handle, &link->conf); 298 i = pcmcia_request_configuration(link, &link->conf);
303 if (i != CS_SUCCESS) { 299 if (i != CS_SUCCESS) {
304 last_fn = RequestConfiguration; 300 last_fn = RequestConfiguration;
305 goto cs_failed; 301 goto cs_failed;
@@ -342,7 +338,7 @@ static void teles_cs_config(dev_link_t *link)
342 338
343 return; 339 return;
344cs_failed: 340cs_failed:
345 cs_error(link->handle, last_fn, i); 341 cs_error(link, last_fn, i);
346 teles_cs_release(link); 342 teles_cs_release(link);
347} /* teles_cs_config */ 343} /* teles_cs_config */
348 344
@@ -354,7 +350,7 @@ cs_failed:
354 350
355======================================================================*/ 351======================================================================*/
356 352
357static void teles_cs_release(dev_link_t *link) 353static void teles_cs_release(struct pcmcia_device *link)
358{ 354{
359 local_info_t *local = link->priv; 355 local_info_t *local = link->priv;
360 356
@@ -367,12 +363,11 @@ static void teles_cs_release(dev_link_t *link)
367 } 363 }
368 } 364 }
369 365
370 pcmcia_disable_device(link->handle); 366 pcmcia_disable_device(link);
371} /* teles_cs_release */ 367} /* teles_cs_release */
372 368
373static int teles_suspend(struct pcmcia_device *p_dev) 369static int teles_suspend(struct pcmcia_device *link)
374{ 370{
375 dev_link_t *link = dev_to_instance(p_dev);
376 local_info_t *dev = link->priv; 371 local_info_t *dev = link->priv;
377 372
378 dev->busy = 1; 373 dev->busy = 1;
@@ -380,9 +375,8 @@ static int teles_suspend(struct pcmcia_device *p_dev)
380 return 0; 375 return 0;
381} 376}
382 377
383static int teles_resume(struct pcmcia_device *p_dev) 378static int teles_resume(struct pcmcia_device *link)
384{ 379{
385 dev_link_t *link = dev_to_instance(p_dev);
386 local_info_t *dev = link->priv; 380 local_info_t *dev = link->priv;
387 381
388 dev->busy = 0; 382 dev->busy = 0;