Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

[PATCH] pcmcia: remove dev_list from drivers

The linked list of devices managed by each PCMCIA driver is, in very most
cases, unused. Therefore, remove it from many drivers.

Signed-off-by: Dominik Brodowski <linux@dominikbrodowski.net>

+74 -647
+1 -17
drivers/bluetooth/bluecard_cs.c
··· 94 94 static dev_link_t *bluecard_attach(void); 95 95 static void bluecard_detach(struct pcmcia_device *p_dev); 96 96 97 - static dev_link_t *dev_list = NULL; 98 - 99 97 100 98 /* Default baud rate: 57600, 115200, 230400 or 460800 */ 101 99 #define DEFAULT_BAUD_RATE 230400 ··· 888 890 link->conf.IntType = INT_MEMORY_AND_IO; 889 891 890 892 /* Register with Card Services */ 891 - link->next = dev_list; 892 - dev_list = link; 893 + link->next = NULL; 893 894 client_reg.dev_info = &dev_info; 894 895 client_reg.Version = 0x0210; 895 896 client_reg.event_callback_args.client_data = link; ··· 908 911 { 909 912 dev_link_t *link = dev_to_instance(p_dev); 910 913 bluecard_info_t *info = link->priv; 911 - dev_link_t **linkp; 912 - 913 - /* Locate device structure */ 914 - for (linkp = &dev_list; *linkp; linkp = &(*linkp)->next) 915 - if (*linkp == link) 916 - break; 917 - 918 - if (*linkp == NULL) 919 - return; 920 914 921 915 if (link->state & DEV_CONFIG) 922 916 bluecard_release(link); 923 - 924 - /* Unlink device structure, free bits */ 925 - *linkp = link->next; 926 917 927 918 kfree(info); 928 919 } ··· 1090 1105 static void __exit exit_bluecard_cs(void) 1091 1106 { 1092 1107 pcmcia_unregister_driver(&bluecard_driver); 1093 - BUG_ON(dev_list != NULL); 1094 1108 } 1095 1109 1096 1110 module_init(init_bluecard_cs);
+1 -17
drivers/bluetooth/bt3c_cs.c
··· 97 97 static dev_link_t *bt3c_attach(void); 98 98 static void bt3c_detach(struct pcmcia_device *p_dev); 99 99 100 - static dev_link_t *dev_list = NULL; 101 - 102 100 103 101 /* Transmit states */ 104 102 #define XMIT_SENDING 1 ··· 689 691 link->conf.IntType = INT_MEMORY_AND_IO; 690 692 691 693 /* Register with Card Services */ 692 - link->next = dev_list; 693 - dev_list = link; 694 + link->next = NULL; 694 695 client_reg.dev_info = &dev_info; 695 696 client_reg.Version = 0x0210; 696 697 client_reg.event_callback_args.client_data = link; ··· 709 712 { 710 713 dev_link_t *link = dev_to_instance(p_dev); 711 714 bt3c_info_t *info = link->priv; 712 - dev_link_t **linkp; 713 - 714 - /* Locate device structure */ 715 - for (linkp = &dev_list; *linkp; linkp = &(*linkp)->next) 716 - if (*linkp == link) 717 - break; 718 - 719 - if (*linkp == NULL) 720 - return; 721 715 722 716 if (link->state & DEV_CONFIG) 723 717 bt3c_release(link); 724 - 725 - /* Unlink device structure, free bits */ 726 - *linkp = link->next; 727 718 728 719 kfree(info); 729 720 } ··· 934 949 static void __exit exit_bt3c_cs(void) 935 950 { 936 951 pcmcia_unregister_driver(&bt3c_driver); 937 - BUG_ON(dev_list != NULL); 938 952 } 939 953 940 954 module_init(init_bt3c_cs);
+1 -17
drivers/bluetooth/btuart_cs.c
··· 93 93 static dev_link_t *btuart_attach(void); 94 94 static void btuart_detach(struct pcmcia_device *p_dev); 95 95 96 - static dev_link_t *dev_list = NULL; 97 - 98 96 99 97 /* Maximum baud rate */ 100 98 #define SPEED_MAX 115200 ··· 608 610 link->conf.IntType = INT_MEMORY_AND_IO; 609 611 610 612 /* Register with Card Services */ 611 - link->next = dev_list; 612 - dev_list = link; 613 + link->next = NULL; 613 614 client_reg.dev_info = &dev_info; 614 615 client_reg.Version = 0x0210; 615 616 client_reg.event_callback_args.client_data = link; ··· 628 631 { 629 632 dev_link_t *link = dev_to_instance(p_dev); 630 633 btuart_info_t *info = link->priv; 631 - dev_link_t **linkp; 632 - 633 - /* Locate device structure */ 634 - for (linkp = &dev_list; *linkp; linkp = &(*linkp)->next) 635 - if (*linkp == link) 636 - break; 637 - 638 - if (*linkp == NULL) 639 - return; 640 634 641 635 if (link->state & DEV_CONFIG) 642 636 btuart_release(link); 643 - 644 - /* Unlink device structure, free bits */ 645 - *linkp = link->next; 646 637 647 638 kfree(info); 648 639 } ··· 855 870 static void __exit exit_btuart_cs(void) 856 871 { 857 872 pcmcia_unregister_driver(&btuart_driver); 858 - BUG_ON(dev_list != NULL); 859 873 } 860 874 861 875 module_init(init_btuart_cs);
+1 -17
drivers/bluetooth/dtl1_cs.c
··· 96 96 static dev_link_t *dtl1_attach(void); 97 97 static void dtl1_detach(struct pcmcia_device *p_dev); 98 98 99 - static dev_link_t *dev_list = NULL; 100 - 101 99 102 100 /* Transmit states */ 103 101 #define XMIT_SENDING 1 ··· 587 589 link->conf.IntType = INT_MEMORY_AND_IO; 588 590 589 591 /* Register with Card Services */ 590 - link->next = dev_list; 591 - dev_list = link; 592 + link->next = NULL; 592 593 client_reg.dev_info = &dev_info; 593 594 client_reg.Version = 0x0210; 594 595 client_reg.event_callback_args.client_data = link; ··· 607 610 { 608 611 dev_link_t *link = dev_to_instance(p_dev); 609 612 dtl1_info_t *info = link->priv; 610 - dev_link_t **linkp; 611 - 612 - /* Locate device structure */ 613 - for (linkp = &dev_list; *linkp; linkp = &(*linkp)->next) 614 - if (*linkp == link) 615 - break; 616 - 617 - if (*linkp == NULL) 618 - return; 619 613 620 614 if (link->state & DEV_CONFIG) 621 615 dtl1_release(link); 622 - 623 - /* Unlink device structure, free bits */ 624 - *linkp = link->next; 625 616 626 617 kfree(info); 627 618 } ··· 807 822 static void __exit exit_dtl1_cs(void) 808 823 { 809 824 pcmcia_unregister_driver(&dtl1_driver); 810 - BUG_ON(dev_list != NULL); 811 825 } 812 826 813 827 module_init(init_dtl1_cs);
+4 -15
drivers/ide/legacy/ide-cs.c
··· 96 96 static dev_link_t *ide_attach(void); 97 97 static void ide_detach(struct pcmcia_device *p_dev); 98 98 99 - static dev_link_t *dev_list = NULL; 99 + 100 + 100 101 101 102 /*====================================================================== 102 103 ··· 131 130 link->conf.IntType = INT_MEMORY_AND_IO; 132 131 133 132 /* Register with Card Services */ 134 - link->next = dev_list; 135 - dev_list = link; 133 + link->next = NULL; 136 134 client_reg.dev_info = &dev_info; 137 135 client_reg.Version = 0x0210; 138 136 client_reg.event_callback_args.client_data = link; ··· 157 157 static void ide_detach(struct pcmcia_device *p_dev) 158 158 { 159 159 dev_link_t *link = dev_to_instance(p_dev); 160 - dev_link_t **linkp; 161 160 162 161 DEBUG(0, "ide_detach(0x%p)\n", link); 163 - 164 - /* Locate device structure */ 165 - for (linkp = &dev_list; *linkp; linkp = &(*linkp)->next) 166 - if (*linkp == link) break; 167 - if (*linkp == NULL) 168 - return; 169 162 170 163 if (link->state & DEV_CONFIG) 171 164 ide_release(link); 172 - 173 - /* Unlink, free device structure */ 174 - *linkp = link->next; 165 + 175 166 kfree(link->priv); 176 - 177 167 } /* ide_detach */ 178 168 179 169 static int idecs_register(unsigned long io, unsigned long ctl, unsigned long irq, struct pcmcia_device *handle) ··· 497 507 static void __exit exit_ide_cs(void) 498 508 { 499 509 pcmcia_unregister_driver(&ide_cs_driver); 500 - BUG_ON(dev_list != NULL); 501 510 } 502 511 503 512 late_initcall(init_ide_cs);
+1 -20
drivers/isdn/hardware/avm/avm_cs.c
··· 83 83 device numbers are used to derive the corresponding array index. 84 84 */ 85 85 86 - static dev_link_t *dev_list = NULL; 87 - 88 86 /* 89 - A dev_link_t structure has fields for most things that are needed 90 - to keep track of a socket, but there will usually be some device 91 - specific information that also needs to be kept track of. The 92 - 'priv' pointer in a dev_link_t structure can be used to point to 93 - a device-specific private data structure, like this. 94 - 95 87 A driver needs to provide a dev_node_t structure for each device 96 88 on a card. In some cases, there is only one device per card (for 97 89 example, ethernet cards, modems). In other cases, there may be ··· 149 157 link->priv = local; 150 158 151 159 /* Register with Card Services */ 152 - link->next = dev_list; 153 - dev_list = link; 160 + link->next = NULL; 154 161 client_reg.dev_info = &dev_info; 155 162 client_reg.Version = 0x0210; 156 163 client_reg.event_callback_args.client_data = link; ··· 179 188 static void avmcs_detach(struct pcmcia_device *p_dev) 180 189 { 181 190 dev_link_t *link = dev_to_instance(p_dev); 182 - dev_link_t **linkp; 183 - 184 - /* Locate device structure */ 185 - for (linkp = &dev_list; *linkp; linkp = &(*linkp)->next) 186 - if (*linkp == link) break; 187 - if (*linkp == NULL) 188 - return; 189 191 190 192 if (link->state & DEV_CONFIG) 191 193 avmcs_release(link); 192 194 193 - /* Unlink device structure, free pieces */ 194 - *linkp = link->next; 195 195 kfree(link->priv); 196 196 kfree(link); 197 197 } /* avmcs_detach */ ··· 476 494 static void __exit avmcs_exit(void) 477 495 { 478 496 pcmcia_unregister_driver(&avmcs_driver); 479 - BUG_ON(dev_list != NULL); 480 497 } 481 498 482 499 module_init(avmcs_init);
+1 -20
drivers/isdn/hisax/avma1_cs.c
··· 99 99 device numbers are used to derive the corresponding array index. 100 100 */ 101 101 102 - static dev_link_t *dev_list = NULL; 103 - 104 102 /* 105 - A dev_link_t structure has fields for most things that are needed 106 - to keep track of a socket, but there will usually be some device 107 - specific information that also needs to be kept track of. The 108 - 'priv' pointer in a dev_link_t structure can be used to point to 109 - a device-specific private data structure, like this. 110 - 111 103 A driver needs to provide a dev_node_t structure for each device 112 104 on a card. In some cases, there is only one device per card (for 113 105 example, ethernet cards, modems). In other cases, there may be ··· 171 179 link->conf.Present = PRESENT_OPTION; 172 180 173 181 /* Register with Card Services */ 174 - link->next = dev_list; 175 - dev_list = link; 182 + link->next = NULL; 176 183 client_reg.dev_info = &dev_info; 177 184 client_reg.Version = 0x0210; 178 185 client_reg.event_callback_args.client_data = link; ··· 197 206 static void avma1cs_detach(struct pcmcia_device *p_dev) 198 207 { 199 208 dev_link_t *link = dev_to_instance(p_dev); 200 - dev_link_t **linkp; 201 209 202 210 DEBUG(0, "avma1cs_detach(0x%p)\n", link); 203 - 204 - /* Locate device structure */ 205 - for (linkp = &dev_list; *linkp; linkp = &(*linkp)->next) 206 - if (*linkp == link) break; 207 - if (*linkp == NULL) 208 - return; 209 211 210 212 if (link->state & DEV_CONFIG) 211 213 avma1cs_release(link); 212 214 213 - /* Unlink device structure, free pieces */ 214 - *linkp = link->next; 215 215 kfree(link->priv); 216 216 kfree(link); 217 217 } /* avma1cs_detach */ ··· 490 508 static void __exit exit_avma1_cs(void) 491 509 { 492 510 pcmcia_unregister_driver(&avma1cs_driver); 493 - BUG_ON(dev_list != NULL); 494 511 } 495 512 496 513 module_init(init_avma1_cs);
+3 -25
drivers/isdn/hisax/elsa_cs.c
··· 126 126 device numbers are used to derive the corresponding array index. 127 127 */ 128 128 129 - static dev_link_t *dev_list = NULL; 130 - 131 129 /* 132 - A dev_link_t structure has fields for most things that are needed 133 - to keep track of a socket, but there will usually be some device 134 - specific information that also needs to be kept track of. The 135 - 'priv' pointer in a dev_link_t structure can be used to point to 136 - a device-specific private data structure, like this. 137 - 138 - To simplify the data structure handling, we actually include the 139 - dev_link_t structure in the device's private data structure. 140 - 141 130 A driver needs to provide a dev_node_t structure for each device 142 131 on a card. In some cases, there is only one device per card (for 143 132 example, ethernet cards, modems). In other cases, there may be ··· 197 208 link->conf.IntType = INT_MEMORY_AND_IO; 198 209 199 210 /* Register with Card Services */ 200 - link->next = dev_list; 201 - dev_list = link; 211 + link->next = NULL; 202 212 client_reg.dev_info = &dev_info; 203 213 client_reg.Version = 0x0210; 204 214 client_reg.event_callback_args.client_data = link; ··· 223 235 static void elsa_cs_detach(struct pcmcia_device *p_dev) 224 236 { 225 237 dev_link_t *link = dev_to_instance(p_dev); 226 - dev_link_t **linkp; 227 238 local_info_t *info = link->priv; 228 239 229 240 DEBUG(0, "elsa_cs_detach(0x%p)\n", link); 230 241 231 - /* Locate device structure */ 232 - for (linkp = &dev_list; *linkp; linkp = &(*linkp)->next) 233 - if (*linkp == link) break; 234 - if (*linkp == NULL) 235 - return; 236 - 237 242 if (link->state & DEV_CONFIG) { 238 - ((local_info_t*)link->priv)->busy = 1; 239 - elsa_cs_release(link); 243 + info->busy = 1; 244 + elsa_cs_release(link); 240 245 } 241 246 242 - /* Unlink device structure and free it */ 243 - *linkp = link->next; 244 247 kfree(info); 245 248 246 249 } /* elsa_cs_detach */ ··· 505 526 static void __exit exit_elsa_cs(void) 506 527 { 507 528 pcmcia_unregister_driver(&elsa_cs_driver); 508 - BUG_ON(dev_list != NULL); 509 529 } 510 530 511 531 module_init(init_elsa_cs);
+3 -25
drivers/isdn/hisax/sedlbauer_cs.c
··· 134 134 device numbers are used to derive the corresponding array index. 135 135 */ 136 136 137 - static dev_link_t *dev_list = NULL; 138 - 139 137 /* 140 - A dev_link_t structure has fields for most things that are needed 141 - to keep track of a socket, but there will usually be some device 142 - specific information that also needs to be kept track of. The 143 - 'priv' pointer in a dev_link_t structure can be used to point to 144 - a device-specific private data structure, like this. 145 - 146 - To simplify the data structure handling, we actually include the 147 - dev_link_t structure in the device's private data structure. 148 - 149 138 A driver needs to provide a dev_node_t structure for each device 150 139 on a card. In some cases, there is only one device per card (for 151 140 example, ethernet cards, modems). In other cases, there may be ··· 211 222 link->conf.IntType = INT_MEMORY_AND_IO; 212 223 213 224 /* Register with Card Services */ 214 - link->next = dev_list; 215 - dev_list = link; 225 + link->next = NULL; 216 226 client_reg.dev_info = &dev_info; 217 227 client_reg.Version = 0x0210; 218 228 client_reg.event_callback_args.client_data = link; ··· 237 249 static void sedlbauer_detach(struct pcmcia_device *p_dev) 238 250 { 239 251 dev_link_t *link = dev_to_instance(p_dev); 240 - dev_link_t **linkp; 241 252 242 253 DEBUG(0, "sedlbauer_detach(0x%p)\n", link); 243 - 244 - /* Locate device structure */ 245 - for (linkp = &dev_list; *linkp; linkp = &(*linkp)->next) 246 - if (*linkp == link) break; 247 - if (*linkp == NULL) 248 - return; 249 254 250 255 if (link->state & DEV_CONFIG) { 251 - ((local_info_t *)link->priv)->stop = 1; 252 - sedlbauer_release(link); 256 + ((local_info_t *)link->priv)->stop = 1; 257 + sedlbauer_release(link); 253 258 } 254 259 255 - /* Unlink device structure, and free it */ 256 - *linkp = link->next; 257 260 /* This points to the parent local_info_t struct */ 258 261 kfree(link->priv); 259 262 } /* sedlbauer_detach */ ··· 602 623 static void __exit exit_sedlbauer_cs(void) 603 624 { 604 625 pcmcia_unregister_driver(&sedlbauer_driver); 605 - BUG_ON(dev_list != NULL); 606 626 } 607 627 608 628 module_init(init_sedlbauer_cs);
+3 -25
drivers/isdn/hisax/teles_cs.c
··· 107 107 device numbers are used to derive the corresponding array index. 108 108 */ 109 109 110 - static dev_link_t *dev_list = NULL; 111 - 112 110 /* 113 - A dev_link_t structure has fields for most things that are needed 114 - to keep track of a socket, but there will usually be some device 115 - specific information that also needs to be kept track of. The 116 - 'priv' pointer in a dev_link_t structure can be used to point to 117 - a device-specific private data structure, like this. 118 - 119 - To simplify the data structure handling, we actually include the 120 - dev_link_t structure in the device's private data structure. 121 - 122 111 A driver needs to provide a dev_node_t structure for each device 123 112 on a card. In some cases, there is only one device per card (for 124 113 example, ethernet cards, modems). In other cases, there may be ··· 178 189 link->conf.IntType = INT_MEMORY_AND_IO; 179 190 180 191 /* Register with Card Services */ 181 - link->next = dev_list; 182 - dev_list = link; 192 + link->next = NULL; 183 193 client_reg.dev_info = &dev_info; 184 194 client_reg.Version = 0x0210; 185 195 client_reg.event_callback_args.client_data = link; ··· 204 216 static void teles_detach(struct pcmcia_device *p_dev) 205 217 { 206 218 dev_link_t *link = dev_to_instance(p_dev); 207 - dev_link_t **linkp; 208 219 local_info_t *info = link->priv; 209 220 210 221 DEBUG(0, "teles_detach(0x%p)\n", link); 211 222 212 - /* Locate device structure */ 213 - for (linkp = &dev_list; *linkp; linkp = &(*linkp)->next) 214 - if (*linkp == link) break; 215 - if (*linkp == NULL) 216 - return; 217 - 218 223 if (link->state & DEV_CONFIG) { 219 - info->busy = 1; 220 - teles_cs_release(link); 224 + info->busy = 1; 225 + teles_cs_release(link); 221 226 } 222 227 223 - /* Unlink device structure and free it */ 224 - *linkp = link->next; 225 228 kfree(info); 226 229 227 230 } /* teles_detach */ ··· 485 506 static void __exit exit_teles_cs(void) 486 507 { 487 508 pcmcia_unregister_driver(&teles_cs_driver); 488 - BUG_ON(dev_list != NULL); 489 509 } 490 510 491 511 module_init(init_teles_cs);
+1 -4
drivers/mtd/maps/pcmciamtd.c
··· 67 67 68 68 69 69 static dev_info_t dev_info = "pcmciamtd"; 70 - static dev_link_t *dev_list; 71 70 72 71 /* Module parameters */ 73 72 ··· 781 782 link->conf.Attributes = 0; 782 783 link->conf.IntType = INT_MEMORY; 783 784 784 - link->next = dev_list; 785 - dev_list = link; 785 + link->next = NULL; 786 786 787 787 /* Register with Card Services */ 788 788 client_reg.dev_info = &dev_info; ··· 863 865 { 864 866 DEBUG(1, DRIVER_DESC " unloading"); 865 867 pcmcia_unregister_driver(&pcmciamtd_driver); 866 - BUG_ON(dev_list != NULL); 867 868 } 868 869 869 870 module_init(init_pcmciamtd);
+1 -14
drivers/net/pcmcia/3c574_cs.c
··· 255 255 static dev_link_t *tc574_attach(void); 256 256 static void tc574_detach(struct pcmcia_device *p_dev); 257 257 258 - static dev_link_t *dev_list; 259 - 260 258 /* 261 259 tc574_attach() creates an "instance" of the driver, allocating 262 260 local data structures for one device. The device is registered ··· 306 308 #endif 307 309 308 310 /* Register with Card Services */ 309 - link->next = dev_list; 310 - dev_list = link; 311 + link->next = NULL; 311 312 client_reg.dev_info = &dev_info; 312 313 client_reg.Version = 0x0210; 313 314 client_reg.event_callback_args.client_data = link; ··· 333 336 { 334 337 dev_link_t *link = dev_to_instance(p_dev); 335 338 struct net_device *dev = link->priv; 336 - dev_link_t **linkp; 337 339 338 340 DEBUG(0, "3c574_detach(0x%p)\n", link); 339 - 340 - /* Locate device structure */ 341 - for (linkp = &dev_list; *linkp; linkp = &(*linkp)->next) 342 - if (*linkp == link) break; 343 - if (*linkp == NULL) 344 - return; 345 341 346 342 if (link->dev) 347 343 unregister_netdev(dev); ··· 342 352 if (link->state & DEV_CONFIG) 343 353 tc574_release(link); 344 354 345 - /* Unlink device structure, free bits */ 346 - *linkp = link->next; 347 355 free_netdev(dev); 348 356 } /* tc574_detach */ 349 357 ··· 1298 1310 static void __exit exit_tc574(void) 1299 1311 { 1300 1312 pcmcia_unregister_driver(&tc574_driver); 1301 - BUG_ON(dev_list != NULL); 1302 1313 } 1303 1314 1304 1315 module_init(init_tc574);
+2 -15
drivers/net/pcmcia/3c589_cs.c
··· 166 166 static dev_link_t *tc589_attach(void); 167 167 static void tc589_detach(struct pcmcia_device *p_dev); 168 168 169 - static dev_link_t *dev_list; 170 - 171 169 /*====================================================================== 172 170 173 171 tc589_attach() creates an "instance" of the driver, allocating ··· 220 222 SET_ETHTOOL_OPS(dev, &netdev_ethtool_ops); 221 223 222 224 /* Register with Card Services */ 223 - link->next = dev_list; 224 - dev_list = link; 225 + link->next = NULL; 225 226 client_reg.dev_info = &dev_info; 226 227 client_reg.Version = 0x0210; 227 228 client_reg.event_callback_args.client_data = link; ··· 247 250 { 248 251 dev_link_t *link = dev_to_instance(p_dev); 249 252 struct net_device *dev = link->priv; 250 - dev_link_t **linkp; 251 - 253 + 252 254 DEBUG(0, "3c589_detach(0x%p)\n", link); 253 - 254 - /* Locate device structure */ 255 - for (linkp = &dev_list; *linkp; linkp = &(*linkp)->next) 256 - if (*linkp == link) break; 257 - if (*linkp == NULL) 258 - return; 259 255 260 256 if (link->dev) 261 257 unregister_netdev(dev); ··· 256 266 if (link->state & DEV_CONFIG) 257 267 tc589_release(link); 258 268 259 - /* Unlink device structure, free bits */ 260 - *linkp = link->next; 261 269 free_netdev(dev); 262 270 } /* tc589_detach */ 263 271 ··· 1073 1085 static void __exit exit_tc589(void) 1074 1086 { 1075 1087 pcmcia_unregister_driver(&tc589_driver); 1076 - BUG_ON(dev_list != NULL); 1077 1088 } 1078 1089 1079 1090 module_init(init_tc589);
+1 -13
drivers/net/pcmcia/axnet_cs.c
··· 111 111 static void axnet_detach(struct pcmcia_device *p_dev); 112 112 113 113 static dev_info_t dev_info = "axnet_cs"; 114 - static dev_link_t *dev_list; 115 114 116 115 static void axdev_setup(struct net_device *dev); 117 116 static void AX88190_init(struct net_device *dev, int startp); ··· 176 177 SET_ETHTOOL_OPS(dev, &netdev_ethtool_ops); 177 178 178 179 /* Register with Card Services */ 179 - link->next = dev_list; 180 - dev_list = link; 180 + link->next = NULL; 181 181 client_reg.dev_info = &dev_info; 182 182 client_reg.Version = 0x0210; 183 183 client_reg.event_callback_args.client_data = link; ··· 203 205 { 204 206 dev_link_t *link = dev_to_instance(p_dev); 205 207 struct net_device *dev = link->priv; 206 - dev_link_t **linkp; 207 208 208 209 DEBUG(0, "axnet_detach(0x%p)\n", link); 209 - 210 - /* Locate device structure */ 211 - for (linkp = &dev_list; *linkp; linkp = &(*linkp)->next) 212 - if (*linkp == link) break; 213 - if (*linkp == NULL) 214 - return; 215 210 216 211 if (link->dev) 217 212 unregister_netdev(dev); ··· 212 221 if (link->state & DEV_CONFIG) 213 222 axnet_release(link); 214 223 215 - /* Unlink device structure, free bits */ 216 - *linkp = link->next; 217 224 free_netdev(dev); 218 225 } /* axnet_detach */ 219 226 ··· 885 896 static void __exit exit_axnet_cs(void) 886 897 { 887 898 pcmcia_unregister_driver(&axnet_cs_driver); 888 - BUG_ON(dev_list != NULL); 889 899 } 890 900 891 901 module_init(init_axnet_cs);
+4 -18
drivers/net/pcmcia/com20020_cs.c
··· 128 128 static dev_link_t *com20020_attach(void); 129 129 static void com20020_detach(struct pcmcia_device *p_dev); 130 130 131 - static dev_link_t *dev_list; 132 - 133 131 /*====================================================================*/ 134 132 135 133 typedef struct com20020_dev_t { ··· 194 196 link->priv = info; 195 197 196 198 /* Register with Card Services */ 197 - link->next = dev_list; 198 - dev_list = link; 199 + link->next = NULL; 199 200 client_reg.dev_info = &dev_info; 200 201 client_reg.Version = 0x0210; 201 202 client_reg.event_callback_args.client_data = link; ··· 227 230 { 228 231 dev_link_t *link = dev_to_instance(p_dev); 229 232 struct com20020_dev_t *info = link->priv; 230 - dev_link_t **linkp; 231 - struct net_device *dev; 232 - 233 + struct net_device *dev = info->dev; 234 + 233 235 DEBUG(1,"detach...\n"); 234 236 235 237 DEBUG(0, "com20020_detach(0x%p)\n", link); 236 - 237 - /* Locate device structure */ 238 - for (linkp = &dev_list; *linkp; linkp = &(*linkp)->next) 239 - if (*linkp == link) break; 240 - if (*linkp == NULL) 241 - return; 242 - 243 - dev = info->dev; 244 238 245 239 if (link->dev) { 246 240 DEBUG(1,"unregister...\n"); 247 241 248 242 unregister_netdev(dev); 249 - 243 + 250 244 /* 251 245 * this is necessary because we register our IRQ separately 252 246 * from card services. ··· 251 263 252 264 /* Unlink device structure, free bits */ 253 265 DEBUG(1,"unlinking...\n"); 254 - *linkp = link->next; 255 266 if (link->priv) 256 267 { 257 268 dev = info->dev; ··· 494 507 static void __exit exit_com20020_cs(void) 495 508 { 496 509 pcmcia_unregister_driver(&com20020_cs_driver); 497 - BUG_ON(dev_list != NULL); 498 510 } 499 511 500 512 module_init(init_com20020_cs);
+2 -14
drivers/net/pcmcia/fmvj18x_cs.c
··· 109 109 static struct ethtool_ops netdev_ethtool_ops; 110 110 111 111 static dev_info_t dev_info = "fmvj18x_cs"; 112 - static dev_link_t *dev_list; 113 112 114 113 /* 115 114 card type ··· 282 283 SET_ETHTOOL_OPS(dev, &netdev_ethtool_ops); 283 284 284 285 /* Register with Card Services */ 285 - link->next = dev_list; 286 - dev_list = link; 286 + link->next = NULL; 287 287 client_reg.dev_info = &dev_info; 288 288 client_reg.Version = 0x0210; 289 289 client_reg.event_callback_args.client_data = link; ··· 302 304 { 303 305 dev_link_t *link = dev_to_instance(p_dev); 304 306 struct net_device *dev = link->priv; 305 - dev_link_t **linkp; 306 - 307 + 307 308 DEBUG(0, "fmvj18x_detach(0x%p)\n", link); 308 - 309 - /* Locate device structure */ 310 - for (linkp = &dev_list; *linkp; linkp = &(*linkp)->next) 311 - if (*linkp == link) break; 312 - if (*linkp == NULL) 313 - return; 314 309 315 310 if (link->dev) 316 311 unregister_netdev(dev); ··· 311 320 if (link->state & DEV_CONFIG) 312 321 fmvj18x_release(link); 313 322 314 - /* Unlink device structure, free pieces */ 315 - *linkp = link->next; 316 323 free_netdev(dev); 317 324 } /* fmvj18x_detach */ 318 325 ··· 796 807 static void __exit exit_fmvj18x_cs(void) 797 808 { 798 809 pcmcia_unregister_driver(&fmvj18x_cs_driver); 799 - BUG_ON(dev_list != NULL); 800 810 } 801 811 802 812 module_init(init_fmvj18x_cs);
+3 -18
drivers/net/pcmcia/ibmtr_cs.c
··· 116 116 static dev_link_t *ibmtr_attach(void); 117 117 static void ibmtr_detach(struct pcmcia_device *p_dev); 118 118 119 - static dev_link_t *dev_list; 120 - 121 119 /*====================================================================*/ 122 120 123 121 typedef struct ibmtr_dev_t { ··· 184 186 SET_ETHTOOL_OPS(dev, &netdev_ethtool_ops); 185 187 186 188 /* Register with Card Services */ 187 - link->next = dev_list; 188 - dev_list = link; 189 + link->next = NULL; 189 190 client_reg.dev_info = &dev_info; 190 191 client_reg.Version = 0x0210; 191 192 client_reg.event_callback_args.client_data = link; ··· 216 219 { 217 220 dev_link_t *link = dev_to_instance(p_dev); 218 221 struct ibmtr_dev_t *info = link->priv; 219 - dev_link_t **linkp; 220 - struct net_device *dev; 222 + struct net_device *dev = info->dev; 221 223 222 224 DEBUG(0, "ibmtr_detach(0x%p)\n", link); 223 - 224 - /* Locate device structure */ 225 - for (linkp = &dev_list; *linkp; linkp = &(*linkp)->next) 226 - if (*linkp == link) break; 227 - if (*linkp == NULL) 228 - return; 229 - 230 - dev = info->dev; 231 225 232 226 if (link->dev) 233 227 unregister_netdev(dev); ··· 230 242 if (link->state & DEV_CONFIG) 231 243 ibmtr_release(link); 232 244 233 - /* Unlink device structure, free bits */ 234 - *linkp = link->next; 235 245 free_netdev(dev); 236 - kfree(info); 246 + kfree(info); 237 247 } /* ibmtr_detach */ 238 248 239 249 /*====================================================================== ··· 516 530 static void __exit exit_ibmtr_cs(void) 517 531 { 518 532 pcmcia_unregister_driver(&ibmtr_cs_driver); 519 - BUG_ON(dev_list != NULL); 520 533 } 521 534 522 535 module_init(init_ibmtr_cs);
+1 -13
drivers/net/pcmcia/nmclan_cs.c
··· 389 389 #endif 390 390 391 391 static dev_info_t dev_info="nmclan_cs"; 392 - static dev_link_t *dev_list; 393 392 394 393 static char *if_names[]={ 395 394 "Auto", "10baseT", "BNC", ··· 497 498 #endif 498 499 499 500 /* Register with Card Services */ 500 - link->next = dev_list; 501 - dev_list = link; 501 + link->next = NULL; 502 502 client_reg.dev_info = &dev_info; 503 503 client_reg.Version = 0x0210; 504 504 client_reg.event_callback_args.client_data = link; ··· 523 525 { 524 526 dev_link_t *link = dev_to_instance(p_dev); 525 527 struct net_device *dev = link->priv; 526 - dev_link_t **linkp; 527 528 528 529 DEBUG(0, "nmclan_detach(0x%p)\n", link); 529 - 530 - /* Locate device structure */ 531 - for (linkp = &dev_list; *linkp; linkp = &(*linkp)->next) 532 - if (*linkp == link) break; 533 - if (*linkp == NULL) 534 - return; 535 530 536 531 if (link->dev) 537 532 unregister_netdev(dev); ··· 532 541 if (link->state & DEV_CONFIG) 533 542 nmclan_release(link); 534 543 535 - /* Unlink device structure, free bits */ 536 - *linkp = link->next; 537 544 free_netdev(dev); 538 545 } /* nmclan_detach */ 539 546 ··· 1689 1700 static void __exit exit_nmclan_cs(void) 1690 1701 { 1691 1702 pcmcia_unregister_driver(&nmclan_cs_driver); 1692 - BUG_ON(dev_list != NULL); 1693 1703 } 1694 1704 1695 1705 module_init(init_nmclan_cs);
+1 -13
drivers/net/pcmcia/pcnet_cs.c
··· 124 124 static void pcnet_detach(struct pcmcia_device *p_dev); 125 125 126 126 static dev_info_t dev_info = "pcnet_cs"; 127 - static dev_link_t *dev_list; 128 127 129 128 /*====================================================================*/ 130 129 ··· 271 272 dev->set_config = &set_config; 272 273 273 274 /* Register with Card Services */ 274 - link->next = dev_list; 275 - dev_list = link; 275 + link->next = NULL; 276 276 client_reg.dev_info = &dev_info; 277 277 client_reg.Version = 0x0210; 278 278 client_reg.event_callback_args.client_data = link; ··· 298 300 { 299 301 dev_link_t *link = dev_to_instance(p_dev); 300 302 struct net_device *dev = link->priv; 301 - dev_link_t **linkp; 302 303 303 304 DEBUG(0, "pcnet_detach(0x%p)\n", link); 304 - 305 - /* Locate device structure */ 306 - for (linkp = &dev_list; *linkp; linkp = &(*linkp)->next) 307 - if (*linkp == link) break; 308 - if (*linkp == NULL) 309 - return; 310 305 311 306 if (link->dev) 312 307 unregister_netdev(dev); ··· 307 316 if (link->state & DEV_CONFIG) 308 317 pcnet_release(link); 309 318 310 - /* Unlink device structure, free bits */ 311 - *linkp = link->next; 312 319 free_netdev(dev); 313 320 } /* pcnet_detach */ 314 321 ··· 1853 1864 { 1854 1865 DEBUG(0, "pcnet_cs: unloading\n"); 1855 1866 pcmcia_unregister_driver(&pcnet_driver); 1856 - BUG_ON(dev_list != NULL); 1857 1867 } 1858 1868 1859 1869 module_init(init_pcnet_cs);
+1 -14
drivers/net/pcmcia/smc91c92_cs.c
··· 104 104 105 105 static dev_info_t dev_info = "smc91c92_cs"; 106 106 107 - static dev_link_t *dev_list; 108 - 109 107 struct smc_private { 110 108 dev_link_t link; 111 109 spinlock_t lock; ··· 365 367 smc->mii_if.reg_num_mask = 0x1f; 366 368 367 369 /* Register with Card Services */ 368 - link->next = dev_list; 369 - dev_list = link; 370 + link->next = NULL; 370 371 client_reg.dev_info = &dev_info; 371 372 client_reg.Version = 0x0210; 372 373 client_reg.event_callback_args.client_data = link; ··· 392 395 { 393 396 dev_link_t *link = dev_to_instance(p_dev); 394 397 struct net_device *dev = link->priv; 395 - dev_link_t **linkp; 396 398 397 399 DEBUG(0, "smc91c92_detach(0x%p)\n", link); 398 - 399 - /* Locate device structure */ 400 - for (linkp = &dev_list; *linkp; linkp = &(*linkp)->next) 401 - if (*linkp == link) break; 402 - if (*linkp == NULL) 403 - return; 404 400 405 401 if (link->dev) 406 402 unregister_netdev(dev); ··· 401 411 if (link->state & DEV_CONFIG) 402 412 smc91c92_release(link); 403 413 404 - /* Unlink device structure, free bits */ 405 - *linkp = link->next; 406 414 free_netdev(dev); 407 415 } /* smc91c92_detach */ 408 416 ··· 2365 2377 static void __exit exit_smc91c92_cs(void) 2366 2378 { 2367 2379 pcmcia_unregister_driver(&smc91c92_cs_driver); 2368 - BUG_ON(dev_list != NULL); 2369 2380 } 2370 2381 2371 2382 module_init(init_smc91c92_cs);
+1 -23
drivers/net/pcmcia/xirc2ps_cs.c
··· 331 331 * device numbers are used to derive the corresponding array index. 332 332 */ 333 333 334 - static dev_link_t *dev_list; 335 - 336 334 /**************** 337 - * A dev_link_t structure has fields for most things that are needed 338 - * to keep track of a socket, but there will usually be some device 339 - * specific information that also needs to be kept track of. The 340 - * 'priv' pointer in a dev_link_t structure can be used to point to 341 - * a device-specific private data structure, like this. 342 - * 343 335 * A driver needs to provide a dev_node_t structure for each device 344 336 * on a card. In some cases, there is only one device per card (for 345 337 * example, ethernet cards, modems). In other cases, there may be ··· 607 615 #endif 608 616 609 617 /* Register with Card Services */ 610 - link->next = dev_list; 611 - dev_list = link; 618 + link->next = NULL; 612 619 client_reg.dev_info = &dev_info; 613 620 client_reg.Version = 0x0210; 614 621 client_reg.event_callback_args.client_data = link; ··· 632 641 { 633 642 dev_link_t *link = dev_to_instance(p_dev); 634 643 struct net_device *dev = link->priv; 635 - dev_link_t **linkp; 636 644 637 645 DEBUG(0, "detach(0x%p)\n", link); 638 - 639 - /* Locate device structure */ 640 - for (linkp = &dev_list; *linkp; linkp = &(*linkp)->next) 641 - if (*linkp == link) 642 - break; 643 - if (!*linkp) { 644 - DEBUG(0, "detach(0x%p): dev_link lost\n", link); 645 - return; 646 - } 647 646 648 647 if (link->dev) 649 648 unregister_netdev(dev); ··· 641 660 if (link->state & DEV_CONFIG) 642 661 xirc2ps_release(link); 643 662 644 - /* Unlink device structure, free it */ 645 - *linkp = link->next; 646 663 free_netdev(dev); 647 664 } /* xirc2ps_detach */ 648 665 ··· 1999 2020 exit_xirc2ps_cs(void) 2000 2021 { 2001 2022 pcmcia_unregister_driver(&xirc2ps_cs_driver); 2002 - BUG_ON(dev_list != NULL); 2003 2023 } 2004 2024 2005 2025 module_init(init_xirc2ps_cs);
+4 -24
drivers/net/wireless/airo_cs.c
··· 119 119 device numbers are used to derive the corresponding array index. 120 120 */ 121 121 122 - static dev_link_t *dev_list = NULL; 123 - 124 122 /* 125 - A dev_link_t structure has fields for most things that are needed 126 - to keep track of a socket, but there will usually be some device 127 - specific information that also needs to be kept track of. The 128 - 'priv' pointer in a dev_link_t structure can be used to point to 129 - a device-specific private data structure, like this. 130 - 131 123 A driver needs to provide a dev_node_t structure for each device 132 124 on a card. In some cases, there is only one device per card (for 133 125 example, ethernet cards, modems). In other cases, there may be ··· 194 202 link->priv = local; 195 203 196 204 /* Register with Card Services */ 197 - link->next = dev_list; 198 - dev_list = link; 205 + link->next = NULL; 199 206 client_reg.dev_info = &dev_info; 200 207 client_reg.Version = 0x0210; 201 208 client_reg.event_callback_args.client_data = link; ··· 220 229 static void airo_detach(struct pcmcia_device *p_dev) 221 230 { 222 231 dev_link_t *link = dev_to_instance(p_dev); 223 - dev_link_t **linkp; 224 - 232 + 225 233 DEBUG(0, "airo_detach(0x%p)\n", link); 226 - 227 - /* Locate device structure */ 228 - for (linkp = &dev_list; *linkp; linkp = &(*linkp)->next) 229 - if (*linkp == link) break; 230 - if (*linkp == NULL) 231 - return; 232 - 234 + 233 235 if (link->state & DEV_CONFIG) 234 236 airo_release(link); 235 - 237 + 236 238 if ( ((local_info_t*)link->priv)->eth_dev ) { 237 239 stop_airo_card( ((local_info_t*)link->priv)->eth_dev, 0 ); 238 240 } 239 241 ((local_info_t*)link->priv)->eth_dev = NULL; 240 242 241 - /* Unlink device structure, free pieces */ 242 - *linkp = link->next; 243 243 kfree(link->priv); 244 244 kfree(link); 245 - 246 245 } /* airo_detach */ 247 246 248 247 /*====================================================================== ··· 555 574 static void airo_cs_cleanup(void) 556 575 { 557 576 pcmcia_unregister_driver(&airo_driver); 558 - BUG_ON(dev_list != NULL); 559 577 } 560 578 561 579 /*
+3 -22
drivers/net/wireless/atmel_cs.c
··· 130 130 device numbers are used to derive the corresponding array index. 131 131 */ 132 132 133 - static dev_link_t *dev_list = NULL; 134 - 135 133 /* 136 - A dev_link_t structure has fields for most things that are needed 137 - to keep track of a socket, but there will usually be some device 138 - specific information that also needs to be kept track of. The 139 - 'priv' pointer in a dev_link_t structure can be used to point to 140 - a device-specific private data structure, like this. 141 - 142 134 A driver needs to provide a dev_node_t structure for each device 143 135 on a card. In some cases, there is only one device per card (for 144 136 example, ethernet cards, modems). In other cases, there may be ··· 205 213 link->priv = local; 206 214 207 215 /* Register with Card Services */ 208 - link->next = dev_list; 209 - dev_list = link; 216 + link->next = NULL; 210 217 client_reg.dev_info = &dev_info; 211 218 client_reg.Version = 0x0210; 212 219 client_reg.event_callback_args.client_data = link; ··· 231 240 static void atmel_detach(struct pcmcia_device *p_dev) 232 241 { 233 242 dev_link_t *link = dev_to_instance(p_dev); 234 - dev_link_t **linkp; 235 - 243 + 236 244 DEBUG(0, "atmel_detach(0x%p)\n", link); 237 - 238 - /* Locate device structure */ 239 - for (linkp = &dev_list; *linkp; linkp = &(*linkp)->next) 240 - if (*linkp == link) break; 241 - if (*linkp == NULL) 242 - return; 243 245 244 246 if (link->state & DEV_CONFIG) 245 247 atmel_release(link); 246 - 247 - /* Unlink device structure, free pieces */ 248 - *linkp = link->next; 248 + 249 249 kfree(link->priv); 250 250 kfree(link); 251 251 } ··· 578 596 static void atmel_cs_cleanup(void) 579 597 { 580 598 pcmcia_unregister_driver(&atmel_driver); 581 - BUG_ON(dev_list != NULL); 582 599 } 583 600 584 601 /*
+1 -14
drivers/net/wireless/hostap/hostap_cs.c
··· 25 25 26 26 static char *version = PRISM2_VERSION " (Jouni Malinen <jkmaline@cc.hut.fi>)"; 27 27 static dev_info_t dev_info = "hostap_cs"; 28 - static dev_link_t *dev_list = NULL; 29 28 30 29 MODULE_AUTHOR("Jouni Malinen"); 31 30 MODULE_DESCRIPTION("Support for Intersil Prism2-based 802.11 wireless LAN " ··· 519 520 link->conf.IntType = INT_MEMORY_AND_IO; 520 521 521 522 /* register with CardServices */ 522 - link->next = dev_list; 523 - dev_list = link; 523 + link->next = NULL; 524 524 client_reg.dev_info = &dev_info; 525 525 client_reg.Version = 0x0210; 526 526 client_reg.event_callback_args.client_data = link; ··· 536 538 static void prism2_detach(struct pcmcia_device *p_dev) 537 539 { 538 540 dev_link_t *link = dev_to_instance(p_dev); 539 - dev_link_t **linkp; 540 541 541 542 PDEBUG(DEBUG_FLOW, "prism2_detach\n"); 542 - 543 - for (linkp = &dev_list; *linkp; linkp = &(*linkp)->next) 544 - if (*linkp == link) 545 - break; 546 - if (*linkp == NULL) { 547 - printk(KERN_WARNING "%s: Attempt to detach non-existing " 548 - "PCMCIA client\n", dev_info); 549 - return; 550 - } 551 543 552 544 if (link->state & DEV_CONFIG) { 553 545 prism2_release((u_long)link); 554 546 } 555 547 556 - *linkp = link->next; 557 548 /* release net devices */ 558 549 if (link->priv) { 559 550 struct hostap_cs_priv *hw_priv;
+10 -42
drivers/net/wireless/netwave_cs.c
··· 228 228 static void set_multicast_list(struct net_device *dev); 229 229 230 230 /* 231 - A linked list of "instances" of the skeleton device. Each actual 232 - PCMCIA card corresponds to one device instance, and is described 233 - by one dev_link_t structure (defined in ds.h). 234 - 235 - You may not want to use a linked list for this -- for example, the 236 - memory card driver uses an array of dev_link_t pointers, where minor 237 - device numbers are used to derive the corresponding array index. 238 - */ 239 - static dev_link_t *dev_list; 240 - 241 - /* 242 231 A dev_link_t structure has fields for most things that are needed 243 232 to keep track of a socket, but there will usually be some device 244 233 specific information that also needs to be kept track of. The ··· 440 451 link->irq.Instance = dev; 441 452 442 453 /* Register with Card Services */ 443 - link->next = dev_list; 444 - dev_list = link; 454 + link->next = NULL; 445 455 client_reg.dev_info = &dev_info; 446 456 client_reg.Version = 0x0210; 447 457 client_reg.event_callback_args.client_data = link; ··· 464 476 */ 465 477 static void netwave_detach(struct pcmcia_device *p_dev) 466 478 { 467 - dev_link_t *link = dev_to_instance(p_dev); 468 - struct net_device *dev = link->priv; 469 - dev_link_t **linkp; 479 + dev_link_t *link = dev_to_instance(p_dev); 480 + struct net_device *dev = link->priv; 470 481 471 - DEBUG(0, "netwave_detach(0x%p)\n", link); 472 - 473 - /* 474 - If the device is currently configured and active, we won't 475 - actually delete it yet. Instead, it is marked so that when 476 - the release() function is called, that will trigger a proper 477 - detach(). 478 - */ 479 - if (link->state & DEV_CONFIG) 480 - netwave_release(link); 482 + DEBUG(0, "netwave_detach(0x%p)\n", link); 481 483 482 - /* Locate device structure */ 483 - for (linkp = &dev_list; *linkp; linkp = &(*linkp)->next) 484 - if (*linkp == link) break; 485 - if (*linkp == NULL) 486 - { 487 - DEBUG(1, "netwave_cs: detach fail, '%s' not in list\n", 488 - link->dev->dev_name); 489 - return; 490 - } 484 + if (link->state & DEV_CONFIG) 485 + netwave_release(link); 491 486 492 - /* Unlink device structure, free pieces */ 493 - *linkp = link->next; 494 - if (link->dev) 495 - unregister_netdev(dev); 496 - free_netdev(dev); 497 - 487 + if (link->dev) 488 + unregister_netdev(dev); 489 + 490 + free_netdev(dev); 498 491 } /* netwave_detach */ 499 492 500 493 /* ··· 1472 1503 static void __exit exit_netwave_cs(void) 1473 1504 { 1474 1505 pcmcia_unregister_driver(&netwave_driver); 1475 - BUG_ON(dev_list != NULL); 1476 1506 } 1477 1507 1478 1508 module_init(init_netwave_cs);
+1 -20
drivers/net/wireless/orinoco_cs.c
··· 69 69 unsigned long hard_reset_in_progress; 70 70 }; 71 71 72 - /* 73 - * A linked list of "instances" of the device. Each actual PCMCIA 74 - * card corresponds to one device instance, and is described by one 75 - * dev_link_t structure (defined in ds.h). 76 - */ 77 - static dev_link_t *dev_list; /* = NULL */ 78 72 79 73 /********************************************************************/ 80 74 /* Function prototypes */ ··· 148 154 link->conf.IntType = INT_MEMORY_AND_IO; 149 155 150 156 /* Register with Card Services */ 151 - /* FIXME: need a lock? */ 152 - link->next = dev_list; 153 - dev_list = link; 157 + link->next = NULL; 154 158 155 159 client_reg.dev_info = &dev_info; 156 160 client_reg.Version = 0x0210; /* FIXME: what does this mean? */ ··· 173 181 static void orinoco_cs_detach(struct pcmcia_device *p_dev) 174 182 { 175 183 dev_link_t *link = dev_to_instance(p_dev); 176 - dev_link_t **linkp; 177 184 struct net_device *dev = link->priv; 178 - 179 - /* Locate device structure */ 180 - for (linkp = &dev_list; *linkp; linkp = &(*linkp)->next) 181 - if (*linkp == link) 182 - break; 183 - 184 - BUG_ON(*linkp == NULL); 185 185 186 186 if (link->state & DEV_CONFIG) 187 187 orinoco_cs_release(link); 188 188 189 - /* Unlink device structure, and free it */ 190 - *linkp = link->next; 191 189 DEBUG(0, PFX "detach: link=%p link->dev=%p\n", link, link->dev); 192 190 if (link->dev) { 193 191 DEBUG(0, PFX "About to unregister net device %p\n", ··· 660 678 exit_orinoco_cs(void) 661 679 { 662 680 pcmcia_unregister_driver(&orinoco_driver); 663 - BUG_ON(dev_list != NULL); 664 681 } 665 682 666 683 module_init(init_orinoco_cs);
+1 -10
drivers/net/wireless/spectrum_cs.c
··· 78 78 dev_node_t node; 79 79 }; 80 80 81 - /* 82 - * A linked list of "instances" of the device. Each actual PCMCIA 83 - * card corresponds to one device instance, and is described by one 84 - * dev_link_t structure (defined in ds.h). 85 - */ 86 - static dev_link_t *dev_list; /* = NULL */ 87 - 88 81 /********************************************************************/ 89 82 /* Function prototypes */ 90 83 /********************************************************************/ ··· 630 637 631 638 /* Register with Card Services */ 632 639 /* FIXME: need a lock? */ 633 - link->next = dev_list; 634 - dev_list = link; 640 + link->next = NULL; /* not needed */ 635 641 636 642 client_reg.dev_info = &dev_info; 637 643 client_reg.Version = 0x0210; /* FIXME: what does this mean? */ ··· 1041 1049 exit_spectrum_cs(void) 1042 1050 { 1043 1051 pcmcia_unregister_driver(&orinoco_driver); 1044 - BUG_ON(dev_list != NULL); 1045 1052 } 1046 1053 1047 1054 module_init(init_spectrum_cs);
+1 -23
drivers/net/wireless/wavelan_cs.c
··· 4627 4627 link->conf.IntType = INT_MEMORY_AND_IO; 4628 4628 4629 4629 /* Chain drivers */ 4630 - link->next = dev_list; 4631 - dev_list = link; 4630 + link->next = NULL; 4632 4631 4633 4632 /* Allocate the generic data structure */ 4634 4633 dev = alloc_etherdev(sizeof(net_local)); ··· 4728 4729 { 4729 4730 /* Some others haven't done their job : give them another chance */ 4730 4731 wv_pcmcia_release(link); 4731 - } 4732 - 4733 - /* Remove the interface data from the linked list */ 4734 - if(dev_list == link) 4735 - dev_list = link->next; 4736 - else 4737 - { 4738 - dev_link_t * prev = dev_list; 4739 - 4740 - while((prev != (dev_link_t *) NULL) && (prev->next != link)) 4741 - prev = prev->next; 4742 - 4743 - if(prev == (dev_link_t *) NULL) 4744 - { 4745 - #ifdef DEBUG_CONFIG_ERRORS 4746 - printk(KERN_WARNING "wavelan_detach : Attempting to remove a nonexistent device.\n"); 4747 - #endif 4748 - return; 4749 - } 4750 - 4751 - prev->next = link->next; 4752 4732 } 4753 4733 4754 4734 /* Free pieces */
-1
drivers/net/wireless/wavelan_cs.p.h
··· 766 766 /**************************** VARIABLES ****************************/ 767 767 768 768 static dev_info_t dev_info = "wavelan_cs"; 769 - static dev_link_t *dev_list = NULL; /* Linked list of devices */ 770 769 771 770 /* 772 771 * Parameters that can be set with 'insmod'
+1 -13
drivers/parport/parport_cs.c
··· 95 95 event_callback_args_t *args); 96 96 97 97 static dev_info_t dev_info = "parport_cs"; 98 - static dev_link_t *dev_list = NULL; 99 98 100 99 /*====================================================================== 101 100 ··· 128 129 link->conf.IntType = INT_MEMORY_AND_IO; 129 130 130 131 /* Register with Card Services */ 131 - link->next = dev_list; 132 - dev_list = link; 132 + link->next = NULL; 133 133 client_reg.dev_info = &dev_info; 134 134 client_reg.Version = 0x0210; 135 135 client_reg.event_callback_args.client_data = link; ··· 154 156 static void parport_detach(struct pcmcia_device *p_dev) 155 157 { 156 158 dev_link_t *link = dev_to_instance(p_dev); 157 - dev_link_t **linkp; 158 159 159 160 DEBUG(0, "parport_detach(0x%p)\n", link); 160 - 161 - /* Locate device structure */ 162 - for (linkp = &dev_list; *linkp; linkp = &(*linkp)->next) 163 - if (*linkp == link) break; 164 - if (*linkp == NULL) 165 - return; 166 161 167 162 if (link->state & DEV_CONFIG) 168 163 parport_cs_release(link); 169 164 170 - /* Unlink, free device structure */ 171 - *linkp = link->next; 172 165 kfree(link->priv); 173 166 } /* parport_detach */ 174 167 ··· 380 391 static void __exit exit_parport_cs(void) 381 392 { 382 393 pcmcia_unregister_driver(&parport_cs_driver); 383 - BUG_ON(dev_list != NULL); 384 394 } 385 395 386 396 module_init(init_parport_cs);
+6 -20
drivers/scsi/pcmcia/fdomain_stub.c
··· 87 87 static void fdomain_detach(struct pcmcia_device *p_dev); 88 88 89 89 90 - static dev_link_t *dev_list = NULL; 91 - 92 90 static dev_info_t dev_info = "fdomain_cs"; 93 91 94 92 static dev_link_t *fdomain_attach(void) ··· 114 116 link->conf.Present = PRESENT_OPTION; 115 117 116 118 /* Register with Card Services */ 117 - link->next = dev_list; 118 - dev_list = link; 119 + link->next = NULL; 119 120 client_reg.dev_info = &dev_info; 120 121 client_reg.Version = 0x0210; 121 122 client_reg.event_callback_args.client_data = link; ··· 132 135 133 136 static void fdomain_detach(struct pcmcia_device *p_dev) 134 137 { 135 - dev_link_t *link = dev_to_instance(p_dev); 136 - dev_link_t **linkp; 138 + dev_link_t *link = dev_to_instance(p_dev); 137 139 138 - DEBUG(0, "fdomain_detach(0x%p)\n", link); 139 - 140 - /* Locate device structure */ 141 - for (linkp = &dev_list; *linkp; linkp = &(*linkp)->next) 142 - if (*linkp == link) break; 143 - if (*linkp == NULL) 144 - return; 140 + DEBUG(0, "fdomain_detach(0x%p)\n", link); 145 141 146 - if (link->state & DEV_CONFIG) 147 - fdomain_release(link); 142 + if (link->state & DEV_CONFIG) 143 + fdomain_release(link); 148 144 149 - /* Unlink device structure, free bits */ 150 - *linkp = link->next; 151 - kfree(link->priv); 152 - 145 + kfree(link->priv); 153 146 } /* fdomain_detach */ 154 147 155 148 /*====================================================================*/ ··· 311 324 static void __exit exit_fdomain_cs(void) 312 325 { 313 326 pcmcia_unregister_driver(&fdomain_cs_driver); 314 - BUG_ON(dev_list != NULL); 315 327 } 316 328 317 329 module_init(init_fdomain_cs);
+1 -18
drivers/scsi/pcmcia/nsp_cs.c
··· 104 104 #endif 105 105 }; 106 106 107 - static dev_link_t *dev_list = NULL; 108 107 static dev_info_t dev_info = {"nsp_cs"}; 109 108 110 109 static nsp_hw_data nsp_data_base; /* attach <-> detect glue */ ··· 1637 1638 1638 1639 1639 1640 /* Register with Card Services */ 1640 - link->next = dev_list; 1641 - dev_list = link; 1641 + link->next = NULL; 1642 1642 client_reg.dev_info = &dev_info; 1643 1643 client_reg.Version = 0x0210; 1644 1644 client_reg.event_callback_args.client_data = link; ··· 1663 1665 static void nsp_cs_detach(struct pcmcia_device *p_dev) 1664 1666 { 1665 1667 dev_link_t *link = dev_to_instance(p_dev); 1666 - dev_link_t **linkp; 1667 1668 1668 1669 nsp_dbg(NSP_DEBUG_INIT, "in, link=0x%p", link); 1669 - 1670 - /* Locate device structure */ 1671 - for (linkp = &dev_list; *linkp; linkp = &(*linkp)->next) { 1672 - if (*linkp == link) { 1673 - break; 1674 - } 1675 - } 1676 - if (*linkp == NULL) { 1677 - return; 1678 - } 1679 1670 1680 1671 if (link->state & DEV_CONFIG) { 1681 1672 ((scsi_info_t *)link->priv)->stop = 1; 1682 1673 nsp_cs_release(link); 1683 1674 } 1684 1675 1685 - /* Unlink device structure, free bits */ 1686 - *linkp = link->next; 1687 1676 kfree(link->priv); 1688 1677 link->priv = NULL; 1689 - 1690 1678 } /* nsp_cs_detach */ 1691 1679 1692 1680 ··· 2152 2168 2153 2169 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,68)) 2154 2170 pcmcia_unregister_driver(&nsp_driver); 2155 - BUG_ON(dev_list != NULL); 2156 2171 #else 2157 2172 unregister_pcmcia_driver(&dev_info); 2158 2173 /* XXX: this really needs to move into generic code.. */
+1 -15
drivers/scsi/pcmcia/qlogic_stub.c
··· 104 104 static void qlogic_detach(struct pcmcia_device *p_dev); 105 105 106 106 107 - static dev_link_t *dev_list = NULL; 108 - 109 107 static dev_info_t dev_info = "qlogic_cs"; 110 108 111 109 static struct Scsi_Host *qlogic_detect(struct scsi_host_template *host, ··· 188 190 link->conf.Present = PRESENT_OPTION; 189 191 190 192 /* Register with Card Services */ 191 - link->next = dev_list; 192 - dev_list = link; 193 + link->next = NULL; 193 194 client_reg.dev_info = &dev_info; 194 195 client_reg.Version = 0x0210; 195 196 client_reg.event_callback_args.client_data = link; ··· 207 210 static void qlogic_detach(struct pcmcia_device *p_dev) 208 211 { 209 212 dev_link_t *link = dev_to_instance(p_dev); 210 - dev_link_t **linkp; 211 213 212 214 DEBUG(0, "qlogic_detach(0x%p)\n", link); 213 - 214 - /* Locate device structure */ 215 - for (linkp = &dev_list; *linkp; linkp = &(*linkp)->next) 216 - if (*linkp == link) 217 - break; 218 - if (*linkp == NULL) 219 - return; 220 215 221 216 if (link->state & DEV_CONFIG) 222 217 qlogic_release(link); 223 218 224 - /* Unlink device structure, free bits */ 225 - *linkp = link->next; 226 219 kfree(link->priv); 227 220 228 221 } /* qlogic_detach */ ··· 426 439 static void __exit exit_qlogic_cs(void) 427 440 { 428 441 pcmcia_unregister_driver(&qlogic_cs_driver); 429 - BUG_ON(dev_list != NULL); 430 442 } 431 443 432 444 MODULE_AUTHOR("Tom Zerucha, Michael Griffith");
+1 -13
drivers/scsi/pcmcia/sym53c500_cs.c
··· 232 232 * Global (within this module) variables other than 233 233 * sym53c500_driver_template (the scsi_host_template). 234 234 */ 235 - static dev_link_t *dev_list; 236 235 static dev_info_t dev_info = "sym53c500_cs"; 237 236 238 237 /* ================================================================== */ ··· 929 930 SYM53C500_detach(struct pcmcia_device *p_dev) 930 931 { 931 932 dev_link_t *link = dev_to_instance(p_dev); 932 - dev_link_t **linkp; 933 933 934 934 DEBUG(0, "SYM53C500_detach(0x%p)\n", link); 935 - 936 - /* Locate device structure */ 937 - for (linkp = &dev_list; *linkp; linkp = &(*linkp)->next) 938 - if (*linkp == link) 939 - break; 940 - if (*linkp == NULL) 941 - return; 942 935 943 936 if (link->state & DEV_CONFIG) 944 937 SYM53C500_release(link); 945 938 946 - /* Unlink device structure, free bits. */ 947 - *linkp = link->next; 948 939 kfree(link->priv); 949 940 link->priv = NULL; 950 941 } /* SYM53C500_detach */ ··· 967 978 link->conf.Present = PRESENT_OPTION; 968 979 969 980 /* Register with Card Services */ 970 - link->next = dev_list; 971 - dev_list = link; 981 + link->next = NULL; 972 982 client_reg.dev_info = &dev_info; 973 983 client_reg.Version = 0x0210; 974 984 client_reg.event_callback_args.client_data = link;
+2 -15
drivers/serial/serial_cs.c
··· 122 122 static dev_link_t *serial_attach(void); 123 123 static void serial_detach(struct pcmcia_device *p_dev); 124 124 125 - static dev_link_t *dev_list = NULL; 126 - 127 125 /*====================================================================== 128 126 129 127 After a card is removed, serial_remove() will unregister ··· 232 234 link->conf.IntType = INT_MEMORY_AND_IO; 233 235 234 236 /* Register with Card Services */ 235 - link->next = dev_list; 236 - dev_list = link; 237 + link->next = NULL; /* not needed */ 237 238 client_reg.dev_info = &dev_info; 238 239 client_reg.Version = 0x0210; 239 240 client_reg.event_callback_args.client_data = link; ··· 259 262 { 260 263 dev_link_t *link = dev_to_instance(p_dev); 261 264 struct serial_info *info = link->priv; 262 - dev_link_t **linkp; 263 265 264 266 DEBUG(0, "serial_detach(0x%p)\n", link); 265 - 266 - /* Locate device structure */ 267 - for (linkp = &dev_list; *linkp; linkp = &(*linkp)->next) 268 - if (*linkp == link) 269 - break; 270 - if (*linkp == NULL) 271 - return; 272 267 273 268 /* 274 269 * Ensure any outstanding scheduled tasks are completed. ··· 272 283 */ 273 284 serial_remove(link); 274 285 275 - /* Unlink device structure, free bits */ 276 - *linkp = link->next; 286 + /* free bits */ 277 287 kfree(info); 278 288 } 279 289 ··· 859 871 static void __exit exit_serial_cs(void) 860 872 { 861 873 pcmcia_unregister_driver(&serial_cs_driver); 862 - BUG_ON(dev_list != NULL); 863 874 } 864 875 865 876 module_init(init_serial_cs);
+2 -12
drivers/telephony/ixj_pcmcia.c
··· 40 40 static void ixj_cs_release(dev_link_t * link); 41 41 static int ixj_event(event_t event, int priority, event_callback_args_t * args); 42 42 static dev_info_t dev_info = "ixj_cs"; 43 - static dev_link_t *dev_list = NULL; 44 43 45 44 static dev_link_t *ixj_attach(void) 46 45 { ··· 64 65 } 65 66 memset(link->priv, 0, sizeof(struct ixj_info_t)); 66 67 /* Register with Card Services */ 67 - link->next = dev_list; 68 - dev_list = link; 68 + link->next = NULL; 69 69 client_reg.dev_info = &dev_info; 70 70 client_reg.Version = 0x0210; 71 71 client_reg.event_callback_args.client_data = link; ··· 80 82 static void ixj_detach(struct pcmcia_device *p_dev) 81 83 { 82 84 dev_link_t *link = dev_to_instance(p_dev); 83 - dev_link_t **linkp; 84 85 85 86 DEBUG(0, "ixj_detach(0x%p)\n", link); 86 - for (linkp = &dev_list; *linkp; linkp = &(*linkp)->next) 87 - if (*linkp == link) 88 - break; 89 - if (*linkp == NULL) 90 - return; 87 + 91 88 link->state &= ~DEV_RELEASE_PENDING; 92 89 if (link->state & DEV_CONFIG) 93 90 ixj_cs_release(link); 94 91 95 - /* Unlink device structure, free bits */ 96 - *linkp = link->next; 97 92 kfree(link->priv); 98 93 kfree(link); 99 94 } ··· 305 314 static void ixj_pcmcia_exit(void) 306 315 { 307 316 pcmcia_unregister_driver(&ixj_driver); 308 - BUG_ON(dev_list != NULL); 309 317 } 310 318 311 319 module_init(ixj_pcmcia_init);
+1 -15
drivers/usb/host/sl811_cs.c
··· 66 66 67 67 static const char driver_name[DEV_NAME_LEN] = "sl811_cs"; 68 68 69 - static dev_link_t *dev_list = NULL; 70 - 71 69 typedef struct local_info_t { 72 70 dev_link_t link; 73 71 dev_node_t node; ··· 141 143 static void sl811_cs_detach(struct pcmcia_device *p_dev) 142 144 { 143 145 dev_link_t *link = dev_to_instance(p_dev); 144 - dev_link_t **linkp; 145 146 146 147 DBG(0, "sl811_cs_detach(0x%p)\n", link); 147 - 148 - /* Locate device structure */ 149 - for (linkp = &dev_list; *linkp; linkp = &(*linkp)->next) { 150 - if (*linkp == link) 151 - break; 152 - } 153 - if (*linkp == NULL) 154 - return; 155 148 156 149 link->state &= ~DEV_PRESENT; 157 150 if (link->state & DEV_CONFIG) 158 151 sl811_cs_release(link); 159 152 160 - /* Unlink device structure, and free it */ 161 - *linkp = link->next; 162 153 /* This points to the parent local_info_t struct */ 163 154 kfree(link->priv); 164 155 } ··· 365 378 link->conf.IntType = INT_MEMORY_AND_IO; 366 379 367 380 /* Register with Card Services */ 368 - link->next = dev_list; 369 - dev_list = link; 381 + link->next = NULL; 370 382 client_reg.dev_info = (dev_info_t *) &driver_name; 371 383 client_reg.Attributes = INFO_IO_CLIENT | INFO_CARD_SHARE; 372 384 client_reg.Version = 0x0210;