diff options
Diffstat (limited to 'drivers/char/pcmcia/synclink_cs.c')
-rw-r--r-- | drivers/char/pcmcia/synclink_cs.c | 49 |
1 files changed, 8 insertions, 41 deletions
diff --git a/drivers/char/pcmcia/synclink_cs.c b/drivers/char/pcmcia/synclink_cs.c index dc38b1d0a725..cf45b100eff1 100644 --- a/drivers/char/pcmcia/synclink_cs.c +++ b/drivers/char/pcmcia/synclink_cs.c | |||
@@ -486,13 +486,8 @@ static void mgslpc_wait_until_sent(struct tty_struct *tty, int timeout); | |||
486 | 486 | ||
487 | static void mgslpc_config(dev_link_t *link); | 487 | static void mgslpc_config(dev_link_t *link); |
488 | static void mgslpc_release(u_long arg); | 488 | static void mgslpc_release(u_long arg); |
489 | static int mgslpc_event(event_t event, int priority, | ||
490 | event_callback_args_t *args); | ||
491 | static dev_link_t *mgslpc_attach(void); | ||
492 | static void mgslpc_detach(struct pcmcia_device *p_dev); | 489 | static void mgslpc_detach(struct pcmcia_device *p_dev); |
493 | 490 | ||
494 | static dev_info_t dev_info = "synclink_cs"; | ||
495 | |||
496 | /* | 491 | /* |
497 | * 1st function defined in .text section. Calling this function in | 492 | * 1st function defined in .text section. Calling this function in |
498 | * init_module() followed by a breakpoint allows a remote debugger | 493 | * init_module() followed by a breakpoint allows a remote debugger |
@@ -538,12 +533,10 @@ static void ldisc_receive_buf(struct tty_struct *tty, | |||
538 | } | 533 | } |
539 | } | 534 | } |
540 | 535 | ||
541 | static dev_link_t *mgslpc_attach(void) | 536 | static int mgslpc_attach(struct pcmcia_device *p_dev) |
542 | { | 537 | { |
543 | MGSLPC_INFO *info; | 538 | MGSLPC_INFO *info; |
544 | dev_link_t *link; | 539 | dev_link_t *link; |
545 | client_reg_t client_reg; | ||
546 | int ret; | ||
547 | 540 | ||
548 | if (debug_level >= DEBUG_LEVEL_INFO) | 541 | if (debug_level >= DEBUG_LEVEL_INFO) |
549 | printk("mgslpc_attach\n"); | 542 | printk("mgslpc_attach\n"); |
@@ -551,7 +544,7 @@ static dev_link_t *mgslpc_attach(void) | |||
551 | info = (MGSLPC_INFO *)kmalloc(sizeof(MGSLPC_INFO), GFP_KERNEL); | 544 | info = (MGSLPC_INFO *)kmalloc(sizeof(MGSLPC_INFO), GFP_KERNEL); |
552 | if (!info) { | 545 | if (!info) { |
553 | printk("Error can't allocate device instance data\n"); | 546 | printk("Error can't allocate device instance data\n"); |
554 | return NULL; | 547 | return -ENOMEM; |
555 | } | 548 | } |
556 | 549 | ||
557 | memset(info, 0, sizeof(MGSLPC_INFO)); | 550 | memset(info, 0, sizeof(MGSLPC_INFO)); |
@@ -586,23 +579,15 @@ static dev_link_t *mgslpc_attach(void) | |||
586 | link->conf.Vcc = 50; | 579 | link->conf.Vcc = 50; |
587 | link->conf.IntType = INT_MEMORY_AND_IO; | 580 | link->conf.IntType = INT_MEMORY_AND_IO; |
588 | 581 | ||
589 | /* Register with Card Services */ | 582 | link->handle = p_dev; |
590 | link->next = NULL; | 583 | p_dev->instance = link; |
591 | |||
592 | client_reg.dev_info = &dev_info; | ||
593 | client_reg.Version = 0x0210; | ||
594 | client_reg.event_callback_args.client_data = link; | ||
595 | 584 | ||
596 | ret = pcmcia_register_client(&link->handle, &client_reg); | 585 | link->state |= DEV_PRESENT | DEV_CONFIG_PENDING; |
597 | if (ret != CS_SUCCESS) { | 586 | mgslpc_config(link); |
598 | cs_error(link->handle, RegisterClient, ret); | ||
599 | mgslpc_detach(link->handle); | ||
600 | return NULL; | ||
601 | } | ||
602 | 587 | ||
603 | mgslpc_add_device(info); | 588 | mgslpc_add_device(info); |
604 | 589 | ||
605 | return link; | 590 | return 0; |
606 | } | 591 | } |
607 | 592 | ||
608 | /* Card has been inserted. | 593 | /* Card has been inserted. |
@@ -778,23 +763,6 @@ static int mgslpc_resume(struct pcmcia_device *dev) | |||
778 | } | 763 | } |
779 | 764 | ||
780 | 765 | ||
781 | static int mgslpc_event(event_t event, int priority, | ||
782 | event_callback_args_t *args) | ||
783 | { | ||
784 | dev_link_t *link = args->client_data; | ||
785 | |||
786 | if (debug_level >= DEBUG_LEVEL_INFO) | ||
787 | printk("mgslpc_event(0x%06x)\n", event); | ||
788 | |||
789 | switch (event) { | ||
790 | case CS_EVENT_CARD_INSERTION: | ||
791 | link->state |= DEV_PRESENT | DEV_CONFIG_PENDING; | ||
792 | mgslpc_config(link); | ||
793 | break; | ||
794 | } | ||
795 | return 0; | ||
796 | } | ||
797 | |||
798 | static inline int mgslpc_paranoia_check(MGSLPC_INFO *info, | 766 | static inline int mgslpc_paranoia_check(MGSLPC_INFO *info, |
799 | char *name, const char *routine) | 767 | char *name, const char *routine) |
800 | { | 768 | { |
@@ -3071,8 +3039,7 @@ static struct pcmcia_driver mgslpc_driver = { | |||
3071 | .drv = { | 3039 | .drv = { |
3072 | .name = "synclink_cs", | 3040 | .name = "synclink_cs", |
3073 | }, | 3041 | }, |
3074 | .attach = mgslpc_attach, | 3042 | .probe = mgslpc_attach, |
3075 | .event = mgslpc_event, | ||
3076 | .remove = mgslpc_detach, | 3043 | .remove = mgslpc_detach, |
3077 | .id_table = mgslpc_ids, | 3044 | .id_table = mgslpc_ids, |
3078 | .suspend = mgslpc_suspend, | 3045 | .suspend = mgslpc_suspend, |