aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/pcmcia/smc91c92_cs.c
diff options
context:
space:
mode:
authorDominik Brodowski <linux@dominikbrodowski.net>2006-03-01 18:09:29 -0500
committerDominik Brodowski <linux@dominikbrodowski.net>2006-03-31 10:26:33 -0500
commite2d4096365e06b9a3799afbadc28b4519c0b3526 (patch)
tree90ec691d71f9c0309048714e359b8ba351b533f7 /drivers/net/pcmcia/smc91c92_cs.c
parentf6fbe01ac976f3ec618cd5fb71ad9ce2cfa7ab2b (diff)
[PATCH] pcmcia: use bitfield instead of p_state and state
Instead of the two status values struct pcmcia_device->p_state and state, use descriptive bitfields. Most value-checking in drivers was invalid, as the core now only calls the ->remove() (a.k.a. detach) function in case the attachement _and_ configuration was successful. Signed-off-by: Dominik Brodowski <linux@dominikbrodowski.net>
Diffstat (limited to 'drivers/net/pcmcia/smc91c92_cs.c')
-rw-r--r--drivers/net/pcmcia/smc91c92_cs.c59
1 files changed, 25 insertions, 34 deletions
diff --git a/drivers/net/pcmcia/smc91c92_cs.c b/drivers/net/pcmcia/smc91c92_cs.c
index 3252c1dc9ee7..7d565f26a3bf 100644
--- a/drivers/net/pcmcia/smc91c92_cs.c
+++ b/drivers/net/pcmcia/smc91c92_cs.c
@@ -356,7 +356,6 @@ static int smc91c92_probe(struct pcmcia_device *link)
356 smc->mii_if.phy_id_mask = 0x1f; 356 smc->mii_if.phy_id_mask = 0x1f;
357 smc->mii_if.reg_num_mask = 0x1f; 357 smc->mii_if.reg_num_mask = 0x1f;
358 358
359 link->state |= DEV_PRESENT | DEV_CONFIG_PENDING;
360 return smc91c92_config(link); 359 return smc91c92_config(link);
361} /* smc91c92_attach */ 360} /* smc91c92_attach */
362 361
@@ -378,8 +377,7 @@ static void smc91c92_detach(struct pcmcia_device *link)
378 if (link->dev_node) 377 if (link->dev_node)
379 unregister_netdev(dev); 378 unregister_netdev(dev);
380 379
381 if (link->state & DEV_CONFIG) 380 smc91c92_release(link);
382 smc91c92_release(link);
383 381
384 free_netdev(dev); 382 free_netdev(dev);
385} /* smc91c92_detach */ 383} /* smc91c92_detach */
@@ -862,7 +860,7 @@ static int smc91c92_suspend(struct pcmcia_device *link)
862{ 860{
863 struct net_device *dev = link->priv; 861 struct net_device *dev = link->priv;
864 862
865 if ((link->state & DEV_CONFIG) && (link->open)) 863 if (link->open)
866 netif_device_detach(dev); 864 netif_device_detach(dev);
867 865
868 return 0; 866 return 0;
@@ -874,33 +872,31 @@ static int smc91c92_resume(struct pcmcia_device *link)
874 struct smc_private *smc = netdev_priv(dev); 872 struct smc_private *smc = netdev_priv(dev);
875 int i; 873 int i;
876 874
877 if (link->state & DEV_CONFIG) { 875 if ((smc->manfid == MANFID_MEGAHERTZ) &&
878 if ((smc->manfid == MANFID_MEGAHERTZ) && 876 (smc->cardid == PRODID_MEGAHERTZ_EM3288))
879 (smc->cardid == PRODID_MEGAHERTZ_EM3288)) 877 mhz_3288_power(link);
880 mhz_3288_power(link); 878 if (smc->manfid == MANFID_MOTOROLA)
881 if (smc->manfid == MANFID_MOTOROLA) 879 mot_config(link);
882 mot_config(link); 880 if ((smc->manfid == MANFID_OSITECH) &&
883 if ((smc->manfid == MANFID_OSITECH) && 881 (smc->cardid != PRODID_OSITECH_SEVEN)) {
884 (smc->cardid != PRODID_OSITECH_SEVEN)) { 882 /* Power up the card and enable interrupts */
885 /* Power up the card and enable interrupts */ 883 set_bits(0x0300, dev->base_addr-0x10+OSITECH_AUI_PWR);
886 set_bits(0x0300, dev->base_addr-0x10+OSITECH_AUI_PWR); 884 set_bits(0x0300, dev->base_addr-0x10+OSITECH_RESET_ISR);
887 set_bits(0x0300, dev->base_addr-0x10+OSITECH_RESET_ISR); 885 }
888 } 886 if (((smc->manfid == MANFID_OSITECH) &&
889 if (((smc->manfid == MANFID_OSITECH) && 887 (smc->cardid == PRODID_OSITECH_SEVEN)) ||
890 (smc->cardid == PRODID_OSITECH_SEVEN)) || 888 ((smc->manfid == MANFID_PSION) &&
891 ((smc->manfid == MANFID_PSION) && 889 (smc->cardid == PRODID_PSION_NET100))) {
892 (smc->cardid == PRODID_PSION_NET100))) { 890 /* Download the Seven of Diamonds firmware */
893 /* Download the Seven of Diamonds firmware */ 891 for (i = 0; i < sizeof(__Xilinx7OD); i++) {
894 for (i = 0; i < sizeof(__Xilinx7OD); i++) { 892 outb(__Xilinx7OD[i], link->io.BasePort1+2);
895 outb(__Xilinx7OD[i], link->io.BasePort1+2); 893 udelay(50);
896 udelay(50);
897 }
898 }
899 if (link->open) {
900 smc_reset(dev);
901 netif_device_attach(dev);
902 } 894 }
903 } 895 }
896 if (link->open) {
897 smc_reset(dev);
898 netif_device_attach(dev);
899 }
904 900
905 return 0; 901 return 0;
906} 902}
@@ -1010,9 +1006,6 @@ static int smc91c92_config(struct pcmcia_device *link)
1010 smc->cardid = parse->manfid.card; 1006 smc->cardid = parse->manfid.card;
1011 } 1007 }
1012 1008
1013 /* Configure card */
1014 link->state |= DEV_CONFIG;
1015
1016 if ((smc->manfid == MANFID_OSITECH) && 1009 if ((smc->manfid == MANFID_OSITECH) &&
1017 (smc->cardid != PRODID_OSITECH_SEVEN)) { 1010 (smc->cardid != PRODID_OSITECH_SEVEN)) {
1018 i = osi_config(link); 1011 i = osi_config(link);
@@ -1108,7 +1101,6 @@ static int smc91c92_config(struct pcmcia_device *link)
1108 } 1101 }
1109 1102
1110 link->dev_node = &smc->node; 1103 link->dev_node = &smc->node;
1111 link->state &= ~DEV_CONFIG_PENDING;
1112 SET_NETDEV_DEV(dev, &handle_to_dev(link)); 1104 SET_NETDEV_DEV(dev, &handle_to_dev(link));
1113 1105
1114 if (register_netdev(dev) != 0) { 1106 if (register_netdev(dev) != 0) {
@@ -1149,7 +1141,6 @@ config_undo:
1149 unregister_netdev(dev); 1141 unregister_netdev(dev);
1150config_failed: /* CS_EXIT_TEST() calls jump to here... */ 1142config_failed: /* CS_EXIT_TEST() calls jump to here... */
1151 smc91c92_release(link); 1143 smc91c92_release(link);
1152 link->state &= ~DEV_CONFIG_PENDING;
1153 kfree(cfg_mem); 1144 kfree(cfg_mem);
1154 return -ENODEV; 1145 return -ENODEV;
1155} /* smc91c92_config */ 1146} /* smc91c92_config */