diff options
author | Dominik Brodowski <linux@dominikbrodowski.net> | 2009-10-18 17:51:09 -0400 |
---|---|---|
committer | Dominik Brodowski <linux@dominikbrodowski.net> | 2009-10-18 18:29:36 -0400 |
commit | 84897fc0524d7cbfc81d0bdf9f92ade6e3c3816b (patch) | |
tree | e24975ac12a1947c1a74dde7d23e795e27c41146 /drivers/pcmcia/cistpl.c | |
parent | 30514ccfc5651b0b1eb27d5ac1cb580b152cd85f (diff) |
pcmcia: pccard_read_tuple and TUPLE_RETURN_COMMON cleanup
pccard_read_tuple(), which is only used by the PCMCIA core, should
handle TUPLE_RETURN_COMMON more sensibly: If a specific function (which
may be 0) is requested, set tuple.Attributes = 0 as was done in all
PCMCIA drivers. If, however, BIND_FN_ALL is requested, return the
"common" tuple. As to the callers of pccard_read_tuple():
- All calls to pcmcia_validate_cis() had set the "function" parameter to
BIND_FN_ALL. Therefore, remove the "function" parameter and make the
parameter to pccard_read_tuple explicit.
- Calls to CISTPL_VERS_1 and CISTPL_MANFID now set BIND_FN_ALL. This was
already the case for calls to CISTPL_LONGLINK_MFC.
Signed-off-by: Dominik Brodowski <linux@dominikbrodowski.net>
Diffstat (limited to 'drivers/pcmcia/cistpl.c')
-rw-r--r-- | drivers/pcmcia/cistpl.c | 20 |
1 files changed, 11 insertions, 9 deletions
diff --git a/drivers/pcmcia/cistpl.c b/drivers/pcmcia/cistpl.c index 4a110b7b2673..6c4a4fc83630 100644 --- a/drivers/pcmcia/cistpl.c +++ b/drivers/pcmcia/cistpl.c | |||
@@ -1463,7 +1463,9 @@ int pccard_read_tuple(struct pcmcia_socket *s, unsigned int function, cisdata_t | |||
1463 | return -ENOMEM; | 1463 | return -ENOMEM; |
1464 | } | 1464 | } |
1465 | tuple.DesiredTuple = code; | 1465 | tuple.DesiredTuple = code; |
1466 | tuple.Attributes = TUPLE_RETURN_COMMON; | 1466 | tuple.Attributes = 0; |
1467 | if (function == BIND_FN_ALL) | ||
1468 | tuple.Attributes = TUPLE_RETURN_COMMON; | ||
1467 | ret = pccard_get_first_tuple(s, function, &tuple); | 1469 | ret = pccard_get_first_tuple(s, function, &tuple); |
1468 | if (ret != 0) | 1470 | if (ret != 0) |
1469 | goto done; | 1471 | goto done; |
@@ -1490,7 +1492,7 @@ EXPORT_SYMBOL(pccard_read_tuple); | |||
1490 | 1492 | ||
1491 | ======================================================================*/ | 1493 | ======================================================================*/ |
1492 | 1494 | ||
1493 | int pccard_validate_cis(struct pcmcia_socket *s, unsigned int function, unsigned int *info) | 1495 | int pccard_validate_cis(struct pcmcia_socket *s, unsigned int *info) |
1494 | { | 1496 | { |
1495 | tuple_t *tuple; | 1497 | tuple_t *tuple; |
1496 | cisparse_t *p; | 1498 | cisparse_t *p; |
@@ -1515,30 +1517,30 @@ int pccard_validate_cis(struct pcmcia_socket *s, unsigned int function, unsigned | |||
1515 | count = reserved = 0; | 1517 | count = reserved = 0; |
1516 | tuple->DesiredTuple = RETURN_FIRST_TUPLE; | 1518 | tuple->DesiredTuple = RETURN_FIRST_TUPLE; |
1517 | tuple->Attributes = TUPLE_RETURN_COMMON; | 1519 | tuple->Attributes = TUPLE_RETURN_COMMON; |
1518 | ret = pccard_get_first_tuple(s, function, tuple); | 1520 | ret = pccard_get_first_tuple(s, BIND_FN_ALL, tuple); |
1519 | if (ret != 0) | 1521 | if (ret != 0) |
1520 | goto done; | 1522 | goto done; |
1521 | 1523 | ||
1522 | /* First tuple should be DEVICE; we should really have either that | 1524 | /* First tuple should be DEVICE; we should really have either that |
1523 | or a CFTABLE_ENTRY of some sort */ | 1525 | or a CFTABLE_ENTRY of some sort */ |
1524 | if ((tuple->TupleCode == CISTPL_DEVICE) || | 1526 | if ((tuple->TupleCode == CISTPL_DEVICE) || |
1525 | (pccard_read_tuple(s, function, CISTPL_CFTABLE_ENTRY, p) == 0) || | 1527 | (pccard_read_tuple(s, BIND_FN_ALL, CISTPL_CFTABLE_ENTRY, p) == 0) || |
1526 | (pccard_read_tuple(s, function, CISTPL_CFTABLE_ENTRY_CB, p) == 0)) | 1528 | (pccard_read_tuple(s, BIND_FN_ALL, CISTPL_CFTABLE_ENTRY_CB, p) == 0)) |
1527 | dev_ok++; | 1529 | dev_ok++; |
1528 | 1530 | ||
1529 | /* All cards should have a MANFID tuple, and/or a VERS_1 or VERS_2 | 1531 | /* All cards should have a MANFID tuple, and/or a VERS_1 or VERS_2 |
1530 | tuple, for card identification. Certain old D-Link and Linksys | 1532 | tuple, for card identification. Certain old D-Link and Linksys |
1531 | cards have only a broken VERS_2 tuple; hence the bogus test. */ | 1533 | cards have only a broken VERS_2 tuple; hence the bogus test. */ |
1532 | if ((pccard_read_tuple(s, function, CISTPL_MANFID, p) == 0) || | 1534 | if ((pccard_read_tuple(s, BIND_FN_ALL, CISTPL_MANFID, p) == 0) || |
1533 | (pccard_read_tuple(s, function, CISTPL_VERS_1, p) == 0) || | 1535 | (pccard_read_tuple(s, BIND_FN_ALL, CISTPL_VERS_1, p) == 0) || |
1534 | (pccard_read_tuple(s, function, CISTPL_VERS_2, p) != -ENOSPC)) | 1536 | (pccard_read_tuple(s, BIND_FN_ALL, CISTPL_VERS_2, p) != -ENOSPC)) |
1535 | ident_ok++; | 1537 | ident_ok++; |
1536 | 1538 | ||
1537 | if (!dev_ok && !ident_ok) | 1539 | if (!dev_ok && !ident_ok) |
1538 | goto done; | 1540 | goto done; |
1539 | 1541 | ||
1540 | for (count = 1; count < MAX_TUPLES; count++) { | 1542 | for (count = 1; count < MAX_TUPLES; count++) { |
1541 | ret = pccard_get_next_tuple(s, function, tuple); | 1543 | ret = pccard_get_next_tuple(s, BIND_FN_ALL, tuple); |
1542 | if (ret != 0) | 1544 | if (ret != 0) |
1543 | break; | 1545 | break; |
1544 | if (((tuple->TupleCode > 0x23) && (tuple->TupleCode < 0x40)) || | 1546 | if (((tuple->TupleCode > 0x23) && (tuple->TupleCode < 0x40)) || |