diff options
author | Dominik Brodowski <linux@dominikbrodowski.net> | 2006-03-31 10:21:06 -0500 |
---|---|---|
committer | Dominik Brodowski <linux@dominikbrodowski.net> | 2006-03-31 10:21:06 -0500 |
commit | fba395eee7d3f342ca739c20f5b3ee635d0420a0 (patch) | |
tree | 5a73f68d3514aa795b0d8c500e4d72170651d762 /drivers/net/wireless/spectrum_cs.c | |
parent | fd238232cd0ff4840ae6946bb338502154096d88 (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/spectrum_cs.c')
-rw-r--r-- | drivers/net/wireless/spectrum_cs.c | 80 |
1 files changed, 37 insertions, 43 deletions
diff --git a/drivers/net/wireless/spectrum_cs.c b/drivers/net/wireless/spectrum_cs.c index be36679c8c95..a75ea7e593ac 100644 --- a/drivers/net/wireless/spectrum_cs.c +++ b/drivers/net/wireless/spectrum_cs.c | |||
@@ -71,8 +71,8 @@ struct orinoco_pccard { | |||
71 | /* Function prototypes */ | 71 | /* Function prototypes */ |
72 | /********************************************************************/ | 72 | /********************************************************************/ |
73 | 73 | ||
74 | static void spectrum_cs_config(dev_link_t *link); | 74 | static void spectrum_cs_config(struct pcmcia_device *link); |
75 | static void spectrum_cs_release(dev_link_t *link); | 75 | static void spectrum_cs_release(struct pcmcia_device *link); |
76 | 76 | ||
77 | /********************************************************************/ | 77 | /********************************************************************/ |
78 | /* Firmware downloader */ | 78 | /* Firmware downloader */ |
@@ -238,7 +238,7 @@ spectrum_aux_open(hermes_t *hw) | |||
238 | * If IDLE is 1, stop the firmware, so that it can be safely rewritten. | 238 | * If IDLE is 1, stop the firmware, so that it can be safely rewritten. |
239 | */ | 239 | */ |
240 | static int | 240 | static int |
241 | spectrum_reset(dev_link_t *link, int idle) | 241 | spectrum_reset(struct pcmcia_device *link, int idle) |
242 | { | 242 | { |
243 | int last_ret, last_fn; | 243 | int last_ret, last_fn; |
244 | conf_reg_t reg; | 244 | conf_reg_t reg; |
@@ -253,7 +253,7 @@ spectrum_reset(dev_link_t *link, int idle) | |||
253 | reg.Action = CS_READ; | 253 | reg.Action = CS_READ; |
254 | reg.Offset = CISREG_COR; | 254 | reg.Offset = CISREG_COR; |
255 | CS_CHECK(AccessConfigurationRegister, | 255 | CS_CHECK(AccessConfigurationRegister, |
256 | pcmcia_access_configuration_register(link->handle, ®)); | 256 | pcmcia_access_configuration_register(link, ®)); |
257 | save_cor = reg.Value; | 257 | save_cor = reg.Value; |
258 | 258 | ||
259 | /* Soft-Reset card */ | 259 | /* Soft-Reset card */ |
@@ -261,14 +261,14 @@ spectrum_reset(dev_link_t *link, int idle) | |||
261 | reg.Offset = CISREG_COR; | 261 | reg.Offset = CISREG_COR; |
262 | reg.Value = (save_cor | COR_SOFT_RESET); | 262 | reg.Value = (save_cor | COR_SOFT_RESET); |
263 | CS_CHECK(AccessConfigurationRegister, | 263 | CS_CHECK(AccessConfigurationRegister, |
264 | pcmcia_access_configuration_register(link->handle, ®)); | 264 | pcmcia_access_configuration_register(link, ®)); |
265 | udelay(1000); | 265 | udelay(1000); |
266 | 266 | ||
267 | /* Read CCSR */ | 267 | /* Read CCSR */ |
268 | reg.Action = CS_READ; | 268 | reg.Action = CS_READ; |
269 | reg.Offset = CISREG_CCSR; | 269 | reg.Offset = CISREG_CCSR; |
270 | CS_CHECK(AccessConfigurationRegister, | 270 | CS_CHECK(AccessConfigurationRegister, |
271 | pcmcia_access_configuration_register(link->handle, ®)); | 271 | pcmcia_access_configuration_register(link, ®)); |
272 | 272 | ||
273 | /* | 273 | /* |
274 | * Start or stop the firmware. Memory width bit should be | 274 | * Start or stop the firmware. Memory width bit should be |
@@ -278,7 +278,7 @@ spectrum_reset(dev_link_t *link, int idle) | |||
278 | reg.Offset = CISREG_CCSR; | 278 | reg.Offset = CISREG_CCSR; |
279 | reg.Value = (idle ? HCR_IDLE : HCR_RUN) | (reg.Value & HCR_MEM16); | 279 | reg.Value = (idle ? HCR_IDLE : HCR_RUN) | (reg.Value & HCR_MEM16); |
280 | CS_CHECK(AccessConfigurationRegister, | 280 | CS_CHECK(AccessConfigurationRegister, |
281 | pcmcia_access_configuration_register(link->handle, ®)); | 281 | pcmcia_access_configuration_register(link, ®)); |
282 | udelay(1000); | 282 | udelay(1000); |
283 | 283 | ||
284 | /* Restore original COR configuration index */ | 284 | /* Restore original COR configuration index */ |
@@ -286,12 +286,12 @@ spectrum_reset(dev_link_t *link, int idle) | |||
286 | reg.Offset = CISREG_COR; | 286 | reg.Offset = CISREG_COR; |
287 | reg.Value = (save_cor & ~COR_SOFT_RESET); | 287 | reg.Value = (save_cor & ~COR_SOFT_RESET); |
288 | CS_CHECK(AccessConfigurationRegister, | 288 | CS_CHECK(AccessConfigurationRegister, |
289 | pcmcia_access_configuration_register(link->handle, ®)); | 289 | pcmcia_access_configuration_register(link, ®)); |
290 | udelay(1000); | 290 | udelay(1000); |
291 | return 0; | 291 | return 0; |
292 | 292 | ||
293 | cs_failed: | 293 | cs_failed: |
294 | cs_error(link->handle, last_fn, last_ret); | 294 | cs_error(link, last_fn, last_ret); |
295 | return -ENODEV; | 295 | return -ENODEV; |
296 | } | 296 | } |
297 | 297 | ||
@@ -441,7 +441,7 @@ spectrum_load_blocks(hermes_t *hw, const struct dblock *first_block) | |||
441 | * care of the PDA - read it and then write it on top of the firmware. | 441 | * care of the PDA - read it and then write it on top of the firmware. |
442 | */ | 442 | */ |
443 | static int | 443 | static int |
444 | spectrum_dl_image(hermes_t *hw, dev_link_t *link, | 444 | spectrum_dl_image(hermes_t *hw, struct pcmcia_device *link, |
445 | const unsigned char *image) | 445 | const unsigned char *image) |
446 | { | 446 | { |
447 | int ret; | 447 | int ret; |
@@ -505,14 +505,13 @@ spectrum_dl_image(hermes_t *hw, dev_link_t *link, | |||
505 | * reset on the card, to make sure it's in a sane state. | 505 | * reset on the card, to make sure it's in a sane state. |
506 | */ | 506 | */ |
507 | static int | 507 | static int |
508 | spectrum_dl_firmware(hermes_t *hw, dev_link_t *link) | 508 | spectrum_dl_firmware(hermes_t *hw, struct pcmcia_device *link) |
509 | { | 509 | { |
510 | int ret; | 510 | int ret; |
511 | client_handle_t handle = link->handle; | ||
512 | const struct firmware *fw_entry; | 511 | const struct firmware *fw_entry; |
513 | 512 | ||
514 | if (request_firmware(&fw_entry, primary_fw_name, | 513 | if (request_firmware(&fw_entry, primary_fw_name, |
515 | &handle_to_dev(handle)) == 0) { | 514 | &handle_to_dev(link)) == 0) { |
516 | primsym = fw_entry->data; | 515 | primsym = fw_entry->data; |
517 | } else { | 516 | } else { |
518 | printk(KERN_ERR PFX "Cannot find firmware: %s\n", | 517 | printk(KERN_ERR PFX "Cannot find firmware: %s\n", |
@@ -521,7 +520,7 @@ spectrum_dl_firmware(hermes_t *hw, dev_link_t *link) | |||
521 | } | 520 | } |
522 | 521 | ||
523 | if (request_firmware(&fw_entry, secondary_fw_name, | 522 | if (request_firmware(&fw_entry, secondary_fw_name, |
524 | &handle_to_dev(handle)) == 0) { | 523 | &handle_to_dev(link)) == 0) { |
525 | secsym = fw_entry->data; | 524 | secsym = fw_entry->data; |
526 | } else { | 525 | } else { |
527 | printk(KERN_ERR PFX "Cannot find firmware: %s\n", | 526 | printk(KERN_ERR PFX "Cannot find firmware: %s\n", |
@@ -554,7 +553,7 @@ static int | |||
554 | spectrum_cs_hard_reset(struct orinoco_private *priv) | 553 | spectrum_cs_hard_reset(struct orinoco_private *priv) |
555 | { | 554 | { |
556 | struct orinoco_pccard *card = priv->card; | 555 | struct orinoco_pccard *card = priv->card; |
557 | dev_link_t *link = card->p_dev; | 556 | struct pcmcia_device *link = card->p_dev; |
558 | int err; | 557 | int err; |
559 | 558 | ||
560 | if (!hermes_present(&priv->hw)) { | 559 | if (!hermes_present(&priv->hw)) { |
@@ -584,12 +583,11 @@ spectrum_cs_hard_reset(struct orinoco_private *priv) | |||
584 | * configure the card at this point -- we wait until we receive a card | 583 | * configure the card at this point -- we wait until we receive a card |
585 | * insertion event. */ | 584 | * insertion event. */ |
586 | static int | 585 | static int |
587 | spectrum_cs_attach(struct pcmcia_device *p_dev) | 586 | spectrum_cs_attach(struct pcmcia_device *link) |
588 | { | 587 | { |
589 | struct net_device *dev; | 588 | struct net_device *dev; |
590 | struct orinoco_private *priv; | 589 | struct orinoco_private *priv; |
591 | struct orinoco_pccard *card; | 590 | struct orinoco_pccard *card; |
592 | dev_link_t *link = dev_to_instance(p_dev); | ||
593 | 591 | ||
594 | dev = alloc_orinocodev(sizeof(*card), spectrum_cs_hard_reset); | 592 | dev = alloc_orinocodev(sizeof(*card), spectrum_cs_hard_reset); |
595 | if (! dev) | 593 | if (! dev) |
@@ -598,7 +596,7 @@ spectrum_cs_attach(struct pcmcia_device *p_dev) | |||
598 | card = priv->card; | 596 | card = priv->card; |
599 | 597 | ||
600 | /* Link both structures together */ | 598 | /* Link both structures together */ |
601 | card->p_dev = p_dev; | 599 | card->p_dev = link; |
602 | link->priv = dev; | 600 | link->priv = dev; |
603 | 601 | ||
604 | /* Interrupt setup */ | 602 | /* Interrupt setup */ |
@@ -627,9 +625,8 @@ spectrum_cs_attach(struct pcmcia_device *p_dev) | |||
627 | * are freed. Otherwise, the structures will be freed when the device | 625 | * are freed. Otherwise, the structures will be freed when the device |
628 | * is released. | 626 | * is released. |
629 | */ | 627 | */ |
630 | static void spectrum_cs_detach(struct pcmcia_device *p_dev) | 628 | static void spectrum_cs_detach(struct pcmcia_device *link) |
631 | { | 629 | { |
632 | dev_link_t *link = dev_to_instance(p_dev); | ||
633 | struct net_device *dev = link->priv; | 630 | struct net_device *dev = link->priv; |
634 | 631 | ||
635 | if (link->state & DEV_CONFIG) | 632 | if (link->state & DEV_CONFIG) |
@@ -651,10 +648,9 @@ static void spectrum_cs_detach(struct pcmcia_device *p_dev) | |||
651 | */ | 648 | */ |
652 | 649 | ||
653 | static void | 650 | static void |
654 | spectrum_cs_config(dev_link_t *link) | 651 | spectrum_cs_config(struct pcmcia_device *link) |
655 | { | 652 | { |
656 | struct net_device *dev = link->priv; | 653 | struct net_device *dev = link->priv; |
657 | client_handle_t handle = link->handle; | ||
658 | struct orinoco_private *priv = netdev_priv(dev); | 654 | struct orinoco_private *priv = netdev_priv(dev); |
659 | struct orinoco_pccard *card = priv->card; | 655 | struct orinoco_pccard *card = priv->card; |
660 | hermes_t *hw = &priv->hw; | 656 | hermes_t *hw = &priv->hw; |
@@ -666,7 +662,7 @@ spectrum_cs_config(dev_link_t *link) | |||
666 | cisparse_t parse; | 662 | cisparse_t parse; |
667 | void __iomem *mem; | 663 | void __iomem *mem; |
668 | 664 | ||
669 | CS_CHECK(ValidateCIS, pcmcia_validate_cis(handle, &info)); | 665 | CS_CHECK(ValidateCIS, pcmcia_validate_cis(link, &info)); |
670 | 666 | ||
671 | /* | 667 | /* |
672 | * This reads the card's CONFIG tuple to find its | 668 | * This reads the card's CONFIG tuple to find its |
@@ -677,9 +673,9 @@ spectrum_cs_config(dev_link_t *link) | |||
677 | tuple.TupleData = buf; | 673 | tuple.TupleData = buf; |
678 | tuple.TupleDataMax = sizeof(buf); | 674 | tuple.TupleDataMax = sizeof(buf); |
679 | tuple.TupleOffset = 0; | 675 | tuple.TupleOffset = 0; |
680 | CS_CHECK(GetFirstTuple, pcmcia_get_first_tuple(handle, &tuple)); | 676 | CS_CHECK(GetFirstTuple, pcmcia_get_first_tuple(link, &tuple)); |
681 | CS_CHECK(GetTupleData, pcmcia_get_tuple_data(handle, &tuple)); | 677 | CS_CHECK(GetTupleData, pcmcia_get_tuple_data(link, &tuple)); |
682 | CS_CHECK(ParseTuple, pcmcia_parse_tuple(handle, &tuple, &parse)); | 678 | CS_CHECK(ParseTuple, pcmcia_parse_tuple(link, &tuple, &parse)); |
683 | link->conf.ConfigBase = parse.config.base; | 679 | link->conf.ConfigBase = parse.config.base; |
684 | link->conf.Present = parse.config.rmask[0]; | 680 | link->conf.Present = parse.config.rmask[0]; |
685 | 681 | ||
@@ -688,7 +684,7 @@ spectrum_cs_config(dev_link_t *link) | |||
688 | 684 | ||
689 | /* Look up the current Vcc */ | 685 | /* Look up the current Vcc */ |
690 | CS_CHECK(GetConfigurationInfo, | 686 | CS_CHECK(GetConfigurationInfo, |
691 | pcmcia_get_configuration_info(handle, &conf)); | 687 | pcmcia_get_configuration_info(link, &conf)); |
692 | 688 | ||
693 | /* | 689 | /* |
694 | * In this loop, we scan the CIS for configuration table | 690 | * In this loop, we scan the CIS for configuration table |
@@ -705,13 +701,13 @@ spectrum_cs_config(dev_link_t *link) | |||
705 | * implementation-defined details. | 701 | * implementation-defined details. |
706 | */ | 702 | */ |
707 | tuple.DesiredTuple = CISTPL_CFTABLE_ENTRY; | 703 | tuple.DesiredTuple = CISTPL_CFTABLE_ENTRY; |
708 | CS_CHECK(GetFirstTuple, pcmcia_get_first_tuple(handle, &tuple)); | 704 | CS_CHECK(GetFirstTuple, pcmcia_get_first_tuple(link, &tuple)); |
709 | while (1) { | 705 | while (1) { |
710 | cistpl_cftable_entry_t *cfg = &(parse.cftable_entry); | 706 | cistpl_cftable_entry_t *cfg = &(parse.cftable_entry); |
711 | cistpl_cftable_entry_t dflt = { .index = 0 }; | 707 | cistpl_cftable_entry_t dflt = { .index = 0 }; |
712 | 708 | ||
713 | if ( (pcmcia_get_tuple_data(handle, &tuple) != 0) | 709 | if ( (pcmcia_get_tuple_data(link, &tuple) != 0) |
714 | || (pcmcia_parse_tuple(handle, &tuple, &parse) != 0)) | 710 | || (pcmcia_parse_tuple(link, &tuple, &parse) != 0)) |
715 | goto next_entry; | 711 | goto next_entry; |
716 | 712 | ||
717 | if (cfg->flags & CISTPL_CFTABLE_DEFAULT) | 713 | if (cfg->flags & CISTPL_CFTABLE_DEFAULT) |
@@ -776,7 +772,7 @@ spectrum_cs_config(dev_link_t *link) | |||
776 | } | 772 | } |
777 | 773 | ||
778 | /* This reserves IO space but doesn't actually enable it */ | 774 | /* This reserves IO space but doesn't actually enable it */ |
779 | if (pcmcia_request_io(link->handle, &link->io) != 0) | 775 | if (pcmcia_request_io(link, &link->io) != 0) |
780 | goto next_entry; | 776 | goto next_entry; |
781 | } | 777 | } |
782 | 778 | ||
@@ -786,8 +782,8 @@ spectrum_cs_config(dev_link_t *link) | |||
786 | break; | 782 | break; |
787 | 783 | ||
788 | next_entry: | 784 | next_entry: |
789 | pcmcia_disable_device(handle); | 785 | pcmcia_disable_device(link); |
790 | last_ret = pcmcia_get_next_tuple(handle, &tuple); | 786 | last_ret = pcmcia_get_next_tuple(link, &tuple); |
791 | if (last_ret == CS_NO_MORE_ITEMS) { | 787 | if (last_ret == CS_NO_MORE_ITEMS) { |
792 | printk(KERN_ERR PFX "GetNextTuple(): No matching " | 788 | printk(KERN_ERR PFX "GetNextTuple(): No matching " |
793 | "CIS configuration. Maybe you need the " | 789 | "CIS configuration. Maybe you need the " |
@@ -801,7 +797,7 @@ spectrum_cs_config(dev_link_t *link) | |||
801 | * a handler to the interrupt, unless the 'Handler' member of | 797 | * a handler to the interrupt, unless the 'Handler' member of |
802 | * the irq structure is initialized. | 798 | * the irq structure is initialized. |
803 | */ | 799 | */ |
804 | CS_CHECK(RequestIRQ, pcmcia_request_irq(link->handle, &link->irq)); | 800 | CS_CHECK(RequestIRQ, pcmcia_request_irq(link, &link->irq)); |
805 | 801 | ||
806 | /* We initialize the hermes structure before completing PCMCIA | 802 | /* We initialize the hermes structure before completing PCMCIA |
807 | * configuration just in case the interrupt handler gets | 803 | * configuration just in case the interrupt handler gets |
@@ -818,7 +814,7 @@ spectrum_cs_config(dev_link_t *link) | |||
818 | * card and host interface into "Memory and IO" mode. | 814 | * card and host interface into "Memory and IO" mode. |
819 | */ | 815 | */ |
820 | CS_CHECK(RequestConfiguration, | 816 | CS_CHECK(RequestConfiguration, |
821 | pcmcia_request_configuration(link->handle, &link->conf)); | 817 | pcmcia_request_configuration(link, &link->conf)); |
822 | 818 | ||
823 | /* Ok, we have the configuration, prepare to register the netdev */ | 819 | /* Ok, we have the configuration, prepare to register the netdev */ |
824 | dev->base_addr = link->io.BasePort1; | 820 | dev->base_addr = link->io.BasePort1; |
@@ -831,7 +827,7 @@ spectrum_cs_config(dev_link_t *link) | |||
831 | goto failed; | 827 | goto failed; |
832 | } | 828 | } |
833 | 829 | ||
834 | SET_NETDEV_DEV(dev, &handle_to_dev(handle)); | 830 | SET_NETDEV_DEV(dev, &handle_to_dev(link)); |
835 | /* Tell the stack we exist */ | 831 | /* Tell the stack we exist */ |
836 | if (register_netdev(dev) != 0) { | 832 | if (register_netdev(dev) != 0) { |
837 | printk(KERN_ERR PFX "register_netdev() failed\n"); | 833 | printk(KERN_ERR PFX "register_netdev() failed\n"); |
@@ -864,7 +860,7 @@ spectrum_cs_config(dev_link_t *link) | |||
864 | return; | 860 | return; |
865 | 861 | ||
866 | cs_failed: | 862 | cs_failed: |
867 | cs_error(link->handle, last_fn, last_ret); | 863 | cs_error(link, last_fn, last_ret); |
868 | 864 | ||
869 | failed: | 865 | failed: |
870 | spectrum_cs_release(link); | 866 | spectrum_cs_release(link); |
@@ -876,7 +872,7 @@ spectrum_cs_config(dev_link_t *link) | |||
876 | * still open, this will be postponed until it is closed. | 872 | * still open, this will be postponed until it is closed. |
877 | */ | 873 | */ |
878 | static void | 874 | static void |
879 | spectrum_cs_release(dev_link_t *link) | 875 | spectrum_cs_release(struct pcmcia_device *link) |
880 | { | 876 | { |
881 | struct net_device *dev = link->priv; | 877 | struct net_device *dev = link->priv; |
882 | struct orinoco_private *priv = netdev_priv(dev); | 878 | struct orinoco_private *priv = netdev_priv(dev); |
@@ -888,16 +884,15 @@ spectrum_cs_release(dev_link_t *link) | |||
888 | priv->hw_unavailable++; | 884 | priv->hw_unavailable++; |
889 | spin_unlock_irqrestore(&priv->lock, flags); | 885 | spin_unlock_irqrestore(&priv->lock, flags); |
890 | 886 | ||
891 | pcmcia_disable_device(link->handle); | 887 | pcmcia_disable_device(link); |
892 | if (priv->hw.iobase) | 888 | if (priv->hw.iobase) |
893 | ioport_unmap(priv->hw.iobase); | 889 | ioport_unmap(priv->hw.iobase); |
894 | } /* spectrum_cs_release */ | 890 | } /* spectrum_cs_release */ |
895 | 891 | ||
896 | 892 | ||
897 | static int | 893 | static int |
898 | spectrum_cs_suspend(struct pcmcia_device *p_dev) | 894 | spectrum_cs_suspend(struct pcmcia_device *link) |
899 | { | 895 | { |
900 | dev_link_t *link = dev_to_instance(p_dev); | ||
901 | struct net_device *dev = link->priv; | 896 | struct net_device *dev = link->priv; |
902 | struct orinoco_private *priv = netdev_priv(dev); | 897 | struct orinoco_private *priv = netdev_priv(dev); |
903 | unsigned long flags; | 898 | unsigned long flags; |
@@ -922,9 +917,8 @@ spectrum_cs_suspend(struct pcmcia_device *p_dev) | |||
922 | } | 917 | } |
923 | 918 | ||
924 | static int | 919 | static int |
925 | spectrum_cs_resume(struct pcmcia_device *p_dev) | 920 | spectrum_cs_resume(struct pcmcia_device *link) |
926 | { | 921 | { |
927 | dev_link_t *link = dev_to_instance(p_dev); | ||
928 | struct net_device *dev = link->priv; | 922 | struct net_device *dev = link->priv; |
929 | struct orinoco_private *priv = netdev_priv(dev); | 923 | struct orinoco_private *priv = netdev_priv(dev); |
930 | 924 | ||