aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/isdn/hisax/teles_cs.c
diff options
context:
space:
mode:
authorDominik Brodowski <linux@dominikbrodowski.net>2008-07-29 02:38:55 -0400
committerDominik Brodowski <linux@dominikbrodowski.net>2008-08-22 19:21:27 -0400
commit5fcd4da0090828bd34a1956cb322a483c6bf163c (patch)
treeb26a14ab9ea94bfdc7815d62aa59aad77a6a1817 /drivers/isdn/hisax/teles_cs.c
parent0e6f9d2708409cd8e864cdb94edbe599872a19d1 (diff)
pcmcia: use pcmcia_loop_config in ISDN pcmcia drivers
Use the config loop helper in ISDN pcmcia drivers. CC: Karsten Keil <kkeil@suse.de> Signed-off-by: Dominik Brodowski <linux@dominikbrodowski.net>
Diffstat (limited to 'drivers/isdn/hisax/teles_cs.c')
-rw-r--r--drivers/isdn/hisax/teles_cs.c73
1 files changed, 23 insertions, 50 deletions
diff --git a/drivers/isdn/hisax/teles_cs.c b/drivers/isdn/hisax/teles_cs.c
index ab4bd455450e..2b063a2916f4 100644
--- a/drivers/isdn/hisax/teles_cs.c
+++ b/drivers/isdn/hisax/teles_cs.c
@@ -193,68 +193,41 @@ static void teles_detach(struct pcmcia_device *link)
193 device available to the system. 193 device available to the system.
194 194
195======================================================================*/ 195======================================================================*/
196static int get_tuple(struct pcmcia_device *handle, tuple_t *tuple,
197 cisparse_t *parse)
198{
199 int i = pcmcia_get_tuple_data(handle, tuple);
200 if (i != CS_SUCCESS) return i;
201 return pcmcia_parse_tuple(handle, tuple, parse);
202}
203
204static int first_tuple(struct pcmcia_device *handle, tuple_t *tuple,
205 cisparse_t *parse)
206{
207 int i = pcmcia_get_first_tuple(handle, tuple);
208 if (i != CS_SUCCESS) return i;
209 return get_tuple(handle, tuple, parse);
210}
211 196
212static int next_tuple(struct pcmcia_device *handle, tuple_t *tuple, 197static int teles_cs_configcheck(struct pcmcia_device *p_dev,
213 cisparse_t *parse) 198 cistpl_cftable_entry_t *cf,
199 void *priv_data)
214{ 200{
215 int i = pcmcia_get_next_tuple(handle, tuple); 201 int j;
216 if (i != CS_SUCCESS) return i; 202
217 return get_tuple(handle, tuple, parse); 203 if ((cf->io.nwin > 0) && cf->io.win[0].base) {
204 printk(KERN_INFO "(teles_cs: looks like the 96 model)\n");
205 p_dev->conf.ConfigIndex = cf->index;
206 p_dev->io.BasePort1 = cf->io.win[0].base;
207 if (!pcmcia_request_io(p_dev, &p_dev->io))
208 return 0;
209 } else {
210 printk(KERN_INFO "(teles_cs: looks like the 97 model)\n");
211 p_dev->conf.ConfigIndex = cf->index;
212 for (j = 0x2f0; j > 0x100; j -= 0x10) {
213 p_dev->io.BasePort1 = j;
214 if (!pcmcia_request_io(p_dev, &p_dev->io))
215 return 0;
216 }
217 }
218 return -ENODEV;
218} 219}
219 220
220static int teles_cs_config(struct pcmcia_device *link) 221static int teles_cs_config(struct pcmcia_device *link)
221{ 222{
222 tuple_t tuple;
223 cisparse_t parse;
224 local_info_t *dev; 223 local_info_t *dev;
225 int i, j, last_fn; 224 int i, last_fn;
226 u_short buf[128];
227 cistpl_cftable_entry_t *cf = &parse.cftable_entry;
228 IsdnCard_t icard; 225 IsdnCard_t icard;
229 226
230 DEBUG(0, "teles_config(0x%p)\n", link); 227 DEBUG(0, "teles_config(0x%p)\n", link);
231 dev = link->priv; 228 dev = link->priv;
232 229
233 tuple.TupleData = (cisdata_t *)buf; 230 i = pcmcia_loop_config(link, teles_cs_configcheck, NULL);
234 tuple.TupleOffset = 0; tuple.TupleDataMax = 255;
235 tuple.Attributes = 0;
236 tuple.DesiredTuple = CISTPL_CFTABLE_ENTRY;
237 i = first_tuple(link, &tuple, &parse);
238 while (i == CS_SUCCESS) {
239 if ( (cf->io.nwin > 0) && cf->io.win[0].base) {
240 printk(KERN_INFO "(teles_cs: looks like the 96 model)\n");
241 link->conf.ConfigIndex = cf->index;
242 link->io.BasePort1 = cf->io.win[0].base;
243 i = pcmcia_request_io(link, &link->io);
244 if (i == CS_SUCCESS) break;
245 } else {
246 printk(KERN_INFO "(teles_cs: looks like the 97 model)\n");
247 link->conf.ConfigIndex = cf->index;
248 for (i = 0, j = 0x2f0; j > 0x100; j -= 0x10) {
249 link->io.BasePort1 = j;
250 i = pcmcia_request_io(link, &link->io);
251 if (i == CS_SUCCESS) break;
252 }
253 break;
254 }
255 i = next_tuple(link, &tuple, &parse);
256 }
257
258 if (i != CS_SUCCESS) { 231 if (i != CS_SUCCESS) {
259 last_fn = RequestIO; 232 last_fn = RequestIO;
260 goto cs_failed; 233 goto cs_failed;