aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/pcmcia/cistpl.c
diff options
context:
space:
mode:
authorDominik Brodowski <linux@dominikbrodowski.net>2008-06-19 14:12:34 -0400
committerDominik Brodowski <linux@dominikbrodowski.net>2008-06-24 09:33:42 -0400
commitc5081d5f4775b2a3f858f91151bbf9163e473075 (patch)
tree8e9e077e8011fd7bf888b491711933f8c90f0cf0 /drivers/pcmcia/cistpl.c
parentc502380170ee93fd1f4028cc1f32efc87fde7376 (diff)
pcmcia: simplify pccard_validate_cis
As cisinfo_t only contains one unsigned_int, pccard_validate_cis can be simplified by passing that around directly. Signed-off-by: Dominik Brodowski <linux@dominikbrodowski.net>
Diffstat (limited to 'drivers/pcmcia/cistpl.c')
-rw-r--r--drivers/pcmcia/cistpl.c15
1 files changed, 9 insertions, 6 deletions
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;