aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/char/pcmcia/synclink_cs.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/char/pcmcia/synclink_cs.c')
-rw-r--r--drivers/char/pcmcia/synclink_cs.c46
1 files changed, 20 insertions, 26 deletions
diff --git a/drivers/char/pcmcia/synclink_cs.c b/drivers/char/pcmcia/synclink_cs.c
index 7b1e055184d1..9bfd90e5d6b7 100644
--- a/drivers/char/pcmcia/synclink_cs.c
+++ b/drivers/char/pcmcia/synclink_cs.c
@@ -484,7 +484,7 @@ static void mgslpc_wait_until_sent(struct tty_struct *tty, int timeout);
484 484
485/* PCMCIA prototypes */ 485/* PCMCIA prototypes */
486 486
487static void mgslpc_config(dev_link_t *link); 487static void mgslpc_config(struct pcmcia_device *link);
488static void mgslpc_release(u_long arg); 488static void mgslpc_release(u_long arg);
489static void mgslpc_detach(struct pcmcia_device *p_dev); 489static void mgslpc_detach(struct pcmcia_device *p_dev);
490 490
@@ -533,10 +533,9 @@ static void ldisc_receive_buf(struct tty_struct *tty,
533 } 533 }
534} 534}
535 535
536static int mgslpc_attach(struct pcmcia_device *p_dev) 536static int mgslpc_attach(struct pcmcia_device *link)
537{ 537{
538 MGSLPC_INFO *info; 538 MGSLPC_INFO *info;
539 dev_link_t *link = dev_to_instance(p_dev);
540 539
541 if (debug_level >= DEBUG_LEVEL_INFO) 540 if (debug_level >= DEBUG_LEVEL_INFO)
542 printk("mgslpc_attach\n"); 541 printk("mgslpc_attach\n");
@@ -565,10 +564,10 @@ static int mgslpc_attach(struct pcmcia_device *p_dev)
565 info->imrb_value = 0xffff; 564 info->imrb_value = 0xffff;
566 info->pim_value = 0xff; 565 info->pim_value = 0xff;
567 566
568 info->p_dev = p_dev; 567 info->p_dev = link;
569 link->priv = info; 568 link->priv = info;
570 569
571 /* Initialize the dev_link_t structure */ 570 /* Initialize the struct pcmcia_device structure */
572 571
573 /* Interrupt setup */ 572 /* Interrupt setup */
574 link->irq.Attributes = IRQ_TYPE_EXCLUSIVE; 573 link->irq.Attributes = IRQ_TYPE_EXCLUSIVE;
@@ -592,9 +591,8 @@ static int mgslpc_attach(struct pcmcia_device *p_dev)
592#define CS_CHECK(fn, ret) \ 591#define CS_CHECK(fn, ret) \
593do { last_fn = (fn); if ((last_ret = (ret)) != 0) goto cs_failed; } while (0) 592do { last_fn = (fn); if ((last_ret = (ret)) != 0) goto cs_failed; } while (0)
594 593
595static void mgslpc_config(dev_link_t *link) 594static void mgslpc_config(struct pcmcia_device *link)
596{ 595{
597 client_handle_t handle = link->handle;
598 MGSLPC_INFO *info = link->priv; 596 MGSLPC_INFO *info = link->priv;
599 tuple_t tuple; 597 tuple_t tuple;
600 cisparse_t parse; 598 cisparse_t parse;
@@ -612,9 +610,9 @@ static void mgslpc_config(dev_link_t *link)
612 tuple.TupleData = buf; 610 tuple.TupleData = buf;
613 tuple.TupleDataMax = sizeof(buf); 611 tuple.TupleDataMax = sizeof(buf);
614 tuple.TupleOffset = 0; 612 tuple.TupleOffset = 0;
615 CS_CHECK(GetFirstTuple, pcmcia_get_first_tuple(handle, &tuple)); 613 CS_CHECK(GetFirstTuple, pcmcia_get_first_tuple(link, &tuple));
616 CS_CHECK(GetTupleData, pcmcia_get_tuple_data(handle, &tuple)); 614 CS_CHECK(GetTupleData, pcmcia_get_tuple_data(link, &tuple));
617 CS_CHECK(ParseTuple, pcmcia_parse_tuple(handle, &tuple, &parse)); 615 CS_CHECK(ParseTuple, pcmcia_parse_tuple(link, &tuple, &parse));
618 link->conf.ConfigBase = parse.config.base; 616 link->conf.ConfigBase = parse.config.base;
619 link->conf.Present = parse.config.rmask[0]; 617 link->conf.Present = parse.config.rmask[0];
620 618
@@ -624,11 +622,11 @@ static void mgslpc_config(dev_link_t *link)
624 /* get CIS configuration entry */ 622 /* get CIS configuration entry */
625 623
626 tuple.DesiredTuple = CISTPL_CFTABLE_ENTRY; 624 tuple.DesiredTuple = CISTPL_CFTABLE_ENTRY;
627 CS_CHECK(GetFirstTuple, pcmcia_get_first_tuple(handle, &tuple)); 625 CS_CHECK(GetFirstTuple, pcmcia_get_first_tuple(link, &tuple));
628 626
629 cfg = &(parse.cftable_entry); 627 cfg = &(parse.cftable_entry);
630 CS_CHECK(GetTupleData, pcmcia_get_tuple_data(handle, &tuple)); 628 CS_CHECK(GetTupleData, pcmcia_get_tuple_data(link, &tuple));
631 CS_CHECK(ParseTuple, pcmcia_parse_tuple(handle, &tuple, &parse)); 629 CS_CHECK(ParseTuple, pcmcia_parse_tuple(link, &tuple, &parse));
632 630
633 if (cfg->flags & CISTPL_CFTABLE_DEFAULT) dflt = *cfg; 631 if (cfg->flags & CISTPL_CFTABLE_DEFAULT) dflt = *cfg;
634 if (cfg->index == 0) 632 if (cfg->index == 0)
@@ -649,7 +647,7 @@ static void mgslpc_config(dev_link_t *link)
649 link->io.IOAddrLines = io->flags & CISTPL_IO_LINES_MASK; 647 link->io.IOAddrLines = io->flags & CISTPL_IO_LINES_MASK;
650 link->io.BasePort1 = io->win[0].base; 648 link->io.BasePort1 = io->win[0].base;
651 link->io.NumPorts1 = io->win[0].len; 649 link->io.NumPorts1 = io->win[0].len;
652 CS_CHECK(RequestIO, pcmcia_request_io(link->handle, &link->io)); 650 CS_CHECK(RequestIO, pcmcia_request_io(link, &link->io));
653 } 651 }
654 652
655 link->conf.Attributes = CONF_ENABLE_IRQ; 653 link->conf.Attributes = CONF_ENABLE_IRQ;
@@ -660,9 +658,9 @@ static void mgslpc_config(dev_link_t *link)
660 link->irq.Attributes |= IRQ_HANDLE_PRESENT; 658 link->irq.Attributes |= IRQ_HANDLE_PRESENT;
661 link->irq.Handler = mgslpc_isr; 659 link->irq.Handler = mgslpc_isr;
662 link->irq.Instance = info; 660 link->irq.Instance = info;
663 CS_CHECK(RequestIRQ, pcmcia_request_irq(link->handle, &link->irq)); 661 CS_CHECK(RequestIRQ, pcmcia_request_irq(link, &link->irq));
664 662
665 CS_CHECK(RequestConfiguration, pcmcia_request_configuration(link->handle, &link->conf)); 663 CS_CHECK(RequestConfiguration, pcmcia_request_configuration(link, &link->conf));
666 664
667 info->io_base = link->io.BasePort1; 665 info->io_base = link->io.BasePort1;
668 info->irq_level = link->irq.AssignedIRQ; 666 info->irq_level = link->irq.AssignedIRQ;
@@ -685,7 +683,7 @@ static void mgslpc_config(dev_link_t *link)
685 return; 683 return;
686 684
687cs_failed: 685cs_failed:
688 cs_error(link->handle, last_fn, last_ret); 686 cs_error(link, last_fn, last_ret);
689 mgslpc_release((u_long)link); 687 mgslpc_release((u_long)link);
690} 688}
691 689
@@ -695,18 +693,16 @@ cs_failed:
695 */ 693 */
696static void mgslpc_release(u_long arg) 694static void mgslpc_release(u_long arg)
697{ 695{
698 dev_link_t *link = (dev_link_t *)arg; 696 struct pcmcia_device *link = (struct pcmcia_device *)arg;
699 697
700 if (debug_level >= DEBUG_LEVEL_INFO) 698 if (debug_level >= DEBUG_LEVEL_INFO)
701 printk("mgslpc_release(0x%p)\n", link); 699 printk("mgslpc_release(0x%p)\n", link);
702 700
703 pcmcia_disable_device(link->handle); 701 pcmcia_disable_device(link);
704} 702}
705 703
706static void mgslpc_detach(struct pcmcia_device *p_dev) 704static void mgslpc_detach(struct pcmcia_device *link)
707{ 705{
708 dev_link_t *link = dev_to_instance(p_dev);
709
710 if (debug_level >= DEBUG_LEVEL_INFO) 706 if (debug_level >= DEBUG_LEVEL_INFO)
711 printk("mgslpc_detach(0x%p)\n", link); 707 printk("mgslpc_detach(0x%p)\n", link);
712 708
@@ -718,9 +714,8 @@ static void mgslpc_detach(struct pcmcia_device *p_dev)
718 mgslpc_remove_device((MGSLPC_INFO *)link->priv); 714 mgslpc_remove_device((MGSLPC_INFO *)link->priv);
719} 715}
720 716
721static int mgslpc_suspend(struct pcmcia_device *dev) 717static int mgslpc_suspend(struct pcmcia_device *link)
722{ 718{
723 dev_link_t *link = dev_to_instance(dev);
724 MGSLPC_INFO *info = link->priv; 719 MGSLPC_INFO *info = link->priv;
725 720
726 info->stop = 1; 721 info->stop = 1;
@@ -728,9 +723,8 @@ static int mgslpc_suspend(struct pcmcia_device *dev)
728 return 0; 723 return 0;
729} 724}
730 725
731static int mgslpc_resume(struct pcmcia_device *dev) 726static int mgslpc_resume(struct pcmcia_device *link)
732{ 727{
733 dev_link_t *link = dev_to_instance(dev);
734 MGSLPC_INFO *info = link->priv; 728 MGSLPC_INFO *info = link->priv;
735 729
736 info->stop = 0; 730 info->stop = 0;