aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/isdn/hisax/avma1_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/avma1_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/avma1_cs.c')
-rw-r--r--drivers/isdn/hisax/avma1_cs.c76
1 files changed, 20 insertions, 56 deletions
diff --git a/drivers/isdn/hisax/avma1_cs.c b/drivers/isdn/hisax/avma1_cs.c
index fc6cc2c065b8..8142d9fc8147 100644
--- a/drivers/isdn/hisax/avma1_cs.c
+++ b/drivers/isdn/hisax/avma1_cs.c
@@ -174,38 +174,28 @@ static void avma1cs_detach(struct pcmcia_device *link)
174 174
175======================================================================*/ 175======================================================================*/
176 176
177static int get_tuple(struct pcmcia_device *handle, tuple_t *tuple, 177static int avma1cs_configcheck(struct pcmcia_device *p_dev,
178 cisparse_t *parse) 178 cistpl_cftable_entry_t *cf,
179 void *priv_data)
179{ 180{
180 int i = pcmcia_get_tuple_data(handle, tuple); 181 if (cf->io.nwin <= 0)
181 if (i != CS_SUCCESS) return i; 182 return -ENODEV;
182 return pcmcia_parse_tuple(handle, tuple, parse); 183
184 p_dev->conf.ConfigIndex = cf->index;
185 p_dev->io.BasePort1 = cf->io.win[0].base;
186 p_dev->io.NumPorts1 = cf->io.win[0].len;
187 p_dev->io.NumPorts2 = 0;
188 printk(KERN_INFO "avma1_cs: testing i/o %#x-%#x\n",
189 p_dev->io.BasePort1,
190 p_dev->io.BasePort1+p_dev->io.NumPorts1-1);
191 return pcmcia_request_io(p_dev, &p_dev->io);
183} 192}
184 193
185static 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
193static 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 194
201static int avma1cs_config(struct pcmcia_device *link) 195static int avma1cs_config(struct pcmcia_device *link)
202{ 196{
203 tuple_t tuple;
204 cisparse_t parse;
205 cistpl_cftable_entry_t *cf = &parse.cftable_entry;
206 local_info_t *dev; 197 local_info_t *dev;
207 int i; 198 int i;
208 u_char buf[64];
209 char devname[128]; 199 char devname[128];
210 IsdnCard_t icard; 200 IsdnCard_t icard;
211 int busy = 0; 201 int busy = 0;
@@ -214,40 +204,14 @@ static int avma1cs_config(struct pcmcia_device *link)
214 204
215 DEBUG(0, "avma1cs_config(0x%p)\n", link); 205 DEBUG(0, "avma1cs_config(0x%p)\n", link);
216 206
217 do { 207 devname[0] = 0;
218 devname[0] = 0; 208 if (link->prod_id[1])
219 if (link->prod_id[1]) 209 strlcpy(devname, link->prod_id[1], sizeof(devname));
220 strlcpy(devname, link->prod_id[1], sizeof(devname));
221 210
222 /* 211 if (pcmcia_loop_config(link, avma1cs_configcheck, NULL))
223 * find IO port 212 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 213
245found_port: 214 do {
246 if (i != CS_SUCCESS) {
247 cs_error(link, RequestIO, i);
248 break;
249 }
250
251 /* 215 /*
252 * allocate an interrupt line 216 * allocate an interrupt line
253 */ 217 */