diff options
Diffstat (limited to 'drivers/scsi/pcmcia/fdomain_stub.c')
-rw-r--r-- | drivers/scsi/pcmcia/fdomain_stub.c | 36 |
1 files changed, 16 insertions, 20 deletions
diff --git a/drivers/scsi/pcmcia/fdomain_stub.c b/drivers/scsi/pcmcia/fdomain_stub.c index d8b99351b053..fefef7d81f14 100644 --- a/drivers/scsi/pcmcia/fdomain_stub.c +++ b/drivers/scsi/pcmcia/fdomain_stub.c | |||
@@ -123,34 +123,29 @@ static void fdomain_detach(struct pcmcia_device *link) | |||
123 | #define CS_CHECK(fn, ret) \ | 123 | #define CS_CHECK(fn, ret) \ |
124 | do { last_fn = (fn); if ((last_ret = (ret)) != 0) goto cs_failed; } while (0) | 124 | do { last_fn = (fn); if ((last_ret = (ret)) != 0) goto cs_failed; } while (0) |
125 | 125 | ||
126 | static int fdomain_config_check(struct pcmcia_device *p_dev, | ||
127 | cistpl_cftable_entry_t *cfg, | ||
128 | void *priv_data) | ||
129 | { | ||
130 | p_dev->conf.ConfigIndex = cfg->index; | ||
131 | p_dev->io.BasePort1 = cfg->io.win[0].base; | ||
132 | return pcmcia_request_io(p_dev, &p_dev->io); | ||
133 | } | ||
134 | |||
135 | |||
126 | static int fdomain_config(struct pcmcia_device *link) | 136 | static int fdomain_config(struct pcmcia_device *link) |
127 | { | 137 | { |
128 | scsi_info_t *info = link->priv; | 138 | scsi_info_t *info = link->priv; |
129 | tuple_t tuple; | 139 | int last_ret, last_fn; |
130 | cisparse_t parse; | ||
131 | int i, last_ret, last_fn; | ||
132 | u_char tuple_data[64]; | ||
133 | char str[22]; | 140 | char str[22]; |
134 | struct Scsi_Host *host; | 141 | struct Scsi_Host *host; |
135 | 142 | ||
136 | DEBUG(0, "fdomain_config(0x%p)\n", link); | 143 | DEBUG(0, "fdomain_config(0x%p)\n", link); |
137 | 144 | ||
138 | tuple.TupleData = tuple_data; | 145 | last_ret = pcmcia_loop_config(link, fdomain_config_check, NULL); |
139 | tuple.TupleDataMax = 64; | 146 | if (last_ret) { |
140 | tuple.TupleOffset = 0; | 147 | cs_error(link, RequestIO, last_ret); |
141 | 148 | goto failed; | |
142 | tuple.DesiredTuple = CISTPL_CFTABLE_ENTRY; | ||
143 | CS_CHECK(GetFirstTuple, pcmcia_get_first_tuple(link, &tuple)); | ||
144 | while (1) { | ||
145 | if (pcmcia_get_tuple_data(link, &tuple) != 0 || | ||
146 | pcmcia_parse_tuple(link, &tuple, &parse) != 0) | ||
147 | goto next_entry; | ||
148 | link->conf.ConfigIndex = parse.cftable_entry.index; | ||
149 | link->io.BasePort1 = parse.cftable_entry.io.win[0].base; | ||
150 | i = pcmcia_request_io(link, &link->io); | ||
151 | if (i == CS_SUCCESS) break; | ||
152 | next_entry: | ||
153 | CS_CHECK(GetNextTuple, pcmcia_get_next_tuple(link, &tuple)); | ||
154 | } | 149 | } |
155 | 150 | ||
156 | CS_CHECK(RequestIRQ, pcmcia_request_irq(link, &link->irq)); | 151 | CS_CHECK(RequestIRQ, pcmcia_request_irq(link, &link->irq)); |
@@ -181,6 +176,7 @@ static int fdomain_config(struct pcmcia_device *link) | |||
181 | 176 | ||
182 | cs_failed: | 177 | cs_failed: |
183 | cs_error(link, last_fn, last_ret); | 178 | cs_error(link, last_fn, last_ret); |
179 | failed: | ||
184 | fdomain_release(link); | 180 | fdomain_release(link); |
185 | return -ENODEV; | 181 | return -ENODEV; |
186 | } /* fdomain_config */ | 182 | } /* fdomain_config */ |