aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/isdn/hisax/teles_cs.c
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2008-10-13 17:12:40 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2008-10-13 17:12:40 -0400
commit2be4ff2f084842839b041b793ed6237e8d1d315a (patch)
tree1d776ac1717edeff4ee7d59ab0aea2782cb86dba /drivers/isdn/hisax/teles_cs.c
parentcf2fa66055d718ae13e62451bb546505f63906a2 (diff)
parenta45b3fb19ba1e4dfc3fc53563a072612092930a9 (diff)
Merge git://git.kernel.org/pub/scm/linux/kernel/git/brodo/pcmcia-2.6
* git://git.kernel.org/pub/scm/linux/kernel/git/brodo/pcmcia-2.6: (49 commits) pcmcia: ioctl-internal definitions pcmcia: cistpl header cleanup pcmcia: remove unused argument to pcmcia_parse_tuple() pcmcia: card services header cleanup pcmcia: device_id header cleanup pcmcia: encapsulate ioaddr_t pcmcia: cleanup device driver header file pcmcia: cleanup socket services header file pcmcia: merge ds_internal.h into cs_internal.h pcmcia: cleanup cs_internal.h pcmcia: cs_internal.h is internal pcmcia: use dev_printk for cs_error() pcmcia: remove CS_ error codes alltogether pcmcia: deprecate CS_BAD_TUPLE pcmcia: deprecate CS_BAD_ARGS pcmcia: deprecate CS_BAD_BASE, CS_BAD_IRQ, CS_BAD_OFFSET and CS_BAD_SIZE pcmcia: deprecate CS_BAD_ATTRIBUTE, CS_BAD_TYPE and CS_BAD_PAGE pcmcia: deprecate CS_NO_MORE_ITEMS pcmcia: deprecate CS_IN_USE pcmcia: deprecate CS_CONFIGURATION_LOCKED ... Fix trivial conflict in drivers/pcmcia/ds.c manually
Diffstat (limited to 'drivers/isdn/hisax/teles_cs.c')
-rw-r--r--drivers/isdn/hisax/teles_cs.c79
1 files changed, 26 insertions, 53 deletions
diff --git a/drivers/isdn/hisax/teles_cs.c b/drivers/isdn/hisax/teles_cs.c
index ab4bd455450e..623d111544d4 100644
--- a/drivers/isdn/hisax/teles_cs.c
+++ b/drivers/isdn/hisax/teles_cs.c
@@ -193,82 +193,55 @@ 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 cistpl_cftable_entry_t *dflt,
200 unsigned int vcc,
201 void *priv_data)
214{ 202{
215 int i = pcmcia_get_next_tuple(handle, tuple); 203 int j;
216 if (i != CS_SUCCESS) return i; 204
217 return get_tuple(handle, tuple, parse); 205 if ((cf->io.nwin > 0) && cf->io.win[0].base) {
206 printk(KERN_INFO "(teles_cs: looks like the 96 model)\n");
207 p_dev->io.BasePort1 = cf->io.win[0].base;
208 if (!pcmcia_request_io(p_dev, &p_dev->io))
209 return 0;
210 } else {
211 printk(KERN_INFO "(teles_cs: looks like the 97 model)\n");
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; 231 if (i != 0) {
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) {
259 last_fn = RequestIO; 232 last_fn = RequestIO;
260 goto cs_failed; 233 goto cs_failed;
261 } 234 }
262 235
263 i = pcmcia_request_irq(link, &link->irq); 236 i = pcmcia_request_irq(link, &link->irq);
264 if (i != CS_SUCCESS) { 237 if (i != 0) {
265 link->irq.AssignedIRQ = 0; 238 link->irq.AssignedIRQ = 0;
266 last_fn = RequestIRQ; 239 last_fn = RequestIRQ;
267 goto cs_failed; 240 goto cs_failed;
268 } 241 }
269 242
270 i = pcmcia_request_configuration(link, &link->conf); 243 i = pcmcia_request_configuration(link, &link->conf);
271 if (i != CS_SUCCESS) { 244 if (i != 0) {
272 last_fn = RequestConfiguration; 245 last_fn = RequestConfiguration;
273 goto cs_failed; 246 goto cs_failed;
274 } 247 }