aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/scsi/pcmcia/sym53c500_cs.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/scsi/pcmcia/sym53c500_cs.c')
-rw-r--r--drivers/scsi/pcmcia/sym53c500_cs.c46
1 files changed, 21 insertions, 25 deletions
diff --git a/drivers/scsi/pcmcia/sym53c500_cs.c b/drivers/scsi/pcmcia/sym53c500_cs.c
index 0be232b58ffb..b330c11a1752 100644
--- a/drivers/scsi/pcmcia/sym53c500_cs.c
+++ b/drivers/scsi/pcmcia/sym53c500_cs.c
@@ -700,15 +700,27 @@ static struct scsi_host_template sym53c500_driver_template = {
700#define CS_CHECK(fn, ret) \ 700#define CS_CHECK(fn, ret) \
701do { last_fn = (fn); if ((last_ret = (ret)) != 0) goto cs_failed; } while (0) 701do { last_fn = (fn); if ((last_ret = (ret)) != 0) goto cs_failed; } while (0)
702 702
703static int SYM53C500_config_check(struct pcmcia_device *p_dev,
704 cistpl_cftable_entry_t *cfg,
705 cistpl_cftable_entry_t *dflt,
706 unsigned int vcc,
707 void *priv_data)
708{
709 p_dev->io.BasePort1 = cfg->io.win[0].base;
710 p_dev->io.NumPorts1 = cfg->io.win[0].len;
711
712 if (p_dev->io.BasePort1 == 0)
713 return -ENODEV;
714
715 return pcmcia_request_io(p_dev, &p_dev->io);
716}
717
703static int 718static int
704SYM53C500_config(struct pcmcia_device *link) 719SYM53C500_config(struct pcmcia_device *link)
705{ 720{
706 struct scsi_info_t *info = link->priv; 721 struct scsi_info_t *info = link->priv;
707 tuple_t tuple; 722 int last_ret, last_fn;
708 cisparse_t parse;
709 int i, last_ret, last_fn;
710 int irq_level, port_base; 723 int irq_level, port_base;
711 unsigned short tuple_data[32];
712 struct Scsi_Host *host; 724 struct Scsi_Host *host;
713 struct scsi_host_template *tpnt = &sym53c500_driver_template; 725 struct scsi_host_template *tpnt = &sym53c500_driver_template;
714 struct sym53c500_data *data; 726 struct sym53c500_data *data;
@@ -717,27 +729,10 @@ SYM53C500_config(struct pcmcia_device *link)
717 729
718 info->manf_id = link->manf_id; 730 info->manf_id = link->manf_id;
719 731
720 tuple.TupleData = (cisdata_t *)tuple_data; 732 last_ret = pcmcia_loop_config(link, SYM53C500_config_check, NULL);
721 tuple.TupleDataMax = 64; 733 if (last_ret) {
722 tuple.TupleOffset = 0; 734 cs_error(link, RequestIO, last_ret);
723 735 goto failed;
724 tuple.DesiredTuple = CISTPL_CFTABLE_ENTRY;
725 CS_CHECK(GetFirstTuple, pcmcia_get_first_tuple(link, &tuple));
726 while (1) {
727 if (pcmcia_get_tuple_data(link, &tuple) != 0 ||
728 pcmcia_parse_tuple(link, &tuple, &parse) != 0)
729 goto next_entry;
730 link->conf.ConfigIndex = parse.cftable_entry.index;
731 link->io.BasePort1 = parse.cftable_entry.io.win[0].base;
732 link->io.NumPorts1 = parse.cftable_entry.io.win[0].len;
733
734 if (link->io.BasePort1 != 0) {
735 i = pcmcia_request_io(link, &link->io);
736 if (i == CS_SUCCESS)
737 break;
738 }
739next_entry:
740 CS_CHECK(GetNextTuple, pcmcia_get_next_tuple(link, &tuple));
741 } 736 }
742 737
743 CS_CHECK(RequestIRQ, pcmcia_request_irq(link, &link->irq)); 738 CS_CHECK(RequestIRQ, pcmcia_request_irq(link, &link->irq));
@@ -831,6 +826,7 @@ err_release:
831 826
832cs_failed: 827cs_failed:
833 cs_error(link, last_fn, last_ret); 828 cs_error(link, last_fn, last_ret);
829failed:
834 SYM53C500_release(link); 830 SYM53C500_release(link);
835 return -ENODEV; 831 return -ENODEV;
836} /* SYM53C500_config */ 832} /* SYM53C500_config */