aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
Diffstat (limited to 'drivers')
-rw-r--r--drivers/mtd/maps/pcmciamtd.c5
-rw-r--r--drivers/pcmcia/cistpl.c15
-rw-r--r--drivers/pcmcia/ds.c7
-rw-r--r--drivers/pcmcia/pcmcia_ioctl.c2
-rw-r--r--drivers/pcmcia/rsrc_nonstatic.c11
-rw-r--r--drivers/pcmcia/socket_sysfs.c6
6 files changed, 23 insertions, 23 deletions
diff --git a/drivers/mtd/maps/pcmciamtd.c b/drivers/mtd/maps/pcmciamtd.c
index 1912d968718b..00530f9bf4a7 100644
--- a/drivers/mtd/maps/pcmciamtd.c
+++ b/drivers/mtd/maps/pcmciamtd.c
@@ -498,17 +498,14 @@ static int pcmciamtd_config(struct pcmcia_device *link)
498 int i; 498 int i;
499 config_info_t t; 499 config_info_t t;
500 static char *probes[] = { "jedec_probe", "cfi_probe" }; 500 static char *probes[] = { "jedec_probe", "cfi_probe" };
501 cisinfo_t cisinfo;
502 int new_name = 0; 501 int new_name = 0;
503 502
504 DEBUG(3, "link=0x%p", link); 503 DEBUG(3, "link=0x%p", link);
505 504
506 DEBUG(2, "Validating CIS"); 505 DEBUG(2, "Validating CIS");
507 ret = pcmcia_validate_cis(link, &cisinfo); 506 ret = pcmcia_validate_cis(link, NULL);
508 if(ret != CS_SUCCESS) { 507 if(ret != CS_SUCCESS) {
509 cs_error(link, GetTupleData, ret); 508 cs_error(link, GetTupleData, ret);
510 } else {
511 DEBUG(2, "ValidateCIS found %d chains", cisinfo.Chains);
512 } 509 }
513 510
514 card_settings(dev, link, &new_name); 511 card_settings(dev, link, &new_name);
diff --git a/drivers/pcmcia/cistpl.c b/drivers/pcmcia/cistpl.c
index 36379535f9da..0996ca253f28 100644
--- a/drivers/pcmcia/cistpl.c
+++ b/drivers/pcmcia/cistpl.c
@@ -1439,10 +1439,11 @@ EXPORT_SYMBOL(pccard_read_tuple);
1439 1439
1440======================================================================*/ 1440======================================================================*/
1441 1441
1442int pccard_validate_cis(struct pcmcia_socket *s, unsigned int function, cisinfo_t *info) 1442int pccard_validate_cis(struct pcmcia_socket *s, unsigned int function, unsigned int *info)
1443{ 1443{
1444 tuple_t *tuple; 1444 tuple_t *tuple;
1445 cisparse_t *p; 1445 cisparse_t *p;
1446 unsigned int count = 0;
1446 int ret, reserved, dev_ok = 0, ident_ok = 0; 1447 int ret, reserved, dev_ok = 0, ident_ok = 0;
1447 1448
1448 if (!s) 1449 if (!s)
@@ -1457,7 +1458,7 @@ int pccard_validate_cis(struct pcmcia_socket *s, unsigned int function, cisinfo_
1457 return CS_OUT_OF_RESOURCE; 1458 return CS_OUT_OF_RESOURCE;
1458 } 1459 }
1459 1460
1460 info->Chains = reserved = 0; 1461 count = reserved = 0;
1461 tuple->DesiredTuple = RETURN_FIRST_TUPLE; 1462 tuple->DesiredTuple = RETURN_FIRST_TUPLE;
1462 tuple->Attributes = TUPLE_RETURN_COMMON; 1463 tuple->Attributes = TUPLE_RETURN_COMMON;
1463 ret = pccard_get_first_tuple(s, function, tuple); 1464 ret = pccard_get_first_tuple(s, function, tuple);
@@ -1482,7 +1483,7 @@ int pccard_validate_cis(struct pcmcia_socket *s, unsigned int function, cisinfo_
1482 if (!dev_ok && !ident_ok) 1483 if (!dev_ok && !ident_ok)
1483 goto done; 1484 goto done;
1484 1485
1485 for (info->Chains = 1; info->Chains < MAX_TUPLES; info->Chains++) { 1486 for (count = 1; count < MAX_TUPLES; count++) {
1486 ret = pccard_get_next_tuple(s, function, tuple); 1487 ret = pccard_get_next_tuple(s, function, tuple);
1487 if (ret != CS_SUCCESS) break; 1488 if (ret != CS_SUCCESS) break;
1488 if (((tuple->TupleCode > 0x23) && (tuple->TupleCode < 0x40)) || 1489 if (((tuple->TupleCode > 0x23) && (tuple->TupleCode < 0x40)) ||
@@ -1490,11 +1491,13 @@ int pccard_validate_cis(struct pcmcia_socket *s, unsigned int function, cisinfo_
1490 ((tuple->TupleCode > 0x90) && (tuple->TupleCode < 0xff))) 1491 ((tuple->TupleCode > 0x90) && (tuple->TupleCode < 0xff)))
1491 reserved++; 1492 reserved++;
1492 } 1493 }
1493 if ((info->Chains == MAX_TUPLES) || (reserved > 5) || 1494 if ((count) || (reserved > 5) ||
1494 ((!dev_ok || !ident_ok) && (info->Chains > 10))) 1495 ((!dev_ok || !ident_ok) && (count > 10)))
1495 info->Chains = 0; 1496 count = 0;
1496 1497
1497done: 1498done:
1499 if (info)
1500 *info = count;
1498 kfree(tuple); 1501 kfree(tuple);
1499 kfree(p); 1502 kfree(p);
1500 return CS_SUCCESS; 1503 return CS_SUCCESS;
diff --git a/drivers/pcmcia/ds.c b/drivers/pcmcia/ds.c
index e40775443d04..0f56cb5a30be 100644
--- a/drivers/pcmcia/ds.c
+++ b/drivers/pcmcia/ds.c
@@ -741,9 +741,8 @@ struct pcmcia_device * pcmcia_device_add(struct pcmcia_socket *s, unsigned int f
741 741
742static int pcmcia_card_add(struct pcmcia_socket *s) 742static int pcmcia_card_add(struct pcmcia_socket *s)
743{ 743{
744 cisinfo_t cisinfo;
745 cistpl_longlink_mfc_t mfc; 744 cistpl_longlink_mfc_t mfc;
746 unsigned int no_funcs, i; 745 unsigned int no_funcs, i, no_chains;
747 int ret = 0; 746 int ret = 0;
748 747
749 if (!(s->resource_setup_done)) { 748 if (!(s->resource_setup_done)) {
@@ -757,8 +756,8 @@ static int pcmcia_card_add(struct pcmcia_socket *s)
757 return -EAGAIN; /* try again, but later... */ 756 return -EAGAIN; /* try again, but later... */
758 } 757 }
759 758
760 ret = pccard_validate_cis(s, BIND_FN_ALL, &cisinfo); 759 ret = pccard_validate_cis(s, BIND_FN_ALL, &no_chains);
761 if (ret || !cisinfo.Chains) { 760 if (ret || !no_chains) {
762 ds_dbg(0, "invalid CIS or invalid resources\n"); 761 ds_dbg(0, "invalid CIS or invalid resources\n");
763 return -ENODEV; 762 return -ENODEV;
764 } 763 }
diff --git a/drivers/pcmcia/pcmcia_ioctl.c b/drivers/pcmcia/pcmcia_ioctl.c
index 758ece8dc362..1efc74fef148 100644
--- a/drivers/pcmcia/pcmcia_ioctl.c
+++ b/drivers/pcmcia/pcmcia_ioctl.c
@@ -735,7 +735,7 @@ static int ds_ioctl(struct inode * inode, struct file * file,
735 mutex_lock(&s->skt_mutex); 735 mutex_lock(&s->skt_mutex);
736 pcmcia_validate_mem(s); 736 pcmcia_validate_mem(s);
737 mutex_unlock(&s->skt_mutex); 737 mutex_unlock(&s->skt_mutex);
738 ret = pccard_validate_cis(s, BIND_FN_ALL, &buf->cisinfo); 738 ret = pccard_validate_cis(s, BIND_FN_ALL, &buf->cisinfo.Chains);
739 break; 739 break;
740 case DS_SUSPEND_CARD: 740 case DS_SUSPEND_CARD:
741 ret = pcmcia_suspend_card(s); 741 ret = pcmcia_suspend_card(s);
diff --git a/drivers/pcmcia/rsrc_nonstatic.c b/drivers/pcmcia/rsrc_nonstatic.c
index 162693480ed0..70d2e010e654 100644
--- a/drivers/pcmcia/rsrc_nonstatic.c
+++ b/drivers/pcmcia/rsrc_nonstatic.c
@@ -261,21 +261,22 @@ static void do_io_probe(struct pcmcia_socket *s, unsigned int base,
261======================================================================*/ 261======================================================================*/
262 262
263/* Validation function for cards with a valid CIS */ 263/* Validation function for cards with a valid CIS */
264static int readable(struct pcmcia_socket *s, struct resource *res, cisinfo_t *info) 264static int readable(struct pcmcia_socket *s, struct resource *res,
265 unsigned int *count)
265{ 266{
266 int ret = -1; 267 int ret = -1;
267 268
268 s->cis_mem.res = res; 269 s->cis_mem.res = res;
269 s->cis_virt = ioremap(res->start, s->map_size); 270 s->cis_virt = ioremap(res->start, s->map_size);
270 if (s->cis_virt) { 271 if (s->cis_virt) {
271 ret = pccard_validate_cis(s, BIND_FN_ALL, info); 272 ret = pccard_validate_cis(s, BIND_FN_ALL, count);
272 /* invalidate mapping and CIS cache */ 273 /* invalidate mapping and CIS cache */
273 iounmap(s->cis_virt); 274 iounmap(s->cis_virt);
274 s->cis_virt = NULL; 275 s->cis_virt = NULL;
275 destroy_cis_cache(s); 276 destroy_cis_cache(s);
276 } 277 }
277 s->cis_mem.res = NULL; 278 s->cis_mem.res = NULL;
278 if ((ret != 0) || (info->Chains == 0)) 279 if ((ret != 0) || (count == 0))
279 return 0; 280 return 0;
280 return 1; 281 return 1;
281} 282}
@@ -316,7 +317,7 @@ static int
316cis_readable(struct pcmcia_socket *s, unsigned long base, unsigned long size) 317cis_readable(struct pcmcia_socket *s, unsigned long base, unsigned long size)
317{ 318{
318 struct resource *res1, *res2; 319 struct resource *res1, *res2;
319 cisinfo_t info1, info2; 320 unsigned int info1, info2;
320 int ret = 0; 321 int ret = 0;
321 322
322 res1 = claim_region(s, base, size/2, IORESOURCE_MEM, "cs memory probe"); 323 res1 = claim_region(s, base, size/2, IORESOURCE_MEM, "cs memory probe");
@@ -330,7 +331,7 @@ cis_readable(struct pcmcia_socket *s, unsigned long base, unsigned long size)
330 free_region(res2); 331 free_region(res2);
331 free_region(res1); 332 free_region(res1);
332 333
333 return (ret == 2) && (info1.Chains == info2.Chains); 334 return (ret == 2) && (info1 == info2);
334} 335}
335 336
336static int 337static int
diff --git a/drivers/pcmcia/socket_sysfs.c b/drivers/pcmcia/socket_sysfs.c
index 562384d6f321..ff079987db1d 100644
--- a/drivers/pcmcia/socket_sysfs.c
+++ b/drivers/pcmcia/socket_sysfs.c
@@ -293,7 +293,7 @@ static ssize_t pccard_show_cis(struct kobject *kobj,
293 count = 0; 293 count = 0;
294 else { 294 else {
295 struct pcmcia_socket *s; 295 struct pcmcia_socket *s;
296 cisinfo_t cisinfo; 296 unsigned int chains;
297 297
298 if (off + count > size) 298 if (off + count > size)
299 count = size - off; 299 count = size - off;
@@ -302,9 +302,9 @@ static ssize_t pccard_show_cis(struct kobject *kobj,
302 302
303 if (!(s->state & SOCKET_PRESENT)) 303 if (!(s->state & SOCKET_PRESENT))
304 return -ENODEV; 304 return -ENODEV;
305 if (pccard_validate_cis(s, BIND_FN_ALL, &cisinfo)) 305 if (pccard_validate_cis(s, BIND_FN_ALL, &chains))
306 return -EIO; 306 return -EIO;
307 if (!cisinfo.Chains) 307 if (!chains)
308 return -ENODATA; 308 return -ENODATA;
309 309
310 count = pccard_extract_cis(s, buf, off, count); 310 count = pccard_extract_cis(s, buf, off, count);