diff options
Diffstat (limited to 'drivers/isdn/hisax/avma1_cs.c')
-rw-r--r-- | drivers/isdn/hisax/avma1_cs.c | 77 |
1 files changed, 21 insertions, 56 deletions
diff --git a/drivers/isdn/hisax/avma1_cs.c b/drivers/isdn/hisax/avma1_cs.c index fc6cc2c065b..8fd3ca0fb93 100644 --- a/drivers/isdn/hisax/avma1_cs.c +++ b/drivers/isdn/hisax/avma1_cs.c | |||
@@ -174,38 +174,29 @@ static void avma1cs_detach(struct pcmcia_device *link) | |||
174 | 174 | ||
175 | ======================================================================*/ | 175 | ======================================================================*/ |
176 | 176 | ||
177 | static int get_tuple(struct pcmcia_device *handle, tuple_t *tuple, | 177 | static int avma1cs_configcheck(struct pcmcia_device *p_dev, |
178 | cisparse_t *parse) | 178 | cistpl_cftable_entry_t *cf, |
179 | cistpl_cftable_entry_t *dflt, | ||
180 | unsigned int vcc, | ||
181 | void *priv_data) | ||
179 | { | 182 | { |
180 | int i = pcmcia_get_tuple_data(handle, tuple); | 183 | if (cf->io.nwin <= 0) |
181 | if (i != CS_SUCCESS) return i; | 184 | return -ENODEV; |
182 | return pcmcia_parse_tuple(handle, tuple, parse); | 185 | |
186 | p_dev->io.BasePort1 = cf->io.win[0].base; | ||
187 | p_dev->io.NumPorts1 = cf->io.win[0].len; | ||
188 | p_dev->io.NumPorts2 = 0; | ||
189 | printk(KERN_INFO "avma1_cs: testing i/o %#x-%#x\n", | ||
190 | p_dev->io.BasePort1, | ||
191 | p_dev->io.BasePort1+p_dev->io.NumPorts1-1); | ||
192 | return pcmcia_request_io(p_dev, &p_dev->io); | ||
183 | } | 193 | } |
184 | 194 | ||
185 | static int first_tuple(struct pcmcia_device *handle, tuple_t *tuple, | ||
186 | cisparse_t *parse) | ||
187 | { | ||
188 | int i = pcmcia_get_first_tuple(handle, tuple); | ||
189 | if (i != CS_SUCCESS) return i; | ||
190 | return get_tuple(handle, tuple, parse); | ||
191 | } | ||
192 | |||
193 | static int next_tuple(struct pcmcia_device *handle, tuple_t *tuple, | ||
194 | cisparse_t *parse) | ||
195 | { | ||
196 | int i = pcmcia_get_next_tuple(handle, tuple); | ||
197 | if (i != CS_SUCCESS) return i; | ||
198 | return get_tuple(handle, tuple, parse); | ||
199 | } | ||
200 | 195 | ||
201 | static int avma1cs_config(struct pcmcia_device *link) | 196 | static int avma1cs_config(struct pcmcia_device *link) |
202 | { | 197 | { |
203 | tuple_t tuple; | ||
204 | cisparse_t parse; | ||
205 | cistpl_cftable_entry_t *cf = &parse.cftable_entry; | ||
206 | local_info_t *dev; | 198 | local_info_t *dev; |
207 | int i; | 199 | int i; |
208 | u_char buf[64]; | ||
209 | char devname[128]; | 200 | char devname[128]; |
210 | IsdnCard_t icard; | 201 | IsdnCard_t icard; |
211 | int busy = 0; | 202 | int busy = 0; |
@@ -214,40 +205,14 @@ static int avma1cs_config(struct pcmcia_device *link) | |||
214 | 205 | ||
215 | DEBUG(0, "avma1cs_config(0x%p)\n", link); | 206 | DEBUG(0, "avma1cs_config(0x%p)\n", link); |
216 | 207 | ||
217 | do { | 208 | devname[0] = 0; |
218 | devname[0] = 0; | 209 | if (link->prod_id[1]) |
219 | if (link->prod_id[1]) | 210 | strlcpy(devname, link->prod_id[1], sizeof(devname)); |
220 | strlcpy(devname, link->prod_id[1], sizeof(devname)); | ||
221 | 211 | ||
222 | /* | 212 | if (pcmcia_loop_config(link, avma1cs_configcheck, NULL)) |
223 | * find IO port | 213 | return -ENODEV; |
224 | */ | ||
225 | tuple.TupleData = (cisdata_t *)buf; | ||
226 | tuple.TupleOffset = 0; tuple.TupleDataMax = 255; | ||
227 | tuple.Attributes = 0; | ||
228 | tuple.DesiredTuple = CISTPL_CFTABLE_ENTRY; | ||
229 | i = first_tuple(link, &tuple, &parse); | ||
230 | while (i == CS_SUCCESS) { | ||
231 | if (cf->io.nwin > 0) { | ||
232 | link->conf.ConfigIndex = cf->index; | ||
233 | link->io.BasePort1 = cf->io.win[0].base; | ||
234 | link->io.NumPorts1 = cf->io.win[0].len; | ||
235 | link->io.NumPorts2 = 0; | ||
236 | printk(KERN_INFO "avma1_cs: testing i/o %#x-%#x\n", | ||
237 | link->io.BasePort1, | ||
238 | link->io.BasePort1+link->io.NumPorts1 - 1); | ||
239 | i = pcmcia_request_io(link, &link->io); | ||
240 | if (i == CS_SUCCESS) goto found_port; | ||
241 | } | ||
242 | i = next_tuple(link, &tuple, &parse); | ||
243 | } | ||
244 | 214 | ||
245 | found_port: | 215 | do { |
246 | if (i != CS_SUCCESS) { | ||
247 | cs_error(link, RequestIO, i); | ||
248 | break; | ||
249 | } | ||
250 | |||
251 | /* | 216 | /* |
252 | * allocate an interrupt line | 217 | * allocate an interrupt line |
253 | */ | 218 | */ |