aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless/hostap/hostap_cs.c
diff options
context:
space:
mode:
authorDominik Brodowski <linux@dominikbrodowski.net>2006-03-31 10:21:06 -0500
committerDominik Brodowski <linux@dominikbrodowski.net>2006-03-31 10:21:06 -0500
commitfba395eee7d3f342ca739c20f5b3ee635d0420a0 (patch)
tree5a73f68d3514aa795b0d8c500e4d72170651d762 /drivers/net/wireless/hostap/hostap_cs.c
parentfd238232cd0ff4840ae6946bb338502154096d88 (diff)
[PATCH] pcmcia: remove dev_link_t and client_handle_t indirection
dev_link_t * and client_handle_t both mean struct pcmcai_device * by now. Therefore, remove all such indirections. Signed-off-by: Dominik Brodowski <linux@dominikbrodowski.net>
Diffstat (limited to 'drivers/net/wireless/hostap/hostap_cs.c')
-rw-r--r--drivers/net/wireless/hostap/hostap_cs.c82
1 files changed, 39 insertions, 43 deletions
diff --git a/drivers/net/wireless/hostap/hostap_cs.c b/drivers/net/wireless/hostap/hostap_cs.c
index e3095a88745c..89b178106edf 100644
--- a/drivers/net/wireless/hostap/hostap_cs.c
+++ b/drivers/net/wireless/hostap/hostap_cs.c
@@ -42,7 +42,7 @@ MODULE_PARM_DESC(ignore_cis_vcc, "Ignore broken CIS VCC entry");
42/* struct local_info::hw_priv */ 42/* struct local_info::hw_priv */
43struct hostap_cs_priv { 43struct hostap_cs_priv {
44 dev_node_t node; 44 dev_node_t node;
45 dev_link_t *link; 45 struct pcmcia_device *link;
46 int sandisk_connectplus; 46 int sandisk_connectplus;
47}; 47};
48 48
@@ -204,7 +204,7 @@ static int hfa384x_to_bap(struct net_device *dev, u16 bap, void *buf, int len)
204 204
205static void prism2_detach(struct pcmcia_device *p_dev); 205static void prism2_detach(struct pcmcia_device *p_dev);
206static void prism2_release(u_long arg); 206static void prism2_release(u_long arg);
207static int prism2_config(dev_link_t *link); 207static int prism2_config(struct pcmcia_device *link);
208 208
209 209
210static int prism2_pccard_card_present(local_info_t *local) 210static int prism2_pccard_card_present(local_info_t *local)
@@ -237,7 +237,7 @@ static void sandisk_set_iobase(local_info_t *local)
237 reg.Action = CS_WRITE; 237 reg.Action = CS_WRITE;
238 reg.Offset = 0x10; /* 0x3f0 IO base 1 */ 238 reg.Offset = 0x10; /* 0x3f0 IO base 1 */
239 reg.Value = hw_priv->link->io.BasePort1 & 0x00ff; 239 reg.Value = hw_priv->link->io.BasePort1 & 0x00ff;
240 res = pcmcia_access_configuration_register(hw_priv->link->handle, 240 res = pcmcia_access_configuration_register(hw_priv->link,
241 &reg); 241 &reg);
242 if (res != CS_SUCCESS) { 242 if (res != CS_SUCCESS) {
243 printk(KERN_DEBUG "Prism3 SanDisk - failed to set I/O base 0 -" 243 printk(KERN_DEBUG "Prism3 SanDisk - failed to set I/O base 0 -"
@@ -249,7 +249,7 @@ static void sandisk_set_iobase(local_info_t *local)
249 reg.Action = CS_WRITE; 249 reg.Action = CS_WRITE;
250 reg.Offset = 0x12; /* 0x3f2 IO base 2 */ 250 reg.Offset = 0x12; /* 0x3f2 IO base 2 */
251 reg.Value = (hw_priv->link->io.BasePort1 & 0xff00) >> 8; 251 reg.Value = (hw_priv->link->io.BasePort1 & 0xff00) >> 8;
252 res = pcmcia_access_configuration_register(hw_priv->link->handle, 252 res = pcmcia_access_configuration_register(hw_priv->link,
253 &reg); 253 &reg);
254 if (res != CS_SUCCESS) { 254 if (res != CS_SUCCESS) {
255 printk(KERN_DEBUG "Prism3 SanDisk - failed to set I/O base 1 -" 255 printk(KERN_DEBUG "Prism3 SanDisk - failed to set I/O base 1 -"
@@ -301,9 +301,9 @@ static int sandisk_enable_wireless(struct net_device *dev)
301 tuple.TupleData = buf; 301 tuple.TupleData = buf;
302 tuple.TupleDataMax = sizeof(buf); 302 tuple.TupleDataMax = sizeof(buf);
303 tuple.TupleOffset = 0; 303 tuple.TupleOffset = 0;
304 if (pcmcia_get_first_tuple(hw_priv->link->handle, &tuple) || 304 if (pcmcia_get_first_tuple(hw_priv->link, &tuple) ||
305 pcmcia_get_tuple_data(hw_priv->link->handle, &tuple) || 305 pcmcia_get_tuple_data(hw_priv->link, &tuple) ||
306 pcmcia_parse_tuple(hw_priv->link->handle, &tuple, parse) || 306 pcmcia_parse_tuple(hw_priv->link, &tuple, parse) ||
307 parse->manfid.manf != 0xd601 || parse->manfid.card != 0x0101) { 307 parse->manfid.manf != 0xd601 || parse->manfid.card != 0x0101) {
308 /* No SanDisk manfid found */ 308 /* No SanDisk manfid found */
309 ret = -ENODEV; 309 ret = -ENODEV;
@@ -311,9 +311,9 @@ static int sandisk_enable_wireless(struct net_device *dev)
311 } 311 }
312 312
313 tuple.DesiredTuple = CISTPL_LONGLINK_MFC; 313 tuple.DesiredTuple = CISTPL_LONGLINK_MFC;
314 if (pcmcia_get_first_tuple(hw_priv->link->handle, &tuple) || 314 if (pcmcia_get_first_tuple(hw_priv->link, &tuple) ||
315 pcmcia_get_tuple_data(hw_priv->link->handle, &tuple) || 315 pcmcia_get_tuple_data(hw_priv->link, &tuple) ||
316 pcmcia_parse_tuple(hw_priv->link->handle, &tuple, parse) || 316 pcmcia_parse_tuple(hw_priv->link, &tuple, parse) ||
317 parse->longlink_mfc.nfn < 2) { 317 parse->longlink_mfc.nfn < 2) {
318 /* No multi-function links found */ 318 /* No multi-function links found */
319 ret = -ENODEV; 319 ret = -ENODEV;
@@ -328,7 +328,7 @@ static int sandisk_enable_wireless(struct net_device *dev)
328 reg.Action = CS_WRITE; 328 reg.Action = CS_WRITE;
329 reg.Offset = CISREG_COR; 329 reg.Offset = CISREG_COR;
330 reg.Value = COR_SOFT_RESET; 330 reg.Value = COR_SOFT_RESET;
331 res = pcmcia_access_configuration_register(hw_priv->link->handle, 331 res = pcmcia_access_configuration_register(hw_priv->link,
332 &reg); 332 &reg);
333 if (res != CS_SUCCESS) { 333 if (res != CS_SUCCESS) {
334 printk(KERN_DEBUG "%s: SanDisk - COR sreset failed (%d)\n", 334 printk(KERN_DEBUG "%s: SanDisk - COR sreset failed (%d)\n",
@@ -345,7 +345,7 @@ static int sandisk_enable_wireless(struct net_device *dev)
345 * will be enabled during the first cor_sreset call. 345 * will be enabled during the first cor_sreset call.
346 */ 346 */
347 reg.Value = COR_LEVEL_REQ | 0x8 | COR_ADDR_DECODE | COR_FUNC_ENA; 347 reg.Value = COR_LEVEL_REQ | 0x8 | COR_ADDR_DECODE | COR_FUNC_ENA;
348 res = pcmcia_access_configuration_register(hw_priv->link->handle, 348 res = pcmcia_access_configuration_register(hw_priv->link,
349 &reg); 349 &reg);
350 if (res != CS_SUCCESS) { 350 if (res != CS_SUCCESS) {
351 printk(KERN_DEBUG "%s: SanDisk - COR sreset failed (%d)\n", 351 printk(KERN_DEBUG "%s: SanDisk - COR sreset failed (%d)\n",
@@ -380,7 +380,7 @@ static void prism2_pccard_cor_sreset(local_info_t *local)
380 reg.Action = CS_READ; 380 reg.Action = CS_READ;
381 reg.Offset = CISREG_COR; 381 reg.Offset = CISREG_COR;
382 reg.Value = 0; 382 reg.Value = 0;
383 res = pcmcia_access_configuration_register(hw_priv->link->handle, 383 res = pcmcia_access_configuration_register(hw_priv->link,
384 &reg); 384 &reg);
385 if (res != CS_SUCCESS) { 385 if (res != CS_SUCCESS) {
386 printk(KERN_DEBUG "prism2_pccard_cor_sreset failed 1 (%d)\n", 386 printk(KERN_DEBUG "prism2_pccard_cor_sreset failed 1 (%d)\n",
@@ -392,7 +392,7 @@ static void prism2_pccard_cor_sreset(local_info_t *local)
392 392
393 reg.Action = CS_WRITE; 393 reg.Action = CS_WRITE;
394 reg.Value |= COR_SOFT_RESET; 394 reg.Value |= COR_SOFT_RESET;
395 res = pcmcia_access_configuration_register(hw_priv->link->handle, 395 res = pcmcia_access_configuration_register(hw_priv->link,
396 &reg); 396 &reg);
397 if (res != CS_SUCCESS) { 397 if (res != CS_SUCCESS) {
398 printk(KERN_DEBUG "prism2_pccard_cor_sreset failed 2 (%d)\n", 398 printk(KERN_DEBUG "prism2_pccard_cor_sreset failed 2 (%d)\n",
@@ -405,7 +405,7 @@ static void prism2_pccard_cor_sreset(local_info_t *local)
405 reg.Value &= ~COR_SOFT_RESET; 405 reg.Value &= ~COR_SOFT_RESET;
406 if (hw_priv->sandisk_connectplus) 406 if (hw_priv->sandisk_connectplus)
407 reg.Value |= COR_IREQ_ENA; 407 reg.Value |= COR_IREQ_ENA;
408 res = pcmcia_access_configuration_register(hw_priv->link->handle, 408 res = pcmcia_access_configuration_register(hw_priv->link,
409 &reg); 409 &reg);
410 if (res != CS_SUCCESS) { 410 if (res != CS_SUCCESS) {
411 printk(KERN_DEBUG "prism2_pccard_cor_sreset failed 3 (%d)\n", 411 printk(KERN_DEBUG "prism2_pccard_cor_sreset failed 3 (%d)\n",
@@ -439,7 +439,7 @@ static void prism2_pccard_genesis_reset(local_info_t *local, int hcr)
439 reg.Action = CS_READ; 439 reg.Action = CS_READ;
440 reg.Offset = CISREG_COR; 440 reg.Offset = CISREG_COR;
441 reg.Value = 0; 441 reg.Value = 0;
442 res = pcmcia_access_configuration_register(hw_priv->link->handle, 442 res = pcmcia_access_configuration_register(hw_priv->link,
443 &reg); 443 &reg);
444 if (res != CS_SUCCESS) { 444 if (res != CS_SUCCESS) {
445 printk(KERN_DEBUG "prism2_pccard_genesis_sreset failed 1 " 445 printk(KERN_DEBUG "prism2_pccard_genesis_sreset failed 1 "
@@ -452,7 +452,7 @@ static void prism2_pccard_genesis_reset(local_info_t *local, int hcr)
452 452
453 reg.Action = CS_WRITE; 453 reg.Action = CS_WRITE;
454 reg.Value |= COR_SOFT_RESET; 454 reg.Value |= COR_SOFT_RESET;
455 res = pcmcia_access_configuration_register(hw_priv->link->handle, 455 res = pcmcia_access_configuration_register(hw_priv->link,
456 &reg); 456 &reg);
457 if (res != CS_SUCCESS) { 457 if (res != CS_SUCCESS) {
458 printk(KERN_DEBUG "prism2_pccard_genesis_sreset failed 2 " 458 printk(KERN_DEBUG "prism2_pccard_genesis_sreset failed 2 "
@@ -466,7 +466,7 @@ static void prism2_pccard_genesis_reset(local_info_t *local, int hcr)
466 reg.Action = CS_WRITE; 466 reg.Action = CS_WRITE;
467 reg.Value = hcr; 467 reg.Value = hcr;
468 reg.Offset = CISREG_CCSR; 468 reg.Offset = CISREG_CCSR;
469 res = pcmcia_access_configuration_register(hw_priv->link->handle, 469 res = pcmcia_access_configuration_register(hw_priv->link,
470 &reg); 470 &reg);
471 if (res != CS_SUCCESS) { 471 if (res != CS_SUCCESS) {
472 printk(KERN_DEBUG "prism2_pccard_genesis_sreset failed 3 " 472 printk(KERN_DEBUG "prism2_pccard_genesis_sreset failed 3 "
@@ -478,7 +478,7 @@ static void prism2_pccard_genesis_reset(local_info_t *local, int hcr)
478 reg.Action = CS_WRITE; 478 reg.Action = CS_WRITE;
479 reg.Offset = CISREG_COR; 479 reg.Offset = CISREG_COR;
480 reg.Value = old_cor & ~COR_SOFT_RESET; 480 reg.Value = old_cor & ~COR_SOFT_RESET;
481 res = pcmcia_access_configuration_register(hw_priv->link->handle, 481 res = pcmcia_access_configuration_register(hw_priv->link,
482 &reg); 482 &reg);
483 if (res != CS_SUCCESS) { 483 if (res != CS_SUCCESS) {
484 printk(KERN_DEBUG "prism2_pccard_genesis_sreset failed 4 " 484 printk(KERN_DEBUG "prism2_pccard_genesis_sreset failed 4 "
@@ -514,10 +514,8 @@ static int prism2_attach(struct pcmcia_device *p_dev)
514} 514}
515 515
516 516
517static void prism2_detach(struct pcmcia_device *p_dev) 517static void prism2_detach(struct pcmcia_device *link)
518{ 518{
519 dev_link_t *link = dev_to_instance(p_dev);
520
521 PDEBUG(DEBUG_FLOW, "prism2_detach\n"); 519 PDEBUG(DEBUG_FLOW, "prism2_detach\n");
522 520
523 if (link->state & DEV_CONFIG) { 521 if (link->state & DEV_CONFIG) {
@@ -545,7 +543,7 @@ do { last_fn = (fn); if ((last_ret = (ret)) != 0) goto cs_failed; } while (0)
545do { int ret = (retf); \ 543do { int ret = (retf); \
546if (ret != 0) { \ 544if (ret != 0) { \
547 PDEBUG(DEBUG_EXTRA, "CardServices(" #fn ") returned %d\n", ret); \ 545 PDEBUG(DEBUG_EXTRA, "CardServices(" #fn ") returned %d\n", ret); \
548 cs_error(link->handle, fn, ret); \ 546 cs_error(link, fn, ret); \
549 goto next_entry; \ 547 goto next_entry; \
550} \ 548} \
551} while (0) 549} while (0)
@@ -553,7 +551,7 @@ if (ret != 0) { \
553 551
554/* run after a CARD_INSERTION event is received to configure the PCMCIA 552/* run after a CARD_INSERTION event is received to configure the PCMCIA
555 * socket and make the device available to the system */ 553 * socket and make the device available to the system */
556static int prism2_config(dev_link_t *link) 554static int prism2_config(struct pcmcia_device *link)
557{ 555{
558 struct net_device *dev; 556 struct net_device *dev;
559 struct hostap_interface *iface; 557 struct hostap_interface *iface;
@@ -582,24 +580,24 @@ static int prism2_config(dev_link_t *link)
582 tuple.TupleData = buf; 580 tuple.TupleData = buf;
583 tuple.TupleDataMax = sizeof(buf); 581 tuple.TupleDataMax = sizeof(buf);
584 tuple.TupleOffset = 0; 582 tuple.TupleOffset = 0;
585 CS_CHECK(GetFirstTuple, pcmcia_get_first_tuple(link->handle, &tuple)); 583 CS_CHECK(GetFirstTuple, pcmcia_get_first_tuple(link, &tuple));
586 CS_CHECK(GetTupleData, pcmcia_get_tuple_data(link->handle, &tuple)); 584 CS_CHECK(GetTupleData, pcmcia_get_tuple_data(link, &tuple));
587 CS_CHECK(ParseTuple, pcmcia_parse_tuple(link->handle, &tuple, parse)); 585 CS_CHECK(ParseTuple, pcmcia_parse_tuple(link, &tuple, parse));
588 link->conf.ConfigBase = parse->config.base; 586 link->conf.ConfigBase = parse->config.base;
589 link->conf.Present = parse->config.rmask[0]; 587 link->conf.Present = parse->config.rmask[0];
590 588
591 CS_CHECK(GetConfigurationInfo, 589 CS_CHECK(GetConfigurationInfo,
592 pcmcia_get_configuration_info(link->handle, &conf)); 590 pcmcia_get_configuration_info(link, &conf));
593 591
594 /* Look for an appropriate configuration table entry in the CIS */ 592 /* Look for an appropriate configuration table entry in the CIS */
595 tuple.DesiredTuple = CISTPL_CFTABLE_ENTRY; 593 tuple.DesiredTuple = CISTPL_CFTABLE_ENTRY;
596 CS_CHECK(GetFirstTuple, pcmcia_get_first_tuple(link->handle, &tuple)); 594 CS_CHECK(GetFirstTuple, pcmcia_get_first_tuple(link, &tuple));
597 for (;;) { 595 for (;;) {
598 cistpl_cftable_entry_t *cfg = &(parse->cftable_entry); 596 cistpl_cftable_entry_t *cfg = &(parse->cftable_entry);
599 CFG_CHECK2(GetTupleData, 597 CFG_CHECK2(GetTupleData,
600 pcmcia_get_tuple_data(link->handle, &tuple)); 598 pcmcia_get_tuple_data(link, &tuple));
601 CFG_CHECK2(ParseTuple, 599 CFG_CHECK2(ParseTuple,
602 pcmcia_parse_tuple(link->handle, &tuple, parse)); 600 pcmcia_parse_tuple(link, &tuple, parse));
603 601
604 if (cfg->flags & CISTPL_CFTABLE_DEFAULT) 602 if (cfg->flags & CISTPL_CFTABLE_DEFAULT)
605 dflt = *cfg; 603 dflt = *cfg;
@@ -679,19 +677,19 @@ static int prism2_config(dev_link_t *link)
679 677
680 /* This reserves IO space but doesn't actually enable it */ 678 /* This reserves IO space but doesn't actually enable it */
681 CFG_CHECK2(RequestIO, 679 CFG_CHECK2(RequestIO,
682 pcmcia_request_io(link->handle, &link->io)); 680 pcmcia_request_io(link, &link->io));
683 681
684 /* This configuration table entry is OK */ 682 /* This configuration table entry is OK */
685 break; 683 break;
686 684
687 next_entry: 685 next_entry:
688 CS_CHECK(GetNextTuple, 686 CS_CHECK(GetNextTuple,
689 pcmcia_get_next_tuple(link->handle, &tuple)); 687 pcmcia_get_next_tuple(link, &tuple));
690 } 688 }
691 689
692 /* Need to allocate net_device before requesting IRQ handler */ 690 /* Need to allocate net_device before requesting IRQ handler */
693 dev = prism2_init_local_data(&prism2_pccard_funcs, 0, 691 dev = prism2_init_local_data(&prism2_pccard_funcs, 0,
694 &handle_to_dev(link->handle)); 692 &handle_to_dev(link));
695 if (dev == NULL) 693 if (dev == NULL)
696 goto failed; 694 goto failed;
697 link->priv = dev; 695 link->priv = dev;
@@ -714,7 +712,7 @@ static int prism2_config(dev_link_t *link)
714 link->irq.Handler = prism2_interrupt; 712 link->irq.Handler = prism2_interrupt;
715 link->irq.Instance = dev; 713 link->irq.Instance = dev;
716 CS_CHECK(RequestIRQ, 714 CS_CHECK(RequestIRQ,
717 pcmcia_request_irq(link->handle, &link->irq)); 715 pcmcia_request_irq(link, &link->irq));
718 } 716 }
719 717
720 /* 718 /*
@@ -723,7 +721,7 @@ static int prism2_config(dev_link_t *link)
723 * card and host interface into "Memory and IO" mode. 721 * card and host interface into "Memory and IO" mode.
724 */ 722 */
725 CS_CHECK(RequestConfiguration, 723 CS_CHECK(RequestConfiguration,
726 pcmcia_request_configuration(link->handle, &link->conf)); 724 pcmcia_request_configuration(link, &link->conf));
727 725
728 dev->irq = link->irq.AssignedIRQ; 726 dev->irq = link->irq.AssignedIRQ;
729 dev->base_addr = link->io.BasePort1; 727 dev->base_addr = link->io.BasePort1;
@@ -761,7 +759,7 @@ static int prism2_config(dev_link_t *link)
761 return ret; 759 return ret;
762 760
763 cs_failed: 761 cs_failed:
764 cs_error(link->handle, last_fn, last_ret); 762 cs_error(link, last_fn, last_ret);
765 763
766 failed: 764 failed:
767 kfree(parse); 765 kfree(parse);
@@ -773,7 +771,7 @@ static int prism2_config(dev_link_t *link)
773 771
774static void prism2_release(u_long arg) 772static void prism2_release(u_long arg)
775{ 773{
776 dev_link_t *link = (dev_link_t *)arg; 774 struct pcmcia_device *link = (struct pcmcia_device *)arg;
777 775
778 PDEBUG(DEBUG_FLOW, "prism2_release\n"); 776 PDEBUG(DEBUG_FLOW, "prism2_release\n");
779 777
@@ -787,13 +785,12 @@ static void prism2_release(u_long arg)
787 iface->local->shutdown = 1; 785 iface->local->shutdown = 1;
788 } 786 }
789 787
790 pcmcia_disable_device(link->handle); 788 pcmcia_disable_device(link);
791 PDEBUG(DEBUG_FLOW, "release - done\n"); 789 PDEBUG(DEBUG_FLOW, "release - done\n");
792} 790}
793 791
794static int hostap_cs_suspend(struct pcmcia_device *p_dev) 792static int hostap_cs_suspend(struct pcmcia_device *link)
795{ 793{
796 dev_link_t *link = dev_to_instance(p_dev);
797 struct net_device *dev = (struct net_device *) link->priv; 794 struct net_device *dev = (struct net_device *) link->priv;
798 int dev_open = 0; 795 int dev_open = 0;
799 796
@@ -813,9 +810,8 @@ static int hostap_cs_suspend(struct pcmcia_device *p_dev)
813 return 0; 810 return 0;
814} 811}
815 812
816static int hostap_cs_resume(struct pcmcia_device *p_dev) 813static int hostap_cs_resume(struct pcmcia_device *link)
817{ 814{
818 dev_link_t *link = dev_to_instance(p_dev);
819 struct net_device *dev = (struct net_device *) link->priv; 815 struct net_device *dev = (struct net_device *) link->priv;
820 int dev_open = 0; 816 int dev_open = 0;
821 817