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

[PATCH] pcmcia: unify attach, EVENT_CARD_INSERTION handlers into one probe callback

Unify the EVENT_CARD_INSERTION and "attach" callbacks to one unified
probe() callback. As all in-kernel drivers are changed to this new
callback, there will be no temporary backwards-compatibility. Inside a
probe() function, each driver _must_ set struct pcmcia_device
*p_dev->instance and instance->handle correctly.

With these patches, the basic driver interface for 16-bit PCMCIA drivers
now has the classic four callbacks known also from other buses:

int (*probe) (struct pcmcia_device *dev);
void (*remove) (struct pcmcia_device *dev);

int (*suspend) (struct pcmcia_device *dev);
int (*resume) (struct pcmcia_device *dev);

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

+469 -2230
+4 -2
Documentation/pcmcia/driver-changes.txt
··· 1 1 This file details changes in 2.6 which affect PCMCIA card driver authors: 2 2 3 - * Unify detach and REMOVAL event code (as of 2.6.16) 4 - void (*remove) (struct pcmcia_device *dev); 3 + * Unify detach and REMOVAL event code, as well as attach and INSERTION 4 + code (as of 2.6.16) 5 + void (*remove) (struct pcmcia_device *dev); 6 + int (*probe) (struct pcmcia_device *dev); 5 7 6 8 * Move suspend, resume and reset out of event handler (as of 2.6.16) 7 9 int (*suspend) (struct pcmcia_device *dev);
+8 -36
drivers/bluetooth/bluecard_cs.c
··· 87 87 88 88 static void bluecard_config(dev_link_t *link); 89 89 static void bluecard_release(dev_link_t *link); 90 - static int bluecard_event(event_t event, int priority, event_callback_args_t *args); 91 90 92 - static dev_info_t dev_info = "bluecard_cs"; 93 - 94 - static dev_link_t *bluecard_attach(void); 95 91 static void bluecard_detach(struct pcmcia_device *p_dev); 96 92 97 93 ··· 856 860 return 0; 857 861 } 858 862 859 - static dev_link_t *bluecard_attach(void) 863 + static int bluecard_attach(struct pcmcia_device *p_dev) 860 864 { 861 865 bluecard_info_t *info; 862 - client_reg_t client_reg; 863 866 dev_link_t *link; 864 - int ret; 865 867 866 868 /* Create new info device */ 867 869 info = kzalloc(sizeof(*info), GFP_KERNEL); 868 870 if (!info) 869 - return NULL; 871 + return -ENOMEM; 870 872 871 873 link = &info->link; 872 874 link->priv = info; ··· 881 887 link->conf.Vcc = 50; 882 888 link->conf.IntType = INT_MEMORY_AND_IO; 883 889 884 - /* Register with Card Services */ 885 - link->next = NULL; 886 - client_reg.dev_info = &dev_info; 887 - client_reg.Version = 0x0210; 888 - client_reg.event_callback_args.client_data = link; 890 + link->handle = p_dev; 891 + p_dev->instance = link; 889 892 890 - ret = pcmcia_register_client(&link->handle, &client_reg); 891 - if (ret != CS_SUCCESS) { 892 - cs_error(link->handle, RegisterClient, ret); 893 - bluecard_detach(link->handle); 894 - return NULL; 895 - } 893 + link->state |= DEV_PRESENT | DEV_CONFIG_PENDING; 894 + bluecard_config(link); 896 895 897 - return link; 896 + return 0; 898 897 } 899 898 900 899 ··· 1033 1046 return 0; 1034 1047 } 1035 1048 1036 - static int bluecard_event(event_t event, int priority, event_callback_args_t *args) 1037 - { 1038 - dev_link_t *link = args->client_data; 1039 - 1040 - switch (event) { 1041 - case CS_EVENT_CARD_INSERTION: 1042 - link->state |= DEV_PRESENT | DEV_CONFIG_PENDING; 1043 - bluecard_config(link); 1044 - break; 1045 - } 1046 - 1047 - return 0; 1048 - } 1049 - 1050 1049 static struct pcmcia_device_id bluecard_ids[] = { 1051 1050 PCMCIA_DEVICE_PROD_ID12("BlueCard", "LSE041", 0xbaf16fbf, 0x657cc15e), 1052 1051 PCMCIA_DEVICE_PROD_ID12("BTCFCARD", "LSE139", 0xe3987764, 0x2524b59c), ··· 1046 1073 .drv = { 1047 1074 .name = "bluecard_cs", 1048 1075 }, 1049 - .attach = bluecard_attach, 1050 - .event = bluecard_event, 1076 + .probe = bluecard_attach, 1051 1077 .remove = bluecard_detach, 1052 1078 .id_table = bluecard_ids, 1053 1079 .suspend = bluecard_suspend,
+8 -35
drivers/bluetooth/bt3c_cs.c
··· 90 90 91 91 static void bt3c_config(dev_link_t *link); 92 92 static void bt3c_release(dev_link_t *link); 93 - static int bt3c_event(event_t event, int priority, event_callback_args_t *args); 94 93 95 - static dev_info_t dev_info = "bt3c_cs"; 96 - 97 - static dev_link_t *bt3c_attach(void); 98 94 static void bt3c_detach(struct pcmcia_device *p_dev); 99 95 100 96 ··· 657 661 return 0; 658 662 } 659 663 660 - static dev_link_t *bt3c_attach(void) 664 + static int bt3c_attach(struct pcmcia_device *p_dev) 661 665 { 662 666 bt3c_info_t *info; 663 - client_reg_t client_reg; 664 667 dev_link_t *link; 665 - int ret; 666 668 667 669 /* Create new info device */ 668 670 info = kzalloc(sizeof(*info), GFP_KERNEL); 669 671 if (!info) 670 - return NULL; 672 + return -ENOMEM; 671 673 672 674 link = &info->link; 673 675 link->priv = info; ··· 682 688 link->conf.Vcc = 50; 683 689 link->conf.IntType = INT_MEMORY_AND_IO; 684 690 685 - /* Register with Card Services */ 686 - link->next = NULL; 687 - client_reg.dev_info = &dev_info; 688 - client_reg.Version = 0x0210; 689 - client_reg.event_callback_args.client_data = link; 691 + link->handle = p_dev; 692 + p_dev->instance = link; 690 693 691 - ret = pcmcia_register_client(&link->handle, &client_reg); 692 - if (ret != CS_SUCCESS) { 693 - cs_error(link->handle, RegisterClient, ret); 694 - bt3c_detach(link->handle); 695 - return NULL; 696 - } 694 + link->state |= DEV_PRESENT | DEV_CONFIG_PENDING; 695 + bt3c_config(link); 697 696 698 - return link; 697 + return 0; 699 698 } 700 699 701 700 ··· 879 892 return 0; 880 893 } 881 894 882 - static int bt3c_event(event_t event, int priority, event_callback_args_t *args) 883 - { 884 - dev_link_t *link = args->client_data; 885 - 886 - switch (event) { 887 - case CS_EVENT_CARD_INSERTION: 888 - link->state |= DEV_PRESENT | DEV_CONFIG_PENDING; 889 - bt3c_config(link); 890 - break; 891 - } 892 - 893 - return 0; 894 - } 895 895 896 896 static struct pcmcia_device_id bt3c_ids[] = { 897 897 PCMCIA_DEVICE_PROD_ID13("3COM", "Bluetooth PC Card", 0xefce0a31, 0xd4ce9b02), ··· 891 917 .drv = { 892 918 .name = "bt3c_cs", 893 919 }, 894 - .attach = bt3c_attach, 895 - .event = bt3c_event, 920 + .probe = bt3c_attach, 896 921 .remove = bt3c_detach, 897 922 .id_table = bt3c_ids, 898 923 .suspend = bt3c_suspend,
+8 -36
drivers/bluetooth/btuart_cs.c
··· 86 86 87 87 static void btuart_config(dev_link_t *link); 88 88 static void btuart_release(dev_link_t *link); 89 - static int btuart_event(event_t event, int priority, event_callback_args_t *args); 90 89 91 - static dev_info_t dev_info = "btuart_cs"; 92 - 93 - static dev_link_t *btuart_attach(void); 94 90 static void btuart_detach(struct pcmcia_device *p_dev); 95 91 96 92 ··· 576 580 return 0; 577 581 } 578 582 579 - static dev_link_t *btuart_attach(void) 583 + static int btuart_attach(struct pcmcia_device *p_dev) 580 584 { 581 585 btuart_info_t *info; 582 - client_reg_t client_reg; 583 586 dev_link_t *link; 584 - int ret; 585 587 586 588 /* Create new info device */ 587 589 info = kzalloc(sizeof(*info), GFP_KERNEL); 588 590 if (!info) 589 - return NULL; 591 + return -ENOMEM; 590 592 591 593 link = &info->link; 592 594 link->priv = info; ··· 601 607 link->conf.Vcc = 50; 602 608 link->conf.IntType = INT_MEMORY_AND_IO; 603 609 604 - /* Register with Card Services */ 605 - link->next = NULL; 606 - client_reg.dev_info = &dev_info; 607 - client_reg.Version = 0x0210; 608 - client_reg.event_callback_args.client_data = link; 610 + link->handle = p_dev; 611 + p_dev->instance = link; 609 612 610 - ret = pcmcia_register_client(&link->handle, &client_reg); 611 - if (ret != CS_SUCCESS) { 612 - cs_error(link->handle, RegisterClient, ret); 613 - btuart_detach(link->handle); 614 - return NULL; 615 - } 613 + link->state |= DEV_PRESENT | DEV_CONFIG_PENDING; 614 + btuart_config(link); 616 615 617 - return link; 616 + return 0; 618 617 } 619 618 620 619 ··· 800 813 } 801 814 802 815 803 - static int btuart_event(event_t event, int priority, event_callback_args_t *args) 804 - { 805 - dev_link_t *link = args->client_data; 806 - 807 - switch (event) { 808 - case CS_EVENT_CARD_INSERTION: 809 - link->state |= DEV_PRESENT | DEV_CONFIG_PENDING; 810 - btuart_config(link); 811 - break; 812 - } 813 - 814 - return 0; 815 - } 816 - 817 816 static struct pcmcia_device_id btuart_ids[] = { 818 817 /* don't use this driver. Use serial_cs + hci_uart instead */ 819 818 PCMCIA_DEVICE_NULL ··· 811 838 .drv = { 812 839 .name = "btuart_cs", 813 840 }, 814 - .attach = btuart_attach, 815 - .event = btuart_event, 841 + .probe = btuart_attach, 816 842 .remove = btuart_detach, 817 843 .id_table = btuart_ids, 818 844 .suspend = btuart_suspend,
+8 -35
drivers/bluetooth/dtl1_cs.c
··· 89 89 90 90 static void dtl1_config(dev_link_t *link); 91 91 static void dtl1_release(dev_link_t *link); 92 - static int dtl1_event(event_t event, int priority, event_callback_args_t *args); 93 92 94 - static dev_info_t dev_info = "dtl1_cs"; 95 - 96 - static dev_link_t *dtl1_attach(void); 97 93 static void dtl1_detach(struct pcmcia_device *p_dev); 98 94 99 95 ··· 555 559 return 0; 556 560 } 557 561 558 - static dev_link_t *dtl1_attach(void) 562 + static int dtl1_attach(struct pcmcia_device *p_dev) 559 563 { 560 564 dtl1_info_t *info; 561 - client_reg_t client_reg; 562 565 dev_link_t *link; 563 - int ret; 564 566 565 567 /* Create new info device */ 566 568 info = kzalloc(sizeof(*info), GFP_KERNEL); 567 569 if (!info) 568 - return NULL; 570 + return -ENOMEM; 569 571 570 572 link = &info->link; 571 573 link->priv = info; ··· 580 586 link->conf.Vcc = 50; 581 587 link->conf.IntType = INT_MEMORY_AND_IO; 582 588 583 - /* Register with Card Services */ 584 - link->next = NULL; 585 - client_reg.dev_info = &dev_info; 586 - client_reg.Version = 0x0210; 587 - client_reg.event_callback_args.client_data = link; 589 + link->handle = p_dev; 590 + p_dev->instance = link; 588 591 589 - ret = pcmcia_register_client(&link->handle, &client_reg); 590 - if (ret != CS_SUCCESS) { 591 - cs_error(link->handle, RegisterClient, ret); 592 - dtl1_detach(link->handle); 593 - return NULL; 594 - } 592 + link->state |= DEV_PRESENT | DEV_CONFIG_PENDING; 593 + dtl1_config(link); 595 594 596 - return link; 595 + return 0; 597 596 } 598 597 599 598 ··· 751 764 return 0; 752 765 } 753 766 754 - static int dtl1_event(event_t event, int priority, event_callback_args_t *args) 755 - { 756 - dev_link_t *link = args->client_data; 757 - 758 - switch (event) { 759 - case CS_EVENT_CARD_INSERTION: 760 - link->state |= DEV_PRESENT | DEV_CONFIG_PENDING; 761 - dtl1_config(link); 762 - break; 763 - } 764 - 765 - return 0; 766 - } 767 767 768 768 static struct pcmcia_device_id dtl1_ids[] = { 769 769 PCMCIA_DEVICE_PROD_ID12("Nokia Mobile Phones", "DTL-1", 0xe1bfdd64, 0xe168480d), ··· 764 790 .drv = { 765 791 .name = "dtl1_cs", 766 792 }, 767 - .attach = dtl1_attach, 768 - .event = dtl1_event, 793 + .probe = dtl1_attach, 769 794 .remove = dtl1_detach, 770 795 .id_table = dtl1_ids, 771 796 .suspend = dtl1_suspend,
+11 -57
drivers/char/pcmcia/cm4000_cs.c
··· 66 66 #define T_100MSEC msecs_to_jiffies(100) 67 67 #define T_500MSEC msecs_to_jiffies(500) 68 68 69 - static void cm4000_detach(struct pcmcia_device *p_dev); 70 69 static void cm4000_release(dev_link_t *link); 71 70 72 71 static int major; /* major number we get from the kernel */ ··· 155 156 /*sbuf*/ 512*sizeof(char) - \ 156 157 /*queue*/ 4*sizeof(wait_queue_head_t)) 157 158 158 - static dev_info_t dev_info = MODULE_NAME; 159 159 static dev_link_t *dev_table[CM4000_MAX_DEV]; 160 160 161 161 /* This table doesn't use spaces after the comma between fields and thus ··· 1862 1864 link->state &= ~DEV_CONFIG_PENDING; 1863 1865 } 1864 1866 1865 - static int cm4000_event(event_t event, int priority, 1866 - event_callback_args_t *args) 1867 - { 1868 - dev_link_t *link; 1869 - struct cm4000_dev *dev; 1870 - int devno; 1871 - 1872 - link = args->client_data; 1873 - dev = link->priv; 1874 - 1875 - DEBUGP(3, dev, "-> cm4000_event\n"); 1876 - for (devno = 0; devno < CM4000_MAX_DEV; devno++) 1877 - if (dev_table[devno] == link) 1878 - break; 1879 - 1880 - if (devno == CM4000_MAX_DEV) 1881 - return CS_BAD_ADAPTER; 1882 - 1883 - switch (event) { 1884 - case CS_EVENT_CARD_INSERTION: 1885 - DEBUGP(5, dev, "CS_EVENT_CARD_INSERTION\n"); 1886 - link->state |= DEV_PRESENT | DEV_CONFIG_PENDING; 1887 - cm4000_config(link, devno); 1888 - break; 1889 - default: 1890 - DEBUGP(5, dev, "unknown event %.2x\n", event); 1891 - break; 1892 - } 1893 - DEBUGP(3, dev, "<- cm4000_event\n"); 1894 - return CS_SUCCESS; 1895 - } 1896 - 1897 1867 static int cm4000_suspend(struct pcmcia_device *p_dev) 1898 1868 { 1899 1869 dev_link_t *link = dev_to_instance(p_dev); ··· 1901 1935 pcmcia_release_io(link->handle, &link->io); 1902 1936 } 1903 1937 1904 - static dev_link_t *cm4000_attach(void) 1938 + static int cm4000_attach(struct pcmcia_device *p_dev) 1905 1939 { 1906 1940 struct cm4000_dev *dev; 1907 1941 dev_link_t *link; 1908 - client_reg_t client_reg; 1909 1942 int i; 1910 1943 1911 1944 for (i = 0; i < CM4000_MAX_DEV; i++) ··· 1913 1948 1914 1949 if (i == CM4000_MAX_DEV) { 1915 1950 printk(KERN_NOTICE MODULE_NAME ": all devices in use\n"); 1916 - return NULL; 1951 + return -ENODEV; 1917 1952 } 1918 1953 1919 1954 /* create a new cm4000_cs device */ 1920 1955 dev = kzalloc(sizeof(struct cm4000_dev), GFP_KERNEL); 1921 1956 if (dev == NULL) 1922 - return NULL; 1957 + return -ENOMEM; 1923 1958 1924 1959 link = &dev->link; 1925 1960 link->priv = dev; 1926 1961 link->conf.IntType = INT_MEMORY_AND_IO; 1927 1962 dev_table[i] = link; 1928 1963 1929 - /* register with card services */ 1930 - client_reg.dev_info = &dev_info; 1931 - client_reg.EventMask = 1932 - CS_EVENT_CARD_INSERTION | CS_EVENT_CARD_REMOVAL | 1933 - CS_EVENT_RESET_PHYSICAL | CS_EVENT_CARD_RESET | 1934 - CS_EVENT_PM_SUSPEND | CS_EVENT_PM_RESUME; 1935 - client_reg.Version = 0x0210; 1936 - client_reg.event_callback_args.client_data = link; 1937 - 1938 - i = pcmcia_register_client(&link->handle, &client_reg); 1939 - if (i) { 1940 - cs_error(link->handle, RegisterClient, i); 1941 - cm4000_detach(link->handle); 1942 - return NULL; 1943 - } 1944 - 1945 1964 init_waitqueue_head(&dev->devq); 1946 1965 init_waitqueue_head(&dev->ioq); 1947 1966 init_waitqueue_head(&dev->atrq); 1948 1967 init_waitqueue_head(&dev->readq); 1949 1968 1950 - return link; 1969 + link->handle = p_dev; 1970 + p_dev->instance = link; 1971 + 1972 + link->state |= DEV_PRESENT | DEV_CONFIG_PENDING; 1973 + cm4000_config(link, i); 1974 + 1975 + return 0; 1951 1976 } 1952 1977 1953 1978 static void cm4000_detach(struct pcmcia_device *p_dev) ··· 1986 2031 .drv = { 1987 2032 .name = "cm4000_cs", 1988 2033 }, 1989 - .attach = cm4000_attach, 2034 + .probe = cm4000_attach, 1990 2035 .remove = cm4000_detach, 1991 2036 .suspend = cm4000_suspend, 1992 2037 .resume = cm4000_resume, 1993 - .event = cm4000_event, 1994 2038 .id_table = cm4000_ids, 1995 2039 }; 1996 2040
+11 -56
drivers/char/pcmcia/cm4040_cs.c
··· 65 65 #define POLL_PERIOD msecs_to_jiffies(10) 66 66 67 67 static void reader_release(dev_link_t *link); 68 - static void reader_detach(struct pcmcia_device *p_dev); 69 68 70 69 static int major; 71 70 ··· 85 86 struct timer_list poll_timer; 86 87 }; 87 88 88 - static dev_info_t dev_info = MODULE_NAME; 89 89 static dev_link_t *dev_table[CM_MAX_DEV]; 90 90 91 91 #ifndef PCMCIA_DEBUG ··· 627 629 link->state &= ~DEV_CONFIG_PENDING; 628 630 } 629 631 630 - static int reader_event(event_t event, int priority, 631 - event_callback_args_t *args) 632 - { 633 - dev_link_t *link; 634 - struct reader_dev *dev; 635 - int devno; 636 - 637 - link = args->client_data; 638 - dev = link->priv; 639 - DEBUGP(3, dev, "-> reader_event\n"); 640 - for (devno = 0; devno < CM_MAX_DEV; devno++) { 641 - if (dev_table[devno] == link) 642 - break; 643 - } 644 - if (devno == CM_MAX_DEV) 645 - return CS_BAD_ADAPTER; 646 - 647 - switch (event) { 648 - case CS_EVENT_CARD_INSERTION: 649 - DEBUGP(5, dev, "CS_EVENT_CARD_INSERTION\n"); 650 - link->state |= DEV_PRESENT | DEV_CONFIG_PENDING; 651 - reader_config(link, devno); 652 - break; 653 - 654 - default: 655 - DEBUGP(5, dev, "reader_event: unknown event %.2x\n", 656 - event); 657 - break; 658 - } 659 - DEBUGP(3, dev, "<- reader_event\n"); 660 - return CS_SUCCESS; 661 - } 662 - 663 632 static int reader_suspend(struct pcmcia_device *p_dev) 664 633 { 665 634 dev_link_t *link = dev_to_instance(p_dev); ··· 656 691 pcmcia_release_io(link->handle, &link->io); 657 692 } 658 693 659 - static dev_link_t *reader_attach(void) 694 + static int reader_attach(struct pcmcia_device *p_dev) 660 695 { 661 696 struct reader_dev *dev; 662 697 dev_link_t *link; 663 - client_reg_t client_reg; 664 698 int i; 665 699 666 700 for (i = 0; i < CM_MAX_DEV; i++) { ··· 668 704 } 669 705 670 706 if (i == CM_MAX_DEV) 671 - return NULL; 707 + return -ENODEV; 672 708 673 709 dev = kzalloc(sizeof(struct reader_dev), GFP_KERNEL); 674 710 if (dev == NULL) 675 - return NULL; 711 + return -ENOMEM; 676 712 677 713 dev->timeout = CCID_DRIVER_MINIMUM_TIMEOUT; 678 714 dev->buffer_status = 0; ··· 683 719 link->conf.IntType = INT_MEMORY_AND_IO; 684 720 dev_table[i] = link; 685 721 686 - client_reg.dev_info = &dev_info; 687 - client_reg.Attributes = INFO_IO_CLIENT | INFO_CARD_SHARE; 688 - client_reg.EventMask= 689 - CS_EVENT_CARD_INSERTION | CS_EVENT_CARD_REMOVAL | 690 - CS_EVENT_RESET_PHYSICAL | CS_EVENT_CARD_RESET | 691 - CS_EVENT_PM_SUSPEND | CS_EVENT_PM_RESUME; 692 - client_reg.Version = 0x0210; 693 - client_reg.event_callback_args.client_data = link; 694 - i = pcmcia_register_client(&link->handle, &client_reg); 695 - if (i) { 696 - cs_error(link->handle, RegisterClient, i); 697 - reader_detach(link->handle); 698 - return NULL; 699 - } 700 722 init_waitqueue_head(&dev->devq); 701 723 init_waitqueue_head(&dev->poll_wait); 702 724 init_waitqueue_head(&dev->read_wait); ··· 690 740 init_timer(&dev->poll_timer); 691 741 dev->poll_timer.function = &cm4040_do_poll; 692 742 693 - return link; 743 + link->handle = p_dev; 744 + p_dev->instance = link; 745 + 746 + link->state |= DEV_PRESENT | DEV_CONFIG_PENDING; 747 + reader_config(link, i); 748 + 749 + return 0; 694 750 } 695 751 696 752 static void reader_detach(struct pcmcia_device *p_dev) ··· 746 790 .drv = { 747 791 .name = "cm4040_cs", 748 792 }, 749 - .attach = reader_attach, 793 + .probe = reader_attach, 750 794 .remove = reader_detach, 751 795 .suspend = reader_suspend, 752 796 .resume = reader_resume, 753 - .event = reader_event, 754 797 .id_table = cm4040_ids, 755 798 }; 756 799
+14 -42
drivers/ide/legacy/ide-cs.c
··· 88 88 } ide_info_t; 89 89 90 90 static void ide_release(dev_link_t *); 91 - static int ide_event(event_t event, int priority, 92 - event_callback_args_t *args); 91 + static void ide_config(dev_link_t *); 93 92 94 - static dev_info_t dev_info = "ide-cs"; 95 - 96 - static dev_link_t *ide_attach(void); 97 93 static void ide_detach(struct pcmcia_device *p_dev); 98 94 99 95 ··· 103 107 104 108 ======================================================================*/ 105 109 106 - static dev_link_t *ide_attach(void) 110 + static int ide_attach(struct pcmcia_device *p_dev) 107 111 { 108 112 ide_info_t *info; 109 113 dev_link_t *link; 110 - client_reg_t client_reg; 111 - int ret; 112 - 114 + 113 115 DEBUG(0, "ide_attach()\n"); 114 116 115 117 /* Create new ide device */ 116 118 info = kzalloc(sizeof(*info), GFP_KERNEL); 117 - if (!info) return NULL; 119 + if (!info) 120 + return -ENOMEM; 118 121 link = &info->link; link->priv = info; 119 122 120 123 link->io.Attributes1 = IO_DATA_PATH_WIDTH_AUTO; ··· 124 129 link->conf.Attributes = CONF_ENABLE_IRQ; 125 130 link->conf.Vcc = 50; 126 131 link->conf.IntType = INT_MEMORY_AND_IO; 127 - 128 - /* Register with Card Services */ 129 - link->next = NULL; 130 - client_reg.dev_info = &dev_info; 131 - client_reg.Version = 0x0210; 132 - client_reg.event_callback_args.client_data = link; 133 - ret = pcmcia_register_client(&link->handle, &client_reg); 134 - if (ret != CS_SUCCESS) { 135 - cs_error(link->handle, RegisterClient, ret); 136 - ide_detach(link->handle); 137 - return NULL; 138 - } 139 - 140 - return link; 132 + 133 + link->handle = p_dev; 134 + p_dev->instance = link; 135 + 136 + link->state |= DEV_PRESENT | DEV_CONFIG_PENDING; 137 + ide_config(link); 138 + 139 + return 0; 141 140 } /* ide_attach */ 142 141 143 142 /*====================================================================== ··· 410 421 411 422 ======================================================================*/ 412 423 413 - int ide_event(event_t event, int priority, 414 - event_callback_args_t *args) 415 - { 416 - dev_link_t *link = args->client_data; 417 - 418 - DEBUG(1, "ide_event(0x%06x)\n", event); 419 - 420 - switch (event) { 421 - case CS_EVENT_CARD_INSERTION: 422 - link->state |= DEV_PRESENT | DEV_CONFIG_PENDING; 423 - ide_config(link); 424 - break; 425 - } 426 - return 0; 427 - } /* ide_event */ 428 - 429 424 static struct pcmcia_device_id ide_ids[] = { 430 425 PCMCIA_DEVICE_FUNC_ID(4), 431 426 PCMCIA_DEVICE_MANF_CARD(0x0032, 0x0704), ··· 454 481 .drv = { 455 482 .name = "ide-cs", 456 483 }, 457 - .attach = ide_attach, 458 - .event = ide_event, 484 + .probe = ide_attach, 459 485 .remove = ide_detach, 460 486 .id_table = ide_ids, 461 487 .suspend = ide_suspend,
+12 -44
drivers/isdn/hardware/avm/avm_cs.c
··· 53 53 54 54 static void avmcs_config(dev_link_t *link); 55 55 static void avmcs_release(dev_link_t *link); 56 - static int avmcs_event(event_t event, int priority, 57 - event_callback_args_t *args); 58 56 59 57 /* 60 58 The attach() and detach() entry points are used to create and destroy ··· 60 62 needed to manage one actual PCMCIA card. 61 63 */ 62 64 63 - static dev_link_t *avmcs_attach(void); 64 65 static void avmcs_detach(struct pcmcia_device *p_dev); 65 - 66 - /* 67 - The dev_info variable is the "key" that is used to match up this 68 - device driver with appropriate cards, through the card configuration 69 - database. 70 - */ 71 - 72 - static dev_info_t dev_info = "avm_cs"; 73 66 74 67 /* 75 68 A linked list of "instances" of the skeleton device. Each actual ··· 99 110 100 111 ======================================================================*/ 101 112 102 - static dev_link_t *avmcs_attach(void) 113 + static int avmcs_attach(struct pcmcia_device *p_dev) 103 114 { 104 - client_reg_t client_reg; 105 115 dev_link_t *link; 106 116 local_info_t *local; 107 - int ret; 108 - 117 + 109 118 /* Initialize the dev_link_t structure */ 110 119 link = kmalloc(sizeof(struct dev_link_t), GFP_KERNEL); 111 120 if (!link) ··· 134 147 goto err_kfree; 135 148 memset(local, 0, sizeof(local_info_t)); 136 149 link->priv = local; 137 - 138 - /* Register with Card Services */ 139 - link->next = NULL; 140 - client_reg.dev_info = &dev_info; 141 - client_reg.Version = 0x0210; 142 - client_reg.event_callback_args.client_data = link; 143 - ret = pcmcia_register_client(&link->handle, &client_reg); 144 - if (ret != 0) { 145 - cs_error(link->handle, RegisterClient, ret); 146 - avmcs_detach(link->handle); 147 - goto err; 148 - } 149 - return link; 150 + 151 + link->handle = p_dev; 152 + p_dev->instance = link; 153 + 154 + link->state |= DEV_PRESENT | DEV_CONFIG_PENDING; 155 + avmcs_config(link); 156 + 157 + return 0; 150 158 151 159 err_kfree: 152 160 kfree(link); 153 161 err: 154 - return NULL; 162 + return -EINVAL; 155 163 } /* avmcs_attach */ 156 164 157 165 /*====================================================================== ··· 415 433 416 434 ======================================================================*/ 417 435 418 - static int avmcs_event(event_t event, int priority, 419 - event_callback_args_t *args) 420 - { 421 - dev_link_t *link = args->client_data; 422 - 423 - switch (event) { 424 - case CS_EVENT_CARD_INSERTION: 425 - link->state |= DEV_PRESENT | DEV_CONFIG_PENDING; 426 - avmcs_config(link); 427 - break; 428 - } 429 - return 0; 430 - } /* avmcs_event */ 431 436 432 437 static struct pcmcia_device_id avmcs_ids[] = { 433 438 PCMCIA_DEVICE_PROD_ID12("AVM", "ISDN-Controller B1", 0x95d42008, 0x845dc335), ··· 429 460 .drv = { 430 461 .name = "avm_cs", 431 462 }, 432 - .attach = avmcs_attach, 433 - .event = avmcs_event, 463 + .probe = avmcs_attach, 434 464 .remove = avmcs_detach, 435 465 .id_table = avmcs_ids, 436 466 .suspend= avmcs_suspend,
+11 -59
drivers/isdn/hisax/avma1_cs.c
··· 69 69 70 70 static void avma1cs_config(dev_link_t *link); 71 71 static void avma1cs_release(dev_link_t *link); 72 - static int avma1cs_event(event_t event, int priority, 73 - event_callback_args_t *args); 74 72 75 73 /* 76 74 The attach() and detach() entry points are used to create and destroy ··· 76 78 needed to manage one actual PCMCIA card. 77 79 */ 78 80 79 - static dev_link_t *avma1cs_attach(void); 80 81 static void avma1cs_detach(struct pcmcia_device *p_dev); 81 82 82 - /* 83 - The dev_info variable is the "key" that is used to match up this 84 - device driver with appropriate cards, through the card configuration 85 - database. 86 - */ 87 - 88 - static dev_info_t dev_info = "avma1_cs"; 89 83 90 84 /* 91 85 A linked list of "instances" of the skeleton device. Each actual ··· 116 126 117 127 ======================================================================*/ 118 128 119 - static dev_link_t *avma1cs_attach(void) 129 + static int avma1cs_attach(struct pcmcia_device *p_dev) 120 130 { 121 - client_reg_t client_reg; 122 131 dev_link_t *link; 123 132 local_info_t *local; 124 - int ret; 125 - 133 + 126 134 DEBUG(0, "avma1cs_attach()\n"); 127 135 128 136 /* Initialize the dev_link_t structure */ 129 137 link = kmalloc(sizeof(struct dev_link_t), GFP_KERNEL); 130 138 if (!link) 131 - return NULL; 139 + return -ENOMEM; 132 140 memset(link, 0, sizeof(struct dev_link_t)); 133 141 134 142 /* Allocate space for private device-specific data */ 135 143 local = kmalloc(sizeof(local_info_t), GFP_KERNEL); 136 144 if (!local) { 137 145 kfree(link); 138 - return NULL; 146 + return -ENOMEM; 139 147 } 140 148 memset(local, 0, sizeof(local_info_t)); 141 149 link->priv = local; ··· 158 170 link->conf.ConfigIndex = 1; 159 171 link->conf.Present = PRESENT_OPTION; 160 172 161 - /* Register with Card Services */ 162 - link->next = NULL; 163 - client_reg.dev_info = &dev_info; 164 - client_reg.Version = 0x0210; 165 - client_reg.event_callback_args.client_data = link; 166 - ret = pcmcia_register_client(&link->handle, &client_reg); 167 - if (ret != 0) { 168 - cs_error(link->handle, RegisterClient, ret); 169 - avma1cs_detach(link->handle); 170 - return NULL; 171 - } 173 + link->handle = p_dev; 174 + p_dev->instance = link; 172 175 173 - return link; 176 + link->state |= DEV_PRESENT | DEV_CONFIG_PENDING; 177 + avma1cs_config(link); 178 + 179 + return 0; 174 180 } /* avma1cs_attach */ 175 181 176 182 /*====================================================================== ··· 412 430 return 0; 413 431 } 414 432 415 - /*====================================================================== 416 - 417 - The card status event handler. Mostly, this schedules other 418 - stuff to run after an event is received. A CARD_REMOVAL event 419 - also sets some flags to discourage the net drivers from trying 420 - to talk to the card any more. 421 - 422 - When a CARD_REMOVAL event is received, we immediately set a flag 423 - to block future accesses to this device. All the functions that 424 - actually access the device should check this flag to make sure 425 - the card is still present. 426 - 427 - ======================================================================*/ 428 - 429 - static int avma1cs_event(event_t event, int priority, 430 - event_callback_args_t *args) 431 - { 432 - dev_link_t *link = args->client_data; 433 - 434 - DEBUG(1, "avma1cs_event(0x%06x)\n", event); 435 - 436 - switch (event) { 437 - case CS_EVENT_CARD_INSERTION: 438 - link->state |= DEV_PRESENT | DEV_CONFIG_PENDING; 439 - avma1cs_config(link); 440 - break; 441 - } 442 - return 0; 443 - } /* avma1cs_event */ 444 433 445 434 static struct pcmcia_device_id avma1cs_ids[] = { 446 435 PCMCIA_DEVICE_PROD_ID12("AVM", "ISDN A", 0x95d42008, 0xadc9d4bb), ··· 425 472 .drv = { 426 473 .name = "avma1_cs", 427 474 }, 428 - .attach = avma1cs_attach, 429 - .event = avma1cs_event, 475 + .probe = avma1cs_attach, 430 476 .remove = avma1cs_detach, 431 477 .id_table = avma1cs_ids, 432 478 .suspend = avma1cs_suspend,
+9 -69
drivers/isdn/hisax/elsa_cs.c
··· 96 96 97 97 static void elsa_cs_config(dev_link_t *link); 98 98 static void elsa_cs_release(dev_link_t *link); 99 - static int elsa_cs_event(event_t event, int priority, 100 - event_callback_args_t *args); 101 99 102 100 /* 103 101 The attach() and detach() entry points are used to create and destroy ··· 103 105 needed to manage one actual PCMCIA card. 104 106 */ 105 107 106 - static dev_link_t *elsa_cs_attach(void); 107 108 static void elsa_cs_detach(struct pcmcia_device *p_dev); 108 - 109 - /* 110 - The dev_info variable is the "key" that is used to match up this 111 - device driver with appropriate cards, through the card configuration 112 - database. 113 - */ 114 - 115 - static dev_info_t dev_info = "elsa_cs"; 116 - 117 - /* 118 - A linked list of "instances" of the elsa_cs device. Each actual 119 - PCMCIA card corresponds to one device instance, and is described 120 - by one dev_link_t structure (defined in ds.h). 121 - 122 - You may not want to use a linked list for this -- for example, the 123 - memory card driver uses an array of dev_link_t pointers, where minor 124 - device numbers are used to derive the corresponding array index. 125 - */ 126 109 127 110 /* 128 111 A driver needs to provide a dev_node_t structure for each device ··· 139 160 140 161 ======================================================================*/ 141 162 142 - static dev_link_t *elsa_cs_attach(void) 163 + static int elsa_cs_attach(struct pcmcia_device *p_dev) 143 164 { 144 - client_reg_t client_reg; 145 165 dev_link_t *link; 146 166 local_info_t *local; 147 - int ret; 148 167 149 168 DEBUG(0, "elsa_cs_attach()\n"); 150 169 151 170 /* Allocate space for private device-specific data */ 152 171 local = kmalloc(sizeof(local_info_t), GFP_KERNEL); 153 - if (!local) return NULL; 172 + if (!local) return -ENOMEM; 154 173 memset(local, 0, sizeof(local_info_t)); 155 174 local->cardnr = -1; 156 175 link = &local->link; link->priv = local; ··· 173 196 link->conf.Vcc = 50; 174 197 link->conf.IntType = INT_MEMORY_AND_IO; 175 198 176 - /* Register with Card Services */ 177 - link->next = NULL; 178 - client_reg.dev_info = &dev_info; 179 - client_reg.Version = 0x0210; 180 - client_reg.event_callback_args.client_data = link; 181 - ret = pcmcia_register_client(&link->handle, &client_reg); 182 - if (ret != CS_SUCCESS) { 183 - cs_error(link->handle, RegisterClient, ret); 184 - elsa_cs_detach(link->handle); 185 - return NULL; 186 - } 199 + link->handle = p_dev; 200 + p_dev->instance = link; 187 201 188 - return link; 202 + link->state |= DEV_PRESENT | DEV_CONFIG_PENDING; 203 + elsa_cs_config(link); 204 + 205 + return 0; 189 206 } /* elsa_cs_attach */ 190 207 191 208 /*====================================================================== ··· 418 447 return 0; 419 448 } 420 449 421 - /*====================================================================== 422 - 423 - The card status event handler. Mostly, this schedules other 424 - stuff to run after an event is received. A CARD_REMOVAL event 425 - also sets some flags to discourage the net drivers from trying 426 - to talk to the card any more. 427 - 428 - When a CARD_REMOVAL event is received, we immediately set a flag 429 - to block future accesses to this device. All the functions that 430 - actually access the device should check this flag to make sure 431 - the card is still present. 432 - 433 - ======================================================================*/ 434 - 435 - static int elsa_cs_event(event_t event, int priority, 436 - event_callback_args_t *args) 437 - { 438 - dev_link_t *link = args->client_data; 439 - 440 - DEBUG(1, "elsa_cs_event(%d)\n", event); 441 - 442 - switch (event) { 443 - case CS_EVENT_CARD_INSERTION: 444 - link->state |= DEV_PRESENT | DEV_CONFIG_PENDING; 445 - elsa_cs_config(link); 446 - break; 447 - } 448 - return 0; 449 - } /* elsa_cs_event */ 450 - 451 450 static struct pcmcia_device_id elsa_ids[] = { 452 451 PCMCIA_DEVICE_PROD_ID12("ELSA AG (Aachen, Germany)", "MicroLink ISDN/MC ", 0x983de2c4, 0x333ba257), 453 452 PCMCIA_DEVICE_PROD_ID12("ELSA GmbH, Aachen", "MicroLink ISDN/MC ", 0x639e5718, 0x333ba257), ··· 430 489 .drv = { 431 490 .name = "elsa_cs", 432 491 }, 433 - .attach = elsa_cs_attach, 434 - .event = elsa_cs_event, 492 + .probe = elsa_cs_attach, 435 493 .remove = elsa_cs_detach, 436 494 .id_table = elsa_ids, 437 495 .suspend = elsa_suspend,
+9 -66
drivers/isdn/hisax/sedlbauer_cs.c
··· 97 97 98 98 static void sedlbauer_config(dev_link_t *link); 99 99 static void sedlbauer_release(dev_link_t *link); 100 - static int sedlbauer_event(event_t event, int priority, 101 - event_callback_args_t *args); 102 100 103 101 /* 104 102 The attach() and detach() entry points are used to create and destroy ··· 104 106 needed to manage one actual PCMCIA card. 105 107 */ 106 108 107 - static dev_link_t *sedlbauer_attach(void); 108 109 static void sedlbauer_detach(struct pcmcia_device *p_dev); 109 110 110 111 /* ··· 111 114 be used to talk to your device. See 'memory_cs' for a good example 112 115 of a fully self-sufficient driver; the other drivers rely more or 113 116 less on other parts of the kernel. 114 - */ 115 - 116 - /* 117 - The dev_info variable is the "key" that is used to match up this 118 - device driver with appropriate cards, through the card configuration 119 - database. 120 - */ 121 - 122 - static dev_info_t dev_info = "sedlbauer_cs"; 123 - 124 - /* 125 - A linked list of "instances" of the sedlbauer device. Each actual 126 - PCMCIA card corresponds to one device instance, and is described 127 - by one dev_link_t structure (defined in ds.h). 128 - 129 - You may not want to use a linked list for this -- for example, the 130 - memory card driver uses an array of dev_link_t pointers, where minor 131 - device numbers are used to derive the corresponding array index. 132 117 */ 133 118 134 119 /* ··· 148 169 149 170 ======================================================================*/ 150 171 151 - static dev_link_t *sedlbauer_attach(void) 172 + static int sedlbauer_attach(struct pcmcia_device *p_dev) 152 173 { 153 174 local_info_t *local; 154 175 dev_link_t *link; 155 - client_reg_t client_reg; 156 - int ret; 157 176 158 177 DEBUG(0, "sedlbauer_attach()\n"); 159 178 160 179 /* Allocate space for private device-specific data */ 161 180 local = kmalloc(sizeof(local_info_t), GFP_KERNEL); 162 - if (!local) return NULL; 181 + if (!local) return -ENOMEM; 163 182 memset(local, 0, sizeof(local_info_t)); 164 183 local->cardnr = -1; 165 184 link = &local->link; link->priv = local; ··· 187 210 link->conf.Vcc = 50; 188 211 link->conf.IntType = INT_MEMORY_AND_IO; 189 212 190 - /* Register with Card Services */ 191 - link->next = NULL; 192 - client_reg.dev_info = &dev_info; 193 - client_reg.Version = 0x0210; 194 - client_reg.event_callback_args.client_data = link; 195 - ret = pcmcia_register_client(&link->handle, &client_reg); 196 - if (ret != CS_SUCCESS) { 197 - cs_error(link->handle, RegisterClient, ret); 198 - sedlbauer_detach(link->handle); 199 - return NULL; 200 - } 213 + link->handle = p_dev; 214 + p_dev->instance = link; 201 215 202 - return link; 216 + link->state |= DEV_PRESENT | DEV_CONFIG_PENDING; 217 + sedlbauer_config(link); 218 + 219 + return 0; 203 220 } /* sedlbauer_attach */ 204 221 205 222 /*====================================================================== ··· 512 541 return 0; 513 542 } 514 543 515 - /*====================================================================== 516 - 517 - The card status event handler. Mostly, this schedules other 518 - stuff to run after an event is received. 519 - 520 - When a CARD_REMOVAL event is received, we immediately set a 521 - private flag to block future accesses to this device. All the 522 - functions that actually access the device should check this flag 523 - to make sure the card is still present. 524 - 525 - ======================================================================*/ 526 - 527 - static int sedlbauer_event(event_t event, int priority, 528 - event_callback_args_t *args) 529 - { 530 - dev_link_t *link = args->client_data; 531 - 532 - DEBUG(1, "sedlbauer_event(0x%06x)\n", event); 533 - 534 - switch (event) { 535 - case CS_EVENT_CARD_INSERTION: 536 - link->state |= DEV_PRESENT | DEV_CONFIG_PENDING; 537 - sedlbauer_config(link); 538 - break; 539 - } 540 - return 0; 541 - } /* sedlbauer_event */ 542 544 543 545 static struct pcmcia_device_id sedlbauer_ids[] = { 544 546 PCMCIA_DEVICE_PROD_ID123("SEDLBAUER", "speed star II", "V 3.1", 0x81fb79f5, 0xf3612e1d, 0x6b95c78a), ··· 530 586 .drv = { 531 587 .name = "sedlbauer_cs", 532 588 }, 533 - .attach = sedlbauer_attach, 534 - .event = sedlbauer_event, 589 + .probe = sedlbauer_attach, 535 590 .remove = sedlbauer_detach, 536 591 .id_table = sedlbauer_ids, 537 592 .suspend = sedlbauer_suspend,
+9 -58
drivers/isdn/hisax/teles_cs.c
··· 77 77 78 78 static void teles_cs_config(dev_link_t *link); 79 79 static void teles_cs_release(dev_link_t *link); 80 - static int teles_cs_event(event_t event, int priority, 81 - event_callback_args_t *args); 82 80 83 81 /* 84 82 The attach() and detach() entry points are used to create and destroy ··· 84 86 needed to manage one actual PCMCIA card. 85 87 */ 86 88 87 - static dev_link_t *teles_attach(void); 88 89 static void teles_detach(struct pcmcia_device *p_dev); 89 - 90 - /* 91 - The dev_info variable is the "key" that is used to match up this 92 - device driver with appropriate cards, through the card configuration 93 - database. 94 - */ 95 - 96 - static dev_info_t dev_info = "teles_cs"; 97 90 98 91 /* 99 92 A linked list of "instances" of the teles_cs device. Each actual ··· 130 141 131 142 ======================================================================*/ 132 143 133 - static dev_link_t *teles_attach(void) 144 + static int teles_attach(struct pcmcia_device *p_dev) 134 145 { 135 - client_reg_t client_reg; 136 146 dev_link_t *link; 137 147 local_info_t *local; 138 - int ret; 139 148 140 149 DEBUG(0, "teles_attach()\n"); 141 150 142 151 /* Allocate space for private device-specific data */ 143 152 local = kmalloc(sizeof(local_info_t), GFP_KERNEL); 144 - if (!local) return NULL; 153 + if (!local) return -ENOMEM; 145 154 memset(local, 0, sizeof(local_info_t)); 146 155 local->cardnr = -1; 147 156 link = &local->link; link->priv = local; ··· 164 177 link->conf.Vcc = 50; 165 178 link->conf.IntType = INT_MEMORY_AND_IO; 166 179 167 - /* Register with Card Services */ 168 - link->next = NULL; 169 - client_reg.dev_info = &dev_info; 170 - client_reg.Version = 0x0210; 171 - client_reg.event_callback_args.client_data = link; 172 - ret = pcmcia_register_client(&link->handle, &client_reg); 173 - if (ret != CS_SUCCESS) { 174 - cs_error(link->handle, RegisterClient, ret); 175 - teles_detach(link->handle); 176 - return NULL; 177 - } 180 + link->handle = p_dev; 181 + p_dev->instance = link; 178 182 179 - return link; 183 + link->state |= DEV_PRESENT | DEV_CONFIG_PENDING; 184 + teles_cs_config(link); 185 + 186 + return 0; 180 187 } /* teles_attach */ 181 188 182 189 /*====================================================================== ··· 409 428 return 0; 410 429 } 411 430 412 - /*====================================================================== 413 - 414 - The card status event handler. Mostly, this schedules other 415 - stuff to run after an event is received. A CARD_REMOVAL event 416 - also sets some flags to discourage the net drivers from trying 417 - to talk to the card any more. 418 - 419 - When a CARD_REMOVAL event is received, we immediately set a flag 420 - to block future accesses to this device. All the functions that 421 - actually access the device should check this flag to make sure 422 - the card is still present. 423 - 424 - ======================================================================*/ 425 - 426 - static int teles_cs_event(event_t event, int priority, 427 - event_callback_args_t *args) 428 - { 429 - dev_link_t *link = args->client_data; 430 - 431 - DEBUG(1, "teles_cs_event(%d)\n", event); 432 - 433 - switch (event) { 434 - case CS_EVENT_CARD_INSERTION: 435 - link->state |= DEV_PRESENT | DEV_CONFIG_PENDING; 436 - teles_cs_config(link); 437 - break; 438 - } 439 - return 0; 440 - } /* teles_cs_event */ 441 431 442 432 static struct pcmcia_device_id teles_ids[] = { 443 433 PCMCIA_DEVICE_PROD_ID12("TELES", "S0/PC", 0x67b50eae, 0xe9e70119), ··· 421 469 .drv = { 422 470 .name = "teles_cs", 423 471 }, 424 - .attach = teles_attach, 425 - .event = teles_cs_event, 472 + .probe = teles_attach, 426 473 .remove = teles_detach, 427 474 .id_table = teles_ids, 428 475 .suspend = teles_suspend,
+9 -45
drivers/mtd/maps/pcmciamtd.c
··· 66 66 }; 67 67 68 68 69 - static dev_info_t dev_info = "pcmciamtd"; 70 - 71 69 /* Module parameters */ 72 70 73 71 /* 2 = do 16-bit transfers, 1 = do 8-bit transfers */ ··· 706 708 return 0; 707 709 } 708 710 709 - /* The card status event handler. Mostly, this schedules other 710 - * stuff to run after an event is received. A CARD_REMOVAL event 711 - * also sets some flags to discourage the driver from trying 712 - * to talk to the card any more. 713 - */ 714 - 715 - static int pcmciamtd_event(event_t event, int priority, 716 - event_callback_args_t *args) 717 - { 718 - dev_link_t *link = args->client_data; 719 - 720 - DEBUG(1, "event=0x%06x", event); 721 - switch (event) { 722 - case CS_EVENT_CARD_INSERTION: 723 - DEBUG(2, "EVENT_CARD_INSERTION"); 724 - link->state |= DEV_PRESENT | DEV_CONFIG_PENDING; 725 - pcmciamtd_config(link); 726 - break; 727 - default: 728 - DEBUG(2, "Unknown event %d", event); 729 - } 730 - return 0; 731 - } 732 - 733 711 734 712 /* This deletes a driver "instance". The device is de-registered 735 713 * with Card Services. If it has been released, all local data ··· 736 762 * with Card Services. 737 763 */ 738 764 739 - static dev_link_t *pcmciamtd_attach(void) 765 + static int pcmciamtd_attach(struct pcmcia_device *p_dev) 740 766 { 741 767 struct pcmciamtd_dev *dev; 742 768 dev_link_t *link; 743 - client_reg_t client_reg; 744 - int ret; 745 769 746 770 /* Create new memory card device */ 747 771 dev = kmalloc(sizeof(*dev), GFP_KERNEL); 748 - if (!dev) return NULL; 772 + if (!dev) return -ENOMEM; 749 773 DEBUG(1, "dev=0x%p", dev); 750 774 751 775 memset(dev, 0, sizeof(*dev)); ··· 754 782 link->conf.IntType = INT_MEMORY; 755 783 756 784 link->next = NULL; 785 + link->handle = p_dev; 786 + p_dev->instance = link; 757 787 758 - /* Register with Card Services */ 759 - client_reg.dev_info = &dev_info; 760 - client_reg.Version = 0x0210; 761 - client_reg.event_callback_args.client_data = link; 762 - DEBUG(2, "Calling RegisterClient"); 763 - ret = pcmcia_register_client(&link->handle, &client_reg); 764 - if (ret != 0) { 765 - cs_error(link->handle, RegisterClient, ret); 766 - pcmciamtd_detach(link->handle); 767 - return NULL; 768 - } 769 - DEBUG(2, "link = %p", link); 770 - return link; 788 + link->state |= DEV_PRESENT | DEV_CONFIG_PENDING; 789 + pcmciamtd_config(link); 790 + 791 + return 0; 771 792 } 772 793 773 794 static struct pcmcia_device_id pcmciamtd_ids[] = { ··· 794 829 .drv = { 795 830 .name = "pcmciamtd" 796 831 }, 797 - .attach = pcmciamtd_attach, 798 - .event = pcmciamtd_event, 832 + .probe = pcmciamtd_attach, 799 833 .remove = pcmciamtd_detach, 800 834 .owner = THIS_MODULE, 801 835 .id_table = pcmciamtd_ids,
+9 -46
drivers/net/pcmcia/3c574_cs.c
··· 227 227 228 228 static void tc574_config(dev_link_t *link); 229 229 static void tc574_release(dev_link_t *link); 230 - static int tc574_event(event_t event, int priority, 231 - event_callback_args_t *args); 232 230 233 231 static void mdio_sync(kio_addr_t ioaddr, int bits); 234 232 static int mdio_read(kio_addr_t ioaddr, int phy_id, int location); ··· 248 250 static struct ethtool_ops netdev_ethtool_ops; 249 251 static void set_rx_mode(struct net_device *dev); 250 252 251 - static dev_info_t dev_info = "3c574_cs"; 252 - 253 - static dev_link_t *tc574_attach(void); 254 253 static void tc574_detach(struct pcmcia_device *p_dev); 255 254 256 255 /* ··· 256 261 with Card Services. 257 262 */ 258 263 259 - static dev_link_t *tc574_attach(void) 264 + static int tc574_attach(struct pcmcia_device *p_dev) 260 265 { 261 266 struct el3_private *lp; 262 - client_reg_t client_reg; 263 267 dev_link_t *link; 264 268 struct net_device *dev; 265 - int ret; 266 269 267 270 DEBUG(0, "3c574_attach()\n"); 268 271 269 272 /* Create the PC card device object. */ 270 273 dev = alloc_etherdev(sizeof(struct el3_private)); 271 274 if (!dev) 272 - return NULL; 275 + return -ENOMEM; 273 276 lp = netdev_priv(dev); 274 277 link = &lp->link; 275 278 link->priv = dev; ··· 298 305 dev->watchdog_timeo = TX_TIMEOUT; 299 306 #endif 300 307 301 - /* Register with Card Services */ 302 - link->next = NULL; 303 - client_reg.dev_info = &dev_info; 304 - client_reg.Version = 0x0210; 305 - client_reg.event_callback_args.client_data = link; 306 - ret = pcmcia_register_client(&link->handle, &client_reg); 307 - if (ret != 0) { 308 - cs_error(link->handle, RegisterClient, ret); 309 - tc574_detach(link->handle); 310 - return NULL; 311 - } 308 + link->handle = p_dev; 309 + p_dev->instance = link; 312 310 313 - return link; 311 + link->state |= DEV_PRESENT | DEV_CONFIG_PENDING; 312 + tc574_config(link); 313 + 314 + return 0; 314 315 } /* tc574_attach */ 315 316 316 317 /* ··· 551 564 552 565 return 0; 553 566 } 554 - 555 - /* 556 - The card status event handler. Mostly, this schedules other 557 - stuff to run after an event is received. A CARD_REMOVAL event 558 - also sets some flags to discourage the net drivers from trying 559 - to talk to the card any more. 560 - */ 561 - 562 - static int tc574_event(event_t event, int priority, 563 - event_callback_args_t *args) 564 - { 565 - dev_link_t *link = args->client_data; 566 - 567 - DEBUG(1, "3c574_event(0x%06x)\n", event); 568 - 569 - switch (event) { 570 - case CS_EVENT_CARD_INSERTION: 571 - link->state |= DEV_PRESENT | DEV_CONFIG_PENDING; 572 - tc574_config(link); 573 - break; 574 - } 575 - return 0; 576 - } /* tc574_event */ 577 567 578 568 static void dump_status(struct net_device *dev) 579 569 { ··· 1246 1282 .drv = { 1247 1283 .name = "3c574_cs", 1248 1284 }, 1249 - .attach = tc574_attach, 1250 - .event = tc574_event, 1285 + .probe = tc574_attach, 1251 1286 .remove = tc574_detach, 1252 1287 .id_table = tc574_ids, 1253 1288 .suspend = tc574_suspend,
+12 -51
drivers/net/pcmcia/3c589_cs.c
··· 143 143 144 144 static void tc589_config(dev_link_t *link); 145 145 static void tc589_release(dev_link_t *link); 146 - static int tc589_event(event_t event, int priority, 147 - event_callback_args_t *args); 148 146 149 147 static u16 read_eeprom(kio_addr_t ioaddr, int index); 150 148 static void tc589_reset(struct net_device *dev); ··· 159 161 static void set_multicast_list(struct net_device *dev); 160 162 static struct ethtool_ops netdev_ethtool_ops; 161 163 162 - static dev_info_t dev_info = "3c589_cs"; 163 - 164 - static dev_link_t *tc589_attach(void); 165 164 static void tc589_detach(struct pcmcia_device *p_dev); 166 165 167 166 /*====================================================================== ··· 169 174 170 175 ======================================================================*/ 171 176 172 - static dev_link_t *tc589_attach(void) 177 + static int tc589_attach(struct pcmcia_device *p_dev) 173 178 { 174 179 struct el3_private *lp; 175 - client_reg_t client_reg; 176 180 dev_link_t *link; 177 181 struct net_device *dev; 178 - int ret; 179 182 180 183 DEBUG(0, "3c589_attach()\n"); 181 - 184 + 182 185 /* Create new ethernet device */ 183 186 dev = alloc_etherdev(sizeof(struct el3_private)); 184 187 if (!dev) 185 - return NULL; 188 + return -ENOMEM; 186 189 lp = netdev_priv(dev); 187 190 link = &lp->link; 188 191 link->priv = dev; ··· 197 204 link->conf.IntType = INT_MEMORY_AND_IO; 198 205 link->conf.ConfigIndex = 1; 199 206 link->conf.Present = PRESENT_OPTION; 200 - 207 + 201 208 /* The EL3-specific entries in the device structure. */ 202 209 SET_MODULE_OWNER(dev); 203 210 dev->hard_start_xmit = &el3_start_xmit; ··· 212 219 #endif 213 220 SET_ETHTOOL_OPS(dev, &netdev_ethtool_ops); 214 221 215 - /* Register with Card Services */ 216 - link->next = NULL; 217 - client_reg.dev_info = &dev_info; 218 - client_reg.Version = 0x0210; 219 - client_reg.event_callback_args.client_data = link; 220 - ret = pcmcia_register_client(&link->handle, &client_reg); 221 - if (ret != 0) { 222 - cs_error(link->handle, RegisterClient, ret); 223 - tc589_detach(link->handle); 224 - return NULL; 225 - } 226 - 227 - return link; 222 + link->handle = p_dev; 223 + p_dev->instance = link; 224 + 225 + link->state |= DEV_PRESENT | DEV_CONFIG_PENDING; 226 + tc589_config(link); 227 + 228 + return 0; 228 229 } /* tc589_attach */ 229 230 230 231 /*====================================================================== ··· 425 438 426 439 return 0; 427 440 } 428 - 429 - /*====================================================================== 430 - 431 - The card status event handler. Mostly, this schedules other 432 - stuff to run after an event is received. A CARD_REMOVAL event 433 - also sets some flags to discourage the net drivers from trying 434 - to talk to the card any more. 435 - 436 - ======================================================================*/ 437 - 438 - static int tc589_event(event_t event, int priority, 439 - event_callback_args_t *args) 440 - { 441 - dev_link_t *link = args->client_data; 442 - 443 - DEBUG(1, "3c589_event(0x%06x)\n", event); 444 - 445 - switch (event) { 446 - case CS_EVENT_CARD_INSERTION: 447 - link->state |= DEV_PRESENT | DEV_CONFIG_PENDING; 448 - tc589_config(link); 449 - break; 450 - } 451 - return 0; 452 - } /* tc589_event */ 453 441 454 442 /*====================================================================*/ 455 443 ··· 1019 1057 .drv = { 1020 1058 .name = "3c589_cs", 1021 1059 }, 1022 - .attach = tc589_attach, 1023 - .event = tc589_event, 1060 + .probe = tc589_attach, 1024 1061 .remove = tc589_detach, 1025 1062 .id_table = tc589_ids, 1026 1063 .suspend = tc589_suspend,
+10 -49
drivers/net/pcmcia/axnet_cs.c
··· 87 87 88 88 static void axnet_config(dev_link_t *link); 89 89 static void axnet_release(dev_link_t *link); 90 - static int axnet_event(event_t event, int priority, 91 - event_callback_args_t *args); 92 90 static int axnet_open(struct net_device *dev); 93 91 static int axnet_close(struct net_device *dev); 94 92 static int axnet_ioctl(struct net_device *dev, struct ifreq *rq, int cmd); ··· 105 107 static void block_output(struct net_device *dev, int count, 106 108 const u_char *buf, const int start_page); 107 109 108 - static dev_link_t *axnet_attach(void); 109 110 static void axnet_detach(struct pcmcia_device *p_dev); 110 - 111 - static dev_info_t dev_info = "axnet_cs"; 112 111 113 112 static void axdev_setup(struct net_device *dev); 114 113 static void AX88190_init(struct net_device *dev, int startp); ··· 141 146 142 147 ======================================================================*/ 143 148 144 - static dev_link_t *axnet_attach(void) 149 + static int axnet_attach(struct pcmcia_device *p_dev) 145 150 { 146 151 axnet_dev_t *info; 147 152 dev_link_t *link; 148 153 struct net_device *dev; 149 - client_reg_t client_reg; 150 - int ret; 151 154 152 155 DEBUG(0, "axnet_attach()\n"); 153 156 ··· 153 160 "eth%d", axdev_setup); 154 161 155 162 if (!dev) 156 - return NULL; 163 + return -ENOMEM; 157 164 158 165 info = PRIV(dev); 159 166 link = &info->link; ··· 168 175 dev->do_ioctl = &axnet_ioctl; 169 176 SET_ETHTOOL_OPS(dev, &netdev_ethtool_ops); 170 177 171 - /* Register with Card Services */ 172 - link->next = NULL; 173 - client_reg.dev_info = &dev_info; 174 - client_reg.Version = 0x0210; 175 - client_reg.event_callback_args.client_data = link; 176 - ret = pcmcia_register_client(&link->handle, &client_reg); 177 - if (ret != CS_SUCCESS) { 178 - cs_error(link->handle, RegisterClient, ret); 179 - axnet_detach(link->handle); 180 - return NULL; 181 - } 178 + link->handle = p_dev; 179 + p_dev->instance = link; 182 180 183 - return link; 181 + link->state |= DEV_PRESENT | DEV_CONFIG_PENDING; 182 + axnet_config(link); 183 + 184 + return 0; 184 185 } /* axnet_attach */ 185 186 186 187 /*====================================================================== ··· 500 513 501 514 /*====================================================================== 502 515 503 - The card status event handler. Mostly, this schedules other 504 - stuff to run after an event is received. A CARD_REMOVAL event 505 - also sets some flags to discourage the net drivers from trying 506 - to talk to the card any more. 507 - 508 - ======================================================================*/ 509 - 510 - static int axnet_event(event_t event, int priority, 511 - event_callback_args_t *args) 512 - { 513 - dev_link_t *link = args->client_data; 514 - 515 - DEBUG(2, "axnet_event(0x%06x)\n", event); 516 - 517 - switch (event) { 518 - case CS_EVENT_CARD_INSERTION: 519 - link->state |= DEV_PRESENT | DEV_CONFIG_PENDING; 520 - axnet_config(link); 521 - break; 522 - } 523 - return 0; 524 - } /* axnet_event */ 525 - 526 - /*====================================================================== 527 - 528 516 MII interface support 529 517 530 518 ======================================================================*/ ··· 570 608 571 609 link->open++; 572 610 573 - request_irq(dev->irq, ei_irq_wrapper, SA_SHIRQ, dev_info, dev); 611 + request_irq(dev->irq, ei_irq_wrapper, SA_SHIRQ, "axnet_cs", dev); 574 612 575 613 info->link_status = 0x00; 576 614 init_timer(&info->watchdog); ··· 831 869 .drv = { 832 870 .name = "axnet_cs", 833 871 }, 834 - .attach = axnet_attach, 835 - .event = axnet_event, 872 + .probe = axnet_attach, 836 873 .remove = axnet_detach, 837 874 .id_table = axnet_ids, 838 875 .suspend = axnet_suspend,
+8 -51
drivers/net/pcmcia/com20020_cs.c
··· 120 120 121 121 static void com20020_config(dev_link_t *link); 122 122 static void com20020_release(dev_link_t *link); 123 - static int com20020_event(event_t event, int priority, 124 - event_callback_args_t *args); 125 123 126 - static dev_info_t dev_info = "com20020_cs"; 127 - 128 - static dev_link_t *com20020_attach(void); 129 124 static void com20020_detach(struct pcmcia_device *p_dev); 130 125 131 126 /*====================================================================*/ ··· 138 143 139 144 ======================================================================*/ 140 145 141 - static dev_link_t *com20020_attach(void) 146 + static int com20020_attach(struct pcmcia_device *p_dev) 142 147 { 143 - client_reg_t client_reg; 144 148 dev_link_t *link; 145 149 com20020_dev_t *info; 146 150 struct net_device *dev; 147 - int ret; 148 151 struct arcnet_local *lp; 149 - 152 + 150 153 DEBUG(0, "com20020_attach()\n"); 151 154 152 155 /* Create new network device */ 153 156 link = kmalloc(sizeof(struct dev_link_t), GFP_KERNEL); 154 157 if (!link) 155 - return NULL; 158 + return -ENOMEM; 156 159 157 160 info = kmalloc(sizeof(struct com20020_dev_t), GFP_KERNEL); 158 161 if (!info) ··· 182 189 link->conf.IntType = INT_MEMORY_AND_IO; 183 190 link->conf.Present = PRESENT_OPTION; 184 191 185 - 186 192 link->irq.Instance = info->dev = dev; 187 193 link->priv = info; 188 194 189 - /* Register with Card Services */ 190 - link->next = NULL; 191 - client_reg.dev_info = &dev_info; 192 - client_reg.Version = 0x0210; 193 - client_reg.event_callback_args.client_data = link; 194 - ret = pcmcia_register_client(&link->handle, &client_reg); 195 - if (ret != 0) { 196 - cs_error(link->handle, RegisterClient, ret); 197 - com20020_detach(link->handle); 198 - return NULL; 199 - } 195 + link->state |= DEV_PRESENT; 196 + com20020_config(link); 200 197 201 - return link; 198 + return 0; 202 199 203 200 fail_alloc_dev: 204 201 kfree(info); 205 202 fail_alloc_info: 206 203 kfree(link); 207 - return NULL; 204 + return -ENOMEM; 208 205 } /* com20020_attach */ 209 206 210 207 /*====================================================================== ··· 425 442 return 0; 426 443 } 427 444 428 - /*====================================================================== 429 - 430 - The card status event handler. Mostly, this schedules other 431 - stuff to run after an event is received. A CARD_REMOVAL event 432 - also sets some flags to discourage the net drivers from trying 433 - to talk to the card any more. 434 - 435 - ======================================================================*/ 436 - 437 - static int com20020_event(event_t event, int priority, 438 - event_callback_args_t *args) 439 - { 440 - dev_link_t *link = args->client_data; 441 - 442 - DEBUG(1, "com20020_event(0x%06x)\n", event); 443 - 444 - switch (event) { 445 - case CS_EVENT_CARD_INSERTION: 446 - link->state |= DEV_PRESENT; 447 - com20020_config(link); 448 - break; 449 - } 450 - return 0; 451 - } /* com20020_event */ 452 - 453 445 static struct pcmcia_device_id com20020_ids[] = { 454 446 PCMCIA_DEVICE_PROD_ID12("Contemporary Control Systems, Inc.", "PCM20 Arcnet Adapter", 0x59991666, 0x95dfffaf), 455 447 PCMCIA_DEVICE_NULL ··· 436 478 .drv = { 437 479 .name = "com20020_cs", 438 480 }, 439 - .attach = com20020_attach, 440 - .event = com20020_event, 481 + .probe = com20020_attach, 441 482 .remove = com20020_detach, 442 483 .id_table = com20020_ids, 443 484 .suspend = com20020_suspend,
+12 -42
drivers/net/pcmcia/fmvj18x_cs.c
··· 88 88 static int fmvj18x_get_hwinfo(dev_link_t *link, u_char *node_id); 89 89 static int fmvj18x_setup_mfc(dev_link_t *link); 90 90 static void fmvj18x_release(dev_link_t *link); 91 - static int fmvj18x_event(event_t event, int priority, 92 - event_callback_args_t *args); 93 - static dev_link_t *fmvj18x_attach(void); 94 91 static void fmvj18x_detach(struct pcmcia_device *p_dev); 95 92 96 93 /* ··· 104 107 static void set_rx_mode(struct net_device *dev); 105 108 static void fjn_tx_timeout(struct net_device *dev); 106 109 static struct ethtool_ops netdev_ethtool_ops; 107 - 108 - static dev_info_t dev_info = "fmvj18x_cs"; 109 110 110 111 /* 111 112 card type ··· 228 233 #define BANK_1U 0x24 /* bank 1 (CONFIG_1) */ 229 234 #define BANK_2U 0x28 /* bank 2 (CONFIG_1) */ 230 235 231 - static dev_link_t *fmvj18x_attach(void) 236 + static int fmvj18x_attach(struct pcmcia_device *p_dev) 232 237 { 233 238 local_info_t *lp; 234 239 dev_link_t *link; 235 240 struct net_device *dev; 236 - client_reg_t client_reg; 237 - int ret; 238 - 241 + 239 242 DEBUG(0, "fmvj18x_attach()\n"); 240 243 241 244 /* Make up a FMVJ18x specific data structure */ 242 245 dev = alloc_etherdev(sizeof(local_info_t)); 243 246 if (!dev) 244 - return NULL; 247 + return -ENOMEM; 245 248 lp = netdev_priv(dev); 246 249 link = &lp->link; 247 250 link->priv = dev; ··· 254 261 link->irq.IRQInfo1 = IRQ_LEVEL_ID; 255 262 link->irq.Handler = &fjn_interrupt; 256 263 link->irq.Instance = dev; 257 - 264 + 258 265 /* General socket configuration */ 259 266 link->conf.Attributes = CONF_ENABLE_IRQ; 260 267 link->conf.Vcc = 50; ··· 273 280 dev->watchdog_timeo = TX_TIMEOUT; 274 281 #endif 275 282 SET_ETHTOOL_OPS(dev, &netdev_ethtool_ops); 276 - 277 - /* Register with Card Services */ 278 - link->next = NULL; 279 - client_reg.dev_info = &dev_info; 280 - client_reg.Version = 0x0210; 281 - client_reg.event_callback_args.client_data = link; 282 - ret = pcmcia_register_client(&link->handle, &client_reg); 283 - if (ret != 0) { 284 - cs_error(link->handle, RegisterClient, ret); 285 - fmvj18x_detach(link->handle); 286 - return NULL; 287 - } 288 283 289 - return link; 284 + link->handle = p_dev; 285 + p_dev->instance = link; 286 + 287 + link->state |= DEV_PRESENT | DEV_CONFIG_PENDING; 288 + fmvj18x_config(link); 289 + 290 + return 0; 290 291 } /* fmvj18x_attach */ 291 292 292 293 /*====================================================================*/ ··· 721 734 722 735 /*====================================================================*/ 723 736 724 - static int fmvj18x_event(event_t event, int priority, 725 - event_callback_args_t *args) 726 - { 727 - dev_link_t *link = args->client_data; 728 - 729 - DEBUG(1, "fmvj18x_event(0x%06x)\n", event); 730 - 731 - switch (event) { 732 - case CS_EVENT_CARD_INSERTION: 733 - link->state |= DEV_PRESENT | DEV_CONFIG_PENDING; 734 - fmvj18x_config(link); 735 - break; 736 - } 737 - return 0; 738 - } /* fmvj18x_event */ 739 - 740 737 static struct pcmcia_device_id fmvj18x_ids[] = { 741 738 PCMCIA_DEVICE_MANF_CARD(0x0004, 0x0004), 742 739 PCMCIA_DEVICE_PROD_ID12("EAGLE Technology", "NE200 ETHERNET LAN MBH10302 04", 0x528c88c4, 0x74f91e59), ··· 751 780 .drv = { 752 781 .name = "fmvj18x_cs", 753 782 }, 754 - .attach = fmvj18x_attach, 755 - .event = fmvj18x_event, 783 + .probe = fmvj18x_attach, 756 784 .remove = fmvj18x_detach, 757 785 .id_table = fmvj18x_ids, 758 786 .suspend = fmvj18x_suspend,
+12 -57
drivers/net/pcmcia/ibmtr_cs.c
··· 108 108 static void ibmtr_config(dev_link_t *link); 109 109 static void ibmtr_hw_setup(struct net_device *dev, u_int mmiobase); 110 110 static void ibmtr_release(dev_link_t *link); 111 - static int ibmtr_event(event_t event, int priority, 112 - event_callback_args_t *args); 113 - 114 - static dev_info_t dev_info = "ibmtr_cs"; 115 - 116 - static dev_link_t *ibmtr_attach(void); 117 111 static void ibmtr_detach(struct pcmcia_device *p_dev); 118 112 119 113 /*====================================================================*/ ··· 138 144 139 145 ======================================================================*/ 140 146 141 - static dev_link_t *ibmtr_attach(void) 147 + static int ibmtr_attach(struct pcmcia_device *p_dev) 142 148 { 143 149 ibmtr_dev_t *info; 144 150 dev_link_t *link; 145 151 struct net_device *dev; 146 - client_reg_t client_reg; 147 - int ret; 148 152 149 153 DEBUG(0, "ibmtr_attach()\n"); 150 154 151 155 /* Create new token-ring device */ 152 156 info = kmalloc(sizeof(*info), GFP_KERNEL); 153 - if (!info) return NULL; 157 + if (!info) return -ENOMEM; 154 158 memset(info,0,sizeof(*info)); 155 159 dev = alloc_trdev(sizeof(struct tok_info)); 156 - if (!dev) { 157 - kfree(info); 158 - return NULL; 159 - } 160 + if (!dev) { 161 + kfree(info); 162 + return -ENOMEM; 163 + } 160 164 161 165 link = &info->link; 162 166 link->priv = info; ··· 175 183 176 184 SET_ETHTOOL_OPS(dev, &netdev_ethtool_ops); 177 185 178 - /* Register with Card Services */ 179 - link->next = NULL; 180 - client_reg.dev_info = &dev_info; 181 - client_reg.Version = 0x0210; 182 - client_reg.event_callback_args.client_data = link; 183 - ret = pcmcia_register_client(&link->handle, &client_reg); 184 - if (ret != 0) { 185 - cs_error(link->handle, RegisterClient, ret); 186 - goto out_detach; 187 - } 186 + link->handle = p_dev; 187 + p_dev->instance = link; 188 188 189 - out: 190 - return link; 189 + link->state |= DEV_PRESENT; 190 + ibmtr_config(link); 191 191 192 - out_detach: 193 - ibmtr_detach(link->handle); 194 - link = NULL; 195 - goto out; 192 + return 0; 196 193 } /* ibmtr_attach */ 197 194 198 195 /*====================================================================== ··· 401 420 } 402 421 403 422 404 - /*====================================================================== 405 - 406 - The card status event handler. Mostly, this schedules other 407 - stuff to run after an event is received. A CARD_REMOVAL event 408 - also sets some flags to discourage the net drivers from trying 409 - to talk to the card any more. 410 - 411 - ======================================================================*/ 412 - 413 - static int ibmtr_event(event_t event, int priority, 414 - event_callback_args_t *args) 415 - { 416 - dev_link_t *link = args->client_data; 417 - 418 - DEBUG(1, "ibmtr_event(0x%06x)\n", event); 419 - 420 - switch (event) { 421 - case CS_EVENT_CARD_INSERTION: 422 - link->state |= DEV_PRESENT; 423 - ibmtr_config(link); 424 - break; 425 - } 426 - return 0; 427 - } /* ibmtr_event */ 428 - 429 423 /*====================================================================*/ 430 424 431 425 static void ibmtr_hw_setup(struct net_device *dev, u_int mmiobase) ··· 456 500 .drv = { 457 501 .name = "ibmtr_cs", 458 502 }, 459 - .attach = ibmtr_attach, 460 - .event = ibmtr_event, 503 + .probe = ibmtr_attach, 461 504 .remove = ibmtr_detach, 462 505 .id_table = ibmtr_ids, 463 506 .suspend = ibmtr_suspend,
+9 -48
drivers/net/pcmcia/nmclan_cs.c
··· 388 388 DRV_NAME " " DRV_VERSION " (Roger C. Pao)"; 389 389 #endif 390 390 391 - static dev_info_t dev_info="nmclan_cs"; 392 - 393 391 static char *if_names[]={ 394 392 "Auto", "10baseT", "BNC", 395 393 }; ··· 419 421 420 422 static void nmclan_config(dev_link_t *link); 421 423 static void nmclan_release(dev_link_t *link); 422 - static int nmclan_event(event_t event, int priority, 423 - event_callback_args_t *args); 424 424 425 425 static void nmclan_reset(struct net_device *dev); 426 426 static int mace_config(struct net_device *dev, struct ifmap *map); ··· 434 438 static struct ethtool_ops netdev_ethtool_ops; 435 439 436 440 437 - static dev_link_t *nmclan_attach(void); 438 441 static void nmclan_detach(struct pcmcia_device *p_dev); 439 442 440 443 /* ---------------------------------------------------------------------------- ··· 443 448 Services. 444 449 ---------------------------------------------------------------------------- */ 445 450 446 - static dev_link_t *nmclan_attach(void) 451 + static int nmclan_attach(struct pcmcia_device *p_dev) 447 452 { 448 453 mace_private *lp; 449 454 dev_link_t *link; 450 455 struct net_device *dev; 451 - client_reg_t client_reg; 452 - int ret; 453 456 454 457 DEBUG(0, "nmclan_attach()\n"); 455 458 DEBUG(1, "%s\n", rcsid); ··· 455 462 /* Create new ethernet device */ 456 463 dev = alloc_etherdev(sizeof(mace_private)); 457 464 if (!dev) 458 - return NULL; 465 + return -ENOMEM; 459 466 lp = netdev_priv(dev); 460 467 link = &lp->link; 461 468 link->priv = dev; ··· 489 496 dev->watchdog_timeo = TX_TIMEOUT; 490 497 #endif 491 498 492 - /* Register with Card Services */ 493 - link->next = NULL; 494 - client_reg.dev_info = &dev_info; 495 - client_reg.Version = 0x0210; 496 - client_reg.event_callback_args.client_data = link; 497 - ret = pcmcia_register_client(&link->handle, &client_reg); 498 - if (ret != 0) { 499 - cs_error(link->handle, RegisterClient, ret); 500 - nmclan_detach(link->handle); 501 - return NULL; 502 - } 499 + link->handle = p_dev; 500 + p_dev->instance = link; 503 501 504 - return link; 502 + link->state |= DEV_PRESENT | DEV_CONFIG_PENDING; 503 + nmclan_config(link); 504 + 505 + return 0; 505 506 } /* nmclan_attach */ 506 507 507 508 /* ---------------------------------------------------------------------------- ··· 808 821 return 0; 809 822 } 810 823 811 - /* ---------------------------------------------------------------------------- 812 - nmclan_event 813 - The card status event handler. Mostly, this schedules other 814 - stuff to run after an event is received. A CARD_REMOVAL event 815 - also sets some flags to discourage the net drivers from trying 816 - to talk to the card any more. 817 - ---------------------------------------------------------------------------- */ 818 - static int nmclan_event(event_t event, int priority, 819 - event_callback_args_t *args) 820 - { 821 - dev_link_t *link = args->client_data; 822 - 823 - DEBUG(1, "nmclan_event(0x%06x)\n", event); 824 - 825 - switch (event) { 826 - case CS_EVENT_CARD_INSERTION: 827 - link->state |= DEV_PRESENT | DEV_CONFIG_PENDING; 828 - nmclan_config(link); 829 - break; 830 - case CS_EVENT_RESET_REQUEST: 831 - return 1; 832 - break; 833 - } 834 - return 0; 835 - } /* nmclan_event */ 836 824 837 825 /* ---------------------------------------------------------------------------- 838 826 nmclan_reset ··· 1635 1673 .drv = { 1636 1674 .name = "nmclan_cs", 1637 1675 }, 1638 - .attach = nmclan_attach, 1639 - .event = nmclan_event, 1676 + .probe = nmclan_attach, 1640 1677 .remove = nmclan_detach, 1641 1678 .id_table = nmclan_ids, 1642 1679 .suspend = nmclan_suspend,
+9 -36
drivers/net/pcmcia/pcnet_cs.c
··· 105 105 static void mii_phy_probe(struct net_device *dev); 106 106 static void pcnet_config(dev_link_t *link); 107 107 static void pcnet_release(dev_link_t *link); 108 - static int pcnet_event(event_t event, int priority, 109 - event_callback_args_t *args); 110 108 static int pcnet_open(struct net_device *dev); 111 109 static int pcnet_close(struct net_device *dev); 112 110 static int ei_ioctl(struct net_device *dev, struct ifreq *rq, int cmd); ··· 118 120 static int setup_dma_config(dev_link_t *link, int start_pg, 119 121 int stop_pg); 120 122 121 - static dev_link_t *pcnet_attach(void); 122 123 static void pcnet_detach(struct pcmcia_device *p_dev); 123 124 124 125 static dev_info_t dev_info = "pcnet_cs"; ··· 240 243 241 244 ======================================================================*/ 242 245 243 - static dev_link_t *pcnet_attach(void) 246 + static int pcnet_probe(struct pcmcia_device *p_dev) 244 247 { 245 248 pcnet_dev_t *info; 246 249 dev_link_t *link; 247 250 struct net_device *dev; 248 - client_reg_t client_reg; 249 - int ret; 250 251 251 252 DEBUG(0, "pcnet_attach()\n"); 252 253 253 254 /* Create new ethernet device */ 254 255 dev = __alloc_ei_netdev(sizeof(pcnet_dev_t)); 255 - if (!dev) return NULL; 256 + if (!dev) return -ENOMEM; 256 257 info = PRIV(dev); 257 258 link = &info->link; 258 259 link->priv = dev; ··· 265 270 dev->stop = &pcnet_close; 266 271 dev->set_config = &set_config; 267 272 268 - /* Register with Card Services */ 269 - link->next = NULL; 270 - client_reg.dev_info = &dev_info; 271 - client_reg.Version = 0x0210; 272 - client_reg.event_callback_args.client_data = link; 273 - ret = pcmcia_register_client(&link->handle, &client_reg); 274 - if (ret != CS_SUCCESS) { 275 - cs_error(link->handle, RegisterClient, ret); 276 - pcnet_detach(link->handle); 277 - return NULL; 278 - } 273 + link->handle = p_dev; 274 + p_dev->instance = link; 279 275 280 - return link; 276 + link->state |= DEV_PRESENT | DEV_CONFIG_PENDING; 277 + pcnet_config(link); 278 + 279 + return 0; 281 280 } /* pcnet_attach */ 282 281 283 282 /*====================================================================== ··· 789 800 return 0; 790 801 } 791 802 792 - static int pcnet_event(event_t event, int priority, 793 - event_callback_args_t *args) 794 - { 795 - dev_link_t *link = args->client_data; 796 - 797 - DEBUG(2, "pcnet_event(0x%06x)\n", event); 798 - 799 - switch (event) { 800 - case CS_EVENT_CARD_INSERTION: 801 - link->state |= DEV_PRESENT | DEV_CONFIG_PENDING; 802 - pcnet_config(link); 803 - break; 804 - } 805 - return 0; 806 - } /* pcnet_event */ 807 803 808 804 /*====================================================================== 809 805 ··· 1809 1835 .drv = { 1810 1836 .name = "pcnet_cs", 1811 1837 }, 1812 - .attach = pcnet_attach, 1813 - .event = pcnet_event, 1838 + .probe = pcnet_probe, 1814 1839 .remove = pcnet_detach, 1815 1840 .owner = THIS_MODULE, 1816 1841 .id_table = pcnet_ids,
+9 -48
drivers/net/pcmcia/smc91c92_cs.c
··· 102 102 currently have room for another Tx packet. */ 103 103 #define MEMORY_WAIT_TIME 8 104 104 105 - static dev_info_t dev_info = "smc91c92_cs"; 106 - 107 105 struct smc_private { 108 106 dev_link_t link; 109 107 spinlock_t lock; ··· 277 279 278 280 /*====================================================================*/ 279 281 280 - static dev_link_t *smc91c92_attach(void); 281 282 static void smc91c92_detach(struct pcmcia_device *p_dev); 282 283 static void smc91c92_config(dev_link_t *link); 283 284 static void smc91c92_release(dev_link_t *link); 284 - static int smc91c92_event(event_t event, int priority, 285 - event_callback_args_t *args); 286 285 287 286 static int smc_open(struct net_device *dev); 288 287 static int smc_close(struct net_device *dev); ··· 308 313 309 314 ======================================================================*/ 310 315 311 - static dev_link_t *smc91c92_attach(void) 316 + static int smc91c92_attach(struct pcmcia_device *p_dev) 312 317 { 313 - client_reg_t client_reg; 314 318 struct smc_private *smc; 315 319 dev_link_t *link; 316 320 struct net_device *dev; 317 - int ret; 318 321 319 322 DEBUG(0, "smc91c92_attach()\n"); 320 323 321 324 /* Create new ethernet device */ 322 325 dev = alloc_etherdev(sizeof(struct smc_private)); 323 326 if (!dev) 324 - return NULL; 327 + return -ENOMEM; 325 328 smc = netdev_priv(dev); 326 329 link = &smc->link; 327 330 link->priv = dev; ··· 357 364 smc->mii_if.phy_id_mask = 0x1f; 358 365 smc->mii_if.reg_num_mask = 0x1f; 359 366 360 - /* Register with Card Services */ 361 - link->next = NULL; 362 - client_reg.dev_info = &dev_info; 363 - client_reg.Version = 0x0210; 364 - client_reg.event_callback_args.client_data = link; 365 - ret = pcmcia_register_client(&link->handle, &client_reg); 366 - if (ret != 0) { 367 - cs_error(link->handle, RegisterClient, ret); 368 - smc91c92_detach(link->handle); 369 - return NULL; 370 - } 367 + link->handle = p_dev; 368 + p_dev->instance = link; 371 369 372 - return link; 370 + link->state |= DEV_PRESENT | DEV_CONFIG_PENDING; 371 + smc91c92_config(link); 372 + 373 + return 0; 373 374 } /* smc91c92_attach */ 374 375 375 376 /*====================================================================== ··· 1196 1209 1197 1210 link->state &= ~DEV_CONFIG; 1198 1211 } 1199 - 1200 - /*====================================================================== 1201 - 1202 - The card status event handler. Mostly, this schedules other 1203 - stuff to run after an event is received. A CARD_REMOVAL event 1204 - also sets some flags to discourage the net drivers from trying 1205 - to talk to the card any more. 1206 - 1207 - ======================================================================*/ 1208 - 1209 - static int smc91c92_event(event_t event, int priority, 1210 - event_callback_args_t *args) 1211 - { 1212 - dev_link_t *link = args->client_data; 1213 - 1214 - DEBUG(1, "smc91c92_event(0x%06x)\n", event); 1215 - 1216 - switch (event) { 1217 - case CS_EVENT_CARD_INSERTION: 1218 - link->state |= DEV_PRESENT | DEV_CONFIG_PENDING; 1219 - smc91c92_config(link); 1220 - break; 1221 - } 1222 - return 0; 1223 - } /* smc91c92_event */ 1224 1212 1225 1213 /*====================================================================== 1226 1214 ··· 2311 2349 .drv = { 2312 2350 .name = "smc91c92_cs", 2313 2351 }, 2314 - .attach = smc91c92_attach, 2315 - .event = smc91c92_event, 2352 + .probe = smc91c92_attach, 2316 2353 .remove = smc91c92_detach, 2317 2354 .id_table = smc91c92_ids, 2318 2355 .suspend = smc91c92_suspend,
+10 -57
drivers/net/pcmcia/xirc2ps_cs.c
··· 292 292 static int has_ce2_string(dev_link_t * link); 293 293 static void xirc2ps_config(dev_link_t * link); 294 294 static void xirc2ps_release(dev_link_t * link); 295 - static int xirc2ps_event(event_t event, int priority, 296 - event_callback_args_t * args); 297 295 298 296 /**************** 299 297 * The attach() and detach() entry points are used to create and destroy ··· 299 301 * needed to manage one actual PCMCIA card. 300 302 */ 301 303 302 - static dev_link_t *xirc2ps_attach(void); 303 304 static void xirc2ps_detach(struct pcmcia_device *p_dev); 304 305 305 306 /**************** ··· 309 312 */ 310 313 311 314 static irqreturn_t xirc2ps_interrupt(int irq, void *dev_id, struct pt_regs *regs); 312 - 313 - /* 314 - * The dev_info variable is the "key" that is used to match up this 315 - * device driver with appropriate cards, through the card configuration 316 - * database. 317 - */ 318 - 319 - static dev_info_t dev_info = "xirc2ps_cs"; 320 315 321 316 /**************** 322 317 * A linked list of "instances" of the device. Each actual ··· 552 563 * card insertion event. 553 564 */ 554 565 555 - static dev_link_t * 556 - xirc2ps_attach(void) 566 + static int 567 + xirc2ps_attach(struct pcmcia_device *p_dev) 557 568 { 558 - client_reg_t client_reg; 559 569 dev_link_t *link; 560 570 struct net_device *dev; 561 571 local_info_t *local; 562 - int err; 563 572 564 573 DEBUG(0, "attach()\n"); 565 574 566 575 /* Allocate the device structure */ 567 576 dev = alloc_etherdev(sizeof(local_info_t)); 568 577 if (!dev) 569 - return NULL; 578 + return -ENOMEM; 570 579 local = netdev_priv(dev); 571 580 link = &local->link; 572 581 link->priv = dev; ··· 593 606 dev->watchdog_timeo = TX_TIMEOUT; 594 607 #endif 595 608 596 - /* Register with Card Services */ 597 - link->next = NULL; 598 - client_reg.dev_info = &dev_info; 599 - client_reg.Version = 0x0210; 600 - client_reg.event_callback_args.client_data = link; 601 - if ((err = pcmcia_register_client(&link->handle, &client_reg))) { 602 - cs_error(link->handle, RegisterClient, err); 603 - xirc2ps_detach(link->handle); 604 - return NULL; 605 - } 609 + link->handle = p_dev; 610 + p_dev->instance = link; 606 611 607 - return link; 612 + link->state |= DEV_PRESENT | DEV_CONFIG_PENDING; 613 + xirc2ps_config(link); 614 + 615 + return 0; 608 616 } /* xirc2ps_attach */ 609 617 610 618 /**************** ··· 1144 1162 return 0; 1145 1163 } 1146 1164 1147 - /**************** 1148 - * The card status event handler. Mostly, this schedules other 1149 - * stuff to run after an event is received. A CARD_REMOVAL event 1150 - * also sets some flags to discourage the net drivers from trying 1151 - * to talk to the card any more. 1152 - * 1153 - * When a CARD_REMOVAL event is received, we immediately set a flag 1154 - * to block future accesses to this device. All the functions that 1155 - * actually access the device should check this flag to make sure 1156 - * the card is still present. 1157 - */ 1158 - 1159 - static int 1160 - xirc2ps_event(event_t event, int priority, 1161 - event_callback_args_t * args) 1162 - { 1163 - dev_link_t *link = args->client_data; 1164 - 1165 - DEBUG(0, "event(%d)\n", (int)event); 1166 - 1167 - switch (event) { 1168 - case CS_EVENT_CARD_INSERTION: 1169 - link->state |= DEV_PRESENT | DEV_CONFIG_PENDING; 1170 - xirc2ps_config(link); 1171 - break; 1172 - } 1173 - return 0; 1174 - } /* xirc2ps_event */ 1175 1165 1176 1166 /*====================================================================*/ 1177 1167 ··· 1935 1981 .drv = { 1936 1982 .name = "xirc2ps_cs", 1937 1983 }, 1938 - .attach = xirc2ps_attach, 1939 - .event = xirc2ps_event, 1984 + .probe = xirc2ps_attach, 1940 1985 .remove = xirc2ps_detach, 1941 1986 .id_table = xirc2ps_ids, 1942 1987 .suspend = xirc2ps_suspend,
+13 -61
drivers/net/wireless/airo_cs.c
··· 82 82 83 83 static void airo_config(dev_link_t *link); 84 84 static void airo_release(dev_link_t *link); 85 - static int airo_event(event_t event, int priority, 86 - event_callback_args_t *args); 87 85 88 86 /* 89 87 The attach() and detach() entry points are used to create and destroy ··· 89 91 needed to manage one actual PCMCIA card. 90 92 */ 91 93 92 - static dev_link_t *airo_attach(void); 93 94 static void airo_detach(struct pcmcia_device *p_dev); 94 95 95 96 /* ··· 97 100 of a fully self-sufficient driver; the other drivers rely more or 98 101 less on other parts of the kernel. 99 102 */ 100 - 101 - /* 102 - The dev_info variable is the "key" that is used to match up this 103 - device driver with appropriate cards, through the card configuration 104 - database. 105 - */ 106 - 107 - static dev_info_t dev_info = "airo_cs"; 108 103 109 104 /* 110 105 A linked list of "instances" of the aironet device. Each actual ··· 141 152 142 153 ======================================================================*/ 143 154 144 - static dev_link_t *airo_attach(void) 155 + static int airo_attach(struct pcmcia_device *p_dev) 145 156 { 146 - client_reg_t client_reg; 147 157 dev_link_t *link; 148 158 local_info_t *local; 149 - int ret; 150 - 159 + 151 160 DEBUG(0, "airo_attach()\n"); 152 161 153 162 /* Initialize the dev_link_t structure */ 154 163 link = kzalloc(sizeof(struct dev_link_t), GFP_KERNEL); 155 164 if (!link) { 156 165 printk(KERN_ERR "airo_cs: no memory for new device\n"); 157 - return NULL; 166 + return -ENOMEM; 158 167 } 159 168 160 169 /* Interrupt setup */ ··· 176 189 if (!local) { 177 190 printk(KERN_ERR "airo_cs: no memory for new device\n"); 178 191 kfree (link); 179 - return NULL; 192 + return -ENOMEM; 180 193 } 181 194 link->priv = local; 182 - 183 - /* Register with Card Services */ 184 - link->next = NULL; 185 - client_reg.dev_info = &dev_info; 186 - client_reg.Version = 0x0210; 187 - client_reg.event_callback_args.client_data = link; 188 - ret = pcmcia_register_client(&link->handle, &client_reg); 189 - if (ret != 0) { 190 - cs_error(link->handle, RegisterClient, ret); 191 - airo_detach(link->handle); 192 - return NULL; 193 - } 194 - 195 - return link; 195 + 196 + link->handle = p_dev; 197 + p_dev->instance = link; 198 + 199 + link->state |= DEV_PRESENT | DEV_CONFIG_PENDING; 200 + airo_config(link); 201 + 202 + return 0; 196 203 } /* airo_attach */ 197 204 198 205 /*====================================================================== ··· 478 497 return 0; 479 498 } 480 499 481 - /*====================================================================== 482 - 483 - The card status event handler. Mostly, this schedules other 484 - stuff to run after an event is received. 485 - 486 - When a CARD_REMOVAL event is received, we immediately set a 487 - private flag to block future accesses to this device. All the 488 - functions that actually access the device should check this flag 489 - to make sure the card is still present. 490 - 491 - ======================================================================*/ 492 - 493 - static int airo_event(event_t event, int priority, 494 - event_callback_args_t *args) 495 - { 496 - dev_link_t *link = args->client_data; 497 - 498 - DEBUG(1, "airo_event(0x%06x)\n", event); 499 - 500 - switch (event) { 501 - case CS_EVENT_CARD_INSERTION: 502 - link->state |= DEV_PRESENT | DEV_CONFIG_PENDING; 503 - airo_config(link); 504 - break; 505 - } 506 - return 0; 507 - } /* airo_event */ 508 - 509 500 static struct pcmcia_device_id airo_ids[] = { 510 501 PCMCIA_DEVICE_MANF_CARD(0x015f, 0x000a), 511 502 PCMCIA_DEVICE_MANF_CARD(0x015f, 0x0005), ··· 492 539 .drv = { 493 540 .name = "airo_cs", 494 541 }, 495 - .attach = airo_attach, 496 - .event = airo_event, 542 + .probe = airo_attach, 497 543 .remove = airo_detach, 498 544 .id_table = airo_ids, 499 545 .suspend = airo_suspend,
+16 -64
drivers/net/wireless/atmel_cs.c
··· 93 93 94 94 static void atmel_config(dev_link_t *link); 95 95 static void atmel_release(dev_link_t *link); 96 - static int atmel_event(event_t event, int priority, 97 - event_callback_args_t *args); 98 96 99 97 /* 100 98 The attach() and detach() entry points are used to create and destroy ··· 100 102 needed to manage one actual PCMCIA card. 101 103 */ 102 104 103 - static dev_link_t *atmel_attach(void); 104 105 static void atmel_detach(struct pcmcia_device *p_dev); 105 106 106 107 /* ··· 108 111 of a fully self-sufficient driver; the other drivers rely more or 109 112 less on other parts of the kernel. 110 113 */ 111 - 112 - /* 113 - The dev_info variable is the "key" that is used to match up this 114 - device driver with appropriate cards, through the card configuration 115 - database. 116 - */ 117 - 118 - static dev_info_t dev_info = "atmel_cs"; 119 114 120 115 /* 121 116 A linked list of "instances" of the atmelnet device. Each actual ··· 152 163 153 164 ======================================================================*/ 154 165 155 - static dev_link_t *atmel_attach(void) 166 + static int atmel_attach(struct pcmcia_device *p_dev) 156 167 { 157 - client_reg_t client_reg; 158 168 dev_link_t *link; 159 169 local_info_t *local; 160 - int ret; 161 - 170 + 162 171 DEBUG(0, "atmel_attach()\n"); 163 172 164 173 /* Initialize the dev_link_t structure */ 165 174 link = kzalloc(sizeof(struct dev_link_t), GFP_KERNEL); 166 175 if (!link) { 167 176 printk(KERN_ERR "atmel_cs: no memory for new device\n"); 168 - return NULL; 177 + return -ENOMEM; 169 178 } 170 - 179 + 171 180 /* Interrupt setup */ 172 181 link->irq.Attributes = IRQ_TYPE_EXCLUSIVE; 173 182 link->irq.IRQInfo1 = IRQ_LEVEL_ID; 174 183 link->irq.Handler = NULL; 175 - 184 + 176 185 /* 177 186 General socket configuration defaults can go here. In this 178 187 client, we assume very little, and rely on the CIS for almost ··· 181 194 link->conf.Attributes = 0; 182 195 link->conf.Vcc = 50; 183 196 link->conf.IntType = INT_MEMORY_AND_IO; 184 - 197 + 185 198 /* Allocate space for private device-specific data */ 186 199 local = kzalloc(sizeof(local_info_t), GFP_KERNEL); 187 200 if (!local) { 188 201 printk(KERN_ERR "atmel_cs: no memory for new device\n"); 189 202 kfree (link); 190 - return NULL; 203 + return -ENOMEM; 191 204 } 192 205 link->priv = local; 193 - 194 - /* Register with Card Services */ 195 - link->next = NULL; 196 - client_reg.dev_info = &dev_info; 197 - client_reg.Version = 0x0210; 198 - client_reg.event_callback_args.client_data = link; 199 - ret = pcmcia_register_client(&link->handle, &client_reg); 200 - if (ret != 0) { 201 - cs_error(link->handle, RegisterClient, ret); 202 - atmel_detach(link->handle); 203 - return NULL; 204 - } 205 - 206 - return link; 206 + 207 + link->handle = p_dev; 208 + p_dev->instance = link; 209 + 210 + link->state |= DEV_PRESENT | DEV_CONFIG_PENDING; 211 + atmel_config(link); 212 + 213 + return 0; 207 214 } /* atmel_attach */ 208 215 209 216 /*====================================================================== ··· 466 485 return 0; 467 486 } 468 487 469 - /*====================================================================== 470 - 471 - The card status event handler. Mostly, this schedules other 472 - stuff to run after an event is received. 473 - 474 - When a CARD_REMOVAL event is received, we immediately set a 475 - private flag to block future accesses to this device. All the 476 - functions that actually access the device should check this flag 477 - to make sure the card is still present. 478 - 479 - ======================================================================*/ 480 - 481 - static int atmel_event(event_t event, int priority, 482 - event_callback_args_t *args) 483 - { 484 - dev_link_t *link = args->client_data; 485 - 486 - DEBUG(1, "atmel_event(0x%06x)\n", event); 487 - 488 - switch (event) { 489 - case CS_EVENT_CARD_INSERTION: 490 - link->state |= DEV_PRESENT | DEV_CONFIG_PENDING; 491 - atmel_config(link); 492 - break; 493 - } 494 - return 0; 495 - } /* atmel_event */ 496 - 497 488 /*====================================================================*/ 498 489 /* We use the driver_info field to store the correct firmware type for a card. */ 499 490 ··· 515 562 .drv = { 516 563 .name = "atmel_cs", 517 564 }, 518 - .attach = atmel_attach, 519 - .event = atmel_event, 565 + .probe = atmel_attach, 520 566 .remove = atmel_detach, 521 567 .id_table = atmel_ids, 522 568 .suspend = atmel_suspend,
+12 -43
drivers/net/wireless/hostap/hostap_cs.c
··· 204 204 205 205 static void prism2_detach(struct pcmcia_device *p_dev); 206 206 static void prism2_release(u_long arg); 207 - static int prism2_event(event_t event, int priority, 208 - event_callback_args_t *args); 207 + static int prism2_config(dev_link_t *link); 209 208 210 209 211 210 static int prism2_pccard_card_present(local_info_t *local) ··· 501 502 502 503 /* allocate local data and register with CardServices 503 504 * initialize dev_link structure, but do not configure the card yet */ 504 - static dev_link_t *prism2_attach(void) 505 + static int prism2_attach(struct pcmcia_device *p_dev) 505 506 { 506 507 dev_link_t *link; 507 - client_reg_t client_reg; 508 - int ret; 509 508 510 509 link = kmalloc(sizeof(dev_link_t), GFP_KERNEL); 511 510 if (link == NULL) 512 - return NULL; 511 + return -ENOMEM; 513 512 514 513 memset(link, 0, sizeof(dev_link_t)); 515 514 ··· 515 518 link->conf.Vcc = 33; 516 519 link->conf.IntType = INT_MEMORY_AND_IO; 517 520 518 - /* register with CardServices */ 519 - link->next = NULL; 520 - client_reg.dev_info = &dev_info; 521 - client_reg.Version = 0x0210; 522 - client_reg.event_callback_args.client_data = link; 523 - ret = pcmcia_register_client(&link->handle, &client_reg); 524 - if (ret != CS_SUCCESS) { 525 - cs_error(link->handle, RegisterClient, ret); 526 - prism2_detach(link->handle); 527 - return NULL; 528 - } 529 - return link; 521 + link->handle = p_dev; 522 + p_dev->instance = link; 523 + 524 + link->state |= DEV_PRESENT | DEV_CONFIG_PENDING; 525 + if (prism2_config(link)) 526 + PDEBUG(DEBUG_EXTRA, "prism2_config() failed\n"); 527 + 528 + return 0; 530 529 } 531 530 532 531 ··· 871 878 return 0; 872 879 } 873 880 874 - static int prism2_event(event_t event, int priority, 875 - event_callback_args_t *args) 876 - { 877 - dev_link_t *link = args->client_data; 878 - 879 - switch (event) { 880 - case CS_EVENT_CARD_INSERTION: 881 - PDEBUG(DEBUG_EXTRA, "%s: CS_EVENT_CARD_INSERTION\n", dev_info); 882 - link->state |= DEV_PRESENT | DEV_CONFIG_PENDING; 883 - if (prism2_config(link)) { 884 - PDEBUG(DEBUG_EXTRA, "prism2_config() failed\n"); 885 - } 886 - break; 887 - 888 - default: 889 - PDEBUG(DEBUG_EXTRA, "%s: prism2_event() - unknown event %d\n", 890 - dev_info, event); 891 - break; 892 - } 893 - return 0; 894 - } 895 - 896 - 897 881 static struct pcmcia_device_id hostap_cs_ids[] = { 898 882 PCMCIA_DEVICE_MANF_CARD(0x000b, 0x7100), 899 883 PCMCIA_DEVICE_MANF_CARD(0x000b, 0x7300), ··· 929 959 .drv = { 930 960 .name = "hostap_cs", 931 961 }, 932 - .attach = prism2_attach, 962 + .probe = prism2_attach, 933 963 .remove = prism2_detach, 934 964 .owner = THIS_MODULE, 935 - .event = prism2_event, 936 965 .id_table = hostap_cs_ids, 937 966 .suspend = hostap_cs_suspend, 938 967 .resume = hostap_cs_resume,
+12 -56
drivers/net/wireless/netwave_cs.c
··· 166 166 #define DEBUG(n, args...) 167 167 #endif 168 168 169 - static dev_info_t dev_info = "netwave_cs"; 170 - 171 169 /*====================================================================*/ 172 170 173 171 /* Parameters that can be set with 'insmod' */ ··· 193 195 194 196 /* PCMCIA (Card Services) related functions */ 195 197 static void netwave_release(dev_link_t *link); /* Card removal */ 196 - static int netwave_event(event_t event, int priority, 197 - event_callback_args_t *args); 198 198 static void netwave_pcmcia_config(dev_link_t *arg); /* Runs after card 199 199 insertion */ 200 - static dev_link_t *netwave_attach(void); /* Create instance */ 201 200 static void netwave_detach(struct pcmcia_device *p_dev); /* Destroy instance */ 202 201 203 202 /* Hardware configuration */ ··· 378 383 * configure the card at this point -- we wait until we receive a 379 384 * card insertion event. 380 385 */ 381 - static dev_link_t *netwave_attach(void) 386 + static int netwave_attach(struct pcmcia_device *p_dev) 382 387 { 383 - client_reg_t client_reg; 384 388 dev_link_t *link; 385 389 struct net_device *dev; 386 390 netwave_private *priv; 387 - int ret; 388 - 391 + 389 392 DEBUG(0, "netwave_attach()\n"); 390 - 393 + 391 394 /* Initialize the dev_link_t structure */ 392 395 dev = alloc_etherdev(sizeof(netwave_private)); 393 396 if (!dev) 394 - return NULL; 397 + return -ENOMEM; 395 398 priv = netdev_priv(dev); 396 399 link = &priv->link; 397 400 link->priv = dev; ··· 431 438 dev->open = &netwave_open; 432 439 dev->stop = &netwave_close; 433 440 link->irq.Instance = dev; 434 - 435 - /* Register with Card Services */ 436 - link->next = NULL; 437 - client_reg.dev_info = &dev_info; 438 - client_reg.Version = 0x0210; 439 - client_reg.event_callback_args.client_data = link; 440 - ret = pcmcia_register_client(&link->handle, &client_reg); 441 - if (ret != 0) { 442 - cs_error(link->handle, RegisterClient, ret); 443 - netwave_detach(link->handle); 444 - return NULL; 445 - } 446 441 447 - return link; 442 + link->handle = p_dev; 443 + p_dev->instance = link; 444 + 445 + link->state |= DEV_PRESENT | DEV_CONFIG_PENDING; 446 + netwave_pcmcia_config( link); 447 + 448 + return 0; 448 449 } /* netwave_attach */ 449 450 450 451 /* ··· 920 933 return 0; 921 934 } 922 935 923 - 924 - /* 925 - * Function netwave_event (event, priority, args) 926 - * 927 - * The card status event handler. Mostly, this schedules other 928 - * stuff to run after an event is received. A CARD_REMOVAL event 929 - * also sets some flags to discourage the net drivers from trying 930 - * to talk to the card any more. 931 - * 932 - * When a CARD_REMOVAL event is received, we immediately set a flag 933 - * to block future accesses to this device. All the functions that 934 - * actually access the device should check this flag to make sure 935 - * the card is still present. 936 - * 937 - */ 938 - static int netwave_event(event_t event, int priority, 939 - event_callback_args_t *args) 940 - { 941 - dev_link_t *link = args->client_data; 942 - 943 - DEBUG(1, "netwave_event(0x%06x)\n", event); 944 - 945 - switch (event) { 946 - case CS_EVENT_CARD_INSERTION: 947 - link->state |= DEV_PRESENT | DEV_CONFIG_PENDING; 948 - netwave_pcmcia_config( link); 949 - break; 950 - } 951 - return 0; 952 - } /* netwave_event */ 953 936 954 937 /* 955 938 * Function netwave_doreset (ioBase, ramBase) ··· 1413 1456 .drv = { 1414 1457 .name = "netwave_cs", 1415 1458 }, 1416 - .attach = netwave_attach, 1417 - .event = netwave_event, 1459 + .probe = netwave_attach, 1418 1460 .remove = netwave_detach, 1419 1461 .id_table = netwave_ids, 1420 1462 .suspend = netwave_suspend,
+10 -48
drivers/net/wireless/orinoco_cs.c
··· 43 43 MODULE_PARM_DESC(ignore_cis_vcc, "Allow voltage mismatch between card and socket"); 44 44 45 45 /********************************************************************/ 46 - /* Magic constants */ 47 - /********************************************************************/ 48 - 49 - /* 50 - * The dev_info variable is the "key" that is used to match up this 51 - * device driver with appropriate cards, through the card 52 - * configuration database. 53 - */ 54 - static dev_info_t dev_info = DRIVER_NAME; 55 - 56 - /********************************************************************/ 57 46 /* Data structures */ 58 47 /********************************************************************/ 59 48 ··· 63 74 /* Function prototypes */ 64 75 /********************************************************************/ 65 76 77 + static void orinoco_cs_config(dev_link_t *link); 66 78 static void orinoco_cs_release(dev_link_t *link); 67 79 static void orinoco_cs_detach(struct pcmcia_device *p_dev); 68 80 ··· 103 113 * The dev_link structure is initialized, but we don't actually 104 114 * configure the card at this point -- we wait until we receive a card 105 115 * insertion event. */ 106 - static dev_link_t * 107 - orinoco_cs_attach(void) 116 + static int 117 + orinoco_cs_attach(struct pcmcia_device *p_dev) 108 118 { 109 119 struct net_device *dev; 110 120 struct orinoco_private *priv; 111 121 struct orinoco_pccard *card; 112 122 dev_link_t *link; 113 - client_reg_t client_reg; 114 - int ret; 115 123 116 124 dev = alloc_orinocodev(sizeof(*card), orinoco_cs_hard_reset); 117 125 if (! dev) 118 - return NULL; 126 + return -ENOMEM; 119 127 priv = netdev_priv(dev); 120 128 card = priv->card; 121 129 ··· 138 150 /* Register with Card Services */ 139 151 link->next = NULL; 140 152 141 - client_reg.dev_info = &dev_info; 142 - client_reg.Version = 0x0210; /* FIXME: what does this mean? */ 143 - client_reg.event_callback_args.client_data = link; 153 + link->handle = p_dev; 154 + p_dev->instance = link; 144 155 145 - ret = pcmcia_register_client(&link->handle, &client_reg); 146 - if (ret != CS_SUCCESS) { 147 - cs_error(link->handle, RegisterClient, ret); 148 - orinoco_cs_detach(link->handle); 149 - return NULL; 150 - } 156 + link->state |= DEV_PRESENT | DEV_CONFIG_PENDING; 157 + orinoco_cs_config(link); 151 158 152 - return link; 159 + return 0; 153 160 } /* orinoco_cs_attach */ 154 161 155 162 /* ··· 504 521 } 505 522 506 523 507 - /* 508 - * The card status event handler. Mostly, this schedules other stuff 509 - * to run after an event is received. 510 - */ 511 - static int 512 - orinoco_cs_event(event_t event, int priority, 513 - event_callback_args_t * args) 514 - { 515 - dev_link_t *link = args->client_data; 516 - 517 - switch (event) { 518 - case CS_EVENT_CARD_INSERTION: 519 - link->state |= DEV_PRESENT | DEV_CONFIG_PENDING; 520 - orinoco_cs_config(link); 521 - break; 522 - } 523 - 524 - return 0; 525 - } /* orinoco_cs_event */ 526 - 527 524 /********************************************************************/ 528 525 /* Module initialization */ 529 526 /********************************************************************/ ··· 603 640 .drv = { 604 641 .name = DRIVER_NAME, 605 642 }, 606 - .attach = orinoco_cs_attach, 643 + .probe = orinoco_cs_attach, 607 644 .remove = orinoco_cs_detach, 608 - .event = orinoco_cs_event, 609 645 .id_table = orinoco_cs_ids, 610 646 .suspend = orinoco_cs_suspend, 611 647 .resume = orinoco_cs_resume,
+11 -59
drivers/net/wireless/ray_cs.c
··· 92 92 /** Prototypes based on PCMCIA skeleton driver *******************************/ 93 93 static void ray_config(dev_link_t *link); 94 94 static void ray_release(dev_link_t *link); 95 - static int ray_event(event_t event, int priority, event_callback_args_t *args); 96 - static dev_link_t *ray_attach(void); 97 95 static void ray_detach(struct pcmcia_device *p_dev); 98 96 99 97 /***** Prototypes indicated by device structure ******************************/ ··· 189 191 */ 190 192 static char *phy_addr = NULL; 191 193 192 - 193 - /* The dev_info variable is the "key" that is used to match up this 194 - device driver with appropriate cards, through the card configuration 195 - database. 196 - */ 197 - static dev_info_t dev_info = "ray_cs"; 198 194 199 195 /* A linked list of "instances" of the ray device. Each actual 200 196 PCMCIA card corresponds to one device instance, and is described ··· 306 314 configure the card at this point -- we wait until we receive a 307 315 card insertion event. 308 316 =============================================================================*/ 309 - static dev_link_t *ray_attach(void) 317 + static int ray_attach(struct pcmcia_device *p_dev) 310 318 { 311 - client_reg_t client_reg; 312 319 dev_link_t *link; 313 320 ray_dev_t *local; 314 - int ret; 315 321 struct net_device *dev; 316 322 317 323 DEBUG(1, "ray_attach()\n"); ··· 318 328 link = kmalloc(sizeof(struct dev_link_t), GFP_KERNEL); 319 329 320 330 if (!link) 321 - return NULL; 331 + return -ENOMEM; 322 332 323 333 /* Allocate space for private device-specific data */ 324 334 dev = alloc_etherdev(sizeof(ray_dev_t)); ··· 377 387 dev->stop = &ray_dev_close; 378 388 netif_stop_queue(dev); 379 389 380 - /* Register with Card Services */ 381 - link->next = dev_list; 382 - dev_list = link; 383 - client_reg.dev_info = &dev_info; 384 - client_reg.Version = 0x0210; 385 - client_reg.event_callback_args.client_data = link; 386 - 387 - DEBUG(2,"ray_cs ray_attach calling pcmcia_register_client(...)\n"); 388 - 389 390 init_timer(&local->timer); 390 391 391 - ret = pcmcia_register_client(&link->handle, &client_reg); 392 - if (ret != 0) { 393 - printk("ray_cs ray_attach RegisterClient unhappy - detaching\n"); 394 - cs_error(link->handle, RegisterClient, ret); 395 - ray_detach(link->handle); 396 - return NULL; 397 - } 398 - DEBUG(2,"ray_cs ray_attach ending\n"); 399 - return link; 392 + link->handle = p_dev; 393 + p_dev->instance = link; 394 + 395 + link->state |= DEV_PRESENT | DEV_CONFIG_PENDING; 396 + ray_config(link); 397 + 398 + return 0; 400 399 401 400 fail_alloc_dev: 402 401 kfree(link); 403 - return NULL; 402 + return -ENOMEM; 404 403 } /* ray_attach */ 405 404 /*============================================================================= 406 405 This deletes a driver "instance". The device is de-registered ··· 903 924 return 0; 904 925 } 905 926 906 - /*============================================================================= 907 - The card status event handler. Mostly, this schedules other 908 - stuff to run after an event is received. A CARD_REMOVAL event 909 - also sets some flags to discourage the net drivers from trying 910 - to talk to the card any more. 911 - 912 - When a CARD_REMOVAL event is received, we immediately set a flag 913 - to block future accesses to this device. All the functions that 914 - actually access the device should check this flag to make sure 915 - the card is still present. 916 - =============================================================================*/ 917 - static int ray_event(event_t event, int priority, 918 - event_callback_args_t *args) 919 - { 920 - dev_link_t *link = args->client_data; 921 - DEBUG(1, "ray_event(0x%06x)\n", event); 922 - 923 - switch (event) { 924 - case CS_EVENT_CARD_INSERTION: 925 - link->state |= DEV_PRESENT | DEV_CONFIG_PENDING; 926 - ray_config(link); 927 - break; 928 - } 929 - return 0; 930 - DEBUG(2,"ray_event ending\n"); 931 - } /* ray_event */ 932 927 /*===========================================================================*/ 933 928 int ray_dev_init(struct net_device *dev) 934 929 { ··· 2898 2945 .drv = { 2899 2946 .name = "ray_cs", 2900 2947 }, 2901 - .attach = ray_attach, 2902 - .event = ray_event, 2948 + .probe = ray_attach, 2903 2949 .remove = ray_detach, 2904 2950 .id_table = ray_ids, 2905 2951 .suspend = ray_suspend,
+10 -53
drivers/net/wireless/spectrum_cs.c
··· 57 57 MODULE_PARM_DESC(ignore_cis_vcc, "Allow voltage mismatch between card and socket"); 58 58 59 59 /********************************************************************/ 60 - /* Magic constants */ 61 - /********************************************************************/ 62 - 63 - /* 64 - * The dev_info variable is the "key" that is used to match up this 65 - * device driver with appropriate cards, through the card 66 - * configuration database. 67 - */ 68 - static dev_info_t dev_info = DRIVER_NAME; 69 - 70 - /********************************************************************/ 71 60 /* Data structures */ 72 61 /********************************************************************/ 73 62 ··· 71 82 /* Function prototypes */ 72 83 /********************************************************************/ 73 84 85 + static void spectrum_cs_config(dev_link_t *link); 74 86 static void spectrum_cs_release(dev_link_t *link); 75 - static void spectrum_cs_detach(struct pcmcia_device *p_dev); 76 87 77 88 /********************************************************************/ 78 89 /* Firmware downloader */ ··· 583 594 * The dev_link structure is initialized, but we don't actually 584 595 * configure the card at this point -- we wait until we receive a card 585 596 * insertion event. */ 586 - static dev_link_t * 587 - spectrum_cs_attach(void) 597 + static int 598 + spectrum_cs_attach(struct pcmcia_device *p_dev) 588 599 { 589 600 struct net_device *dev; 590 601 struct orinoco_private *priv; 591 602 struct orinoco_pccard *card; 592 603 dev_link_t *link; 593 - client_reg_t client_reg; 594 - int ret; 595 604 596 605 dev = alloc_orinocodev(sizeof(*card), spectrum_cs_hard_reset); 597 606 if (! dev) 598 - return NULL; 607 + return -ENOMEM; 599 608 priv = netdev_priv(dev); 600 609 card = priv->card; 601 610 ··· 615 628 link->conf.Attributes = 0; 616 629 link->conf.IntType = INT_MEMORY_AND_IO; 617 630 618 - /* Register with Card Services */ 619 - /* FIXME: need a lock? */ 620 - link->next = NULL; /* not needed */ 631 + link->handle = p_dev; 632 + p_dev->instance = link; 621 633 622 - client_reg.dev_info = &dev_info; 623 - client_reg.Version = 0x0210; /* FIXME: what does this mean? */ 624 - client_reg.event_callback_args.client_data = link; 634 + link->state |= DEV_PRESENT | DEV_CONFIG_PENDING; 635 + spectrum_cs_config(link); 625 636 626 - ret = pcmcia_register_client(&link->handle, &client_reg); 627 - if (ret != CS_SUCCESS) { 628 - cs_error(link->handle, RegisterClient, ret); 629 - spectrum_cs_detach(link->handle); 630 - return NULL; 631 - } 632 - 633 - return link; 637 + return 0; 634 638 } /* spectrum_cs_attach */ 635 639 636 640 /* ··· 955 977 return 0; 956 978 } 957 979 958 - /* 959 - * The card status event handler. Mostly, this schedules other stuff 960 - * to run after an event is received. 961 - */ 962 - static int 963 - spectrum_cs_event(event_t event, int priority, 964 - event_callback_args_t * args) 965 - { 966 - dev_link_t *link = args->client_data; 967 - 968 - switch (event) { 969 - case CS_EVENT_CARD_INSERTION: 970 - link->state |= DEV_PRESENT | DEV_CONFIG_PENDING; 971 - spectrum_cs_config(link); 972 - break; 973 - 974 - } 975 - 976 - return 0; 977 - } /* spectrum_cs_event */ 978 980 979 981 /********************************************************************/ 980 982 /* Module initialization */ ··· 979 1021 .drv = { 980 1022 .name = DRIVER_NAME, 981 1023 }, 982 - .attach = spectrum_cs_attach, 1024 + .probe = spectrum_cs_attach, 983 1025 .remove = spectrum_cs_detach, 984 1026 .suspend = spectrum_cs_suspend, 985 1027 .resume = spectrum_cs_resume, 986 - .event = spectrum_cs_event, 987 1028 .id_table = spectrum_cs_ids, 988 1029 }; 989 1030
+14 -70
drivers/net/wireless/wavelan_cs.c
··· 4594 4594 * configure the card at this point -- we wait until we receive a 4595 4595 * card insertion event. 4596 4596 */ 4597 - static dev_link_t * 4598 - wavelan_attach(void) 4597 + static int 4598 + wavelan_attach(struct pcmcia_device *p_dev) 4599 4599 { 4600 - client_reg_t client_reg; /* Register with cardmgr */ 4601 4600 dev_link_t * link; /* Info for cardmgr */ 4602 4601 struct net_device * dev; /* Interface generic data */ 4603 4602 net_local * lp; /* Interface specific data */ 4604 - int ret; 4605 4603 4606 4604 #ifdef DEBUG_CALLBACK_TRACE 4607 4605 printk(KERN_DEBUG "-> wavelan_attach()\n"); ··· 4607 4609 4608 4610 /* Initialize the dev_link_t structure */ 4609 4611 link = kzalloc(sizeof(struct dev_link_t), GFP_KERNEL); 4610 - if (!link) return NULL; 4612 + if (!link) return -ENOMEM; 4611 4613 4612 4614 /* The io structure describes IO port mapping */ 4613 4615 link->io.NumPorts1 = 8; ··· 4631 4633 dev = alloc_etherdev(sizeof(net_local)); 4632 4634 if (!dev) { 4633 4635 kfree(link); 4634 - return NULL; 4636 + return -ENOMEM; 4635 4637 } 4636 4638 link->priv = link->irq.Instance = dev; 4637 4639 ··· 4676 4678 /* Other specific data */ 4677 4679 dev->mtu = WAVELAN_MTU; 4678 4680 4679 - /* Register with Card Services */ 4680 - client_reg.dev_info = &dev_info; 4681 - client_reg.Version = 0x0210; 4682 - client_reg.event_callback_args.client_data = link; 4681 + link->handle = p_dev; 4682 + p_dev->instance = link; 4683 4683 4684 - #ifdef DEBUG_CONFIG_INFO 4685 - printk(KERN_DEBUG "wavelan_attach(): almost done, calling pcmcia_register_client\n"); 4686 - #endif 4687 - 4688 - ret = pcmcia_register_client(&link->handle, &client_reg); 4689 - if(ret != 0) 4690 - { 4691 - cs_error(link->handle, RegisterClient, ret); 4692 - wavelan_detach(link->handle); 4693 - return NULL; 4694 - } 4684 + link->state |= DEV_PRESENT | DEV_CONFIG_PENDING; 4685 + if(wv_pcmcia_config(link) && 4686 + wv_hw_config(dev)) 4687 + wv_init_info(dev); 4688 + else 4689 + dev->irq = 0; 4695 4690 4696 4691 #ifdef DEBUG_CALLBACK_TRACE 4697 4692 printk(KERN_DEBUG "<- wavelan_attach()\n"); 4698 4693 #endif 4699 4694 4700 - return link; 4695 + return 0; 4701 4696 } 4702 4697 4703 4698 /*------------------------------------------------------------------*/ ··· 4792 4801 } 4793 4802 4794 4803 4795 - /*------------------------------------------------------------------*/ 4796 - /* 4797 - * The card status event handler. Mostly, this schedules other stuff 4798 - * to run after an event is received. A CARD_REMOVAL event also sets 4799 - * some flags to discourage the net drivers from trying to talk to the 4800 - * card any more. 4801 - */ 4802 - static int 4803 - wavelan_event(event_t event, /* The event received */ 4804 - int priority, 4805 - event_callback_args_t * args) 4806 - { 4807 - dev_link_t * link = (dev_link_t *) args->client_data; 4808 - struct net_device * dev = (struct net_device *) link->priv; 4809 - 4810 - #ifdef DEBUG_CALLBACK_TRACE 4811 - printk(KERN_DEBUG "->wavelan_event(): %s\n", 4812 - ((event == CS_EVENT_REGISTRATION_COMPLETE)?"registration complete" : 4813 - ((event == CS_EVENT_CARD_REMOVAL) ? "card removal" : 4814 - ((event == CS_EVENT_CARD_INSERTION) ? "card insertion" : 4815 - ((event == CS_EVENT_PM_SUSPEND) ? "pm suspend" : 4816 - ((event == CS_EVENT_RESET_PHYSICAL) ? "physical reset" : 4817 - ((event == CS_EVENT_PM_RESUME) ? "pm resume" : 4818 - ((event == CS_EVENT_CARD_RESET) ? "card reset" : 4819 - "unknown")))))))); 4820 - #endif 4821 - 4822 - switch(event) 4823 - { 4824 - case CS_EVENT_CARD_INSERTION: 4825 - /* Reset and configure the card */ 4826 - link->state |= DEV_PRESENT | DEV_CONFIG_PENDING; 4827 - if(wv_pcmcia_config(link) && 4828 - wv_hw_config(dev)) 4829 - wv_init_info(dev); 4830 - else 4831 - dev->irq = 0; 4832 - break; 4833 - } 4834 - 4835 - #ifdef DEBUG_CALLBACK_TRACE 4836 - printk(KERN_DEBUG "<-wavelan_event()\n"); 4837 - #endif 4838 - return 0; 4839 - } 4840 - 4841 4804 static struct pcmcia_device_id wavelan_ids[] = { 4842 4805 PCMCIA_DEVICE_PROD_ID12("AT&T","WaveLAN/PCMCIA", 0xe7c5affd, 0x1bc50975), 4843 4806 PCMCIA_DEVICE_PROD_ID12("Digital", "RoamAbout/DS", 0x9999ab35, 0x00d05e06), ··· 4806 4861 .drv = { 4807 4862 .name = "wavelan_cs", 4808 4863 }, 4809 - .attach = wavelan_attach, 4810 - .event = wavelan_event, 4864 + .probe = wavelan_attach, 4811 4865 .remove = wavelan_detach, 4812 4866 .id_table = wavelan_ids, 4813 4867 .suspend = wavelan_suspend,
-8
drivers/net/wireless/wavelan_cs.p.h
··· 754 754 static int 755 755 wavelan_open(struct net_device *), /* Open the device */ 756 756 wavelan_close(struct net_device *); /* Close the device */ 757 - static dev_link_t * 758 - wavelan_attach(void); /* Create a new device */ 759 757 static void 760 758 wavelan_detach(struct pcmcia_device *p_dev); /* Destroy a removed device */ 761 - static int 762 - wavelan_event(event_t, /* Manage pcmcia events */ 763 - int, 764 - event_callback_args_t *); 765 759 766 760 /**************************** VARIABLES ****************************/ 767 - 768 - static dev_info_t dev_info = "wavelan_cs"; 769 761 770 762 /* 771 763 * Parameters that can be set with 'insmod'
+11 -49
drivers/net/wireless/wl3501_cs.c
··· 105 105 */ 106 106 static void wl3501_config(dev_link_t *link); 107 107 static void wl3501_release(dev_link_t *link); 108 - static int wl3501_event(event_t event, int pri, event_callback_args_t *args); 109 108 110 109 /* 111 110 * The dev_info variable is the "key" that is used to match up this ··· 1953 1954 * The dev_link structure is initialized, but we don't actually configure the 1954 1955 * card at this point -- we wait until we receive a card insertion event. 1955 1956 */ 1956 - static dev_link_t *wl3501_attach(void) 1957 + static int wl3501_attach(struct pcmcia_device *p_dev) 1957 1958 { 1958 - client_reg_t client_reg; 1959 1959 dev_link_t *link; 1960 1960 struct net_device *dev; 1961 1961 struct wl3501_card *this; 1962 - int ret; 1963 1962 1964 1963 /* Initialize the dev_link_t structure */ 1965 1964 link = kzalloc(sizeof(*link), GFP_KERNEL); 1966 1965 if (!link) 1967 - goto out; 1966 + return -ENOMEM; 1968 1967 1969 1968 /* The io structure describes IO port mapping */ 1970 1969 link->io.NumPorts1 = 16; ··· 1998 2001 netif_stop_queue(dev); 1999 2002 link->priv = link->irq.Instance = dev; 2000 2003 2001 - /* Register with Card Services */ 2002 - link->next = wl3501_dev_list; 2003 - wl3501_dev_list = link; 2004 - client_reg.dev_info = &wl3501_dev_info; 2005 - client_reg.Version = 0x0210; 2006 - client_reg.event_callback_args.client_data = link; 2007 - ret = pcmcia_register_client(&link->handle, &client_reg); 2008 - if (ret) { 2009 - cs_error(link->handle, RegisterClient, ret); 2010 - wl3501_detach(link->handle); 2011 - link = NULL; 2012 - } 2013 - out: 2014 - return link; 2004 + link->handle = p_dev; 2005 + p_dev->instance = link; 2006 + 2007 + link->state |= DEV_PRESENT | DEV_CONFIG_PENDING; 2008 + wl3501_config(link); 2009 + 2010 + return 0; 2015 2011 out_link: 2016 2012 kfree(link); 2017 2013 link = NULL; 2018 - goto out; 2014 + return -ENOMEM; 2019 2015 } 2020 2016 2021 2017 #define CS_CHECK(fn, ret) \ ··· 2196 2206 } 2197 2207 2198 2208 2199 - /** 2200 - * wl3501_event - The card status event handler 2201 - * @event - event 2202 - * @pri - priority 2203 - * @args - arguments for this event 2204 - * 2205 - * The card status event handler. Mostly, this schedules other stuff to run 2206 - * after an event is received. A CARD_REMOVAL event also sets some flags to 2207 - * discourage the net drivers from trying to talk to the card any more. 2208 - * 2209 - * When a CARD_REMOVAL event is received, we immediately set a flag to block 2210 - * future accesses to this device. All the functions that actually access the 2211 - * device should check this flag to make sure the card is still present. 2212 - */ 2213 - static int wl3501_event(event_t event, int pri, event_callback_args_t *args) 2214 - { 2215 - dev_link_t *link = args->client_data; 2216 - 2217 - switch (event) { 2218 - case CS_EVENT_CARD_INSERTION: 2219 - link->state |= DEV_PRESENT | DEV_CONFIG_PENDING; 2220 - wl3501_config(link); 2221 - break; 2222 - } 2223 - return 0; 2224 - } 2225 - 2226 2209 static struct pcmcia_device_id wl3501_ids[] = { 2227 2210 PCMCIA_DEVICE_MANF_CARD(0xd601, 0x0001), 2228 2211 PCMCIA_DEVICE_NULL ··· 2207 2244 .drv = { 2208 2245 .name = "wl3501_cs", 2209 2246 }, 2210 - .attach = wl3501_attach, 2211 - .event = wl3501_event, 2247 + .probe = wl3501_attach, 2212 2248 .remove = wl3501_detach, 2213 2249 .id_table = wl3501_ids, 2214 2250 .suspend = wl3501_suspend,
+12 -49
drivers/parport/parport_cs.c
··· 87 87 struct parport *port; 88 88 } parport_info_t; 89 89 90 - static dev_link_t *parport_attach(void); 91 90 static void parport_detach(struct pcmcia_device *p_dev); 92 91 static void parport_config(dev_link_t *link); 93 92 static void parport_cs_release(dev_link_t *); 94 - static int parport_event(event_t event, int priority, 95 - event_callback_args_t *args); 96 - 97 - static dev_info_t dev_info = "parport_cs"; 98 93 99 94 /*====================================================================== 100 95 ··· 99 104 100 105 ======================================================================*/ 101 106 102 - static dev_link_t *parport_attach(void) 107 + static int parport_attach(struct pcmcia_device *p_dev) 103 108 { 104 109 parport_info_t *info; 105 110 dev_link_t *link; 106 - client_reg_t client_reg; 107 - int ret; 108 - 111 + 109 112 DEBUG(0, "parport_attach()\n"); 110 113 111 114 /* Create new parport device */ 112 115 info = kmalloc(sizeof(*info), GFP_KERNEL); 113 - if (!info) return NULL; 116 + if (!info) return -ENOMEM; 114 117 memset(info, 0, sizeof(*info)); 115 118 link = &info->link; link->priv = info; 116 119 ··· 119 126 link->conf.Attributes = CONF_ENABLE_IRQ; 120 127 link->conf.Vcc = 50; 121 128 link->conf.IntType = INT_MEMORY_AND_IO; 122 - 123 - /* Register with Card Services */ 124 - link->next = NULL; 125 - client_reg.dev_info = &dev_info; 126 - client_reg.Version = 0x0210; 127 - client_reg.event_callback_args.client_data = link; 128 - ret = pcmcia_register_client(&link->handle, &client_reg); 129 - if (ret != CS_SUCCESS) { 130 - cs_error(link->handle, RegisterClient, ret); 131 - parport_detach(link->handle); 132 - return NULL; 133 - } 134 - 135 - return link; 129 + 130 + link->handle = p_dev; 131 + p_dev->instance = link; 132 + 133 + link->state |= DEV_PRESENT | DEV_CONFIG_PENDING; 134 + parport_config(link); 135 + 136 + return 0; 136 137 } /* parport_attach */ 137 138 138 139 /*====================================================================== ··· 316 329 return 0; 317 330 } 318 331 319 - /*====================================================================== 320 - 321 - The card status event handler. Mostly, this schedules other 322 - stuff to run after an event is received. 323 - 324 - ======================================================================*/ 325 - 326 - int parport_event(event_t event, int priority, 327 - event_callback_args_t *args) 328 - { 329 - dev_link_t *link = args->client_data; 330 - 331 - DEBUG(1, "parport_event(0x%06x)\n", event); 332 - 333 - switch (event) { 334 - case CS_EVENT_CARD_INSERTION: 335 - link->state |= DEV_PRESENT | DEV_CONFIG_PENDING; 336 - parport_config(link); 337 - break; 338 - } 339 - return 0; 340 - } /* parport_event */ 341 - 342 332 static struct pcmcia_device_id parport_ids[] = { 343 333 PCMCIA_DEVICE_FUNC_ID(3), 344 334 PCMCIA_DEVICE_MANF_CARD(0x0137, 0x0003), ··· 328 364 .drv = { 329 365 .name = "parport_cs", 330 366 }, 331 - .attach = parport_attach, 332 - .event = parport_event, 367 + .probe = parport_attach, 333 368 .remove = parport_detach, 334 369 .id_table = parport_ids, 335 370 .suspend = parport_suspend,
+27 -150
drivers/pcmcia/ds.c
··· 203 203 unsigned int i; 204 204 u32 hash; 205 205 206 - if (!p_drv->attach || !p_drv->event || !p_drv->remove) 206 + if (!p_drv->probe || !p_drv->remove) 207 207 printk(KERN_DEBUG "pcmcia: %s lacks a requisite callback " 208 208 "function\n", p_drv->drv.name); 209 209 ··· 361 361 { 362 362 struct pcmcia_device *p_dev; 363 363 struct pcmcia_driver *p_drv; 364 + struct pcmcia_socket *s; 364 365 int ret = 0; 365 366 366 367 dev = get_device(dev); ··· 370 369 371 370 p_dev = to_pcmcia_dev(dev); 372 371 p_drv = to_pcmcia_drv(dev->driver); 372 + s = p_dev->socket; 373 373 374 - if (!try_module_get(p_drv->owner)) { 374 + if ((!p_drv->probe) || (!try_module_get(p_drv->owner))) { 375 375 ret = -EINVAL; 376 376 goto put_dev; 377 377 } 378 378 379 - if (p_drv->attach) { 380 - p_dev->instance = p_drv->attach(); 381 - if ((!p_dev->instance) || (p_dev->state & CLIENT_UNBOUND)) { 382 - printk(KERN_NOTICE "ds: unable to create instance " 383 - "of '%s'!\n", p_drv->drv.name); 384 - ret = -EINVAL; 379 + p_dev->state &= ~CLIENT_UNBOUND; 380 + 381 + /* set up the device configuration, if it hasn't been done before */ 382 + if (!s->functions) { 383 + cistpl_longlink_mfc_t mfc; 384 + if (pccard_read_tuple(s, p_dev->func, CISTPL_LONGLINK_MFC, 385 + &mfc) == CS_SUCCESS) 386 + s->functions = mfc.nfn; 387 + else 388 + s->functions = 1; 389 + s->config = kmalloc(sizeof(config_t) * s->functions, 390 + GFP_KERNEL); 391 + if (!s->config) { 392 + ret = -ENOMEM; 393 + goto put_module; 385 394 } 395 + memset(s->config, 0, sizeof(config_t) * s->functions); 386 396 } 387 397 398 + ret = p_drv->probe(p_dev); 399 + 400 + put_module: 388 401 if (ret) 389 402 module_put(p_drv->owner); 390 403 put_dev: 391 - if ((ret) || !(p_drv->attach)) 404 + if (ret) 392 405 put_device(dev); 393 406 return (ret); 394 407 } ··· 433 418 printk(KERN_INFO "pcmcia: driver %s did not release windows properly\n", 434 419 p_drv->drv.name); 435 420 436 - /* undo pcmcia_register_client */ 437 - p_dev->state = CLIENT_UNBOUND; 438 - pcmcia_put_dev(p_dev); 439 - 440 421 /* references from pcmcia_probe_device */ 422 + p_dev->state = CLIENT_UNBOUND; 441 423 pcmcia_put_dev(p_dev); 442 424 module_put(p_drv->owner); 443 425 ··· 1054 1042 1055 1043 ======================================================================*/ 1056 1044 1057 - struct send_event_data { 1058 - struct pcmcia_socket *skt; 1059 - event_t event; 1060 - int priority; 1061 - }; 1062 - 1063 - static int send_event_callback(struct device *dev, void * _data) 1064 - { 1065 - struct pcmcia_device *p_dev = to_pcmcia_dev(dev); 1066 - struct pcmcia_driver *p_drv; 1067 - struct send_event_data *data = _data; 1068 - 1069 - /* we get called for all sockets, but may only pass the event 1070 - * for drivers _on the affected socket_ */ 1071 - if (p_dev->socket != data->skt) 1072 - return 0; 1073 - 1074 - p_drv = to_pcmcia_drv(p_dev->dev.driver); 1075 - if (!p_drv) 1076 - return 0; 1077 - 1078 - if (p_dev->state & (CLIENT_UNBOUND|CLIENT_STALE)) 1079 - return 0; 1080 - 1081 - if (p_drv->event) 1082 - return p_drv->event(data->event, data->priority, 1083 - &p_dev->event_callback_args); 1084 - 1085 - return 0; 1086 - } 1087 - 1088 - static int send_event(struct pcmcia_socket *s, event_t event, int priority) 1089 - { 1090 - struct send_event_data private; 1091 - 1092 - private.skt = s; 1093 - private.event = event; 1094 - private.priority = priority; 1095 - 1096 - return bus_for_each_dev(&pcmcia_bus_type, NULL, &private, send_event_callback); 1097 - } /* send_event */ 1098 - 1099 - 1100 1045 /* Normally, the event is passed to individual drivers after 1101 1046 * informing userspace. Only for CS_EVENT_CARD_REMOVAL this 1102 1047 * is inversed to maintain historic compatibility. ··· 1062 1093 static int ds_event(struct pcmcia_socket *skt, event_t event, int priority) 1063 1094 { 1064 1095 struct pcmcia_socket *s = pcmcia_get_socket(skt); 1065 - int ret = 0; 1066 1096 1067 1097 ds_dbg(1, "ds_event(0x%06x, %d, 0x%p)\n", 1068 1098 event, priority, skt); 1069 - 1070 - switch (event) { 1071 1099 1100 + switch (event) { 1072 1101 case CS_EVENT_CARD_REMOVAL: 1073 1102 s->pcmcia_state.present = 0; 1074 - send_event(skt, event, priority); 1075 1103 pcmcia_card_remove(skt); 1076 1104 handle_event(skt, event); 1077 1105 break; 1078 - 1106 + 1079 1107 case CS_EVENT_CARD_INSERTION: 1080 1108 s->pcmcia_state.present = 1; 1081 1109 pcmcia_card_add(skt); ··· 1080 1114 break; 1081 1115 1082 1116 case CS_EVENT_EJECTION_REQUEST: 1083 - ret = send_event(skt, event, priority); 1084 1117 break; 1085 1118 1086 1119 case CS_EVENT_PM_SUSPEND: 1087 1120 case CS_EVENT_PM_RESUME: 1088 1121 case CS_EVENT_RESET_PHYSICAL: 1089 1122 case CS_EVENT_CARD_RESET: 1090 - handle_event(skt, event); 1091 - break; 1092 - 1093 1123 default: 1094 1124 handle_event(skt, event); 1095 - send_event(skt, event, priority); 1096 1125 break; 1097 1126 } 1098 1127 ··· 1095 1134 1096 1135 return 0; 1097 1136 } /* ds_event */ 1098 - 1099 - 1100 - 1101 - int pcmcia_register_client(struct pcmcia_device **handle, client_reg_t *req) 1102 - { 1103 - struct pcmcia_socket *s = NULL; 1104 - struct pcmcia_device *p_dev = NULL; 1105 - struct pcmcia_driver *p_drv = NULL; 1106 - 1107 - /* Look for unbound client with matching dev_info */ 1108 - down_read(&pcmcia_socket_list_rwsem); 1109 - list_for_each_entry(s, &pcmcia_socket_list, socket_list) { 1110 - unsigned long flags; 1111 - 1112 - if (s->state & SOCKET_CARDBUS) 1113 - continue; 1114 - 1115 - s = pcmcia_get_socket(s); 1116 - if (!s) 1117 - continue; 1118 - spin_lock_irqsave(&pcmcia_dev_list_lock, flags); 1119 - list_for_each_entry(p_dev, &s->devices_list, socket_device_list) { 1120 - p_dev = pcmcia_get_dev(p_dev); 1121 - if (!p_dev) 1122 - continue; 1123 - if (!(p_dev->state & CLIENT_UNBOUND) || 1124 - (!p_dev->dev.driver)) { 1125 - pcmcia_put_dev(p_dev); 1126 - continue; 1127 - } 1128 - p_drv = to_pcmcia_drv(p_dev->dev.driver); 1129 - if (!strncmp(p_drv->drv.name, (char *)req->dev_info, DEV_NAME_LEN)) { 1130 - spin_unlock_irqrestore(&pcmcia_dev_list_lock, flags); 1131 - goto found; 1132 - } 1133 - pcmcia_put_dev(p_dev); 1134 - } 1135 - spin_unlock_irqrestore(&pcmcia_dev_list_lock, flags); 1136 - pcmcia_put_socket(s); 1137 - } 1138 - found: 1139 - up_read(&pcmcia_socket_list_rwsem); 1140 - if (!p_dev) 1141 - return -ENODEV; 1142 - 1143 - pcmcia_put_socket(s); /* safe, as we already hold a reference from bind_device */ 1144 - 1145 - *handle = p_dev; 1146 - p_dev->state &= ~CLIENT_UNBOUND; 1147 - p_dev->event_callback_args = req->event_callback_args; 1148 - p_dev->event_callback_args.client_handle = p_dev; 1149 - 1150 - 1151 - if (!s->functions) { 1152 - cistpl_longlink_mfc_t mfc; 1153 - if (pccard_read_tuple(s, p_dev->func, CISTPL_LONGLINK_MFC, &mfc) 1154 - == CS_SUCCESS) 1155 - s->functions = mfc.nfn; 1156 - else 1157 - s->functions = 1; 1158 - s->config = kmalloc(sizeof(config_t) * s->functions, 1159 - GFP_KERNEL); 1160 - if (!s->config) 1161 - goto out_no_resource; 1162 - memset(s->config, 0, sizeof(config_t) * s->functions); 1163 - } 1164 - 1165 - ds_dbg(1, "register_client(): client 0x%p, dev %s\n", 1166 - p_dev, p_dev->dev.bus_id); 1167 - 1168 - if ((s->state & (SOCKET_PRESENT|SOCKET_CARDBUS)) == SOCKET_PRESENT) { 1169 - if (p_drv->event) 1170 - p_drv->event(CS_EVENT_CARD_INSERTION, CS_EVENT_PRI_LOW, 1171 - &p_dev->event_callback_args); 1172 - 1173 - } 1174 - 1175 - return CS_SUCCESS; 1176 - 1177 - out_no_resource: 1178 - pcmcia_put_dev(p_dev); 1179 - return CS_OUT_OF_RESOURCE; 1180 - } /* register_client */ 1181 - EXPORT_SYMBOL(pcmcia_register_client); 1182 1137 1183 1138 1184 1139 static struct pcmcia_callback pcmcia_bus_callback = {
+11 -41
drivers/scsi/pcmcia/aha152x_stub.c
··· 95 95 } scsi_info_t; 96 96 97 97 static void aha152x_release_cs(dev_link_t *link); 98 - static int aha152x_event(event_t event, int priority, 99 - event_callback_args_t *args); 100 - 101 - static dev_link_t *aha152x_attach(void); 102 98 static void aha152x_detach(struct pcmcia_device *p_dev); 99 + static void aha152x_config_cs(dev_link_t *link); 103 100 104 101 static dev_link_t *dev_list; 105 - static dev_info_t dev_info = "aha152x_cs"; 106 102 107 - static dev_link_t *aha152x_attach(void) 103 + static int aha152x_attach(struct pcmcia_device *p_dev) 108 104 { 109 105 scsi_info_t *info; 110 - client_reg_t client_reg; 111 106 dev_link_t *link; 112 - int ret; 113 107 114 108 DEBUG(0, "aha152x_attach()\n"); 115 109 116 110 /* Create new SCSI device */ 117 111 info = kmalloc(sizeof(*info), GFP_KERNEL); 118 - if (!info) return NULL; 112 + if (!info) return -ENOMEM; 119 113 memset(info, 0, sizeof(*info)); 120 114 link = &info->link; link->priv = info; 121 115 ··· 123 129 link->conf.IntType = INT_MEMORY_AND_IO; 124 130 link->conf.Present = PRESENT_OPTION; 125 131 126 - /* Register with Card Services */ 127 - link->next = dev_list; 128 - dev_list = link; 129 - client_reg.dev_info = &dev_info; 130 - client_reg.Version = 0x0210; 131 - client_reg.event_callback_args.client_data = link; 132 - ret = pcmcia_register_client(&link->handle, &client_reg); 133 - if (ret != 0) { 134 - cs_error(link->handle, RegisterClient, ret); 135 - aha152x_detach(link->handle); 136 - return NULL; 137 - } 138 - 139 - return link; 132 + link->handle = p_dev; 133 + p_dev->instance = link; 134 + 135 + link->state |= DEV_PRESENT | DEV_CONFIG_PENDING; 136 + aha152x_config_cs(link); 137 + 138 + return 0; 140 139 } /* aha152x_attach */ 141 140 142 141 /*====================================================================*/ ··· 284 297 return 0; 285 298 } 286 299 287 - static int aha152x_event(event_t event, int priority, 288 - event_callback_args_t *args) 289 - { 290 - dev_link_t *link = args->client_data; 291 - 292 - DEBUG(0, "aha152x_event(0x%06x)\n", event); 293 - 294 - switch (event) { 295 - case CS_EVENT_CARD_INSERTION: 296 - link->state |= DEV_PRESENT | DEV_CONFIG_PENDING; 297 - aha152x_config_cs(link); 298 - break; 299 - } 300 - return 0; 301 - } 302 - 303 300 static struct pcmcia_device_id aha152x_ids[] = { 304 301 PCMCIA_DEVICE_PROD_ID123("New Media", "SCSI", "Bus Toaster", 0xcdf7e4cc, 0x35f26476, 0xa8851d6e), 305 302 PCMCIA_DEVICE_PROD_ID123("NOTEWORTHY", "SCSI", "Bus Toaster", 0xad89c6e8, 0x35f26476, 0xa8851d6e), ··· 299 328 .drv = { 300 329 .name = "aha152x_cs", 301 330 }, 302 - .attach = aha152x_attach, 303 - .event = aha152x_event, 331 + .probe = aha152x_attach, 304 332 .remove = aha152x_detach, 305 333 .id_table = aha152x_ids, 306 334 .suspend = aha152x_suspend,
+12 -44
drivers/scsi/pcmcia/fdomain_stub.c
··· 80 80 81 81 82 82 static void fdomain_release(dev_link_t *link); 83 - static int fdomain_event(event_t event, int priority, 84 - event_callback_args_t *args); 85 - 86 - static dev_link_t *fdomain_attach(void); 87 83 static void fdomain_detach(struct pcmcia_device *p_dev); 84 + static void fdomain_config(dev_link_t *link); 88 85 89 - 90 - static dev_info_t dev_info = "fdomain_cs"; 91 - 92 - static dev_link_t *fdomain_attach(void) 86 + static int fdomain_attach(struct pcmcia_device *p_dev) 93 87 { 94 88 scsi_info_t *info; 95 - client_reg_t client_reg; 96 89 dev_link_t *link; 97 - int ret; 98 - 90 + 99 91 DEBUG(0, "fdomain_attach()\n"); 100 92 101 93 /* Create new SCSI device */ 102 94 info = kmalloc(sizeof(*info), GFP_KERNEL); 103 - if (!info) return NULL; 95 + if (!info) return -ENOMEM; 104 96 memset(info, 0, sizeof(*info)); 105 97 link = &info->link; link->priv = info; 106 98 link->io.NumPorts1 = 0x10; ··· 105 113 link->conf.IntType = INT_MEMORY_AND_IO; 106 114 link->conf.Present = PRESENT_OPTION; 107 115 108 - /* Register with Card Services */ 109 - link->next = NULL; 110 - client_reg.dev_info = &dev_info; 111 - client_reg.Version = 0x0210; 112 - client_reg.event_callback_args.client_data = link; 113 - ret = pcmcia_register_client(&link->handle, &client_reg); 114 - if (ret != 0) { 115 - cs_error(link->handle, RegisterClient, ret); 116 - fdomain_detach(link->handle); 117 - return NULL; 118 - } 119 - 120 - return link; 116 + link->handle = p_dev; 117 + p_dev->instance = link; 118 + 119 + link->state |= DEV_PRESENT | DEV_CONFIG_PENDING; 120 + fdomain_config(link); 121 + 122 + return 0; 121 123 } /* fdomain_attach */ 122 124 123 125 /*====================================================================*/ ··· 251 265 return 0; 252 266 } 253 267 254 - static int fdomain_event(event_t event, int priority, 255 - event_callback_args_t *args) 256 - { 257 - dev_link_t *link = args->client_data; 258 - 259 - DEBUG(1, "fdomain_event(0x%06x)\n", event); 260 - 261 - switch (event) { 262 - case CS_EVENT_CARD_INSERTION: 263 - link->state |= DEV_PRESENT | DEV_CONFIG_PENDING; 264 - fdomain_config(link); 265 - break; 266 - } 267 - return 0; 268 - } /* fdomain_event */ 269 - 270 - 271 268 static struct pcmcia_device_id fdomain_ids[] = { 272 269 PCMCIA_DEVICE_PROD_ID12("IBM Corp.", "SCSI PCMCIA Card", 0xe3736c88, 0x859cad20), 273 270 PCMCIA_DEVICE_PROD_ID1("SCSI PCMCIA Adapter Card", 0x8dacb57e), ··· 264 295 .drv = { 265 296 .name = "fdomain_cs", 266 297 }, 267 - .attach = fdomain_attach, 268 - .event = fdomain_event, 298 + .probe = fdomain_attach, 269 299 .remove = fdomain_detach, 270 300 .id_table = fdomain_ids, 271 301 .suspend = fdomain_suspend,
+8 -59
drivers/scsi/pcmcia/nsp_cs.c
··· 104 104 #endif 105 105 }; 106 106 107 - static dev_info_t dev_info = {"nsp_cs"}; 108 - 109 107 static nsp_hw_data nsp_data_base; /* attach <-> detect glue */ 110 108 111 109 ··· 1593 1595 configure the card at this point -- we wait until we receive a 1594 1596 card insertion event. 1595 1597 ======================================================================*/ 1596 - static dev_link_t *nsp_cs_attach(void) 1598 + static int nsp_cs_attach(struct pcmcia_device *p_dev) 1597 1599 { 1598 1600 scsi_info_t *info; 1599 - client_reg_t client_reg; 1600 1601 dev_link_t *link; 1601 - int ret; 1602 1602 nsp_hw_data *data = &nsp_data_base; 1603 1603 1604 1604 nsp_dbg(NSP_DEBUG_INIT, "in"); 1605 1605 1606 1606 /* Create new SCSI device */ 1607 1607 info = kmalloc(sizeof(*info), GFP_KERNEL); 1608 - if (info == NULL) { return NULL; } 1608 + if (info == NULL) { return -ENOMEM; } 1609 1609 memset(info, 0, sizeof(*info)); 1610 1610 link = &info->link; 1611 1611 link->priv = info; ··· 1631 1635 link->conf.IntType = INT_MEMORY_AND_IO; 1632 1636 link->conf.Present = PRESENT_OPTION; 1633 1637 1638 + link->handle = p_dev; 1639 + p_dev->instance = link; 1634 1640 1635 - /* Register with Card Services */ 1636 - link->next = NULL; 1637 - client_reg.dev_info = &dev_info; 1638 - client_reg.Version = 0x0210; 1639 - client_reg.event_callback_args.client_data = link; 1640 - ret = pcmcia_register_client(&link->handle, &client_reg); 1641 - if (ret != CS_SUCCESS) { 1642 - cs_error(link->handle, RegisterClient, ret); 1643 - nsp_cs_detach(link->handle); 1644 - return NULL; 1645 - } 1646 - 1641 + link->state |= DEV_PRESENT | DEV_CONFIG_PENDING; 1642 + nsp_cs_config(link); 1647 1643 1648 1644 nsp_dbg(NSP_DEBUG_INIT, "link=0x%p", link); 1649 - return link; 1645 + return 0; 1650 1646 } /* nsp_cs_attach */ 1651 1647 1652 1648 ··· 2044 2056 return 0; 2045 2057 } 2046 2058 2047 - /*====================================================================== 2048 - 2049 - The card status event handler. Mostly, this schedules other 2050 - stuff to run after an event is received. A CARD_REMOVAL event 2051 - also sets some flags to discourage the net drivers from trying 2052 - to talk to the card any more. 2053 - 2054 - When a CARD_REMOVAL event is received, we immediately set a flag 2055 - to block future accesses to this device. All the functions that 2056 - actually access the device should check this flag to make sure 2057 - the card is still present. 2058 - 2059 - ======================================================================*/ 2060 - static int nsp_cs_event(event_t event, 2061 - int priority, 2062 - event_callback_args_t *args) 2063 - { 2064 - dev_link_t *link = args->client_data; 2065 - 2066 - nsp_dbg(NSP_DEBUG_INIT, "in, event=0x%08x", event); 2067 - 2068 - switch (event) { 2069 - case CS_EVENT_CARD_INSERTION: 2070 - nsp_dbg(NSP_DEBUG_INIT, "event: insert"); 2071 - link->state |= DEV_PRESENT | DEV_CONFIG_PENDING; 2072 - #if (LINUX_VERSION_CODE < KERNEL_VERSION(2,5,68)) 2073 - info->bus = args->bus; 2074 - #endif 2075 - nsp_cs_config(link); 2076 - break; 2077 - default: 2078 - nsp_dbg(NSP_DEBUG_INIT, "event: unknown"); 2079 - break; 2080 - } 2081 - nsp_dbg(NSP_DEBUG_INIT, "end"); 2082 - return 0; 2083 - } /* nsp_cs_event */ 2084 - 2085 2059 /*======================================================================* 2086 2060 * module entry point 2087 2061 *====================================================================*/ ··· 2065 2115 .drv = { 2066 2116 .name = "nsp_cs", 2067 2117 }, 2068 - .attach = nsp_cs_attach, 2069 - .event = nsp_cs_event, 2118 + .probe = nsp_cs_attach, 2070 2119 .remove = nsp_cs_detach, 2071 2120 .id_table = nsp_cs_ids, 2072 2121 .suspend = nsp_cs_suspend,
-2
drivers/scsi/pcmcia/nsp_cs.h
··· 296 296 */ 297 297 298 298 /* Card service functions */ 299 - static dev_link_t *nsp_cs_attach (void); 300 299 static void nsp_cs_detach (struct pcmcia_device *p_dev); 301 300 static void nsp_cs_release(dev_link_t *link); 302 301 static void nsp_cs_config (dev_link_t *link); 303 - static int nsp_cs_event (event_t event, int priority, event_callback_args_t *args); 304 302 305 303 /* Linux SCSI subsystem specific functions */ 306 304 static struct Scsi_Host *nsp_detect (struct scsi_host_template *sht);
+10 -39
drivers/scsi/pcmcia/qlogic_stub.c
··· 98 98 } scsi_info_t; 99 99 100 100 static void qlogic_release(dev_link_t *link); 101 - static int qlogic_event(event_t event, int priority, event_callback_args_t * args); 102 - 103 - static dev_link_t *qlogic_attach(void); 104 101 static void qlogic_detach(struct pcmcia_device *p_dev); 105 - 106 - 107 - static dev_info_t dev_info = "qlogic_cs"; 102 + static void qlogic_config(dev_link_t * link); 108 103 109 104 static struct Scsi_Host *qlogic_detect(struct scsi_host_template *host, 110 105 dev_link_t *link, int qbase, int qlirq) ··· 156 161 err: 157 162 return NULL; 158 163 } 159 - static dev_link_t *qlogic_attach(void) 164 + static int qlogic_attach(struct pcmcia_device *p_dev) 160 165 { 161 166 scsi_info_t *info; 162 - client_reg_t client_reg; 163 167 dev_link_t *link; 164 - int ret; 165 168 166 169 DEBUG(0, "qlogic_attach()\n"); 167 170 168 171 /* Create new SCSI device */ 169 172 info = kmalloc(sizeof(*info), GFP_KERNEL); 170 173 if (!info) 171 - return NULL; 174 + return -ENOMEM; 172 175 memset(info, 0, sizeof(*info)); 173 176 link = &info->link; 174 177 link->priv = info; ··· 180 187 link->conf.IntType = INT_MEMORY_AND_IO; 181 188 link->conf.Present = PRESENT_OPTION; 182 189 183 - /* Register with Card Services */ 184 - link->next = NULL; 185 - client_reg.dev_info = &dev_info; 186 - client_reg.Version = 0x0210; 187 - client_reg.event_callback_args.client_data = link; 188 - ret = pcmcia_register_client(&link->handle, &client_reg); 189 - if (ret != 0) { 190 - cs_error(link->handle, RegisterClient, ret); 191 - qlogic_detach(link->handle); 192 - return NULL; 193 - } 190 + link->handle = p_dev; 191 + p_dev->instance = link; 194 192 195 - return link; 193 + link->state |= DEV_PRESENT | DEV_CONFIG_PENDING; 194 + qlogic_config(link); 195 + 196 + return 0; 196 197 } /* qlogic_attach */ 197 198 198 199 /*====================================================================*/ ··· 355 368 return 0; 356 369 } 357 370 358 - static int qlogic_event(event_t event, int priority, event_callback_args_t * args) 359 - { 360 - dev_link_t *link = args->client_data; 361 - 362 - DEBUG(1, "qlogic_event(0x%06x)\n", event); 363 - 364 - switch (event) { 365 - case CS_EVENT_CARD_INSERTION: 366 - link->state |= DEV_PRESENT | DEV_CONFIG_PENDING; 367 - qlogic_config(link); 368 - break; 369 - } 370 - return 0; 371 - } /* qlogic_event */ 372 - 373 371 static struct pcmcia_device_id qlogic_ids[] = { 374 372 PCMCIA_DEVICE_PROD_ID12("EIger Labs", "PCMCIA-to-SCSI Adapter", 0x88395fa7, 0x33b7a5e6), 375 373 PCMCIA_DEVICE_PROD_ID12("EPSON", "SCSI-2 PC Card SC200", 0xd361772f, 0x299d1751), ··· 382 410 .drv = { 383 411 .name = "qlogic_cs", 384 412 }, 385 - .attach = qlogic_attach, 386 - .event = qlogic_event, 413 + .probe = qlogic_attach, 387 414 .remove = qlogic_detach, 388 415 .id_table = qlogic_ids, 389 416 .suspend = qlogic_suspend,
+10 -43
drivers/scsi/pcmcia/sym53c500_cs.c
··· 228 228 229 229 /* ================================================================== */ 230 230 231 - /* 232 - * Global (within this module) variables other than 233 - * sym53c500_driver_template (the scsi_host_template). 234 - */ 235 - static dev_info_t dev_info = "sym53c500_cs"; 236 - 237 - /* ================================================================== */ 238 - 239 231 static void 240 232 chip_init(int io_port) 241 233 { ··· 901 909 return 0; 902 910 } 903 911 904 - static int 905 - SYM53C500_event(event_t event, int priority, event_callback_args_t *args) 906 - { 907 - dev_link_t *link = args->client_data; 908 - 909 - DEBUG(1, "SYM53C500_event(0x%06x)\n", event); 910 - 911 - switch (event) { 912 - case CS_EVENT_CARD_INSERTION: 913 - link->state |= DEV_PRESENT | DEV_CONFIG_PENDING; 914 - SYM53C500_config(link); 915 - break; 916 - } 917 - return 0; 918 - } /* SYM53C500_event */ 919 - 920 912 static void 921 913 SYM53C500_detach(struct pcmcia_device *p_dev) 922 914 { ··· 915 939 link->priv = NULL; 916 940 } /* SYM53C500_detach */ 917 941 918 - static dev_link_t * 919 - SYM53C500_attach(void) 942 + static int 943 + SYM53C500_attach(struct pcmcia_device *p_dev) 920 944 { 921 945 struct scsi_info_t *info; 922 - client_reg_t client_reg; 923 946 dev_link_t *link; 924 - int ret; 925 947 926 948 DEBUG(0, "SYM53C500_attach()\n"); 927 949 928 950 /* Create new SCSI device */ 929 951 info = kmalloc(sizeof(*info), GFP_KERNEL); 930 952 if (!info) 931 - return NULL; 953 + return -ENOMEM; 932 954 memset(info, 0, sizeof(*info)); 933 955 link = &info->link; 934 956 link->priv = info; ··· 940 966 link->conf.IntType = INT_MEMORY_AND_IO; 941 967 link->conf.Present = PRESENT_OPTION; 942 968 943 - /* Register with Card Services */ 944 - link->next = NULL; 945 - client_reg.dev_info = &dev_info; 946 - client_reg.Version = 0x0210; 947 - client_reg.event_callback_args.client_data = link; 948 - ret = pcmcia_register_client(&link->handle, &client_reg); 949 - if (ret != 0) { 950 - cs_error(link->handle, RegisterClient, ret); 951 - SYM53C500_detach(link->handle); 952 - return NULL; 953 - } 969 + link->handle = p_dev; 970 + p_dev->instance = link; 954 971 955 - return link; 972 + link->state |= DEV_PRESENT | DEV_CONFIG_PENDING; 973 + SYM53C500_config(link); 974 + 975 + return 0; 956 976 } /* SYM53C500_attach */ 957 977 958 978 MODULE_AUTHOR("Bob Tracy <rct@frus.com>"); ··· 966 998 .drv = { 967 999 .name = "sym53c500_cs", 968 1000 }, 969 - .attach = SYM53C500_attach, 970 - .event = SYM53C500_event, 1001 + .probe = SYM53C500_attach, 971 1002 .remove = SYM53C500_detach, 972 1003 .id_table = sym53c500_ids, 973 1004 .suspend = sym53c500_suspend,
+8 -50
drivers/serial/serial_cs.c
··· 114 114 115 115 116 116 static void serial_config(dev_link_t * link); 117 - static int serial_event(event_t event, int priority, 118 - event_callback_args_t * args); 119 117 120 - static dev_info_t dev_info = "serial_cs"; 121 - 122 - static dev_link_t *serial_attach(void); 123 - static void serial_detach(struct pcmcia_device *p_dev); 124 118 125 119 /*====================================================================== 126 120 ··· 197 203 198 204 ======================================================================*/ 199 205 200 - static dev_link_t *serial_attach(void) 206 + static int serial_probe(struct pcmcia_device *p_dev) 201 207 { 202 208 struct serial_info *info; 203 - client_reg_t client_reg; 204 209 dev_link_t *link; 205 - int ret; 206 210 207 211 DEBUG(0, "serial_attach()\n"); 208 212 209 213 /* Create new serial device */ 210 214 info = kmalloc(sizeof (*info), GFP_KERNEL); 211 215 if (!info) 212 - return NULL; 216 + return -ENOMEM; 213 217 memset(info, 0, sizeof (*info)); 214 218 link = &info->link; 215 219 link->priv = info; ··· 223 231 } 224 232 link->conf.IntType = INT_MEMORY_AND_IO; 225 233 226 - /* Register with Card Services */ 227 - link->next = NULL; /* not needed */ 228 - client_reg.dev_info = &dev_info; 229 - client_reg.Version = 0x0210; 230 - client_reg.event_callback_args.client_data = link; 231 - ret = pcmcia_register_client(&link->handle, &client_reg); 232 - if (ret != CS_SUCCESS) { 233 - cs_error(link->handle, RegisterClient, ret); 234 - serial_detach(link->handle); 235 - return NULL; 236 - } 234 + link->handle = p_dev; 235 + p_dev->instance = link; 236 + link->state |= DEV_PRESENT | DEV_CONFIG_PENDING; 237 + serial_config(link); 237 238 238 - return link; 239 + return 0; 239 240 } 240 241 241 242 /*====================================================================== ··· 691 706 kfree(cfg_mem); 692 707 } 693 708 694 - /*====================================================================== 695 - 696 - The card status event handler. Mostly, this schedules other 697 - stuff to run after an event is received. A CARD_REMOVAL event 698 - also sets some flags to discourage the serial drivers from 699 - talking to the ports. 700 - 701 - ======================================================================*/ 702 - 703 - static int 704 - serial_event(event_t event, int priority, event_callback_args_t * args) 705 - { 706 - dev_link_t *link = args->client_data; 707 - 708 - DEBUG(1, "serial_event(0x%06x)\n", event); 709 - 710 - switch (event) { 711 - 712 - case CS_EVENT_CARD_INSERTION: 713 - link->state |= DEV_PRESENT | DEV_CONFIG_PENDING; 714 - serial_config(link); 715 - break; 716 - } 717 - return 0; 718 - } 719 - 720 709 static struct pcmcia_device_id serial_ids[] = { 721 710 PCMCIA_PFC_DEVICE_MANF_CARD(1, 0x0057, 0x0021), 722 711 PCMCIA_PFC_DEVICE_MANF_CARD(1, 0x0089, 0x110a), ··· 802 843 .drv = { 803 844 .name = "serial_cs", 804 845 }, 805 - .attach = serial_attach, 806 - .event = serial_event, 846 + .probe = serial_probe, 807 847 .remove = serial_detach, 808 848 .id_table = serial_ids, 809 849 .suspend = serial_suspend,
+13 -35
drivers/telephony/ixj_pcmcia.c
··· 34 34 struct ixj *port; 35 35 } ixj_info_t; 36 36 37 - static dev_link_t *ixj_attach(void); 38 37 static void ixj_detach(struct pcmcia_device *p_dev); 39 38 static void ixj_config(dev_link_t * link); 40 39 static void ixj_cs_release(dev_link_t * link); 41 - static int ixj_event(event_t event, int priority, event_callback_args_t * args); 42 - static dev_info_t dev_info = "ixj_cs"; 43 40 44 - static dev_link_t *ixj_attach(void) 41 + static int ixj_attach(struct pcmcia_device *p_dev) 45 42 { 46 - client_reg_t client_reg; 47 43 dev_link_t *link; 48 - int ret; 44 + 49 45 DEBUG(0, "ixj_attach()\n"); 50 46 /* Create new ixj device */ 51 47 link = kmalloc(sizeof(struct dev_link_t), GFP_KERNEL); 52 48 if (!link) 53 - return NULL; 49 + return -ENOMEM; 54 50 memset(link, 0, sizeof(struct dev_link_t)); 55 51 link->io.Attributes1 = IO_DATA_PATH_WIDTH_8; 56 52 link->io.Attributes2 = IO_DATA_PATH_WIDTH_8; ··· 56 60 link->priv = kmalloc(sizeof(struct ixj_info_t), GFP_KERNEL); 57 61 if (!link->priv) { 58 62 kfree(link); 59 - return NULL; 63 + return -ENOMEM; 60 64 } 61 65 memset(link->priv, 0, sizeof(struct ixj_info_t)); 62 - /* Register with Card Services */ 63 - link->next = NULL; 64 - client_reg.dev_info = &dev_info; 65 - client_reg.Version = 0x0210; 66 - client_reg.event_callback_args.client_data = link; 67 - ret = pcmcia_register_client(&link->handle, &client_reg); 68 - if (ret != CS_SUCCESS) { 69 - cs_error(link->handle, RegisterClient, ret); 70 - ixj_detach(link->handle); 71 - return NULL; 72 - } 73 - return link; 66 + 67 + link->handle = p_dev; 68 + p_dev->instance = link; 69 + 70 + link->state |= DEV_PRESENT | DEV_CONFIG_PENDING; 71 + ixj_config(link); 72 + 73 + return 0; 74 74 } 75 75 76 76 static void ixj_detach(struct pcmcia_device *p_dev) ··· 257 265 return 0; 258 266 } 259 267 260 - static int ixj_event(event_t event, int priority, event_callback_args_t * args) 261 - { 262 - dev_link_t *link = args->client_data; 263 - DEBUG(1, "ixj_event(0x%06x)\n", event); 264 - switch (event) { 265 - case CS_EVENT_CARD_INSERTION: 266 - link->state |= DEV_PRESENT | DEV_CONFIG_PENDING; 267 - ixj_config(link); 268 - break; 269 - } 270 - return 0; 271 - } 272 - 273 268 static struct pcmcia_device_id ixj_ids[] = { 274 269 PCMCIA_DEVICE_MANF_CARD(0x0257, 0x0600), 275 270 PCMCIA_DEVICE_NULL ··· 268 289 .drv = { 269 290 .name = "ixj_cs", 270 291 }, 271 - .attach = ixj_attach, 272 - .event = ixj_event, 292 + .probe = ixj_attach, 273 293 .remove = ixj_detach, 274 294 .id_table = ixj_ids, 275 295 .suspend = ixj_suspend,
+9 -35
drivers/usb/host/sl811_cs.c
··· 325 325 return 0; 326 326 } 327 327 328 - static int 329 - sl811_cs_event(event_t event, int priority, event_callback_args_t *args) 330 - { 331 - dev_link_t *link = args->client_data; 332 - 333 - DBG(1, "sl811_cs_event(0x%06x)\n", event); 334 - 335 - switch (event) { 336 - case CS_EVENT_CARD_INSERTION: 337 - link->state |= DEV_PRESENT | DEV_CONFIG_PENDING; 338 - sl811_cs_config(link); 339 - break; 340 - } 341 - return 0; 342 - } 343 - 344 - static dev_link_t *sl811_cs_attach(void) 328 + static int sl811_cs_attach(struct pcmcia_device *p_dev) 345 329 { 346 330 local_info_t *local; 347 331 dev_link_t *link; 348 - client_reg_t client_reg; 349 - int ret; 350 332 351 333 local = kmalloc(sizeof(local_info_t), GFP_KERNEL); 352 334 if (!local) 353 - return NULL; 335 + return -ENOMEM; 354 336 memset(local, 0, sizeof(local_info_t)); 355 337 link = &local->link; 356 338 link->priv = local; ··· 346 364 link->conf.Vcc = 33; 347 365 link->conf.IntType = INT_MEMORY_AND_IO; 348 366 349 - /* Register with Card Services */ 350 - link->next = NULL; 351 - client_reg.dev_info = (dev_info_t *) &driver_name; 352 - client_reg.Attributes = INFO_IO_CLIENT | INFO_CARD_SHARE; 353 - client_reg.Version = 0x0210; 354 - client_reg.event_callback_args.client_data = link; 355 - ret = pcmcia_register_client(&link->handle, &client_reg); 356 - if (ret != CS_SUCCESS) { 357 - cs_error(link->handle, RegisterClient, ret); 358 - sl811_cs_detach(link->handle); 359 - return NULL; 360 - } 367 + link->handle = p_dev; 368 + p_dev->instance = link; 361 369 362 - return link; 370 + link->state |= DEV_PRESENT | DEV_CONFIG_PENDING; 371 + sl811_cs_config(link); 372 + 373 + return 0; 363 374 } 364 375 365 376 static struct pcmcia_device_id sl811_ids[] = { ··· 366 391 .drv = { 367 392 .name = (char *)driver_name, 368 393 }, 369 - .attach = sl811_cs_attach, 370 - .event = sl811_cs_event, 394 + .probe = sl811_cs_attach, 371 395 .remove = sl811_cs_detach, 372 396 .id_table = sl811_ids, 373 397 .suspend = sl811_suspend,
-1
include/pcmcia/cs.h
··· 389 389 int pcmcia_get_mem_page(window_handle_t win, memreq_t *req); 390 390 int pcmcia_map_mem_page(window_handle_t win, memreq_t *req); 391 391 int pcmcia_modify_configuration(struct pcmcia_device *p_dev, modconf_t *mod); 392 - int pcmcia_register_client(client_handle_t *handle, client_reg_t *req); 393 392 int pcmcia_release_configuration(struct pcmcia_device *p_dev); 394 393 int pcmcia_release_io(struct pcmcia_device *p_dev, io_req_t *req); 395 394 int pcmcia_release_irq(struct pcmcia_device *p_dev, irq_req_t *req);
+1 -5
include/pcmcia/ds.h
··· 133 133 struct pcmcia_socket; 134 134 135 135 struct pcmcia_driver { 136 - dev_link_t *(*attach)(void); 137 - int (*event) (event_t event, int priority, 138 - event_callback_args_t *); 139 - 136 + int (*probe) (struct pcmcia_device *dev); 140 137 void (*remove) (struct pcmcia_device *dev); 141 138 142 139 int (*suspend) (struct pcmcia_device *dev); ··· 166 169 /* deprecated, a cleaned up version will be moved into this 167 170 struct soon */ 168 171 dev_link_t *instance; 169 - event_callback_args_t event_callback_args; 170 172 u_int state; 171 173 172 174 /* information about this device */