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

[PATCH] pcmcia: embed dev_link_t into struct pcmcia_device

Embed dev_link_t into struct pcmcia_device(), as they basically address the
same entity. The actual contents of dev_link_t will be cleaned up step by step.
This patch includes a bugfix from and signed-off-by Andrew Morton.

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

+446 -729
+14 -17
drivers/bluetooth/bluecard_cs.c
··· 65 65 66 66 67 67 typedef struct bluecard_info_t { 68 - dev_link_t link; 68 + struct pcmcia_device *p_dev; 69 69 dev_node_t node; 70 70 71 71 struct hci_dev *hdev; ··· 162 162 static void bluecard_activity_led_timeout(u_long arg) 163 163 { 164 164 bluecard_info_t *info = (bluecard_info_t *)arg; 165 - unsigned int iobase = info->link.io.BasePort1; 165 + unsigned int iobase = info->p_dev->io.BasePort1; 166 166 167 167 if (!test_bit(CARD_HAS_PCCARD_ID, &(info->hw_state))) 168 168 return; ··· 179 179 180 180 static void bluecard_enable_activity_led(bluecard_info_t *info) 181 181 { 182 - unsigned int iobase = info->link.io.BasePort1; 182 + unsigned int iobase = info->p_dev->io.BasePort1; 183 183 184 184 if (!test_bit(CARD_HAS_PCCARD_ID, &(info->hw_state))) 185 185 return; ··· 235 235 } 236 236 237 237 do { 238 - register unsigned int iobase = info->link.io.BasePort1; 238 + register unsigned int iobase = info->p_dev->io.BasePort1; 239 239 register unsigned int offset; 240 240 register unsigned char command; 241 241 register unsigned long ready_bit; ··· 244 244 245 245 clear_bit(XMIT_WAKEUP, &(info->tx_state)); 246 246 247 - if (!(info->link.state & DEV_PRESENT)) 247 + if (!(info->p_dev->state & DEV_PRESENT)) 248 248 return; 249 249 250 250 if (test_bit(XMIT_BUFFER_NUMBER, &(info->tx_state))) { ··· 382 382 return; 383 383 } 384 384 385 - iobase = info->link.io.BasePort1; 385 + iobase = info->p_dev->io.BasePort1; 386 386 387 387 if (test_bit(XMIT_SENDING_READY, &(info->tx_state))) 388 388 bluecard_enable_activity_led(info); ··· 512 512 if (!test_bit(CARD_READY, &(info->hw_state))) 513 513 return IRQ_HANDLED; 514 514 515 - iobase = info->link.io.BasePort1; 515 + iobase = info->p_dev->io.BasePort1; 516 516 517 517 spin_lock(&(info->lock)); 518 518 ··· 626 626 static int bluecard_hci_open(struct hci_dev *hdev) 627 627 { 628 628 bluecard_info_t *info = (bluecard_info_t *)(hdev->driver_data); 629 - unsigned int iobase = info->link.io.BasePort1; 629 + unsigned int iobase = info->p_dev->io.BasePort1; 630 630 631 631 if (test_bit(CARD_HAS_PCCARD_ID, &(info->hw_state))) 632 632 bluecard_hci_set_baud_rate(hdev, DEFAULT_BAUD_RATE); ··· 646 646 static int bluecard_hci_close(struct hci_dev *hdev) 647 647 { 648 648 bluecard_info_t *info = (bluecard_info_t *)(hdev->driver_data); 649 - unsigned int iobase = info->link.io.BasePort1; 649 + unsigned int iobase = info->p_dev->io.BasePort1; 650 650 651 651 if (!test_and_clear_bit(HCI_RUNNING, &(hdev->flags))) 652 652 return 0; ··· 713 713 714 714 static int bluecard_open(bluecard_info_t *info) 715 715 { 716 - unsigned int iobase = info->link.io.BasePort1; 716 + unsigned int iobase = info->p_dev->io.BasePort1; 717 717 struct hci_dev *hdev; 718 718 unsigned char id; 719 719 ··· 831 831 832 832 static int bluecard_close(bluecard_info_t *info) 833 833 { 834 - unsigned int iobase = info->link.io.BasePort1; 834 + unsigned int iobase = info->p_dev->io.BasePort1; 835 835 struct hci_dev *hdev = info->hdev; 836 836 837 837 if (!hdev) ··· 859 859 static int bluecard_attach(struct pcmcia_device *p_dev) 860 860 { 861 861 bluecard_info_t *info; 862 - dev_link_t *link; 862 + dev_link_t *link = dev_to_instance(p_dev); 863 863 864 864 /* Create new info device */ 865 865 info = kzalloc(sizeof(*info), GFP_KERNEL); 866 866 if (!info) 867 867 return -ENOMEM; 868 868 869 - link = &info->link; 869 + info->p_dev = p_dev; 870 870 link->priv = info; 871 871 872 872 link->io.Attributes1 = IO_DATA_PATH_WIDTH_8; ··· 879 879 880 880 link->conf.Attributes = CONF_ENABLE_IRQ; 881 881 link->conf.IntType = INT_MEMORY_AND_IO; 882 - 883 - link->handle = p_dev; 884 - p_dev->instance = link; 885 882 886 883 link->state |= DEV_PRESENT | DEV_CONFIG_PENDING; 887 884 bluecard_config(link); ··· 973 976 goto failed; 974 977 975 978 strcpy(info->node.dev_name, info->hdev->name); 976 - link->dev = &info->node; 979 + link->dev_node = &info->node; 977 980 link->state &= ~DEV_CONFIG_PENDING; 978 981 979 982 return;
+10 -16
drivers/bluetooth/bt3c_cs.c
··· 72 72 73 73 74 74 typedef struct bt3c_info_t { 75 - dev_link_t link; 75 + struct pcmcia_device *p_dev; 76 76 dev_node_t node; 77 77 78 78 struct hci_dev *hdev; ··· 191 191 return; 192 192 193 193 do { 194 - register unsigned int iobase = info->link.io.BasePort1; 194 + register unsigned int iobase = info->p_dev->io.BasePort1; 195 195 register struct sk_buff *skb; 196 196 register int len; 197 197 198 - if (!(info->link.state & DEV_PRESENT)) 198 + if (!(info->p_dev->state & DEV_PRESENT)) 199 199 break; 200 200 201 201 ··· 229 229 return; 230 230 } 231 231 232 - iobase = info->link.io.BasePort1; 232 + iobase = info->p_dev->io.BasePort1; 233 233 234 234 avail = bt3c_read(iobase, 0x7006); 235 235 //printk("bt3c_cs: receiving %d bytes\n", avail); ··· 350 350 return IRQ_NONE; 351 351 } 352 352 353 - iobase = info->link.io.BasePort1; 353 + iobase = info->p_dev->io.BasePort1; 354 354 355 355 spin_lock(&(info->lock)); 356 356 ··· 481 481 unsigned int iobase, size, addr, fcs, tmp; 482 482 int i, err = 0; 483 483 484 - iobase = info->link.io.BasePort1; 484 + iobase = info->p_dev->io.BasePort1; 485 485 486 486 /* Reset */ 487 487 bt3c_io_write(iobase, 0x8040, 0x0404); ··· 562 562 { 563 563 const struct firmware *firmware; 564 564 struct hci_dev *hdev; 565 - client_handle_t handle; 566 565 int err; 567 566 568 567 spin_lock_init(&(info->lock)); ··· 593 594 594 595 hdev->owner = THIS_MODULE; 595 596 596 - handle = info->link.handle; 597 - 598 597 /* Load firmware */ 599 - err = request_firmware(&firmware, "BT3CPCC.bin", &handle_to_dev(handle)); 598 + err = request_firmware(&firmware, "BT3CPCC.bin", &info->p_dev->dev); 600 599 if (err < 0) { 601 600 BT_ERR("Firmware request failed"); 602 601 goto error; ··· 648 651 static int bt3c_attach(struct pcmcia_device *p_dev) 649 652 { 650 653 bt3c_info_t *info; 651 - dev_link_t *link; 654 + dev_link_t *link = dev_to_instance(p_dev); 652 655 653 656 /* Create new info device */ 654 657 info = kzalloc(sizeof(*info), GFP_KERNEL); 655 658 if (!info) 656 659 return -ENOMEM; 657 660 658 - link = &info->link; 661 + info->p_dev = p_dev; 659 662 link->priv = info; 660 663 661 664 link->io.Attributes1 = IO_DATA_PATH_WIDTH_8; ··· 668 671 669 672 link->conf.Attributes = CONF_ENABLE_IRQ; 670 673 link->conf.IntType = INT_MEMORY_AND_IO; 671 - 672 - link->handle = p_dev; 673 - p_dev->instance = link; 674 674 675 675 link->state |= DEV_PRESENT | DEV_CONFIG_PENDING; 676 676 bt3c_config(link); ··· 809 815 goto failed; 810 816 811 817 strcpy(info->node.dev_name, info->hdev->name); 812 - link->dev = &info->node; 818 + link->dev_node = &info->node; 813 819 link->state &= ~DEV_CONFIG_PENDING; 814 820 815 821 return;
+11 -14
drivers/bluetooth/btuart_cs.c
··· 68 68 69 69 70 70 typedef struct btuart_info_t { 71 - dev_link_t link; 71 + struct pcmcia_device *p_dev; 72 72 dev_node_t node; 73 73 74 74 struct hci_dev *hdev; ··· 146 146 } 147 147 148 148 do { 149 - register unsigned int iobase = info->link.io.BasePort1; 149 + register unsigned int iobase = info->p_dev->io.BasePort1; 150 150 register struct sk_buff *skb; 151 151 register int len; 152 152 153 153 clear_bit(XMIT_WAKEUP, &(info->tx_state)); 154 154 155 - if (!(info->link.state & DEV_PRESENT)) 155 + if (!(info->p_dev->state & DEV_PRESENT)) 156 156 return; 157 157 158 158 if (!(skb = skb_dequeue(&(info->txq)))) ··· 187 187 return; 188 188 } 189 189 190 - iobase = info->link.io.BasePort1; 190 + iobase = info->p_dev->io.BasePort1; 191 191 192 192 do { 193 193 info->hdev->stat.byte_rx++; ··· 301 301 return IRQ_NONE; 302 302 } 303 303 304 - iobase = info->link.io.BasePort1; 304 + iobase = info->p_dev->io.BasePort1; 305 305 306 306 spin_lock(&(info->lock)); 307 307 ··· 357 357 return; 358 358 } 359 359 360 - iobase = info->link.io.BasePort1; 360 + iobase = info->p_dev->io.BasePort1; 361 361 362 362 spin_lock_irqsave(&(info->lock), flags); 363 363 ··· 481 481 static int btuart_open(btuart_info_t *info) 482 482 { 483 483 unsigned long flags; 484 - unsigned int iobase = info->link.io.BasePort1; 484 + unsigned int iobase = info->p_dev->io.BasePort1; 485 485 struct hci_dev *hdev; 486 486 487 487 spin_lock_init(&(info->lock)); ··· 550 550 static int btuart_close(btuart_info_t *info) 551 551 { 552 552 unsigned long flags; 553 - unsigned int iobase = info->link.io.BasePort1; 553 + unsigned int iobase = info->p_dev->io.BasePort1; 554 554 struct hci_dev *hdev = info->hdev; 555 555 556 556 if (!hdev) ··· 579 579 static int btuart_attach(struct pcmcia_device *p_dev) 580 580 { 581 581 btuart_info_t *info; 582 - dev_link_t *link; 582 + dev_link_t *link = dev_to_instance(p_dev); 583 583 584 584 /* Create new info device */ 585 585 info = kzalloc(sizeof(*info), GFP_KERNEL); 586 586 if (!info) 587 587 return -ENOMEM; 588 588 589 - link = &info->link; 589 + info->p_dev = p_dev; 590 590 link->priv = info; 591 591 592 592 link->io.Attributes1 = IO_DATA_PATH_WIDTH_8; ··· 599 599 600 600 link->conf.Attributes = CONF_ENABLE_IRQ; 601 601 link->conf.IntType = INT_MEMORY_AND_IO; 602 - 603 - link->handle = p_dev; 604 - p_dev->instance = link; 605 602 606 603 link->state |= DEV_PRESENT | DEV_CONFIG_PENDING; 607 604 btuart_config(link); ··· 741 744 goto failed; 742 745 743 746 strcpy(info->node.dev_name, info->hdev->name); 744 - link->dev = &info->node; 747 + link->dev_node = &info->node; 745 748 link->state &= ~DEV_CONFIG_PENDING; 746 749 747 750 return;
+11 -14
drivers/bluetooth/dtl1_cs.c
··· 68 68 69 69 70 70 typedef struct dtl1_info_t { 71 - dev_link_t link; 71 + struct pcmcia_device *p_dev; 72 72 dev_node_t node; 73 73 74 74 struct hci_dev *hdev; ··· 153 153 } 154 154 155 155 do { 156 - register unsigned int iobase = info->link.io.BasePort1; 156 + register unsigned int iobase = info->p_dev->io.BasePort1; 157 157 register struct sk_buff *skb; 158 158 register int len; 159 159 160 160 clear_bit(XMIT_WAKEUP, &(info->tx_state)); 161 161 162 - if (!(info->link.state & DEV_PRESENT)) 162 + if (!(info->p_dev->state & DEV_PRESENT)) 163 163 return; 164 164 165 165 if (!(skb = skb_dequeue(&(info->txq)))) ··· 218 218 return; 219 219 } 220 220 221 - iobase = info->link.io.BasePort1; 221 + iobase = info->p_dev->io.BasePort1; 222 222 223 223 do { 224 224 info->hdev->stat.byte_rx++; ··· 305 305 return IRQ_NONE; 306 306 } 307 307 308 - iobase = info->link.io.BasePort1; 308 + iobase = info->p_dev->io.BasePort1; 309 309 310 310 spin_lock(&(info->lock)); 311 311 ··· 458 458 static int dtl1_open(dtl1_info_t *info) 459 459 { 460 460 unsigned long flags; 461 - unsigned int iobase = info->link.io.BasePort1; 461 + unsigned int iobase = info->p_dev->io.BasePort1; 462 462 struct hci_dev *hdev; 463 463 464 464 spin_lock_init(&(info->lock)); ··· 504 504 outb(UART_LCR_WLEN8, iobase + UART_LCR); /* Reset DLAB */ 505 505 outb((UART_MCR_DTR | UART_MCR_RTS | UART_MCR_OUT2), iobase + UART_MCR); 506 506 507 - info->ri_latch = inb(info->link.io.BasePort1 + UART_MSR) & UART_MSR_RI; 507 + info->ri_latch = inb(info->p_dev->io.BasePort1 + UART_MSR) & UART_MSR_RI; 508 508 509 509 /* Turn on interrupts */ 510 510 outb(UART_IER_RLSI | UART_IER_RDI | UART_IER_THRI, iobase + UART_IER); ··· 529 529 static int dtl1_close(dtl1_info_t *info) 530 530 { 531 531 unsigned long flags; 532 - unsigned int iobase = info->link.io.BasePort1; 532 + unsigned int iobase = info->p_dev->io.BasePort1; 533 533 struct hci_dev *hdev = info->hdev; 534 534 535 535 if (!hdev) ··· 558 558 static int dtl1_attach(struct pcmcia_device *p_dev) 559 559 { 560 560 dtl1_info_t *info; 561 - dev_link_t *link; 561 + dev_link_t *link = dev_to_instance(p_dev); 562 562 563 563 /* Create new info device */ 564 564 info = kzalloc(sizeof(*info), GFP_KERNEL); 565 565 if (!info) 566 566 return -ENOMEM; 567 567 568 - link = &info->link; 568 + info->p_dev = p_dev; 569 569 link->priv = info; 570 570 571 571 link->io.Attributes1 = IO_DATA_PATH_WIDTH_8; ··· 578 578 579 579 link->conf.Attributes = CONF_ENABLE_IRQ; 580 580 link->conf.IntType = INT_MEMORY_AND_IO; 581 - 582 - link->handle = p_dev; 583 - p_dev->instance = link; 584 581 585 582 link->state |= DEV_PRESENT | DEV_CONFIG_PENDING; 586 583 dtl1_config(link); ··· 693 696 goto failed; 694 697 695 698 strcpy(info->node.dev_name, info->hdev->name); 696 - link->dev = &info->node; 699 + link->dev_node = &info->node; 697 700 link->state &= ~DEV_CONFIG_PENDING; 698 701 699 702 return;
+13 -16
drivers/char/pcmcia/cm4000_cs.c
··· 46 46 /* #define ATR_CSUM */ 47 47 48 48 #ifdef PCMCIA_DEBUG 49 - #define reader_to_dev(x) (&handle_to_dev(x->link.handle)) 49 + #define reader_to_dev(x) (&handle_to_dev(x->p_dev->handle)) 50 50 static int pc_debug = PCMCIA_DEBUG; 51 51 module_param(pc_debug, int, 0600); 52 52 #define DEBUGP(n, rdr, x, args...) do { \ ··· 106 106 #define REG_STOPBITS(x) (x + 7) 107 107 108 108 struct cm4000_dev { 109 - dev_link_t link; /* pcmcia link */ 109 + struct pcmcia_device *p_dev; 110 110 dev_node_t node; /* OS node (major,minor) */ 111 111 112 112 unsigned char atr[MAX_ATR]; ··· 454 454 static void set_cardparameter(struct cm4000_dev *dev) 455 455 { 456 456 int i; 457 - ioaddr_t iobase = dev->link.io.BasePort1; 457 + ioaddr_t iobase = dev->p_dev->io.BasePort1; 458 458 u_int8_t stopbits = 0x02; /* ISO default */ 459 459 460 460 DEBUGP(3, dev, "-> set_cardparameter\n"); ··· 487 487 unsigned short num_bytes_read; 488 488 unsigned char pts_reply[4]; 489 489 ssize_t rc; 490 - ioaddr_t iobase = dev->link.io.BasePort1; 490 + ioaddr_t iobase = dev->p_dev->io.BasePort1; 491 491 492 492 rc = 0; 493 493 ··· 699 699 static void monitor_card(unsigned long p) 700 700 { 701 701 struct cm4000_dev *dev = (struct cm4000_dev *) p; 702 - ioaddr_t iobase = dev->link.io.BasePort1; 702 + ioaddr_t iobase = dev->p_dev->io.BasePort1; 703 703 unsigned short s; 704 704 struct ptsreq ptsreq; 705 705 int i, atrc; ··· 962 962 loff_t *ppos) 963 963 { 964 964 struct cm4000_dev *dev = filp->private_data; 965 - ioaddr_t iobase = dev->link.io.BasePort1; 965 + ioaddr_t iobase = dev->p_dev->io.BasePort1; 966 966 ssize_t rc; 967 967 int i, j, k; 968 968 ··· 971 971 if (count == 0) /* according to manpage */ 972 972 return 0; 973 973 974 - if ((dev->link.state & DEV_PRESENT) == 0 || /* socket removed */ 974 + if ((dev->p_dev->state & DEV_PRESENT) == 0 || /* socket removed */ 975 975 test_bit(IS_CMM_ABSENT, &dev->flags)) 976 976 return -ENODEV; 977 977 ··· 1083 1083 size_t count, loff_t *ppos) 1084 1084 { 1085 1085 struct cm4000_dev *dev = (struct cm4000_dev *) filp->private_data; 1086 - ioaddr_t iobase = dev->link.io.BasePort1; 1086 + ioaddr_t iobase = dev->p_dev->io.BasePort1; 1087 1087 unsigned short s; 1088 1088 unsigned char tmp; 1089 1089 unsigned char infolen; ··· 1108 1108 1109 1109 sendT0 = dev->proto ? 0 : nr > 5 ? 0x08 : 0; 1110 1110 1111 - if ((dev->link.state & DEV_PRESENT) == 0 || /* socket removed */ 1111 + if ((dev->p_dev->state & DEV_PRESENT) == 0 || /* socket removed */ 1112 1112 test_bit(IS_CMM_ABSENT, &dev->flags)) 1113 1113 return -ENODEV; 1114 1114 ··· 1440 1440 unsigned long arg) 1441 1441 { 1442 1442 struct cm4000_dev *dev = filp->private_data; 1443 - ioaddr_t iobase = dev->link.io.BasePort1; 1443 + ioaddr_t iobase = dev->p_dev->io.BasePort1; 1444 1444 dev_link_t *link; 1445 1445 int size; 1446 1446 int rc; ··· 1844 1844 dev->node.major = major; 1845 1845 dev->node.minor = devno; 1846 1846 dev->node.next = NULL; 1847 - link->dev = &dev->node; 1847 + link->dev_node = &dev->node; 1848 1848 link->state &= ~DEV_CONFIG_PENDING; 1849 1849 1850 1850 return; ··· 1889 1889 static int cm4000_attach(struct pcmcia_device *p_dev) 1890 1890 { 1891 1891 struct cm4000_dev *dev; 1892 - dev_link_t *link; 1893 1892 int i; 1893 + dev_link_t *link = dev_to_instance(p_dev); 1894 1894 1895 1895 for (i = 0; i < CM4000_MAX_DEV; i++) 1896 1896 if (dev_table[i] == NULL) ··· 1906 1906 if (dev == NULL) 1907 1907 return -ENOMEM; 1908 1908 1909 - link = &dev->link; 1909 + dev->p_dev = p_dev; 1910 1910 link->priv = dev; 1911 1911 link->conf.IntType = INT_MEMORY_AND_IO; 1912 1912 dev_table[i] = link; ··· 1915 1915 init_waitqueue_head(&dev->ioq); 1916 1916 init_waitqueue_head(&dev->atrq); 1917 1917 init_waitqueue_head(&dev->readq); 1918 - 1919 - link->handle = p_dev; 1920 - p_dev->instance = link; 1921 1918 1922 1919 link->state |= DEV_PRESENT | DEV_CONFIG_PENDING; 1923 1920 cm4000_config(link, i);
+13 -16
drivers/char/pcmcia/cm4040_cs.c
··· 41 41 42 42 43 43 #ifdef PCMCIA_DEBUG 44 - #define reader_to_dev(x) (&handle_to_dev(x->link.handle)) 44 + #define reader_to_dev(x) (&handle_to_dev(x->p_dev->handle)) 45 45 static int pc_debug = PCMCIA_DEBUG; 46 46 module_param(pc_debug, int, 0600); 47 47 #define DEBUGP(n, rdr, x, args...) do { \ ··· 74 74 #define BS_WRITABLE 0x02 75 75 76 76 struct reader_dev { 77 - dev_link_t link; 77 + struct pcmcia_device *p_dev; 78 78 dev_node_t node; 79 79 wait_queue_head_t devq; 80 80 wait_queue_head_t poll_wait; ··· 116 116 static void cm4040_do_poll(unsigned long dummy) 117 117 { 118 118 struct reader_dev *dev = (struct reader_dev *) dummy; 119 - unsigned int obs = xinb(dev->link.io.BasePort1 119 + unsigned int obs = xinb(dev->p_dev->io.BasePort1 120 120 + REG_OFFSET_BUFFER_STATUS); 121 121 122 122 if ((obs & BSR_BULK_IN_FULL)) { ··· 147 147 static int wait_for_bulk_out_ready(struct reader_dev *dev) 148 148 { 149 149 int i, rc; 150 - int iobase = dev->link.io.BasePort1; 150 + int iobase = dev->p_dev->io.BasePort1; 151 151 152 152 for (i = 0; i < POLL_LOOP_COUNT; i++) { 153 153 if ((xinb(iobase + REG_OFFSET_BUFFER_STATUS) ··· 177 177 /* Write to Sync Control Register */ 178 178 static int write_sync_reg(unsigned char val, struct reader_dev *dev) 179 179 { 180 - int iobase = dev->link.io.BasePort1; 180 + int iobase = dev->p_dev->io.BasePort1; 181 181 int rc; 182 182 183 183 rc = wait_for_bulk_out_ready(dev); ··· 195 195 static int wait_for_bulk_in_ready(struct reader_dev *dev) 196 196 { 197 197 int i, rc; 198 - int iobase = dev->link.io.BasePort1; 198 + int iobase = dev->p_dev->io.BasePort1; 199 199 200 200 for (i = 0; i < POLL_LOOP_COUNT; i++) { 201 201 if ((xinb(iobase + REG_OFFSET_BUFFER_STATUS) ··· 225 225 size_t count, loff_t *ppos) 226 226 { 227 227 struct reader_dev *dev = filp->private_data; 228 - int iobase = dev->link.io.BasePort1; 228 + int iobase = dev->p_dev->io.BasePort1; 229 229 size_t bytes_to_read; 230 230 unsigned long i; 231 231 size_t min_bytes_to_read; ··· 246 246 return -EAGAIN; 247 247 } 248 248 249 - if ((dev->link.state & DEV_PRESENT)==0) 249 + if ((dev->p_dev->state & DEV_PRESENT)==0) 250 250 return -ENODEV; 251 251 252 252 for (i = 0; i < 5; i++) { ··· 328 328 size_t count, loff_t *ppos) 329 329 { 330 330 struct reader_dev *dev = filp->private_data; 331 - int iobase = dev->link.io.BasePort1; 331 + int iobase = dev->p_dev->io.BasePort1; 332 332 ssize_t rc; 333 333 int i; 334 334 unsigned int bytes_to_write; ··· 351 351 return -EAGAIN; 352 352 } 353 353 354 - if ((dev->link.state & DEV_PRESENT) == 0) 354 + if ((dev->p_dev->state & DEV_PRESENT) == 0) 355 355 return -ENODEV; 356 356 357 357 bytes_to_write = count; ··· 606 606 dev->node.major = major; 607 607 dev->node.minor = devno; 608 608 dev->node.next = NULL; 609 - link->dev = &dev->node; 609 + link->dev_node = &dev->node; 610 610 link->state &= ~DEV_CONFIG_PENDING; 611 611 612 612 DEBUGP(2, dev, "device " DEVICE_NAME "%d at 0x%.4x-0x%.4x\n", devno, ··· 631 631 static int reader_attach(struct pcmcia_device *p_dev) 632 632 { 633 633 struct reader_dev *dev; 634 - dev_link_t *link; 635 634 int i; 635 + dev_link_t *link = dev_to_instance(p_dev); 636 636 637 637 for (i = 0; i < CM_MAX_DEV; i++) { 638 638 if (dev_table[i] == NULL) ··· 649 649 dev->timeout = CCID_DRIVER_MINIMUM_TIMEOUT; 650 650 dev->buffer_status = 0; 651 651 652 - link = &dev->link; 653 652 link->priv = dev; 653 + dev->p_dev = p_dev; 654 654 655 655 link->conf.IntType = INT_MEMORY_AND_IO; 656 656 dev_table[i] = link; ··· 661 661 init_waitqueue_head(&dev->write_wait); 662 662 init_timer(&dev->poll_timer); 663 663 dev->poll_timer.function = &cm4040_do_poll; 664 - 665 - link->handle = p_dev; 666 - p_dev->instance = link; 667 664 668 665 link->state |= DEV_PRESENT | DEV_CONFIG_PENDING; 669 666 reader_config(link, i);
+6 -7
drivers/ide/legacy/ide-cs.c
··· 81 81 }; 82 82 83 83 typedef struct ide_info_t { 84 - dev_link_t link; 84 + struct pcmcia_device *p_dev; 85 85 int ndev; 86 86 dev_node_t node; 87 87 int hd; ··· 106 106 static int ide_attach(struct pcmcia_device *p_dev) 107 107 { 108 108 ide_info_t *info; 109 - dev_link_t *link; 109 + dev_link_t *link = dev_to_instance(p_dev); 110 110 111 111 DEBUG(0, "ide_attach()\n"); 112 112 ··· 114 114 info = kzalloc(sizeof(*info), GFP_KERNEL); 115 115 if (!info) 116 116 return -ENOMEM; 117 - link = &info->link; link->priv = info; 117 + 118 + info->p_dev = p_dev; 119 + link->priv = info; 118 120 119 121 link->io.Attributes1 = IO_DATA_PATH_WIDTH_AUTO; 120 122 link->io.Attributes2 = IO_DATA_PATH_WIDTH_8; ··· 125 123 link->irq.IRQInfo1 = IRQ_LEVEL_ID; 126 124 link->conf.Attributes = CONF_ENABLE_IRQ; 127 125 link->conf.IntType = INT_MEMORY_AND_IO; 128 - 129 - link->handle = p_dev; 130 - p_dev->instance = link; 131 126 132 127 link->state |= DEV_PRESENT | DEV_CONFIG_PENDING; 133 128 ide_config(link); ··· 325 326 info->node.major = ide_major[hd]; 326 327 info->node.minor = 0; 327 328 info->hd = hd; 328 - link->dev = &info->node; 329 + link->dev_node = &info->node; 329 330 printk(KERN_INFO "ide-cs: %s: Vpp = %d.%d\n", 330 331 info->node.dev_name, link->conf.Vpp / 10, link->conf.Vpp % 10); 331 332
+16 -29
drivers/isdn/hardware/avm/avm_cs.c
··· 101 101 102 102 static int avmcs_attach(struct pcmcia_device *p_dev) 103 103 { 104 - dev_link_t *link; 105 104 local_info_t *local; 106 105 107 - /* Initialize the dev_link_t structure */ 108 - link = kmalloc(sizeof(struct dev_link_t), GFP_KERNEL); 109 - if (!link) 110 - goto err; 111 - memset(link, 0, sizeof(struct dev_link_t)); 112 - 113 106 /* The io structure describes IO port mapping */ 114 - link->io.NumPorts1 = 16; 115 - link->io.Attributes1 = IO_DATA_PATH_WIDTH_8; 116 - link->io.NumPorts2 = 0; 107 + p_dev->io.NumPorts1 = 16; 108 + p_dev->io.Attributes1 = IO_DATA_PATH_WIDTH_8; 109 + p_dev->io.NumPorts2 = 0; 117 110 118 111 /* Interrupt setup */ 119 - link->irq.Attributes = IRQ_TYPE_EXCLUSIVE; 120 - link->irq.Attributes = IRQ_TYPE_DYNAMIC_SHARING|IRQ_FIRST_SHARED; 112 + p_dev->irq.Attributes = IRQ_TYPE_EXCLUSIVE; 113 + p_dev->irq.Attributes = IRQ_TYPE_DYNAMIC_SHARING|IRQ_FIRST_SHARED; 121 114 122 - link->irq.IRQInfo1 = IRQ_LEVEL_ID; 123 - 115 + p_dev->irq.IRQInfo1 = IRQ_LEVEL_ID; 116 + 124 117 /* General socket configuration */ 125 - link->conf.Attributes = CONF_ENABLE_IRQ; 126 - link->conf.IntType = INT_MEMORY_AND_IO; 127 - link->conf.ConfigIndex = 1; 128 - link->conf.Present = PRESENT_OPTION; 118 + p_dev->conf.Attributes = CONF_ENABLE_IRQ; 119 + p_dev->conf.IntType = INT_MEMORY_AND_IO; 120 + p_dev->conf.ConfigIndex = 1; 121 + p_dev->conf.Present = PRESENT_OPTION; 129 122 130 123 /* Allocate space for private device-specific data */ 131 124 local = kmalloc(sizeof(local_info_t), GFP_KERNEL); 132 125 if (!local) 133 - goto err_kfree; 126 + goto err; 134 127 memset(local, 0, sizeof(local_info_t)); 135 - link->priv = local; 128 + p_dev->priv = local; 136 129 137 - link->handle = p_dev; 138 - p_dev->instance = link; 139 - 140 - link->state |= DEV_PRESENT | DEV_CONFIG_PENDING; 141 - avmcs_config(link); 130 + p_dev->state |= DEV_PRESENT | DEV_CONFIG_PENDING; 131 + avmcs_config(p_dev); 142 132 143 133 return 0; 144 134 145 - err_kfree: 146 - kfree(link); 147 135 err: 148 136 return -EINVAL; 149 137 } /* avmcs_attach */ ··· 153 165 avmcs_release(link); 154 166 155 167 kfree(link->priv); 156 - kfree(link); 157 168 } /* avmcs_detach */ 158 169 159 170 /*====================================================================== ··· 317 330 318 331 dev->node.major = 64; 319 332 dev->node.minor = 0; 320 - link->dev = &dev->node; 333 + link->dev_node = &dev->node; 321 334 322 335 link->state &= ~DEV_CONFIG_PENDING; 323 336 /* If any step failed, release any partially configured state */
+18 -30
drivers/isdn/hisax/avma1_cs.c
··· 118 118 119 119 static int avma1cs_attach(struct pcmcia_device *p_dev) 120 120 { 121 - dev_link_t *link; 122 121 local_info_t *local; 123 122 124 123 DEBUG(0, "avma1cs_attach()\n"); 125 124 126 - /* Initialize the dev_link_t structure */ 127 - link = kmalloc(sizeof(struct dev_link_t), GFP_KERNEL); 128 - if (!link) 129 - return -ENOMEM; 130 - memset(link, 0, sizeof(struct dev_link_t)); 131 - 132 125 /* Allocate space for private device-specific data */ 133 126 local = kmalloc(sizeof(local_info_t), GFP_KERNEL); 134 - if (!local) { 135 - kfree(link); 127 + if (!local) 136 128 return -ENOMEM; 137 - } 129 + 138 130 memset(local, 0, sizeof(local_info_t)); 139 - link->priv = local; 131 + p_dev->priv = local; 140 132 141 133 /* The io structure describes IO port mapping */ 142 - link->io.NumPorts1 = 16; 143 - link->io.Attributes1 = IO_DATA_PATH_WIDTH_8; 144 - link->io.NumPorts2 = 16; 145 - link->io.Attributes2 = IO_DATA_PATH_WIDTH_16; 146 - link->io.IOAddrLines = 5; 134 + p_dev->io.NumPorts1 = 16; 135 + p_dev->io.Attributes1 = IO_DATA_PATH_WIDTH_8; 136 + p_dev->io.NumPorts2 = 16; 137 + p_dev->io.Attributes2 = IO_DATA_PATH_WIDTH_16; 138 + p_dev->io.IOAddrLines = 5; 147 139 148 140 /* Interrupt setup */ 149 - link->irq.Attributes = IRQ_TYPE_EXCLUSIVE; 150 - link->irq.Attributes = IRQ_TYPE_DYNAMIC_SHARING|IRQ_FIRST_SHARED; 141 + p_dev->irq.Attributes = IRQ_TYPE_EXCLUSIVE; 142 + p_dev->irq.Attributes = IRQ_TYPE_DYNAMIC_SHARING|IRQ_FIRST_SHARED; 151 143 152 - link->irq.IRQInfo1 = IRQ_LEVEL_ID; 144 + p_dev->irq.IRQInfo1 = IRQ_LEVEL_ID; 153 145 154 146 /* General socket configuration */ 155 - link->conf.Attributes = CONF_ENABLE_IRQ; 156 - link->conf.IntType = INT_MEMORY_AND_IO; 157 - link->conf.ConfigIndex = 1; 158 - link->conf.Present = PRESENT_OPTION; 147 + p_dev->conf.Attributes = CONF_ENABLE_IRQ; 148 + p_dev->conf.IntType = INT_MEMORY_AND_IO; 149 + p_dev->conf.ConfigIndex = 1; 150 + p_dev->conf.Present = PRESENT_OPTION; 159 151 160 - link->handle = p_dev; 161 - p_dev->instance = link; 162 - 163 - link->state |= DEV_PRESENT | DEV_CONFIG_PENDING; 164 - avma1cs_config(link); 152 + p_dev->state |= DEV_PRESENT | DEV_CONFIG_PENDING; 153 + avma1cs_config(p_dev); 165 154 166 155 return 0; 167 156 } /* avma1cs_attach */ ··· 174 185 avma1cs_release(link); 175 186 176 187 kfree(link->priv); 177 - kfree(link); 178 188 } /* avma1cs_detach */ 179 189 180 190 /*====================================================================== ··· 323 335 strcpy(dev->node.dev_name, "A1"); 324 336 dev->node.major = 45; 325 337 dev->node.minor = 0; 326 - link->dev = &dev->node; 338 + link->dev_node = &dev->node; 327 339 328 340 link->state &= ~DEV_CONFIG_PENDING; 329 341 /* If any step failed, release any partially configured state */
+7 -7
drivers/isdn/hisax/elsa_cs.c
··· 121 121 */ 122 122 123 123 typedef struct local_info_t { 124 - dev_link_t link; 124 + struct pcmcia_device *p_dev; 125 125 dev_node_t node; 126 126 int busy; 127 127 int cardnr; ··· 141 141 142 142 static int elsa_cs_attach(struct pcmcia_device *p_dev) 143 143 { 144 - dev_link_t *link; 145 144 local_info_t *local; 145 + dev_link_t *link = dev_to_instance(p_dev); 146 146 147 147 DEBUG(0, "elsa_cs_attach()\n"); 148 148 ··· 150 150 local = kmalloc(sizeof(local_info_t), GFP_KERNEL); 151 151 if (!local) return -ENOMEM; 152 152 memset(local, 0, sizeof(local_info_t)); 153 + 154 + local->p_dev = p_dev; 155 + link->priv = local; 156 + 153 157 local->cardnr = -1; 154 - link = &local->link; link->priv = local; 155 158 156 159 /* Interrupt setup */ 157 160 link->irq.Attributes = IRQ_TYPE_DYNAMIC_SHARING|IRQ_FIRST_SHARED; ··· 174 171 175 172 link->conf.Attributes = CONF_ENABLE_IRQ; 176 173 link->conf.IntType = INT_MEMORY_AND_IO; 177 - 178 - link->handle = p_dev; 179 - p_dev->instance = link; 180 174 181 175 link->state |= DEV_PRESENT | DEV_CONFIG_PENDING; 182 176 elsa_cs_config(link); ··· 320 320 sprintf(dev->node.dev_name, "elsa"); 321 321 dev->node.major = dev->node.minor = 0x0; 322 322 323 - link->dev = &dev->node; 323 + link->dev_node = &dev->node; 324 324 325 325 /* Finally, report what we've done */ 326 326 printk(KERN_INFO "%s: index 0x%02x: ",
+7 -9
drivers/isdn/hisax/sedlbauer_cs.c
··· 130 130 */ 131 131 132 132 typedef struct local_info_t { 133 - dev_link_t link; 133 + struct pcmcia_device *p_dev; 134 134 dev_node_t node; 135 135 int stop; 136 136 int cardnr; ··· 151 151 static int sedlbauer_attach(struct pcmcia_device *p_dev) 152 152 { 153 153 local_info_t *local; 154 - dev_link_t *link; 154 + dev_link_t *link = dev_to_instance(p_dev); 155 155 156 156 DEBUG(0, "sedlbauer_attach()\n"); 157 157 ··· 160 160 if (!local) return -ENOMEM; 161 161 memset(local, 0, sizeof(local_info_t)); 162 162 local->cardnr = -1; 163 - link = &local->link; link->priv = local; 164 - 163 + 164 + local->p_dev = p_dev; 165 + link->priv = local; 166 + 165 167 /* Interrupt setup */ 166 168 link->irq.Attributes = IRQ_TYPE_EXCLUSIVE; 167 169 link->irq.IRQInfo1 = IRQ_LEVEL_ID; ··· 184 182 link->io.Attributes1 = IO_DATA_PATH_WIDTH_8; 185 183 link->io.IOAddrLines = 3; 186 184 187 - 188 185 link->conf.Attributes = 0; 189 186 link->conf.IntType = INT_MEMORY_AND_IO; 190 - 191 - link->handle = p_dev; 192 - p_dev->instance = link; 193 187 194 188 link->state |= DEV_PRESENT | DEV_CONFIG_PENDING; 195 189 sedlbauer_config(link); ··· 395 397 */ 396 398 sprintf(dev->node.dev_name, "sedlbauer"); 397 399 dev->node.major = dev->node.minor = 0; 398 - link->dev = &dev->node; 400 + link->dev_node = &dev->node; 399 401 400 402 /* Finally, report what we've done */ 401 403 printk(KERN_INFO "%s: index 0x%02x:",
+6 -7
drivers/isdn/hisax/teles_cs.c
··· 112 112 */ 113 113 114 114 typedef struct local_info_t { 115 - dev_link_t link; 115 + struct pcmcia_device *p_dev; 116 116 dev_node_t node; 117 117 int busy; 118 118 int cardnr; ··· 132 132 133 133 static int teles_attach(struct pcmcia_device *p_dev) 134 134 { 135 - dev_link_t *link; 136 135 local_info_t *local; 136 + dev_link_t *link = dev_to_instance(p_dev); 137 137 138 138 DEBUG(0, "teles_attach()\n"); 139 139 ··· 142 142 if (!local) return -ENOMEM; 143 143 memset(local, 0, sizeof(local_info_t)); 144 144 local->cardnr = -1; 145 - link = &local->link; link->priv = local; 145 + 146 + local->p_dev = p_dev; 147 + link->priv = local; 146 148 147 149 /* Interrupt setup */ 148 150 link->irq.Attributes = IRQ_TYPE_DYNAMIC_SHARING|IRQ_FIRST_SHARED; ··· 164 162 165 163 link->conf.Attributes = CONF_ENABLE_IRQ; 166 164 link->conf.IntType = INT_MEMORY_AND_IO; 167 - 168 - link->handle = p_dev; 169 - p_dev->instance = link; 170 165 171 166 link->state |= DEV_PRESENT | DEV_CONFIG_PENDING; 172 167 teles_cs_config(link); ··· 310 311 sprintf(dev->node.dev_name, "teles"); 311 312 dev->node.major = dev->node.minor = 0x0; 312 313 313 - link->dev = &dev->node; 314 + link->dev_node = &dev->node; 314 315 315 316 /* Finally, report what we've done */ 316 317 printk(KERN_INFO "%s: index 0x%02x:",
+9 -13
drivers/mtd/maps/pcmciamtd.c
··· 54 54 #define MAX_PCMCIA_ADDR 0x4000000 55 55 56 56 struct pcmciamtd_dev { 57 - dev_link_t link; /* PCMCIA link */ 57 + struct pcmcia_device *p_dev; 58 58 dev_node_t node; /* device node */ 59 59 caddr_t win_base; /* ioremapped address of PCMCIA window */ 60 60 unsigned int win_size; /* size of window */ ··· 111 111 memreq_t mrq; 112 112 int ret; 113 113 114 - if(!(dev->link.state & DEV_PRESENT)) { 115 - DEBUG(1, "device removed state = 0x%4.4X", dev->link.state); 114 + if(!(dev->p_dev->state & DEV_PRESENT)) { 115 + DEBUG(1, "device removed state = 0x%4.4X", dev->p_dev->state); 116 116 return 0; 117 117 } 118 118 ··· 122 122 dev->offset, mrq.CardOffset); 123 123 mrq.Page = 0; 124 124 if( (ret = pcmcia_map_mem_page(win, &mrq)) != CS_SUCCESS) { 125 - cs_error(dev->link.handle, MapMemPage, ret); 125 + cs_error(dev->p_dev->handle, MapMemPage, ret); 126 126 return NULL; 127 127 } 128 128 dev->offset = mrq.CardOffset; ··· 319 319 static void pcmciamtd_set_vpp(struct map_info *map, int on) 320 320 { 321 321 struct pcmciamtd_dev *dev = (struct pcmciamtd_dev *)map->map_priv_1; 322 - dev_link_t *link = &dev->link; 322 + dev_link_t *link = dev->p_dev; 323 323 modconf_t mod; 324 324 int ret; 325 325 ··· 650 650 use the faster non-remapping read/write functions */ 651 651 if(mtd->size <= dev->win_size) { 652 652 DEBUG(1, "Using non remapping memory functions"); 653 - dev->pcmcia_map.map_priv_1 = (unsigned long)&(dev->link.state); 653 + dev->pcmcia_map.map_priv_1 = (unsigned long)&(dev->p_dev->state); 654 654 dev->pcmcia_map.map_priv_2 = (unsigned long)dev->win_base; 655 655 if (dev->pcmcia_map.bankwidth == 1) { 656 656 dev->pcmcia_map.read = pcmcia_read8; ··· 673 673 snprintf(dev->node.dev_name, sizeof(dev->node.dev_name), "mtd%d", mtd->index); 674 674 info("mtd%d: %s", mtd->index, mtd->name); 675 675 link->state &= ~DEV_CONFIG_PENDING; 676 - link->dev = &dev->node; 676 + link->dev_node = &dev->node; 677 677 return; 678 678 679 679 cs_failed: ··· 735 735 static int pcmciamtd_attach(struct pcmcia_device *p_dev) 736 736 { 737 737 struct pcmciamtd_dev *dev; 738 - dev_link_t *link; 738 + dev_link_t *link = dev_to_instance(p_dev); 739 739 740 740 /* Create new memory card device */ 741 741 dev = kmalloc(sizeof(*dev), GFP_KERNEL); ··· 743 743 DEBUG(1, "dev=0x%p", dev); 744 744 745 745 memset(dev, 0, sizeof(*dev)); 746 - link = &dev->link; 746 + dev->p_dev = p_dev; 747 747 link->priv = dev; 748 748 749 749 link->conf.Attributes = 0; 750 750 link->conf.IntType = INT_MEMORY; 751 - 752 - link->next = NULL; 753 - link->handle = p_dev; 754 - p_dev->instance = link; 755 751 756 752 link->state |= DEV_PRESENT | DEV_CONFIG_PENDING; 757 753 pcmciamtd_config(link);
+8 -11
drivers/net/pcmcia/3c574_cs.c
··· 204 204 #define MEDIA_TP 0x00C0 /* Enable link beat and jabber for 10baseT. */ 205 205 206 206 struct el3_private { 207 - dev_link_t link; 207 + struct pcmcia_device *p_dev; 208 208 dev_node_t node; 209 209 struct net_device_stats stats; 210 210 u16 advertising, partner; /* NWay media advertisement */ ··· 259 259 static int tc574_attach(struct pcmcia_device *p_dev) 260 260 { 261 261 struct el3_private *lp; 262 - dev_link_t *link; 263 262 struct net_device *dev; 263 + dev_link_t *link = dev_to_instance(p_dev); 264 264 265 265 DEBUG(0, "3c574_attach()\n"); 266 266 ··· 269 269 if (!dev) 270 270 return -ENOMEM; 271 271 lp = netdev_priv(dev); 272 - link = &lp->link; 273 272 link->priv = dev; 273 + lp->p_dev = p_dev; 274 274 275 275 spin_lock_init(&lp->window_lock); 276 276 link->io.NumPorts1 = 32; ··· 297 297 dev->watchdog_timeo = TX_TIMEOUT; 298 298 #endif 299 299 300 - link->handle = p_dev; 301 - p_dev->instance = link; 302 - 303 300 link->state |= DEV_PRESENT | DEV_CONFIG_PENDING; 304 301 tc574_config(link); 305 302 ··· 319 322 320 323 DEBUG(0, "3c574_detach(0x%p)\n", link); 321 324 322 - if (link->dev) 325 + if (link->dev_node) 323 326 unregister_netdev(dev); 324 327 325 328 if (link->state & DEV_CONFIG) ··· 470 473 } 471 474 472 475 link->state &= ~DEV_CONFIG_PENDING; 473 - link->dev = &lp->node; 476 + link->dev_node = &lp->node; 474 477 SET_NETDEV_DEV(dev, &handle_to_dev(handle)); 475 478 476 479 if (register_netdev(dev) != 0) { 477 480 printk(KERN_NOTICE "3c574_cs: register_netdev() failed\n"); 478 - link->dev = NULL; 481 + link->dev_node = NULL; 479 482 goto failed; 480 483 } 481 484 ··· 739 742 static int el3_open(struct net_device *dev) 740 743 { 741 744 struct el3_private *lp = netdev_priv(dev); 742 - dev_link_t *link = &lp->link; 745 + dev_link_t *link = lp->p_dev; 743 746 744 747 if (!DEV_OK(link)) 745 748 return -ENODEV; ··· 1185 1188 { 1186 1189 kio_addr_t ioaddr = dev->base_addr; 1187 1190 struct el3_private *lp = netdev_priv(dev); 1188 - dev_link_t *link = &lp->link; 1191 + dev_link_t *link = lp->p_dev; 1189 1192 1190 1193 DEBUG(2, "%s: shutting down ethercard.\n", dev->name); 1191 1194
+10 -13
drivers/net/pcmcia/3c589_cs.c
··· 105 105 #define TX_TIMEOUT ((400*HZ)/1000) 106 106 107 107 struct el3_private { 108 - dev_link_t link; 108 + struct pcmcia_device *p_dev; 109 109 dev_node_t node; 110 110 struct net_device_stats stats; 111 111 /* For transceiver monitoring */ ··· 173 173 static int tc589_attach(struct pcmcia_device *p_dev) 174 174 { 175 175 struct el3_private *lp; 176 - dev_link_t *link; 177 176 struct net_device *dev; 177 + dev_link_t *link = dev_to_instance(p_dev); 178 178 179 179 DEBUG(0, "3c589_attach()\n"); 180 180 ··· 183 183 if (!dev) 184 184 return -ENOMEM; 185 185 lp = netdev_priv(dev); 186 - link = &lp->link; 187 186 link->priv = dev; 187 + lp->p_dev = p_dev; 188 188 189 189 spin_lock_init(&lp->lock); 190 190 link->io.NumPorts1 = 16; ··· 212 212 #endif 213 213 SET_ETHTOOL_OPS(dev, &netdev_ethtool_ops); 214 214 215 - link->handle = p_dev; 216 - p_dev->instance = link; 217 - 218 215 link->state |= DEV_PRESENT | DEV_CONFIG_PENDING; 219 216 tc589_config(link); 220 217 ··· 234 237 235 238 DEBUG(0, "3c589_detach(0x%p)\n", link); 236 239 237 - if (link->dev) 240 + if (link->dev_node) 238 241 unregister_netdev(dev); 239 242 240 243 if (link->state & DEV_CONFIG) ··· 342 345 else 343 346 printk(KERN_ERR "3c589_cs: invalid if_port requested\n"); 344 347 345 - link->dev = &lp->node; 348 + link->dev_node = &lp->node; 346 349 link->state &= ~DEV_CONFIG_PENDING; 347 350 SET_NETDEV_DEV(dev, &handle_to_dev(handle)); 348 351 349 352 if (register_netdev(dev) != 0) { 350 353 printk(KERN_ERR "3c589_cs: register_netdev() failed\n"); 351 - link->dev = NULL; 354 + link->dev_node = NULL; 352 355 goto failed; 353 356 } 354 357 ··· 569 572 static int el3_open(struct net_device *dev) 570 573 { 571 574 struct el3_private *lp = netdev_priv(dev); 572 - dev_link_t *link = &lp->link; 575 + dev_link_t *link = lp->p_dev; 573 576 574 577 if (!DEV_OK(link)) 575 578 return -ENODEV; ··· 830 833 { 831 834 struct el3_private *lp = netdev_priv(dev); 832 835 unsigned long flags; 833 - dev_link_t *link = &lp->link; 836 + dev_link_t *link = lp->p_dev; 834 837 835 838 if (DEV_OK(link)) { 836 839 spin_lock_irqsave(&lp->lock, flags); ··· 932 935 static void set_multicast_list(struct net_device *dev) 933 936 { 934 937 struct el3_private *lp = netdev_priv(dev); 935 - dev_link_t *link = &lp->link; 938 + dev_link_t *link = lp->p_dev; 936 939 kio_addr_t ioaddr = dev->base_addr; 937 940 u16 opts = SetRxFilter | RxStation | RxBroadcast; 938 941 ··· 947 950 static int el3_close(struct net_device *dev) 948 951 { 949 952 struct el3_private *lp = netdev_priv(dev); 950 - dev_link_t *link = &lp->link; 953 + dev_link_t *link = lp->p_dev; 951 954 kio_addr_t ioaddr = dev->base_addr; 952 955 953 956 DEBUG(1, "%s: shutting down ethercard.\n", dev->name);
+8 -11
drivers/net/pcmcia/axnet_cs.c
··· 117 117 /*====================================================================*/ 118 118 119 119 typedef struct axnet_dev_t { 120 - dev_link_t link; 120 + struct pcmcia_device *p_dev; 121 121 dev_node_t node; 122 122 caddr_t base; 123 123 struct timer_list watchdog; ··· 145 145 static int axnet_attach(struct pcmcia_device *p_dev) 146 146 { 147 147 axnet_dev_t *info; 148 - dev_link_t *link; 149 148 struct net_device *dev; 149 + dev_link_t *link = dev_to_instance(p_dev); 150 150 151 151 DEBUG(0, "axnet_attach()\n"); 152 152 ··· 157 157 return -ENOMEM; 158 158 159 159 info = PRIV(dev); 160 - link = &info->link; 160 + info->p_dev = p_dev; 161 161 link->priv = dev; 162 162 link->irq.Attributes = IRQ_TYPE_EXCLUSIVE; 163 163 link->irq.IRQInfo1 = IRQ_LEVEL_ID; ··· 168 168 dev->stop = &axnet_close; 169 169 dev->do_ioctl = &axnet_ioctl; 170 170 SET_ETHTOOL_OPS(dev, &netdev_ethtool_ops); 171 - 172 - link->handle = p_dev; 173 - p_dev->instance = link; 174 171 175 172 link->state |= DEV_PRESENT | DEV_CONFIG_PENDING; 176 173 axnet_config(link); ··· 191 194 192 195 DEBUG(0, "axnet_detach(0x%p)\n", link); 193 196 194 - if (link->dev) 197 + if (link->dev_node) 195 198 unregister_netdev(dev); 196 199 197 200 if (link->state & DEV_CONFIG) ··· 406 409 } 407 410 408 411 info->phy_id = (i < 32) ? i : -1; 409 - link->dev = &info->node; 412 + link->dev_node = &info->node; 410 413 link->state &= ~DEV_CONFIG_PENDING; 411 414 SET_NETDEV_DEV(dev, &handle_to_dev(handle)); 412 415 413 416 if (register_netdev(dev) != 0) { 414 417 printk(KERN_NOTICE "axnet_cs: register_netdev() failed\n"); 415 - link->dev = NULL; 418 + link->dev_node = NULL; 416 419 goto failed; 417 420 } 418 421 ··· 540 543 static int axnet_open(struct net_device *dev) 541 544 { 542 545 axnet_dev_t *info = PRIV(dev); 543 - dev_link_t *link = &info->link; 546 + dev_link_t *link = info->p_dev; 544 547 545 548 DEBUG(2, "axnet_open('%s')\n", dev->name); 546 549 ··· 566 569 static int axnet_close(struct net_device *dev) 567 570 { 568 571 axnet_dev_t *info = PRIV(dev); 569 - dev_link_t *link = &info->link; 572 + dev_link_t *link = info->p_dev; 570 573 571 574 DEBUG(2, "axnet_close('%s')\n", dev->name); 572 575
+15 -24
drivers/net/pcmcia/com20020_cs.c
··· 140 140 141 141 static int com20020_attach(struct pcmcia_device *p_dev) 142 142 { 143 - dev_link_t *link; 144 143 com20020_dev_t *info; 145 144 struct net_device *dev; 146 145 struct arcnet_local *lp; ··· 147 148 DEBUG(0, "com20020_attach()\n"); 148 149 149 150 /* Create new network device */ 150 - link = kmalloc(sizeof(struct dev_link_t), GFP_KERNEL); 151 - if (!link) 152 - return -ENOMEM; 153 - 154 151 info = kmalloc(sizeof(struct com20020_dev_t), GFP_KERNEL); 155 152 if (!info) 156 153 goto fail_alloc_info; ··· 156 161 goto fail_alloc_dev; 157 162 158 163 memset(info, 0, sizeof(struct com20020_dev_t)); 159 - memset(link, 0, sizeof(struct dev_link_t)); 160 164 lp = dev->priv; 161 165 lp->timeout = timeout; 162 166 lp->backplane = backplane; ··· 166 172 /* fill in our module parameters as defaults */ 167 173 dev->dev_addr[0] = node; 168 174 169 - link->io.Attributes1 = IO_DATA_PATH_WIDTH_8; 170 - link->io.NumPorts1 = 16; 171 - link->io.IOAddrLines = 16; 172 - link->irq.Attributes = IRQ_TYPE_EXCLUSIVE; 173 - link->irq.IRQInfo1 = IRQ_LEVEL_ID; 174 - link->conf.Attributes = CONF_ENABLE_IRQ; 175 - link->conf.IntType = INT_MEMORY_AND_IO; 176 - link->conf.Present = PRESENT_OPTION; 175 + p_dev->io.Attributes1 = IO_DATA_PATH_WIDTH_8; 176 + p_dev->io.NumPorts1 = 16; 177 + p_dev->io.IOAddrLines = 16; 178 + p_dev->irq.Attributes = IRQ_TYPE_EXCLUSIVE; 179 + p_dev->irq.IRQInfo1 = IRQ_LEVEL_ID; 180 + p_dev->conf.Attributes = CONF_ENABLE_IRQ; 181 + p_dev->conf.IntType = INT_MEMORY_AND_IO; 182 + p_dev->conf.Present = PRESENT_OPTION; 177 183 178 - link->irq.Instance = info->dev = dev; 179 - link->priv = info; 184 + p_dev->irq.Instance = info->dev = dev; 185 + p_dev->priv = info; 180 186 181 - link->state |= DEV_PRESENT; 182 - com20020_config(link); 187 + p_dev->state |= DEV_PRESENT; 188 + com20020_config(p_dev); 183 189 184 190 return 0; 185 191 186 192 fail_alloc_dev: 187 193 kfree(info); 188 194 fail_alloc_info: 189 - kfree(link); 190 195 return -ENOMEM; 191 196 } /* com20020_attach */ 192 197 ··· 208 215 209 216 DEBUG(0, "com20020_detach(0x%p)\n", link); 210 217 211 - if (link->dev) { 218 + if (link->dev_node) { 212 219 DEBUG(1,"unregister...\n"); 213 220 214 221 unregister_netdev(dev); ··· 237 244 DEBUG(1,"kfree2...\n"); 238 245 kfree(info); 239 246 } 240 - DEBUG(1,"kfree3...\n"); 241 - kfree(link); 242 247 243 248 } /* com20020_detach */ 244 249 ··· 332 341 lp->card_name = "PCMCIA COM20020"; 333 342 lp->card_flags = ARC_CAN_10MBIT; /* pretend all of them can 10Mbit */ 334 343 335 - link->dev = &info->node; 344 + link->dev_node = &info->node; 336 345 link->state &= ~DEV_CONFIG_PENDING; 337 346 SET_NETDEV_DEV(dev, &handle_to_dev(handle)); 338 347 ··· 340 349 341 350 if (i != 0) { 342 351 DEBUG(1,KERN_NOTICE "com20020_cs: com20020_found() failed\n"); 343 - link->dev = NULL; 352 + link->dev_node = NULL; 344 353 goto failed; 345 354 } 346 355
+8 -11
drivers/net/pcmcia/fmvj18x_cs.c
··· 116 116 driver specific data structure 117 117 */ 118 118 typedef struct local_info_t { 119 - dev_link_t link; 119 + struct pcmcia_device *p_dev; 120 120 dev_node_t node; 121 121 struct net_device_stats stats; 122 122 long open_time; ··· 231 231 static int fmvj18x_attach(struct pcmcia_device *p_dev) 232 232 { 233 233 local_info_t *lp; 234 - dev_link_t *link; 235 234 struct net_device *dev; 235 + dev_link_t *link = dev_to_instance(p_dev); 236 236 237 237 DEBUG(0, "fmvj18x_attach()\n"); 238 238 ··· 241 241 if (!dev) 242 242 return -ENOMEM; 243 243 lp = netdev_priv(dev); 244 - link = &lp->link; 245 244 link->priv = dev; 245 + lp->p_dev = p_dev; 246 246 247 247 /* The io structure describes IO port mapping */ 248 248 link->io.NumPorts1 = 32; ··· 273 273 #endif 274 274 SET_ETHTOOL_OPS(dev, &netdev_ethtool_ops); 275 275 276 - link->handle = p_dev; 277 - p_dev->instance = link; 278 - 279 276 link->state |= DEV_PRESENT | DEV_CONFIG_PENDING; 280 277 fmvj18x_config(link); 281 278 ··· 288 291 289 292 DEBUG(0, "fmvj18x_detach(0x%p)\n", link); 290 293 291 - if (link->dev) 294 + if (link->dev_node) 292 295 unregister_netdev(dev); 293 296 294 297 if (link->state & DEV_CONFIG) ··· 536 539 } 537 540 538 541 lp->cardtype = cardtype; 539 - link->dev = &lp->node; 542 + link->dev_node = &lp->node; 540 543 link->state &= ~DEV_CONFIG_PENDING; 541 544 SET_NETDEV_DEV(dev, &handle_to_dev(handle)); 542 545 543 546 if (register_netdev(dev) != 0) { 544 547 printk(KERN_NOTICE "fmvj18x_cs: register_netdev() failed\n"); 545 - link->dev = NULL; 548 + link->dev_node = NULL; 546 549 goto failed; 547 550 } 548 551 ··· 1122 1125 static int fjn_open(struct net_device *dev) 1123 1126 { 1124 1127 struct local_info_t *lp = netdev_priv(dev); 1125 - dev_link_t *link = &lp->link; 1128 + dev_link_t *link = lp->p_dev; 1126 1129 1127 1130 DEBUG(4, "fjn_open('%s').\n", dev->name); 1128 1131 ··· 1147 1150 static int fjn_close(struct net_device *dev) 1148 1151 { 1149 1152 struct local_info_t *lp = netdev_priv(dev); 1150 - dev_link_t *link = &lp->link; 1153 + dev_link_t *link = lp->p_dev; 1151 1154 kio_addr_t ioaddr = dev->base_addr; 1152 1155 1153 1156 DEBUG(4, "fjn_close('%s').\n", dev->name);
+7 -10
drivers/net/pcmcia/ibmtr_cs.c
··· 113 113 /*====================================================================*/ 114 114 115 115 typedef struct ibmtr_dev_t { 116 - dev_link_t link; 116 + struct pcmcia_device *p_dev; 117 117 struct net_device *dev; 118 118 dev_node_t node; 119 119 window_handle_t sram_win_handle; ··· 141 141 static int ibmtr_attach(struct pcmcia_device *p_dev) 142 142 { 143 143 ibmtr_dev_t *info; 144 - dev_link_t *link; 145 144 struct net_device *dev; 145 + dev_link_t *link = dev_to_instance(p_dev); 146 146 147 147 DEBUG(0, "ibmtr_attach()\n"); 148 148 ··· 156 156 return -ENOMEM; 157 157 } 158 158 159 - link = &info->link; 159 + info->p_dev = p_dev; 160 160 link->priv = info; 161 161 info->ti = netdev_priv(dev); 162 162 ··· 171 171 link->conf.Present = PRESENT_OPTION; 172 172 173 173 link->irq.Instance = info->dev = dev; 174 - 175 - SET_ETHTOOL_OPS(dev, &netdev_ethtool_ops); 176 174 177 - link->handle = p_dev; 178 - p_dev->instance = link; 175 + SET_ETHTOOL_OPS(dev, &netdev_ethtool_ops); 179 176 180 177 link->state |= DEV_PRESENT; 181 178 ibmtr_config(link); ··· 197 200 198 201 DEBUG(0, "ibmtr_detach(0x%p)\n", link); 199 202 200 - if (link->dev) 203 + if (link->dev_node) 201 204 unregister_netdev(dev); 202 205 203 206 { ··· 305 308 Adapters Technical Reference" SC30-3585 for this info. */ 306 309 ibmtr_hw_setup(dev, mmiobase); 307 310 308 - link->dev = &info->node; 311 + link->dev_node = &info->node; 309 312 link->state &= ~DEV_CONFIG_PENDING; 310 313 SET_NETDEV_DEV(dev, &handle_to_dev(handle)); 311 314 312 315 i = ibmtr_probe_card(dev); 313 316 if (i != 0) { 314 317 printk(KERN_NOTICE "ibmtr_cs: register_netdev() failed\n"); 315 - link->dev = NULL; 318 + link->dev_node = NULL; 316 319 goto failed; 317 320 } 318 321
+9 -12
drivers/net/pcmcia/nmclan_cs.c
··· 362 362 } mace_statistics; 363 363 364 364 typedef struct _mace_private { 365 - dev_link_t link; 365 + struct pcmcia_device *p_dev; 366 366 dev_node_t node; 367 367 struct net_device_stats linux_stats; /* Linux statistics counters */ 368 368 mace_statistics mace_stats; /* MACE chip statistics counters */ ··· 446 446 static int nmclan_attach(struct pcmcia_device *p_dev) 447 447 { 448 448 mace_private *lp; 449 - dev_link_t *link; 450 449 struct net_device *dev; 450 + dev_link_t *link = dev_to_instance(p_dev); 451 451 452 452 DEBUG(0, "nmclan_attach()\n"); 453 453 DEBUG(1, "%s\n", rcsid); ··· 457 457 if (!dev) 458 458 return -ENOMEM; 459 459 lp = netdev_priv(dev); 460 - link = &lp->link; 460 + lp->p_dev = p_dev; 461 461 link->priv = dev; 462 462 463 463 spin_lock_init(&lp->bank_lock); ··· 488 488 dev->watchdog_timeo = TX_TIMEOUT; 489 489 #endif 490 490 491 - link->handle = p_dev; 492 - p_dev->instance = link; 493 - 494 491 link->state |= DEV_PRESENT | DEV_CONFIG_PENDING; 495 492 nmclan_config(link); 496 493 ··· 509 512 510 513 DEBUG(0, "nmclan_detach(0x%p)\n", link); 511 514 512 - if (link->dev) 515 + if (link->dev_node) 513 516 unregister_netdev(dev); 514 517 515 518 if (link->state & DEV_CONFIG) ··· 726 729 else 727 730 printk(KERN_NOTICE "nmclan_cs: invalid if_port requested\n"); 728 731 729 - link->dev = &lp->node; 732 + link->dev_node = &lp->node; 730 733 link->state &= ~DEV_CONFIG_PENDING; 731 734 SET_NETDEV_DEV(dev, &handle_to_dev(handle)); 732 735 733 736 i = register_netdev(dev); 734 737 if (i != 0) { 735 738 printk(KERN_NOTICE "nmclan_cs: register_netdev() failed\n"); 736 - link->dev = NULL; 739 + link->dev_node = NULL; 737 740 goto failed; 738 741 } 739 742 ··· 866 869 { 867 870 kio_addr_t ioaddr = dev->base_addr; 868 871 mace_private *lp = netdev_priv(dev); 869 - dev_link_t *link = &lp->link; 872 + dev_link_t *link = lp->p_dev; 870 873 871 874 if (!DEV_OK(link)) 872 875 return -ENODEV; ··· 889 892 { 890 893 kio_addr_t ioaddr = dev->base_addr; 891 894 mace_private *lp = netdev_priv(dev); 892 - dev_link_t *link = &lp->link; 895 + dev_link_t *link = lp->p_dev; 893 896 894 897 DEBUG(2, "%s: shutting down ethercard.\n", dev->name); 895 898 ··· 944 947 static void mace_tx_timeout(struct net_device *dev) 945 948 { 946 949 mace_private *lp = netdev_priv(dev); 947 - dev_link_t *link = &lp->link; 950 + dev_link_t *link = lp->p_dev; 948 951 949 952 printk(KERN_NOTICE "%s: transmit timed out -- ", dev->name); 950 953 #if RESET_ON_TIMEOUT
+9 -12
drivers/net/pcmcia/pcnet_cs.c
··· 214 214 static hw_info_t dl10022_info = { 0, 0, 0, 0, IS_DL10022|HAS_MII }; 215 215 216 216 typedef struct pcnet_dev_t { 217 - dev_link_t link; 217 + struct pcmcia_device *p_dev; 218 218 dev_node_t node; 219 219 u_int flags; 220 220 void __iomem *base; ··· 243 243 static int pcnet_probe(struct pcmcia_device *p_dev) 244 244 { 245 245 pcnet_dev_t *info; 246 - dev_link_t *link; 247 246 struct net_device *dev; 247 + dev_link_t *link = dev_to_instance(p_dev); 248 248 249 249 DEBUG(0, "pcnet_attach()\n"); 250 250 ··· 252 252 dev = __alloc_ei_netdev(sizeof(pcnet_dev_t)); 253 253 if (!dev) return -ENOMEM; 254 254 info = PRIV(dev); 255 - link = &info->link; 255 + info->p_dev = p_dev; 256 256 link->priv = dev; 257 257 258 258 link->irq.Attributes = IRQ_TYPE_EXCLUSIVE; ··· 264 264 dev->open = &pcnet_open; 265 265 dev->stop = &pcnet_close; 266 266 dev->set_config = &set_config; 267 - 268 - link->handle = p_dev; 269 - p_dev->instance = link; 270 267 271 268 link->state |= DEV_PRESENT | DEV_CONFIG_PENDING; 272 269 pcnet_config(link); ··· 287 290 288 291 DEBUG(0, "pcnet_detach(0x%p)\n", link); 289 292 290 - if (link->dev) 293 + if (link->dev_node) 291 294 unregister_netdev(dev); 292 295 293 296 if (link->state & DEV_CONFIG) ··· 671 674 info->eth_phy = 0; 672 675 } 673 676 674 - link->dev = &info->node; 677 + link->dev_node = &info->node; 675 678 link->state &= ~DEV_CONFIG_PENDING; 676 679 SET_NETDEV_DEV(dev, &handle_to_dev(handle)); 677 680 ··· 681 684 682 685 if (register_netdev(dev) != 0) { 683 686 printk(KERN_NOTICE "pcnet_cs: register_netdev() failed\n"); 684 - link->dev = NULL; 687 + link->dev_node = NULL; 685 688 goto failed; 686 689 } 687 690 ··· 1002 1005 static int pcnet_open(struct net_device *dev) 1003 1006 { 1004 1007 pcnet_dev_t *info = PRIV(dev); 1005 - dev_link_t *link = &info->link; 1006 - 1008 + dev_link_t *link = info->p_dev; 1009 + 1007 1010 DEBUG(2, "pcnet_open('%s')\n", dev->name); 1008 1011 1009 1012 if (!DEV_OK(link)) ··· 1030 1033 static int pcnet_close(struct net_device *dev) 1031 1034 { 1032 1035 pcnet_dev_t *info = PRIV(dev); 1033 - dev_link_t *link = &info->link; 1036 + dev_link_t *link = info->p_dev; 1034 1037 1035 1038 DEBUG(2, "pcnet_close('%s')\n", dev->name); 1036 1039
+8 -11
drivers/net/pcmcia/smc91c92_cs.c
··· 104 104 #define MEMORY_WAIT_TIME 8 105 105 106 106 struct smc_private { 107 - dev_link_t link; 107 + struct pcmcia_device *p_dev; 108 108 spinlock_t lock; 109 109 u_short manfid; 110 110 u_short cardid; ··· 312 312 static int smc91c92_attach(struct pcmcia_device *p_dev) 313 313 { 314 314 struct smc_private *smc; 315 - dev_link_t *link; 316 315 struct net_device *dev; 316 + dev_link_t *link = dev_to_instance(p_dev); 317 317 318 318 DEBUG(0, "smc91c92_attach()\n"); 319 319 ··· 322 322 if (!dev) 323 323 return -ENOMEM; 324 324 smc = netdev_priv(dev); 325 - link = &smc->link; 325 + smc->p_dev = p_dev; 326 326 link->priv = dev; 327 327 328 328 spin_lock_init(&smc->lock); ··· 357 357 smc->mii_if.phy_id_mask = 0x1f; 358 358 smc->mii_if.reg_num_mask = 0x1f; 359 359 360 - link->handle = p_dev; 361 - p_dev->instance = link; 362 - 363 360 link->state |= DEV_PRESENT | DEV_CONFIG_PENDING; 364 361 smc91c92_config(link); 365 362 ··· 379 382 380 383 DEBUG(0, "smc91c92_detach(0x%p)\n", link); 381 384 382 - if (link->dev) 385 + if (link->dev_node) 383 386 unregister_netdev(dev); 384 387 385 388 if (link->state & DEV_CONFIG) ··· 1117 1120 SMC_SELECT_BANK(0); 1118 1121 } 1119 1122 1120 - link->dev = &smc->node; 1123 + link->dev_node = &smc->node; 1121 1124 link->state &= ~DEV_CONFIG_PENDING; 1122 1125 SET_NETDEV_DEV(dev, &handle_to_dev(handle)); 1123 1126 1124 1127 if (register_netdev(dev) != 0) { 1125 1128 printk(KERN_ERR "smc91c92_cs: register_netdev() failed\n"); 1126 - link->dev = NULL; 1129 + link->dev_node = NULL; 1127 1130 goto config_undo; 1128 1131 } 1129 1132 ··· 1269 1272 static int smc_open(struct net_device *dev) 1270 1273 { 1271 1274 struct smc_private *smc = netdev_priv(dev); 1272 - dev_link_t *link = &smc->link; 1275 + dev_link_t *link = smc->p_dev; 1273 1276 1274 1277 #ifdef PCMCIA_DEBUG 1275 1278 DEBUG(0, "%s: smc_open(%p), ID/Window %4.4x.\n", ··· 1306 1309 static int smc_close(struct net_device *dev) 1307 1310 { 1308 1311 struct smc_private *smc = netdev_priv(dev); 1309 - dev_link_t *link = &smc->link; 1312 + dev_link_t *link = smc->p_dev; 1310 1313 kio_addr_t ioaddr = dev->base_addr; 1311 1314 1312 1315 DEBUG(0, "%s: smc_close(), status %4.4x.\n",
+8 -11
drivers/net/pcmcia/xirc2ps_cs.c
··· 332 332 */ 333 333 334 334 typedef struct local_info_t { 335 - dev_link_t link; 335 + struct pcmcia_device *p_dev; 336 336 dev_node_t node; 337 337 struct net_device_stats stats; 338 338 int card_type; ··· 555 555 static int 556 556 xirc2ps_attach(struct pcmcia_device *p_dev) 557 557 { 558 - dev_link_t *link; 559 558 struct net_device *dev; 560 559 local_info_t *local; 560 + dev_link_t *link = dev_to_instance(p_dev); 561 561 562 562 DEBUG(0, "attach()\n"); 563 563 ··· 566 566 if (!dev) 567 567 return -ENOMEM; 568 568 local = netdev_priv(dev); 569 - link = &local->link; 569 + local->p_dev = p_dev; 570 570 link->priv = dev; 571 571 572 572 /* General socket configuration */ ··· 592 592 dev->watchdog_timeo = TX_TIMEOUT; 593 593 #endif 594 594 595 - link->handle = p_dev; 596 - p_dev->instance = link; 597 - 598 595 link->state |= DEV_PRESENT | DEV_CONFIG_PENDING; 599 596 xirc2ps_config(link); 600 597 ··· 613 616 614 617 DEBUG(0, "detach(0x%p)\n", link); 615 618 616 - if (link->dev) 619 + if (link->dev_node) 617 620 unregister_netdev(dev); 618 621 619 622 if (link->state & DEV_CONFIG) ··· 1046 1049 if (local->dingo) 1047 1050 do_reset(dev, 1); /* a kludge to make the cem56 work */ 1048 1051 1049 - link->dev = &local->node; 1052 + link->dev_node = &local->node; 1050 1053 link->state &= ~DEV_CONFIG_PENDING; 1051 1054 SET_NETDEV_DEV(dev, &handle_to_dev(handle)); 1052 1055 1053 1056 if ((err=register_netdev(dev))) { 1054 1057 printk(KNOT_XIRC "register_netdev() failed\n"); 1055 - link->dev = NULL; 1058 + link->dev_node = NULL; 1056 1059 goto config_error; 1057 1060 } 1058 1061 ··· 1534 1537 do_open(struct net_device *dev) 1535 1538 { 1536 1539 local_info_t *lp = netdev_priv(dev); 1537 - dev_link_t *link = &lp->link; 1540 + dev_link_t *link = lp->p_dev; 1538 1541 1539 1542 DEBUG(0, "do_open(%p)\n", dev); 1540 1543 ··· 1864 1867 { 1865 1868 kio_addr_t ioaddr = dev->base_addr; 1866 1869 local_info_t *lp = netdev_priv(dev); 1867 - dev_link_t *link = &lp->link; 1870 + dev_link_t *link = lp->p_dev; 1868 1871 1869 1872 DEBUG(0, "do_stop(%p)\n", dev); 1870 1873
+10 -23
drivers/net/wireless/airo_cs.c
··· 143 143 144 144 static int airo_attach(struct pcmcia_device *p_dev) 145 145 { 146 - dev_link_t *link; 147 146 local_info_t *local; 148 147 149 148 DEBUG(0, "airo_attach()\n"); 150 149 151 - /* Initialize the dev_link_t structure */ 152 - link = kzalloc(sizeof(struct dev_link_t), GFP_KERNEL); 153 - if (!link) { 154 - printk(KERN_ERR "airo_cs: no memory for new device\n"); 155 - return -ENOMEM; 156 - } 157 - 158 150 /* Interrupt setup */ 159 - link->irq.Attributes = IRQ_TYPE_EXCLUSIVE; 160 - link->irq.IRQInfo1 = IRQ_LEVEL_ID; 161 - link->irq.Handler = NULL; 151 + p_dev->irq.Attributes = IRQ_TYPE_EXCLUSIVE; 152 + p_dev->irq.IRQInfo1 = IRQ_LEVEL_ID; 153 + p_dev->irq.Handler = NULL; 162 154 163 155 /* 164 156 General socket configuration defaults can go here. In this ··· 159 167 and attributes of IO windows) are fixed by the nature of the 160 168 device, and can be hard-wired here. 161 169 */ 162 - link->conf.Attributes = 0; 163 - link->conf.IntType = INT_MEMORY_AND_IO; 170 + p_dev->conf.Attributes = 0; 171 + p_dev->conf.IntType = INT_MEMORY_AND_IO; 164 172 165 173 /* Allocate space for private device-specific data */ 166 174 local = kzalloc(sizeof(local_info_t), GFP_KERNEL); 167 175 if (!local) { 168 176 printk(KERN_ERR "airo_cs: no memory for new device\n"); 169 - kfree (link); 170 177 return -ENOMEM; 171 178 } 172 - link->priv = local; 179 + p_dev->priv = local; 173 180 174 - link->handle = p_dev; 175 - p_dev->instance = link; 176 - 177 - link->state |= DEV_PRESENT | DEV_CONFIG_PENDING; 178 - airo_config(link); 181 + p_dev->state |= DEV_PRESENT | DEV_CONFIG_PENDING; 182 + airo_config(p_dev); 179 183 180 184 return 0; 181 185 } /* airo_attach */ ··· 200 212 ((local_info_t*)link->priv)->eth_dev = NULL; 201 213 202 214 kfree(link->priv); 203 - kfree(link); 204 215 } /* airo_detach */ 205 216 206 217 /*====================================================================== ··· 365 378 366 379 /* 367 380 At this point, the dev_node_t structure(s) need to be 368 - initialized and arranged in a linked list at link->dev. 381 + initialized and arranged in a linked list at link->dev_node. 369 382 */ 370 383 strcpy(dev->node.dev_name, ((local_info_t*)link->priv)->eth_dev->name ); 371 384 dev->node.major = dev->node.minor = 0; 372 - link->dev = &dev->node; 385 + link->dev_node = &dev->node; 373 386 374 387 /* Finally, report what we've done */ 375 388 printk(KERN_INFO "%s: index 0x%02x: ",
+10 -23
drivers/net/wireless/atmel_cs.c
··· 154 154 155 155 static int atmel_attach(struct pcmcia_device *p_dev) 156 156 { 157 - dev_link_t *link; 158 157 local_info_t *local; 159 158 160 159 DEBUG(0, "atmel_attach()\n"); 161 160 162 - /* Initialize the dev_link_t structure */ 163 - link = kzalloc(sizeof(struct dev_link_t), GFP_KERNEL); 164 - if (!link) { 165 - printk(KERN_ERR "atmel_cs: no memory for new device\n"); 166 - return -ENOMEM; 167 - } 168 - 169 161 /* Interrupt setup */ 170 - link->irq.Attributes = IRQ_TYPE_EXCLUSIVE; 171 - link->irq.IRQInfo1 = IRQ_LEVEL_ID; 172 - link->irq.Handler = NULL; 162 + p_dev->irq.Attributes = IRQ_TYPE_EXCLUSIVE; 163 + p_dev->irq.IRQInfo1 = IRQ_LEVEL_ID; 164 + p_dev->irq.Handler = NULL; 173 165 174 166 /* 175 167 General socket configuration defaults can go here. In this ··· 170 178 and attributes of IO windows) are fixed by the nature of the 171 179 device, and can be hard-wired here. 172 180 */ 173 - link->conf.Attributes = 0; 174 - link->conf.IntType = INT_MEMORY_AND_IO; 181 + p_dev->conf.Attributes = 0; 182 + p_dev->conf.IntType = INT_MEMORY_AND_IO; 175 183 176 184 /* Allocate space for private device-specific data */ 177 185 local = kzalloc(sizeof(local_info_t), GFP_KERNEL); 178 186 if (!local) { 179 187 printk(KERN_ERR "atmel_cs: no memory for new device\n"); 180 - kfree (link); 181 188 return -ENOMEM; 182 189 } 183 - link->priv = local; 190 + p_dev->priv = local; 184 191 185 - link->handle = p_dev; 186 - p_dev->instance = link; 187 - 188 - link->state |= DEV_PRESENT | DEV_CONFIG_PENDING; 189 - atmel_config(link); 192 + p_dev->state |= DEV_PRESENT | DEV_CONFIG_PENDING; 193 + atmel_config(p_dev); 190 194 191 195 return 0; 192 196 } /* atmel_attach */ ··· 206 218 atmel_release(link); 207 219 208 220 kfree(link->priv); 209 - kfree(link); 210 221 } 211 222 212 223 /*====================================================================== ··· 374 387 375 388 /* 376 389 At this point, the dev_node_t structure(s) need to be 377 - initialized and arranged in a linked list at link->dev. 390 + initialized and arranged in a linked list at link->dev_node. 378 391 */ 379 392 strcpy(dev->node.dev_name, ((local_info_t*)link->priv)->eth_dev->name ); 380 393 dev->node.major = dev->node.minor = 0; 381 - link->dev = &dev->node; 394 + link->dev_node = &dev->node; 382 395 383 396 link->state &= ~DEV_CONFIG_PENDING; 384 397 return;
+4 -16
drivers/net/wireless/hostap/hostap_cs.c
··· 503 503 * initialize dev_link structure, but do not configure the card yet */ 504 504 static int prism2_attach(struct pcmcia_device *p_dev) 505 505 { 506 - dev_link_t *link; 507 - 508 - link = kmalloc(sizeof(dev_link_t), GFP_KERNEL); 509 - if (link == NULL) 510 - return -ENOMEM; 511 - 512 - memset(link, 0, sizeof(dev_link_t)); 513 - 514 506 PDEBUG(DEBUG_HW, "%s: setting Vcc=33 (constant)\n", dev_info); 515 - link->conf.IntType = INT_MEMORY_AND_IO; 507 + p_dev->conf.IntType = INT_MEMORY_AND_IO; 516 508 517 - link->handle = p_dev; 518 - p_dev->instance = link; 519 - 520 - link->state |= DEV_PRESENT | DEV_CONFIG_PENDING; 521 - if (prism2_config(link)) 509 + p_dev->state |= DEV_PRESENT | DEV_CONFIG_PENDING; 510 + if (prism2_config(p_dev)) 522 511 PDEBUG(DEBUG_EXTRA, "prism2_config() failed\n"); 523 512 524 513 return 0; ··· 535 546 prism2_free_local_data(dev); 536 547 kfree(hw_priv); 537 548 } 538 - kfree(link); 539 549 } 540 550 541 551 ··· 701 713 local->hw_priv = hw_priv; 702 714 hw_priv->link = link; 703 715 strcpy(hw_priv->node.dev_name, dev->name); 704 - link->dev = &hw_priv->node; 716 + link->dev_node = &hw_priv->node; 705 717 706 718 /* 707 719 * Allocate an interrupt line. Note that this does not assign a
+8 -11
drivers/net/wireless/netwave_cs.c
··· 268 268 }; 269 269 270 270 typedef struct netwave_private { 271 - dev_link_t link; 271 + struct pcmcia_device *p_dev; 272 272 spinlock_t spinlock; /* Serialize access to the hardware (SMP) */ 273 273 dev_node_t node; 274 274 u_char __iomem *ramBase; ··· 378 378 */ 379 379 static int netwave_attach(struct pcmcia_device *p_dev) 380 380 { 381 - dev_link_t *link; 382 381 struct net_device *dev; 383 382 netwave_private *priv; 383 + dev_link_t *link = dev_to_instance(p_dev); 384 384 385 385 DEBUG(0, "netwave_attach()\n"); 386 386 ··· 389 389 if (!dev) 390 390 return -ENOMEM; 391 391 priv = netdev_priv(dev); 392 - link = &priv->link; 392 + priv->p_dev = p_dev; 393 393 link->priv = dev; 394 394 395 395 /* The io structure describes IO port mapping */ ··· 429 429 dev->stop = &netwave_close; 430 430 link->irq.Instance = dev; 431 431 432 - link->handle = p_dev; 433 - p_dev->instance = link; 434 - 435 432 link->state |= DEV_PRESENT | DEV_CONFIG_PENDING; 436 433 netwave_pcmcia_config( link); 437 434 ··· 453 456 if (link->state & DEV_CONFIG) 454 457 netwave_release(link); 455 458 456 - if (link->dev) 459 + if (link->dev_node) 457 460 unregister_netdev(dev); 458 461 459 462 free_netdev(dev); ··· 827 830 } 828 831 829 832 strcpy(priv->node.dev_name, dev->name); 830 - link->dev = &priv->node; 833 + link->dev_node = &priv->node; 831 834 link->state &= ~DEV_CONFIG_PENDING; 832 835 833 836 /* Reset card before reading physical address */ ··· 1100 1103 u_char __iomem *ramBase; 1101 1104 struct net_device *dev = (struct net_device *)dev_id; 1102 1105 struct netwave_private *priv = netdev_priv(dev); 1103 - dev_link_t *link = &priv->link; 1106 + dev_link_t *link = priv->p_dev; 1104 1107 int i; 1105 1108 1106 1109 if (!netif_device_present(dev)) ··· 1354 1357 1355 1358 static int netwave_open(struct net_device *dev) { 1356 1359 netwave_private *priv = netdev_priv(dev); 1357 - dev_link_t *link = &priv->link; 1360 + dev_link_t *link = priv->p_dev; 1358 1361 1359 1362 DEBUG(1, "netwave_open: starting.\n"); 1360 1363 ··· 1371 1374 1372 1375 static int netwave_close(struct net_device *dev) { 1373 1376 netwave_private *priv = netdev_priv(dev); 1374 - dev_link_t *link = &priv->link; 1377 + dev_link_t *link = priv->p_dev; 1375 1378 1376 1379 DEBUG(1, "netwave_close: finishing.\n"); 1377 1380
+8 -14
drivers/net/wireless/orinoco_cs.c
··· 49 49 /* PCMCIA specific device information (goes in the card field of 50 50 * struct orinoco_private */ 51 51 struct orinoco_pccard { 52 - dev_link_t link; 52 + struct pcmcia_device *p_dev; 53 53 dev_node_t node; 54 54 55 55 /* Used to handle hard reset */ ··· 75 75 orinoco_cs_hard_reset(struct orinoco_private *priv) 76 76 { 77 77 struct orinoco_pccard *card = priv->card; 78 - dev_link_t *link = &card->link; 78 + dev_link_t *link = card->p_dev; 79 79 int err; 80 80 81 81 /* We need atomic ops here, because we're not holding the lock */ ··· 109 109 struct net_device *dev; 110 110 struct orinoco_private *priv; 111 111 struct orinoco_pccard *card; 112 - dev_link_t *link; 112 + dev_link_t *link = dev_to_instance(p_dev); 113 113 114 114 dev = alloc_orinocodev(sizeof(*card), orinoco_cs_hard_reset); 115 115 if (! dev) ··· 118 118 card = priv->card; 119 119 120 120 /* Link both structures together */ 121 - link = &card->link; 121 + card->p_dev = p_dev; 122 122 link->priv = dev; 123 123 124 124 /* Interrupt setup */ ··· 134 134 * the nature of the device, and can be hard-wired here. */ 135 135 link->conf.Attributes = 0; 136 136 link->conf.IntType = INT_MEMORY_AND_IO; 137 - 138 - /* Register with Card Services */ 139 - link->next = NULL; 140 - 141 - link->handle = p_dev; 142 - p_dev->instance = link; 143 137 144 138 link->state |= DEV_PRESENT | DEV_CONFIG_PENDING; 145 139 orinoco_cs_config(link); ··· 155 161 if (link->state & DEV_CONFIG) 156 162 orinoco_cs_release(link); 157 163 158 - DEBUG(0, PFX "detach: link=%p link->dev=%p\n", link, link->dev); 159 - if (link->dev) { 164 + DEBUG(0, PFX "detach: link=%p link->dev_node=%p\n", link, link->dev_node); 165 + if (link->dev_node) { 160 166 DEBUG(0, PFX "About to unregister net device %p\n", 161 167 dev); 162 168 unregister_netdev(dev); ··· 358 364 } 359 365 360 366 /* At this point, the dev_node_t structure(s) needs to be 361 - * initialized and arranged in a linked list at link->dev. */ 367 + * initialized and arranged in a linked list at link->dev_node. */ 362 368 strcpy(card->node.dev_name, dev->name); 363 - link->dev = &card->node; /* link->dev being non-NULL is also 369 + link->dev_node = &card->node; /* link->dev_node being non-NULL is also 364 370 used to indicate that the 365 371 net_device has been registered */ 366 372 link->state &= ~DEV_CONFIG_PENDING;
+33 -65
drivers/net/wireless/ray_cs.c
··· 190 190 static char *phy_addr = NULL; 191 191 192 192 193 - /* A linked list of "instances" of the ray device. Each actual 194 - PCMCIA card corresponds to one device instance, and is described 195 - by one dev_link_t structure (defined in ds.h). 196 - */ 197 - static dev_link_t *dev_list = NULL; 198 - 199 193 /* A dev_link_t structure has fields for most things that are needed 200 194 to keep track of a socket, but there will usually be some device 201 195 specific information that also needs to be kept track of. The ··· 197 203 a device-specific private data structure, like this. 198 204 */ 199 205 static unsigned int ray_mem_speed = 500; 206 + 207 + /* WARNING: THIS DRIVER IS NOT CAPABLE OF HANDLING MULTIPLE DEVICES! */ 208 + static struct pcmcia_device *this_device = NULL; 200 209 201 210 MODULE_AUTHOR("Corey Thomas <corey@world.std.com>"); 202 211 MODULE_DESCRIPTION("Raylink/WebGear wireless LAN driver"); ··· 305 308 =============================================================================*/ 306 309 static int ray_attach(struct pcmcia_device *p_dev) 307 310 { 308 - dev_link_t *link; 309 311 ray_dev_t *local; 310 312 struct net_device *dev; 311 - 313 + 312 314 DEBUG(1, "ray_attach()\n"); 313 - 314 - /* Initialize the dev_link_t structure */ 315 - link = kmalloc(sizeof(struct dev_link_t), GFP_KERNEL); 316 - 317 - if (!link) 318 - return -ENOMEM; 319 315 320 316 /* Allocate space for private device-specific data */ 321 317 dev = alloc_etherdev(sizeof(ray_dev_t)); 322 - 323 318 if (!dev) 324 319 goto fail_alloc_dev; 325 320 326 321 local = dev->priv; 327 - 328 - memset(link, 0, sizeof(struct dev_link_t)); 322 + local->finder = p_dev; 329 323 330 324 /* The io structure describes IO port mapping. None used here */ 331 - link->io.NumPorts1 = 0; 332 - link->io.Attributes1 = IO_DATA_PATH_WIDTH_8; 333 - link->io.IOAddrLines = 5; 325 + p_dev->io.NumPorts1 = 0; 326 + p_dev->io.Attributes1 = IO_DATA_PATH_WIDTH_8; 327 + p_dev->io.IOAddrLines = 5; 334 328 335 329 /* Interrupt setup. For PCMCIA, driver takes what's given */ 336 - link->irq.Attributes = IRQ_TYPE_EXCLUSIVE | IRQ_HANDLE_PRESENT; 337 - link->irq.IRQInfo1 = IRQ_LEVEL_ID; 338 - link->irq.Handler = &ray_interrupt; 330 + p_dev->irq.Attributes = IRQ_TYPE_EXCLUSIVE | IRQ_HANDLE_PRESENT; 331 + p_dev->irq.IRQInfo1 = IRQ_LEVEL_ID; 332 + p_dev->irq.Handler = &ray_interrupt; 339 333 340 334 /* General socket configuration */ 341 - link->conf.Attributes = CONF_ENABLE_IRQ; 342 - link->conf.IntType = INT_MEMORY_AND_IO; 343 - link->conf.ConfigIndex = 1; 344 - link->conf.Present = PRESENT_OPTION; 335 + p_dev->conf.Attributes = CONF_ENABLE_IRQ; 336 + p_dev->conf.IntType = INT_MEMORY_AND_IO; 337 + p_dev->conf.ConfigIndex = 1; 338 + p_dev->conf.Present = PRESENT_OPTION; 345 339 346 - link->priv = dev; 347 - link->irq.Instance = dev; 340 + p_dev->priv = dev; 341 + p_dev->irq.Instance = dev; 348 342 349 - local->finder = link; 343 + local->finder = p_dev; 350 344 local->card_status = CARD_INSERTED; 351 345 local->authentication_state = UNAUTHENTICATED; 352 346 local->num_multi = 0; 353 - DEBUG(2,"ray_attach link = %p, dev = %p, local = %p, intr = %p\n", 354 - link,dev,local,&ray_interrupt); 347 + DEBUG(2,"ray_attach p_dev = %p, dev = %p, local = %p, intr = %p\n", 348 + p_dev,dev,local,&ray_interrupt); 355 349 356 350 /* Raylink entries in the device structure */ 357 351 dev->hard_start_xmit = &ray_dev_start_xmit; ··· 366 378 367 379 init_timer(&local->timer); 368 380 369 - link->handle = p_dev; 370 - p_dev->instance = link; 371 - 372 - link->state |= DEV_PRESENT | DEV_CONFIG_PENDING; 373 - ray_config(link); 381 + p_dev->state |= DEV_PRESENT | DEV_CONFIG_PENDING; 382 + this_device = p_dev; 383 + ray_config(p_dev); 374 384 375 385 return 0; 376 386 377 387 fail_alloc_dev: 378 - kfree(link); 379 388 return -ENOMEM; 380 389 } /* ray_attach */ 381 390 /*============================================================================= ··· 384 399 static void ray_detach(struct pcmcia_device *p_dev) 385 400 { 386 401 dev_link_t *link = dev_to_instance(p_dev); 387 - dev_link_t **linkp; 388 402 struct net_device *dev; 389 403 ray_dev_t *local; 390 404 391 405 DEBUG(1, "ray_detach(0x%p)\n", link); 392 - 393 - /* Locate device structure */ 394 - for (linkp = &dev_list; *linkp; linkp = &(*linkp)->next) 395 - if (*linkp == link) break; 396 - if (*linkp == NULL) 397 - return; 398 406 407 + this_device = NULL; 399 408 dev = link->priv; 400 409 401 410 if (link->state & DEV_CONFIG) { ··· 399 420 del_timer(&local->timer); 400 421 } 401 422 402 - /* Unlink device structure, free pieces */ 403 - *linkp = link->next; 404 423 if (link->priv) { 405 - if (link->dev) unregister_netdev(dev); 424 + if (link->dev_node) unregister_netdev(dev); 406 425 free_netdev(dev); 407 426 } 408 - kfree(link); 409 427 DEBUG(2,"ray_cs ray_detach ending\n"); 410 428 } /* ray_detach */ 411 429 /*============================================================================= ··· 513 537 } 514 538 515 539 strcpy(local->node.dev_name, dev->name); 516 - link->dev = &local->node; 540 + link->dev_node = &local->node; 517 541 518 542 link->state &= ~DEV_CONFIG_PENDING; 519 543 printk(KERN_INFO "%s: RayLink, irq %d, hw_addr ", ··· 1616 1640 /*===========================================================================*/ 1617 1641 static int ray_open(struct net_device *dev) 1618 1642 { 1619 - dev_link_t *link; 1620 1643 ray_dev_t *local = (ray_dev_t *)dev->priv; 1644 + dev_link_t *link; 1645 + link = local->finder; 1621 1646 1622 1647 DEBUG(1, "ray_open('%s')\n", dev->name); 1623 1648 1624 - for (link = dev_list; link; link = link->next) 1625 - if (link->priv == dev) break; 1626 - if (!DEV_OK(link)) { 1627 - return -ENODEV; 1628 - } 1629 - 1630 - if (link->open == 0) local->num_multi = 0; 1649 + if (link->open == 0) 1650 + local->num_multi = 0; 1631 1651 link->open++; 1632 1652 1633 1653 /* If the card is not started, time to start it ! - Jean II */ ··· 1650 1678 /*===========================================================================*/ 1651 1679 static int ray_dev_close(struct net_device *dev) 1652 1680 { 1681 + ray_dev_t *local = (ray_dev_t *)dev->priv; 1653 1682 dev_link_t *link; 1683 + link = local->finder; 1654 1684 1655 1685 DEBUG(1, "ray_dev_close('%s')\n", dev->name); 1656 - 1657 - for (link = dev_list; link; link = link->next) 1658 - if (link->priv == dev) break; 1659 - if (link == NULL) 1660 - return -ENODEV; 1661 1686 1662 1687 link->open--; 1663 1688 netif_stop_queue(dev); ··· 2648 2679 struct freq_hop_element *pfh; 2649 2680 UCHAR c[33]; 2650 2681 2651 - link = dev_list; 2682 + link = this_device; 2652 2683 if (!link) 2653 2684 return 0; 2654 2685 dev = (struct net_device *)link->priv; ··· 2892 2923 #endif 2893 2924 2894 2925 pcmcia_unregister_driver(&ray_driver); 2895 - BUG_ON(dev_list != NULL); 2896 2926 } /* exit_ray_cs */ 2897 2927 2898 2928 module_init(init_ray_cs);
+9 -12
drivers/net/wireless/spectrum_cs.c
··· 63 63 /* PCMCIA specific device information (goes in the card field of 64 64 * struct orinoco_private */ 65 65 struct orinoco_pccard { 66 - dev_link_t link; 66 + struct pcmcia_device *p_dev; 67 67 dev_node_t node; 68 68 }; 69 69 ··· 554 554 spectrum_cs_hard_reset(struct orinoco_private *priv) 555 555 { 556 556 struct orinoco_pccard *card = priv->card; 557 - dev_link_t *link = &card->link; 557 + dev_link_t *link = card->p_dev; 558 558 int err; 559 559 560 560 if (!hermes_present(&priv->hw)) { 561 561 /* The firmware needs to be reloaded */ 562 - if (spectrum_dl_firmware(&priv->hw, &card->link) != 0) { 562 + if (spectrum_dl_firmware(&priv->hw, link) != 0) { 563 563 printk(KERN_ERR PFX "Firmware download failed\n"); 564 564 err = -ENODEV; 565 565 } ··· 589 589 struct net_device *dev; 590 590 struct orinoco_private *priv; 591 591 struct orinoco_pccard *card; 592 - dev_link_t *link; 592 + dev_link_t *link = dev_to_instance(p_dev); 593 593 594 594 dev = alloc_orinocodev(sizeof(*card), spectrum_cs_hard_reset); 595 595 if (! dev) ··· 598 598 card = priv->card; 599 599 600 600 /* Link both structures together */ 601 - link = &card->link; 601 + card->p_dev = p_dev; 602 602 link->priv = dev; 603 603 604 604 /* Interrupt setup */ ··· 614 614 * the nature of the device, and can be hard-wired here. */ 615 615 link->conf.Attributes = 0; 616 616 link->conf.IntType = INT_MEMORY_AND_IO; 617 - 618 - link->handle = p_dev; 619 - p_dev->instance = link; 620 617 621 618 link->state |= DEV_PRESENT | DEV_CONFIG_PENDING; 622 619 spectrum_cs_config(link); ··· 635 638 if (link->state & DEV_CONFIG) 636 639 spectrum_cs_release(link); 637 640 638 - DEBUG(0, PFX "detach: link=%p link->dev=%p\n", link, link->dev); 639 - if (link->dev) { 641 + DEBUG(0, PFX "detach: link=%p link->dev_node=%p\n", link, link->dev_node); 642 + if (link->dev_node) { 640 643 DEBUG(0, PFX "About to unregister net device %p\n", 641 644 dev); 642 645 unregister_netdev(dev); ··· 839 842 } 840 843 841 844 /* At this point, the dev_node_t structure(s) needs to be 842 - * initialized and arranged in a linked list at link->dev. */ 845 + * initialized and arranged in a linked list at link->dev_node. */ 843 846 strcpy(card->node.dev_name, dev->name); 844 - link->dev = &card->node; /* link->dev being non-NULL is also 847 + link->dev_node = &card->node; /* link->dev_node being non-NULL is also 845 848 used to indicate that the 846 849 net_device has been registered */ 847 850 link->state &= ~DEV_CONFIG_PENDING;
+16 -30
drivers/net/wireless/wavelan_cs.c
··· 4081 4081 } 4082 4082 4083 4083 strcpy(((net_local *) netdev_priv(dev))->node.dev_name, dev->name); 4084 - link->dev = &((net_local *) netdev_priv(dev))->node; 4084 + link->dev_node = &((net_local *) netdev_priv(dev))->node; 4085 4085 4086 4086 #ifdef DEBUG_CONFIG_TRACE 4087 4087 printk(KERN_DEBUG "<-wv_pcmcia_config()\n"); ··· 4583 4583 static int 4584 4584 wavelan_attach(struct pcmcia_device *p_dev) 4585 4585 { 4586 - dev_link_t * link; /* Info for cardmgr */ 4587 4586 struct net_device * dev; /* Interface generic data */ 4588 4587 net_local * lp; /* Interface specific data */ 4589 4588 ··· 4590 4591 printk(KERN_DEBUG "-> wavelan_attach()\n"); 4591 4592 #endif 4592 4593 4593 - /* Initialize the dev_link_t structure */ 4594 - link = kzalloc(sizeof(struct dev_link_t), GFP_KERNEL); 4595 - if (!link) return -ENOMEM; 4596 - 4597 4594 /* The io structure describes IO port mapping */ 4598 - link->io.NumPorts1 = 8; 4599 - link->io.Attributes1 = IO_DATA_PATH_WIDTH_8; 4600 - link->io.IOAddrLines = 3; 4595 + p_dev->io.NumPorts1 = 8; 4596 + p_dev->io.Attributes1 = IO_DATA_PATH_WIDTH_8; 4597 + p_dev->io.IOAddrLines = 3; 4601 4598 4602 4599 /* Interrupt setup */ 4603 - link->irq.Attributes = IRQ_TYPE_EXCLUSIVE | IRQ_HANDLE_PRESENT; 4604 - link->irq.IRQInfo1 = IRQ_LEVEL_ID; 4605 - link->irq.Handler = wavelan_interrupt; 4600 + p_dev->irq.Attributes = IRQ_TYPE_EXCLUSIVE | IRQ_HANDLE_PRESENT; 4601 + p_dev->irq.IRQInfo1 = IRQ_LEVEL_ID; 4602 + p_dev->irq.Handler = wavelan_interrupt; 4606 4603 4607 4604 /* General socket configuration */ 4608 - link->conf.Attributes = CONF_ENABLE_IRQ; 4609 - link->conf.IntType = INT_MEMORY_AND_IO; 4610 - 4611 - /* Chain drivers */ 4612 - link->next = NULL; 4605 + p_dev->conf.Attributes = CONF_ENABLE_IRQ; 4606 + p_dev->conf.IntType = INT_MEMORY_AND_IO; 4613 4607 4614 4608 /* Allocate the generic data structure */ 4615 4609 dev = alloc_etherdev(sizeof(net_local)); 4616 - if (!dev) { 4617 - kfree(link); 4610 + if (!dev) 4618 4611 return -ENOMEM; 4619 - } 4620 - link->priv = link->irq.Instance = dev; 4612 + 4613 + p_dev->priv = p_dev->irq.Instance = dev; 4621 4614 4622 4615 lp = netdev_priv(dev); 4623 4616 ··· 4626 4635 spin_lock_init(&lp->spinlock); 4627 4636 4628 4637 /* back links */ 4629 - lp->link = link; 4630 4638 lp->dev = dev; 4631 4639 4632 4640 /* wavelan NET3 callbacks */ ··· 4651 4661 /* Other specific data */ 4652 4662 dev->mtu = WAVELAN_MTU; 4653 4663 4654 - link->handle = p_dev; 4655 - p_dev->instance = link; 4656 - 4657 - link->state |= DEV_PRESENT | DEV_CONFIG_PENDING; 4658 - if(wv_pcmcia_config(link) && 4664 + p_dev->state |= DEV_PRESENT | DEV_CONFIG_PENDING; 4665 + if(wv_pcmcia_config(p_dev) && 4659 4666 wv_hw_config(dev)) 4660 4667 wv_init_info(dev); 4661 4668 else ··· 4700 4713 4701 4714 /* Remove ourselves from the kernel list of ethernet devices */ 4702 4715 /* Warning : can't be called from interrupt, timer or wavelan_close() */ 4703 - if (link->dev) 4716 + if (link->dev_node) 4704 4717 unregister_netdev(dev); 4705 - link->dev = NULL; 4718 + link->dev_node = NULL; 4706 4719 ((net_local *)netdev_priv(dev))->link = NULL; 4707 4720 ((net_local *)netdev_priv(dev))->dev = NULL; 4708 4721 free_netdev(dev); 4709 4722 } 4710 - kfree(link); 4711 4723 4712 4724 #ifdef DEBUG_CALLBACK_TRACE 4713 4725 printk(KERN_DEBUG "<- wavelan_detach()\n");
+1
drivers/net/wireless/wl3501.h
··· 611 611 struct iw_spy_data spy_data; 612 612 struct iw_public_data wireless_data; 613 613 struct dev_node_t node; 614 + struct pcmcia_device *p_dev; 614 615 }; 615 616 #endif
+9 -52
drivers/net/wireless/wl3501_cs.c
··· 226 226 iw_set_mgmt_info_element(from->id, to, from->data, from->len); 227 227 } 228 228 229 - /* 230 - * A linked list of "instances" of the wl24 device. Each actual PCMCIA card 231 - * corresponds to one device instance, and is described by one dev_link_t 232 - * structure (defined in ds.h). 233 - * 234 - * You may not want to use a linked list for this -- for example, the memory 235 - * card driver uses an array of dev_link_t pointers, where minor device numbers 236 - * are used to derive the corresponding array index. 237 - */ 238 - static dev_link_t *wl3501_dev_list; 239 - 240 229 static inline void wl3501_switch_page(struct wl3501_card *this, u8 page) 241 230 { 242 231 wl3501_outb(page, this->base_addr + WL3501_NIC_BSS); ··· 1271 1282 int rc = -ENODEV; 1272 1283 unsigned long flags; 1273 1284 dev_link_t *link; 1285 + link = this->p_dev; 1274 1286 1275 1287 spin_lock_irqsave(&this->lock, flags); 1276 - /* Check if the device is in wl3501_dev_list */ 1277 - for (link = wl3501_dev_list; link; link = link->next) 1278 - if (link->priv == dev) 1279 - break; 1280 - if (!link) 1281 - goto out; 1282 1288 link->open--; 1283 1289 1284 1290 /* Stop wl3501_hard_start_xmit() from now on */ ··· 1285 1301 1286 1302 rc = 0; 1287 1303 printk(KERN_INFO "%s: WL3501 closed\n", dev->name); 1288 - out: 1289 1304 spin_unlock_irqrestore(&this->lock, flags); 1290 1305 return rc; 1291 1306 } ··· 1384 1401 struct wl3501_card *this = dev->priv; 1385 1402 unsigned long flags; 1386 1403 dev_link_t *link; 1404 + link = this->p_dev; 1387 1405 1388 1406 spin_lock_irqsave(&this->lock, flags); 1389 - /* Check if the device is in wl3501_dev_list */ 1390 - for (link = wl3501_dev_list; link; link = link->next) 1391 - if (link->priv == dev) 1392 - break; 1393 1407 if (!DEV_OK(link)) 1394 1408 goto out; 1395 1409 netif_device_attach(dev); ··· 1480 1500 static void wl3501_detach(struct pcmcia_device *p_dev) 1481 1501 { 1482 1502 dev_link_t *link = dev_to_instance(p_dev); 1483 - dev_link_t **linkp; 1484 1503 struct net_device *dev = link->priv; 1485 - 1486 - /* Locate device structure */ 1487 - for (linkp = &wl3501_dev_list; *linkp; linkp = &(*linkp)->next) 1488 - if (*linkp == link) 1489 - break; 1490 - if (!*linkp) 1491 - goto out; 1492 1504 1493 1505 /* If the device is currently configured and active, we won't actually 1494 1506 * delete it yet. Instead, it is marked so that when the release() ··· 1494 1522 wl3501_release(link); 1495 1523 } 1496 1524 1497 - /* Unlink device structure, free pieces */ 1498 - *linkp = link->next; 1499 - 1500 1525 if (link->priv) 1501 1526 free_netdev(link->priv); 1502 - kfree(link); 1503 - out: 1527 + 1504 1528 return; 1505 1529 } 1506 1530 ··· 1923 1955 */ 1924 1956 static int wl3501_attach(struct pcmcia_device *p_dev) 1925 1957 { 1926 - dev_link_t *link; 1927 1958 struct net_device *dev; 1928 1959 struct wl3501_card *this; 1929 - 1930 - /* Initialize the dev_link_t structure */ 1931 - link = kzalloc(sizeof(*link), GFP_KERNEL); 1932 - if (!link) 1933 - return -ENOMEM; 1960 + dev_link_t *link = dev_to_instance(p_dev); 1934 1961 1935 1962 /* The io structure describes IO port mapping */ 1936 1963 link->io.NumPorts1 = 16; ··· 1954 1991 dev->get_stats = wl3501_get_stats; 1955 1992 this = dev->priv; 1956 1993 this->wireless_data.spy_data = &this->spy_data; 1994 + this->p_dev = p_dev; 1957 1995 dev->wireless_data = &this->wireless_data; 1958 1996 dev->wireless_handlers = (struct iw_handler_def *)&wl3501_handler_def; 1959 1997 SET_ETHTOOL_OPS(dev, &ops); 1960 1998 netif_stop_queue(dev); 1961 1999 link->priv = link->irq.Instance = dev; 1962 2000 1963 - link->handle = p_dev; 1964 - p_dev->instance = link; 1965 - 1966 2001 link->state |= DEV_PRESENT | DEV_CONFIG_PENDING; 1967 - wl3501_config(link); 2002 + wl3501_config(p_dev); 1968 2003 1969 2004 return 0; 1970 2005 out_link: 1971 - kfree(link); 1972 - link = NULL; 1973 2006 return -ENOMEM; 1974 2007 } 1975 2008 ··· 2046 2087 this = dev->priv; 2047 2088 /* 2048 2089 * At this point, the dev_node_t structure(s) should be initialized and 2049 - * arranged in a linked list at link->dev. 2090 + * arranged in a linked list at link->dev_node. 2050 2091 */ 2051 - link->dev = &this->node; 2092 + link->dev_node = &this->node; 2052 2093 link->state &= ~DEV_CONFIG_PENDING; 2053 2094 2054 2095 this->base_addr = dev->base_addr; ··· 2107 2148 struct net_device *dev = link->priv; 2108 2149 2109 2150 /* Unlink the device chain */ 2110 - if (link->dev) 2151 + if (link->dev_node) 2111 2152 unregister_netdev(dev); 2112 2153 2113 2154 pcmcia_disable_device(link->handle); ··· 2165 2206 2166 2207 static void __exit wl3501_exit_module(void) 2167 2208 { 2168 - dprintk(0, ": unloading"); 2169 2209 pcmcia_unregister_driver(&wl3501_driver); 2170 - BUG_ON(wl3501_dev_list != NULL); 2171 2210 } 2172 2211 2173 2212 module_init(wl3501_init_module);
+5 -7
drivers/parport/parport_cs.c
··· 81 81 #define FORCE_EPP_MODE 0x08 82 82 83 83 typedef struct parport_info_t { 84 - dev_link_t link; 84 + struct pcmcia_device *p_dev; 85 85 int ndev; 86 86 dev_node_t node; 87 87 struct parport *port; ··· 102 102 static int parport_attach(struct pcmcia_device *p_dev) 103 103 { 104 104 parport_info_t *info; 105 - dev_link_t *link; 105 + dev_link_t *link = dev_to_instance(p_dev); 106 106 107 107 DEBUG(0, "parport_attach()\n"); 108 108 ··· 110 110 info = kmalloc(sizeof(*info), GFP_KERNEL); 111 111 if (!info) return -ENOMEM; 112 112 memset(info, 0, sizeof(*info)); 113 - link = &info->link; link->priv = info; 113 + link->priv = info; 114 + info->p_dev = p_dev; 114 115 115 116 link->io.Attributes1 = IO_DATA_PATH_WIDTH_8; 116 117 link->io.Attributes2 = IO_DATA_PATH_WIDTH_8; ··· 119 118 link->irq.IRQInfo1 = IRQ_LEVEL_ID; 120 119 link->conf.Attributes = CONF_ENABLE_IRQ; 121 120 link->conf.IntType = INT_MEMORY_AND_IO; 122 - 123 - link->handle = p_dev; 124 - p_dev->instance = link; 125 121 126 122 link->state |= DEV_PRESENT | DEV_CONFIG_PENDING; 127 123 parport_config(link); ··· 237 239 info->node.minor = p->number; 238 240 info->port = p; 239 241 strcpy(info->node.dev_name, p->name); 240 - link->dev = &info->node; 242 + link->dev_node = &info->node; 241 243 242 244 link->state &= ~DEV_CONFIG_PENDING; 243 245 return;
+8 -11
drivers/pcmcia/ds.c
··· 391 391 } 392 392 393 393 p_dev->p_state &= ~CLIENT_UNBOUND; 394 + p_dev->handle = p_dev; 394 395 395 396 ret = p_drv->probe(p_dev); 396 397 if (ret) ··· 1040 1039 ret = p_drv->suspend(p_dev); 1041 1040 if (ret) 1042 1041 return ret; 1043 - if (p_dev->instance) { 1044 - p_dev->instance->state |= DEV_SUSPEND; 1045 - if ((p_dev->instance->state & DEV_CONFIG) && 1046 - !(p_dev->instance->state & DEV_SUSPEND_NORELEASE)) 1042 + p_dev->state |= DEV_SUSPEND; 1043 + if ((p_dev->state & DEV_CONFIG) && 1044 + !(p_dev->state & DEV_SUSPEND_NORELEASE)) 1047 1045 pcmcia_release_configuration(p_dev); 1048 - } 1049 1046 } 1050 1047 1051 1048 return 0; ··· 1060 1061 p_drv = to_pcmcia_drv(dev->driver); 1061 1062 1062 1063 if (p_drv && p_drv->resume) { 1063 - if (p_dev->instance) { 1064 - p_dev->instance->state &= ~DEV_SUSPEND; 1065 - if ((p_dev->instance->state & DEV_CONFIG) && 1066 - !(p_dev->instance->state & DEV_SUSPEND_NORELEASE)){ 1064 + p_dev->state &= ~DEV_SUSPEND; 1065 + if ((p_dev->state & DEV_CONFIG) && 1066 + !(p_dev->state & DEV_SUSPEND_NORELEASE)){ 1067 1067 ret = pcmcia_request_configuration(p_dev, 1068 - &p_dev->instance->conf); 1068 + &p_dev->conf); 1069 1069 if (ret) 1070 1070 return ret; 1071 1071 } 1072 - } 1073 1072 return p_drv->resume(p_dev); 1074 1073 } 1075 1074
+4 -5
drivers/pcmcia/pcmcia_ioctl.c
··· 229 229 * by userspace before, we need to 230 230 * return the "instance". */ 231 231 spin_unlock_irqrestore(&pcmcia_dev_list_lock, flags); 232 - bind_info->instance = p_dev->instance; 232 + bind_info->instance = p_dev; 233 233 ret = -EBUSY; 234 234 goto err_put_module; 235 235 } else { ··· 358 358 found: 359 359 spin_unlock_irqrestore(&pcmcia_dev_list_lock, flags); 360 360 361 - if ((!p_dev->instance) || 362 - (p_dev->instance->state & DEV_CONFIG_PENDING)) { 361 + if (p_dev->state & DEV_CONFIG_PENDING) { 363 362 ret = -EAGAIN; 364 363 goto err_put; 365 364 } 366 365 367 366 if (first) 368 - node = p_dev->instance->dev; 367 + node = p_dev->dev_node; 369 368 else 370 - for (node = p_dev->instance->dev; node; node = node->next) 369 + for (node = p_dev->dev_node; node; node = node->next) 371 370 if (node == bind_info->next) 372 371 break; 373 372 if (!node) {
+5 -8
drivers/pcmcia/pcmcia_resource.c
··· 942 942 EXPORT_SYMBOL(pcmcia_request_window); 943 943 944 944 void pcmcia_disable_device(struct pcmcia_device *p_dev) { 945 - if (!p_dev->instance) 946 - return; 947 - 948 945 pcmcia_release_configuration(p_dev); 949 - pcmcia_release_io(p_dev, &p_dev->instance->io); 950 - pcmcia_release_irq(p_dev, &p_dev->instance->irq); 951 - if (&p_dev->instance->win) 952 - pcmcia_release_window(p_dev->instance->win); 946 + pcmcia_release_io(p_dev, &p_dev->io); 947 + pcmcia_release_irq(p_dev, &p_dev->irq); 948 + if (&p_dev->win) 949 + pcmcia_release_window(p_dev->win); 953 950 954 - p_dev->instance->dev = NULL; 951 + p_dev->dev_node = NULL; 955 952 } 956 953 EXPORT_SYMBOL(pcmcia_disable_device);
+5 -16
drivers/scsi/pcmcia/aha152x_stub.c
··· 89 89 /*====================================================================*/ 90 90 91 91 typedef struct scsi_info_t { 92 - dev_link_t link; 92 + struct pcmcia_device *p_dev; 93 93 dev_node_t node; 94 94 struct Scsi_Host *host; 95 95 } scsi_info_t; ··· 103 103 static int aha152x_attach(struct pcmcia_device *p_dev) 104 104 { 105 105 scsi_info_t *info; 106 - dev_link_t *link; 106 + dev_link_t *link = dev_to_instance(p_dev); 107 107 108 108 DEBUG(0, "aha152x_attach()\n"); 109 109 ··· 111 111 info = kmalloc(sizeof(*info), GFP_KERNEL); 112 112 if (!info) return -ENOMEM; 113 113 memset(info, 0, sizeof(*info)); 114 - link = &info->link; link->priv = info; 114 + info->p_dev = p_dev; 115 + link->priv = info; 115 116 116 117 link->io.NumPorts1 = 0x20; 117 118 link->io.Attributes1 = IO_DATA_PATH_WIDTH_AUTO; ··· 122 121 link->conf.Attributes = CONF_ENABLE_IRQ; 123 122 link->conf.IntType = INT_MEMORY_AND_IO; 124 123 link->conf.Present = PRESENT_OPTION; 125 - 126 - link->handle = p_dev; 127 - p_dev->instance = link; 128 124 129 125 link->state |= DEV_PRESENT | DEV_CONFIG_PENDING; 130 126 aha152x_config_cs(link); ··· 134 136 static void aha152x_detach(struct pcmcia_device *p_dev) 135 137 { 136 138 dev_link_t *link = dev_to_instance(p_dev); 137 - dev_link_t **linkp; 138 139 139 140 DEBUG(0, "aha152x_detach(0x%p)\n", link); 140 - 141 - /* Locate device structure */ 142 - for (linkp = &dev_list; *linkp; linkp = &(*linkp)->next) 143 - if (*linkp == link) break; 144 - if (*linkp == NULL) 145 - return; 146 141 147 142 if (link->state & DEV_CONFIG) 148 143 aha152x_release_cs(link); 149 144 150 145 /* Unlink device structure, free bits */ 151 - *linkp = link->next; 152 146 kfree(link->priv); 153 - 154 147 } /* aha152x_detach */ 155 148 156 149 /*====================================================================*/ ··· 219 230 } 220 231 221 232 sprintf(info->node.dev_name, "scsi%d", host->host_no); 222 - link->dev = &info->node; 233 + link->dev_node = &info->node; 223 234 info->host = host; 224 235 225 236 link->state &= ~DEV_CONFIG_PENDING;
+5 -7
drivers/scsi/pcmcia/fdomain_stub.c
··· 73 73 /*====================================================================*/ 74 74 75 75 typedef struct scsi_info_t { 76 - dev_link_t link; 76 + struct pcmcia_device *p_dev; 77 77 dev_node_t node; 78 78 struct Scsi_Host *host; 79 79 } scsi_info_t; ··· 86 86 static int fdomain_attach(struct pcmcia_device *p_dev) 87 87 { 88 88 scsi_info_t *info; 89 - dev_link_t *link; 89 + dev_link_t *link = dev_to_instance(p_dev); 90 90 91 91 DEBUG(0, "fdomain_attach()\n"); 92 92 ··· 94 94 info = kmalloc(sizeof(*info), GFP_KERNEL); 95 95 if (!info) return -ENOMEM; 96 96 memset(info, 0, sizeof(*info)); 97 - link = &info->link; link->priv = info; 97 + info->p_dev = p_dev; 98 + link->priv = info; 98 99 link->io.NumPorts1 = 0x10; 99 100 link->io.Attributes1 = IO_DATA_PATH_WIDTH_AUTO; 100 101 link->io.IOAddrLines = 10; ··· 104 103 link->conf.Attributes = CONF_ENABLE_IRQ; 105 104 link->conf.IntType = INT_MEMORY_AND_IO; 106 105 link->conf.Present = PRESENT_OPTION; 107 - 108 - link->handle = p_dev; 109 - p_dev->instance = link; 110 106 111 107 link->state |= DEV_PRESENT | DEV_CONFIG_PENDING; 112 108 fdomain_config(link); ··· 189 191 scsi_scan_host(host); 190 192 191 193 sprintf(info->node.dev_name, "scsi%d", host->host_no); 192 - link->dev = &info->node; 194 + link->dev_node = &info->node; 193 195 info->host = host; 194 196 195 197 link->state &= ~DEV_CONFIG_PENDING;
+5 -8
drivers/scsi/pcmcia/nsp_cs.c
··· 1596 1596 static int nsp_cs_attach(struct pcmcia_device *p_dev) 1597 1597 { 1598 1598 scsi_info_t *info; 1599 - dev_link_t *link; 1600 1599 nsp_hw_data *data = &nsp_data_base; 1600 + dev_link_t *link = dev_to_instance(p_dev); 1601 1601 1602 1602 nsp_dbg(NSP_DEBUG_INIT, "in"); 1603 1603 ··· 1605 1605 info = kmalloc(sizeof(*info), GFP_KERNEL); 1606 1606 if (info == NULL) { return -ENOMEM; } 1607 1607 memset(info, 0, sizeof(*info)); 1608 - link = &info->link; 1608 + info->p_dev = p_dev; 1609 1609 link->priv = info; 1610 1610 data->ScsiInfo = info; 1611 1611 ··· 1629 1629 link->conf.Attributes = CONF_ENABLE_IRQ; 1630 1630 link->conf.IntType = INT_MEMORY_AND_IO; 1631 1631 link->conf.Present = PRESENT_OPTION; 1632 - 1633 - link->handle = p_dev; 1634 - p_dev->instance = link; 1635 1632 1636 1633 link->state |= DEV_PRESENT | DEV_CONFIG_PENDING; 1637 1634 nsp_cs_config(link); ··· 1850 1853 scsi_scan_host(host); 1851 1854 1852 1855 snprintf(info->node.dev_name, sizeof(info->node.dev_name), "scsi%d", host->host_no); 1853 - link->dev = &info->node; 1856 + link->dev_node = &info->node; 1854 1857 info->host = host; 1855 1858 1856 1859 #else 1857 1860 nsp_dbg(NSP_DEBUG_INIT, "GET_SCSI_INFO"); 1858 - tail = &link->dev; 1861 + tail = &link->dev_node; 1859 1862 info->ndev = 0; 1860 1863 1861 1864 nsp_dbg(NSP_DEBUG_INIT, "host=0x%p", host); ··· 1959 1962 #else 1960 1963 scsi_unregister_host(&nsp_driver_template); 1961 1964 #endif 1962 - link->dev = NULL; 1965 + link->dev_node = NULL; 1963 1966 1964 1967 if (link->win) { 1965 1968 if (data != NULL) {
+1 -1
drivers/scsi/pcmcia/nsp_cs.h
··· 225 225 /*====================================================================*/ 226 226 227 227 typedef struct scsi_info_t { 228 - dev_link_t link; 228 + struct pcmcia_device *p_dev; 229 229 struct Scsi_Host *host; 230 230 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,74)) 231 231 dev_node_t node;
+4 -7
drivers/scsi/pcmcia/qlogic_stub.c
··· 91 91 /*====================================================================*/ 92 92 93 93 typedef struct scsi_info_t { 94 - dev_link_t link; 94 + struct pcmcia_device *p_dev; 95 95 dev_node_t node; 96 96 struct Scsi_Host *host; 97 97 unsigned short manf_id; ··· 159 159 static int qlogic_attach(struct pcmcia_device *p_dev) 160 160 { 161 161 scsi_info_t *info; 162 - dev_link_t *link; 162 + dev_link_t *link = dev_to_instance(p_dev); 163 163 164 164 DEBUG(0, "qlogic_attach()\n"); 165 165 ··· 168 168 if (!info) 169 169 return -ENOMEM; 170 170 memset(info, 0, sizeof(*info)); 171 - link = &info->link; 171 + info->p_dev = p_dev; 172 172 link->priv = info; 173 173 link->io.NumPorts1 = 16; 174 174 link->io.Attributes1 = IO_DATA_PATH_WIDTH_AUTO; ··· 178 178 link->conf.Attributes = CONF_ENABLE_IRQ; 179 179 link->conf.IntType = INT_MEMORY_AND_IO; 180 180 link->conf.Present = PRESENT_OPTION; 181 - 182 - link->handle = p_dev; 183 - p_dev->instance = link; 184 181 185 182 link->state |= DEV_PRESENT | DEV_CONFIG_PENDING; 186 183 qlogic_config(link); ··· 275 278 } 276 279 277 280 sprintf(info->node.dev_name, "scsi%d", host->host_no); 278 - link->dev = &info->node; 281 + link->dev_node = &info->node; 279 282 info->host = host; 280 283 281 284 out:
+4 -7
drivers/scsi/pcmcia/sym53c500_cs.c
··· 202 202 /* ================================================================== */ 203 203 204 204 struct scsi_info_t { 205 - dev_link_t link; 205 + struct pcmcia_device *p_dev; 206 206 dev_node_t node; 207 207 struct Scsi_Host *host; 208 208 unsigned short manf_id; ··· 829 829 data->fast_pio = USE_FAST_PIO; 830 830 831 831 sprintf(info->node.dev_name, "scsi%d", host->host_no); 832 - link->dev = &info->node; 832 + link->dev_node = &info->node; 833 833 info->host = host; 834 834 835 835 if (scsi_add_host(host, NULL)) ··· 899 899 SYM53C500_attach(struct pcmcia_device *p_dev) 900 900 { 901 901 struct scsi_info_t *info; 902 - dev_link_t *link; 902 + dev_link_t *link = dev_to_instance(p_dev); 903 903 904 904 DEBUG(0, "SYM53C500_attach()\n"); 905 905 ··· 908 908 if (!info) 909 909 return -ENOMEM; 910 910 memset(info, 0, sizeof(*info)); 911 - link = &info->link; 911 + info->p_dev = p_dev; 912 912 link->priv = info; 913 913 link->io.NumPorts1 = 16; 914 914 link->io.Attributes1 = IO_DATA_PATH_WIDTH_AUTO; ··· 918 918 link->conf.Attributes = CONF_ENABLE_IRQ; 919 919 link->conf.IntType = INT_MEMORY_AND_IO; 920 920 link->conf.Present = PRESENT_OPTION; 921 - 922 - link->handle = p_dev; 923 - p_dev->instance = link; 924 921 925 922 link->state |= DEV_PRESENT | DEV_CONFIG_PENDING; 926 923 SYM53C500_config(link);
+7 -9
drivers/serial/serial_cs.c
··· 97 97 #define MULTI_COUNT (sizeof(multi_id)/sizeof(struct multi_id)) 98 98 99 99 struct serial_info { 100 - dev_link_t link; 100 + struct pcmcia_device *p_dev; 101 101 int ndev; 102 102 int multi; 103 103 int slave; ··· 135 135 /* 136 136 * Recheck to see if the device is still configured. 137 137 */ 138 - if (info->link.state & DEV_CONFIG) { 138 + if (info->p_dev->state & DEV_CONFIG) { 139 139 for (i = 0; i < info->ndev; i++) 140 140 serial8250_unregister_port(info->line[i]); 141 141 142 - info->link.dev = NULL; 142 + info->p_dev->dev_node = NULL; 143 143 144 144 if (!info->slave) 145 145 pcmcia_disable_device(link->handle); 146 146 147 - info->link.state &= ~DEV_CONFIG; 147 + info->p_dev->state &= ~DEV_CONFIG; 148 148 } 149 149 } 150 150 ··· 192 192 static int serial_probe(struct pcmcia_device *p_dev) 193 193 { 194 194 struct serial_info *info; 195 - dev_link_t *link; 195 + dev_link_t *link = dev_to_instance(p_dev); 196 196 197 197 DEBUG(0, "serial_attach()\n"); 198 198 ··· 201 201 if (!info) 202 202 return -ENOMEM; 203 203 memset(info, 0, sizeof (*info)); 204 - link = &info->link; 204 + info->p_dev = p_dev; 205 205 link->priv = info; 206 206 207 207 link->io.Attributes1 = IO_DATA_PATH_WIDTH_8; ··· 215 215 } 216 216 link->conf.IntType = INT_MEMORY_AND_IO; 217 217 218 - link->handle = p_dev; 219 - p_dev->instance = link; 220 218 link->state |= DEV_PRESENT | DEV_CONFIG_PENDING; 221 219 serial_config(link); 222 220 ··· 658 660 } 659 661 } 660 662 661 - link->dev = &info->node[0]; 663 + link->dev_node = &info->node[0]; 662 664 link->state &= ~DEV_CONFIG_PENDING; 663 665 kfree(cfg_mem); 664 666 return;
+10 -21
drivers/telephony/ixj_pcmcia.c
··· 40 40 41 41 static int ixj_attach(struct pcmcia_device *p_dev) 42 42 { 43 - dev_link_t *link; 44 - 45 43 DEBUG(0, "ixj_attach()\n"); 46 44 /* Create new ixj device */ 47 - link = kmalloc(sizeof(struct dev_link_t), GFP_KERNEL); 48 - if (!link) 49 - return -ENOMEM; 50 - memset(link, 0, sizeof(struct dev_link_t)); 51 - link->io.Attributes1 = IO_DATA_PATH_WIDTH_8; 52 - link->io.Attributes2 = IO_DATA_PATH_WIDTH_8; 53 - link->io.IOAddrLines = 3; 54 - link->conf.IntType = INT_MEMORY_AND_IO; 55 - link->priv = kmalloc(sizeof(struct ixj_info_t), GFP_KERNEL); 56 - if (!link->priv) { 57 - kfree(link); 45 + p_dev->io.Attributes1 = IO_DATA_PATH_WIDTH_8; 46 + p_dev->io.Attributes2 = IO_DATA_PATH_WIDTH_8; 47 + p_dev->io.IOAddrLines = 3; 48 + p_dev->conf.IntType = INT_MEMORY_AND_IO; 49 + p_dev->priv = kmalloc(sizeof(struct ixj_info_t), GFP_KERNEL); 50 + if (!p_dev->priv) { 58 51 return -ENOMEM; 59 52 } 60 - memset(link->priv, 0, sizeof(struct ixj_info_t)); 53 + memset(p_dev->priv, 0, sizeof(struct ixj_info_t)); 61 54 62 - link->handle = p_dev; 63 - p_dev->instance = link; 64 - 65 - link->state |= DEV_PRESENT | DEV_CONFIG_PENDING; 66 - ixj_config(link); 55 + p_dev->state |= DEV_PRESENT | DEV_CONFIG_PENDING; 56 + ixj_config(p_dev); 67 57 68 58 return 0; 69 59 } ··· 69 79 ixj_cs_release(link); 70 80 71 81 kfree(link->priv); 72 - kfree(link); 73 82 } 74 83 75 84 #define CS_CHECK(fn, ret) \ ··· 201 212 202 213 info->ndev = 1; 203 214 info->node.major = PHONE_MAJOR; 204 - link->dev = &info->node; 215 + link->dev_node = &info->node; 205 216 ixj_get_serial(link, j); 206 217 link->state &= ~DEV_CONFIG_PENDING; 207 218 return;
+4 -7
drivers/usb/host/sl811_cs.c
··· 67 67 static const char driver_name[DEV_NAME_LEN] = "sl811_cs"; 68 68 69 69 typedef struct local_info_t { 70 - dev_link_t link; 70 + struct pcmcia_device *p_dev; 71 71 dev_node_t node; 72 72 } local_info_t; 73 73 ··· 268 268 269 269 sprintf(dev->node.dev_name, driver_name); 270 270 dev->node.major = dev->node.minor = 0; 271 - link->dev = &dev->node; 271 + link->dev_node = &dev->node; 272 272 273 273 printk(KERN_INFO "%s: index 0x%02x: ", 274 274 dev->node.dev_name, link->conf.ConfigIndex); ··· 294 294 static int sl811_cs_attach(struct pcmcia_device *p_dev) 295 295 { 296 296 local_info_t *local; 297 - dev_link_t *link; 297 + dev_link_t *link = dev_to_instance(p_dev); 298 298 299 299 local = kmalloc(sizeof(local_info_t), GFP_KERNEL); 300 300 if (!local) 301 301 return -ENOMEM; 302 302 memset(local, 0, sizeof(local_info_t)); 303 - link = &local->link; 303 + local->p_dev = p_dev; 304 304 link->priv = local; 305 305 306 306 /* Initialize */ ··· 310 310 311 311 link->conf.Attributes = 0; 312 312 link->conf.IntType = INT_MEMORY_AND_IO; 313 - 314 - link->handle = p_dev; 315 - p_dev->instance = link; 316 313 317 314 link->state |= DEV_PRESENT | DEV_CONFIG_PENDING; 318 315 sl811_cs_config(link);
+14 -17
include/pcmcia/ds.h
··· 39 39 typedef struct bind_info_t { 40 40 dev_info_t dev_info; 41 41 u_char function; 42 - struct dev_link_t *instance; 42 + struct pcmcia_device *instance; 43 43 char name[DEV_NAME_LEN]; 44 44 u_short major, minor; 45 45 void *next; ··· 103 103 struct dev_node_t *next; 104 104 } dev_node_t; 105 105 106 - typedef struct dev_link_t { 107 - dev_node_t *dev; 108 - u_int state, open; 109 - client_handle_t handle; 110 - io_req_t io; 111 - irq_req_t irq; 112 - config_req_t conf; 113 - window_handle_t win; 114 - void *priv; 115 - struct dev_link_t *next; 116 - } dev_link_t; 117 - 118 106 /* Flags for device state */ 119 107 #define DEV_PRESENT 0x01 120 108 #define DEV_CONFIG 0x02 ··· 151 163 152 164 struct list_head socket_device_list; 153 165 154 - /* deprecated, a cleaned up version will be moved into this 155 - struct soon */ 156 - dev_link_t *instance; 166 + /* deprecated, will be cleaned up soon */ 167 + dev_node_t *dev_node; 168 + u_int state; 169 + u_int open; 170 + struct pcmcia_device *handle; 171 + io_req_t io; 172 + irq_req_t irq; 173 + config_req_t conf; 174 + window_handle_t win; 175 + void *priv; 176 + 157 177 u_int p_state; 158 178 159 179 /* information about this device */ ··· 185 189 struct pcmcia_driver * cardmgr; 186 190 #endif 187 191 }; 192 + typedef struct pcmcia_device dev_link_t; 188 193 189 194 #define to_pcmcia_dev(n) container_of(n, struct pcmcia_device, dev) 190 195 #define to_pcmcia_drv(n) container_of(n, struct pcmcia_driver, drv) ··· 193 196 #define handle_to_pdev(handle) (handle) 194 197 #define handle_to_dev(handle) (handle->dev) 195 198 196 - #define dev_to_instance(dev) (dev->instance) 199 + #define dev_to_instance(dev) (dev) 197 200 198 201 /* error reporting */ 199 202 void cs_error(client_handle_t handle, int func, int ret);
+5 -7
sound/pcmcia/pdaudiocf/pdaudiocf.c
··· 70 70 */ 71 71 static int snd_pdacf_free(struct snd_pdacf *pdacf) 72 72 { 73 - dev_link_t *link = &pdacf->link; 73 + dev_link_t *link = pdacf->p_dev; 74 74 75 75 pdacf_release(link); 76 76 ··· 99 99 static struct snd_device_ops ops = { 100 100 .dev_free = snd_pdacf_dev_free, 101 101 }; 102 + 103 + link = dev_to_instance(p_dev); 102 104 103 105 snd_printdd(KERN_DEBUG "pdacf_attach called\n"); 104 106 /* find an empty slot from the card list */ ··· 135 133 pdacf->index = i; 136 134 card_list[i] = card; 137 135 138 - link = &pdacf->link; 136 + pdacf->p_dev = p_dev; 139 137 link->priv = pdacf; 140 138 141 139 link->io.Attributes1 = IO_DATA_PATH_WIDTH_AUTO; ··· 152 150 link->conf.ConfigIndex = 1; 153 151 link->conf.Present = PRESENT_OPTION; 154 152 155 - /* Chain drivers */ 156 - link->next = NULL; 157 - 158 - link->handle = p_dev; 159 153 pdacf_config(link); 160 154 161 155 return 0; ··· 260 262 if (snd_pdacf_assign_resources(pdacf, link->io.BasePort1, link->irq.AssignedIRQ) < 0) 261 263 goto failed; 262 264 263 - link->dev = &pdacf->node; 265 + link->dev_node = &pdacf->node; 264 266 link->state &= ~DEV_CONFIG_PENDING; 265 267 return; 266 268
+1 -1
sound/pcmcia/pdaudiocf/pdaudiocf.h
··· 116 116 void *pcm_area; 117 117 118 118 /* pcmcia stuff */ 119 - dev_link_t link; 119 + struct pcmcia_device *p_dev; 120 120 dev_node_t node; 121 121 }; 122 122
+10 -10
sound/pcmcia/vx/vxpocket.c
··· 126 126 /* 127 127 * create vxpocket instance 128 128 */ 129 - static struct snd_vxpocket *snd_vxpocket_new(struct snd_card *card, int ibl) 129 + static struct snd_vxpocket *snd_vxpocket_new(struct snd_card *card, int ibl, 130 + struct pcmcia_device *p_dev) 130 131 { 131 132 dev_link_t *link; /* Info for cardmgr */ 132 133 struct vx_core *chip; ··· 135 134 static struct snd_device_ops ops = { 136 135 .dev_free = snd_vxpocket_dev_free, 137 136 }; 137 + 138 + link = dev_to_instance(p_dev); 138 139 139 140 chip = snd_vx_create(card, &vxpocket_hw, &snd_vxpocket_ops, 140 141 sizeof(struct snd_vxpocket) - sizeof(struct vx_core)); ··· 151 148 152 149 vxp = (struct snd_vxpocket *)chip; 153 150 154 - link = &vxp->link; 151 + vxp->p_dev = p_dev; 155 152 link->priv = chip; 156 153 157 154 link->io.Attributes1 = IO_DATA_PATH_WIDTH_AUTO; ··· 266 263 if (snd_vxpocket_assign_resources(chip, link->io.BasePort1, link->irq.AssignedIRQ) < 0) 267 264 goto failed; 268 265 269 - link->dev = &vxp->node; 266 + link->dev_node = &vxp->node; 270 267 link->state &= ~DEV_CONFIG_PENDING; 271 268 kfree(parse); 272 269 return; ··· 342 339 return -ENOMEM; 343 340 } 344 341 345 - vxp = snd_vxpocket_new(card, ibl[i]); 342 + vxp = snd_vxpocket_new(card, ibl[i], p_dev); 346 343 if (! vxp) { 347 344 snd_card_free(card); 348 345 return -ENODEV; ··· 352 349 vxp->index = i; 353 350 card_alloc |= 1 << i; 354 351 355 - /* Chain drivers */ 356 - vxp->link.next = NULL; 352 + vxp->p_dev = p_dev; 353 + vxp->p_dev->state |= DEV_PRESENT | DEV_CONFIG_PENDING; 357 354 358 - vxp->link.handle = p_dev; 359 - vxp->link.state |= DEV_PRESENT | DEV_CONFIG_PENDING; 360 - p_dev->instance = &vxp->link; 361 - vxpocket_config(&vxp->link); 355 + vxpocket_config(p_dev); 362 356 363 357 return 0; 364 358 }
+1 -1
sound/pcmcia/vx/vxpocket.h
··· 42 42 int index; /* card index */ 43 43 44 44 /* pcmcia stuff */ 45 - dev_link_t link; 45 + struct pcmcia_device *p_dev; 46 46 dev_node_t node; 47 47 }; 48 48