diff options
author | Dominik Brodowski <linux@dominikbrodowski.net> | 2008-08-03 04:07:45 -0400 |
---|---|---|
committer | Dominik Brodowski <linux@dominikbrodowski.net> | 2008-08-22 20:29:26 -0400 |
commit | 4c89e88bfde6a3c179790e21004f24e09a058290 (patch) | |
tree | 2895a308d64aeabb5fde776d92572a51444d835b /drivers/pcmcia/cistpl.c | |
parent | 1a53088c101789bfca431de709ff6e45e8c77003 (diff) |
pcmcia: deprecate CS_SUCCESS
Instead of using own error or success codes, the PCMCIA code should rely on
the generic return values. Therefore, replace all occurrences of CS_SUCCESS
with 0.
CC: netdev@vger.kernel.org
Signed-off-by: Dominik Brodowski <linux@dominikbrodowski.net>
Diffstat (limited to 'drivers/pcmcia/cistpl.c')
-rw-r--r-- | drivers/pcmcia/cistpl.c | 73 |
1 files changed, 38 insertions, 35 deletions
diff --git a/drivers/pcmcia/cistpl.c b/drivers/pcmcia/cistpl.c index fe789e0e7ada..1a513d9a8612 100644 --- a/drivers/pcmcia/cistpl.c +++ b/drivers/pcmcia/cistpl.c | |||
@@ -392,7 +392,7 @@ int pcmcia_replace_cis(struct pcmcia_socket *s, | |||
392 | return CS_OUT_OF_RESOURCE; | 392 | return CS_OUT_OF_RESOURCE; |
393 | s->fake_cis_len = len; | 393 | s->fake_cis_len = len; |
394 | memcpy(s->fake_cis, data, len); | 394 | memcpy(s->fake_cis, data, len); |
395 | return CS_SUCCESS; | 395 | return 0; |
396 | } | 396 | } |
397 | EXPORT_SYMBOL(pcmcia_replace_cis); | 397 | EXPORT_SYMBOL(pcmcia_replace_cis); |
398 | 398 | ||
@@ -441,9 +441,9 @@ int pccard_get_first_tuple(struct pcmcia_socket *s, unsigned int function, tuple | |||
441 | !(tuple->Attributes & TUPLE_RETURN_COMMON)) { | 441 | !(tuple->Attributes & TUPLE_RETURN_COMMON)) { |
442 | cisdata_t req = tuple->DesiredTuple; | 442 | cisdata_t req = tuple->DesiredTuple; |
443 | tuple->DesiredTuple = CISTPL_LONGLINK_MFC; | 443 | tuple->DesiredTuple = CISTPL_LONGLINK_MFC; |
444 | if (pccard_get_next_tuple(s, function, tuple) == CS_SUCCESS) { | 444 | if (pccard_get_next_tuple(s, function, tuple) == 0) { |
445 | tuple->DesiredTuple = CISTPL_LINKTARGET; | 445 | tuple->DesiredTuple = CISTPL_LINKTARGET; |
446 | if (pccard_get_next_tuple(s, function, tuple) != CS_SUCCESS) | 446 | if (pccard_get_next_tuple(s, function, tuple) != 0) |
447 | return CS_NO_MORE_ITEMS; | 447 | return CS_NO_MORE_ITEMS; |
448 | } else | 448 | } else |
449 | tuple->CISOffset = tuple->TupleLink = 0; | 449 | tuple->CISOffset = tuple->TupleLink = 0; |
@@ -584,7 +584,7 @@ int pccard_get_next_tuple(struct pcmcia_socket *s, unsigned int function, tuple_ | |||
584 | tuple->TupleCode = link[0]; | 584 | tuple->TupleCode = link[0]; |
585 | tuple->TupleLink = link[1]; | 585 | tuple->TupleLink = link[1]; |
586 | tuple->CISOffset = ofs + 2; | 586 | tuple->CISOffset = ofs + 2; |
587 | return CS_SUCCESS; | 587 | return 0; |
588 | } | 588 | } |
589 | EXPORT_SYMBOL(pccard_get_next_tuple); | 589 | EXPORT_SYMBOL(pccard_get_next_tuple); |
590 | 590 | ||
@@ -604,11 +604,11 @@ int pccard_get_tuple_data(struct pcmcia_socket *s, tuple_t *tuple) | |||
604 | len = tuple->TupleLink - tuple->TupleOffset; | 604 | len = tuple->TupleLink - tuple->TupleOffset; |
605 | tuple->TupleDataLen = tuple->TupleLink; | 605 | tuple->TupleDataLen = tuple->TupleLink; |
606 | if (len == 0) | 606 | if (len == 0) |
607 | return CS_SUCCESS; | 607 | return 0; |
608 | read_cis_cache(s, SPACE(tuple->Flags), | 608 | read_cis_cache(s, SPACE(tuple->Flags), |
609 | tuple->CISOffset + tuple->TupleOffset, | 609 | tuple->CISOffset + tuple->TupleOffset, |
610 | _MIN(len, tuple->TupleDataMax), tuple->TupleData); | 610 | _MIN(len, tuple->TupleDataMax), tuple->TupleData); |
611 | return CS_SUCCESS; | 611 | return 0; |
612 | } | 612 | } |
613 | EXPORT_SYMBOL(pccard_get_tuple_data); | 613 | EXPORT_SYMBOL(pccard_get_tuple_data); |
614 | 614 | ||
@@ -659,7 +659,7 @@ static int parse_device(tuple_t *tuple, cistpl_device_t *device) | |||
659 | if (++p == q) break; | 659 | if (++p == q) break; |
660 | } | 660 | } |
661 | 661 | ||
662 | return CS_SUCCESS; | 662 | return 0; |
663 | } | 663 | } |
664 | 664 | ||
665 | /*====================================================================*/ | 665 | /*====================================================================*/ |
@@ -673,7 +673,7 @@ static int parse_checksum(tuple_t *tuple, cistpl_checksum_t *csum) | |||
673 | csum->addr = tuple->CISOffset + get_unaligned_le16(p) - 2; | 673 | csum->addr = tuple->CISOffset + get_unaligned_le16(p) - 2; |
674 | csum->len = get_unaligned_le16(p + 2); | 674 | csum->len = get_unaligned_le16(p + 2); |
675 | csum->sum = *(p + 4); | 675 | csum->sum = *(p + 4); |
676 | return CS_SUCCESS; | 676 | return 0; |
677 | } | 677 | } |
678 | 678 | ||
679 | /*====================================================================*/ | 679 | /*====================================================================*/ |
@@ -683,7 +683,7 @@ static int parse_longlink(tuple_t *tuple, cistpl_longlink_t *link) | |||
683 | if (tuple->TupleDataLen < 4) | 683 | if (tuple->TupleDataLen < 4) |
684 | return CS_BAD_TUPLE; | 684 | return CS_BAD_TUPLE; |
685 | link->addr = get_unaligned_le32(tuple->TupleData); | 685 | link->addr = get_unaligned_le32(tuple->TupleData); |
686 | return CS_SUCCESS; | 686 | return 0; |
687 | } | 687 | } |
688 | 688 | ||
689 | /*====================================================================*/ | 689 | /*====================================================================*/ |
@@ -704,7 +704,7 @@ static int parse_longlink_mfc(tuple_t *tuple, | |||
704 | link->fn[i].addr = get_unaligned_le32(p); | 704 | link->fn[i].addr = get_unaligned_le32(p); |
705 | p += 4; | 705 | p += 4; |
706 | } | 706 | } |
707 | return CS_SUCCESS; | 707 | return 0; |
708 | } | 708 | } |
709 | 709 | ||
710 | /*====================================================================*/ | 710 | /*====================================================================*/ |
@@ -729,9 +729,9 @@ static int parse_strings(u_char *p, u_char *q, int max, | |||
729 | } | 729 | } |
730 | if (found) { | 730 | if (found) { |
731 | *found = ns; | 731 | *found = ns; |
732 | return CS_SUCCESS; | 732 | return 0; |
733 | } else { | 733 | } else { |
734 | return (ns == max) ? CS_SUCCESS : CS_BAD_TUPLE; | 734 | return (ns == max) ? 0 : CS_BAD_TUPLE; |
735 | } | 735 | } |
736 | } | 736 | } |
737 | 737 | ||
@@ -782,7 +782,7 @@ static int parse_jedec(tuple_t *tuple, cistpl_jedec_t *jedec) | |||
782 | p += 2; | 782 | p += 2; |
783 | } | 783 | } |
784 | jedec->nid = nid; | 784 | jedec->nid = nid; |
785 | return CS_SUCCESS; | 785 | return 0; |
786 | } | 786 | } |
787 | 787 | ||
788 | /*====================================================================*/ | 788 | /*====================================================================*/ |
@@ -793,7 +793,7 @@ static int parse_manfid(tuple_t *tuple, cistpl_manfid_t *m) | |||
793 | return CS_BAD_TUPLE; | 793 | return CS_BAD_TUPLE; |
794 | m->manf = get_unaligned_le16(tuple->TupleData); | 794 | m->manf = get_unaligned_le16(tuple->TupleData); |
795 | m->card = get_unaligned_le16(tuple->TupleData + 2); | 795 | m->card = get_unaligned_le16(tuple->TupleData + 2); |
796 | return CS_SUCCESS; | 796 | return 0; |
797 | } | 797 | } |
798 | 798 | ||
799 | /*====================================================================*/ | 799 | /*====================================================================*/ |
@@ -806,7 +806,7 @@ static int parse_funcid(tuple_t *tuple, cistpl_funcid_t *f) | |||
806 | p = (u_char *)tuple->TupleData; | 806 | p = (u_char *)tuple->TupleData; |
807 | f->func = p[0]; | 807 | f->func = p[0]; |
808 | f->sysinit = p[1]; | 808 | f->sysinit = p[1]; |
809 | return CS_SUCCESS; | 809 | return 0; |
810 | } | 810 | } |
811 | 811 | ||
812 | /*====================================================================*/ | 812 | /*====================================================================*/ |
@@ -821,7 +821,7 @@ static int parse_funce(tuple_t *tuple, cistpl_funce_t *f) | |||
821 | f->type = p[0]; | 821 | f->type = p[0]; |
822 | for (i = 1; i < tuple->TupleDataLen; i++) | 822 | for (i = 1; i < tuple->TupleDataLen; i++) |
823 | f->data[i-1] = p[i]; | 823 | f->data[i-1] = p[i]; |
824 | return CS_SUCCESS; | 824 | return 0; |
825 | } | 825 | } |
826 | 826 | ||
827 | /*====================================================================*/ | 827 | /*====================================================================*/ |
@@ -847,7 +847,7 @@ static int parse_config(tuple_t *tuple, cistpl_config_t *config) | |||
847 | for (i = 0; i <= rmsz; i++) | 847 | for (i = 0; i <= rmsz; i++) |
848 | config->rmask[i>>2] += p[i] << (8*(i%4)); | 848 | config->rmask[i>>2] += p[i] << (8*(i%4)); |
849 | config->subtuples = tuple->TupleDataLen - (rasz+rmsz+4); | 849 | config->subtuples = tuple->TupleDataLen - (rasz+rmsz+4); |
850 | return CS_SUCCESS; | 850 | return 0; |
851 | } | 851 | } |
852 | 852 | ||
853 | /*====================================================================== | 853 | /*====================================================================== |
@@ -1122,7 +1122,7 @@ static int parse_cftable_entry(tuple_t *tuple, | |||
1122 | 1122 | ||
1123 | entry->subtuples = q-p; | 1123 | entry->subtuples = q-p; |
1124 | 1124 | ||
1125 | return CS_SUCCESS; | 1125 | return 0; |
1126 | } | 1126 | } |
1127 | 1127 | ||
1128 | /*====================================================================*/ | 1128 | /*====================================================================*/ |
@@ -1138,7 +1138,7 @@ static int parse_bar(tuple_t *tuple, cistpl_bar_t *bar) | |||
1138 | bar->attr = *p; | 1138 | bar->attr = *p; |
1139 | p += 2; | 1139 | p += 2; |
1140 | bar->size = get_unaligned_le32(p); | 1140 | bar->size = get_unaligned_le32(p); |
1141 | return CS_SUCCESS; | 1141 | return 0; |
1142 | } | 1142 | } |
1143 | 1143 | ||
1144 | static int parse_config_cb(tuple_t *tuple, cistpl_config_t *config) | 1144 | static int parse_config_cb(tuple_t *tuple, cistpl_config_t *config) |
@@ -1152,7 +1152,7 @@ static int parse_config_cb(tuple_t *tuple, cistpl_config_t *config) | |||
1152 | p++; | 1152 | p++; |
1153 | config->base = get_unaligned_le32(p); | 1153 | config->base = get_unaligned_le32(p); |
1154 | config->subtuples = tuple->TupleDataLen - 6; | 1154 | config->subtuples = tuple->TupleDataLen - 6; |
1155 | return CS_SUCCESS; | 1155 | return 0; |
1156 | } | 1156 | } |
1157 | 1157 | ||
1158 | static int parse_cftable_entry_cb(tuple_t *tuple, | 1158 | static int parse_cftable_entry_cb(tuple_t *tuple, |
@@ -1223,7 +1223,7 @@ static int parse_cftable_entry_cb(tuple_t *tuple, | |||
1223 | 1223 | ||
1224 | entry->subtuples = q-p; | 1224 | entry->subtuples = q-p; |
1225 | 1225 | ||
1226 | return CS_SUCCESS; | 1226 | return 0; |
1227 | } | 1227 | } |
1228 | 1228 | ||
1229 | #endif | 1229 | #endif |
@@ -1249,7 +1249,7 @@ static int parse_device_geo(tuple_t *tuple, cistpl_device_geo_t *geo) | |||
1249 | p += 6; | 1249 | p += 6; |
1250 | } | 1250 | } |
1251 | geo->ngeo = n; | 1251 | geo->ngeo = n; |
1252 | return CS_SUCCESS; | 1252 | return 0; |
1253 | } | 1253 | } |
1254 | 1254 | ||
1255 | /*====================================================================*/ | 1255 | /*====================================================================*/ |
@@ -1291,7 +1291,7 @@ static int parse_org(tuple_t *tuple, cistpl_org_t *org) | |||
1291 | if (*p == '\0') break; | 1291 | if (*p == '\0') break; |
1292 | if (++p == q) return CS_BAD_TUPLE; | 1292 | if (++p == q) return CS_BAD_TUPLE; |
1293 | } | 1293 | } |
1294 | return CS_SUCCESS; | 1294 | return 0; |
1295 | } | 1295 | } |
1296 | 1296 | ||
1297 | /*====================================================================*/ | 1297 | /*====================================================================*/ |
@@ -1310,14 +1310,14 @@ static int parse_format(tuple_t *tuple, cistpl_format_t *fmt) | |||
1310 | fmt->offset = get_unaligned_le32(p + 2); | 1310 | fmt->offset = get_unaligned_le32(p + 2); |
1311 | fmt->length = get_unaligned_le32(p + 6); | 1311 | fmt->length = get_unaligned_le32(p + 6); |
1312 | 1312 | ||
1313 | return CS_SUCCESS; | 1313 | return 0; |
1314 | } | 1314 | } |
1315 | 1315 | ||
1316 | /*====================================================================*/ | 1316 | /*====================================================================*/ |
1317 | 1317 | ||
1318 | int pccard_parse_tuple(tuple_t *tuple, cisparse_t *parse) | 1318 | int pccard_parse_tuple(tuple_t *tuple, cisparse_t *parse) |
1319 | { | 1319 | { |
1320 | int ret = CS_SUCCESS; | 1320 | int ret = 0; |
1321 | 1321 | ||
1322 | if (tuple->TupleDataLen > tuple->TupleDataMax) | 1322 | if (tuple->TupleDataLen > tuple->TupleDataMax) |
1323 | return CS_BAD_TUPLE; | 1323 | return CS_BAD_TUPLE; |
@@ -1388,7 +1388,7 @@ int pccard_parse_tuple(tuple_t *tuple, cisparse_t *parse) | |||
1388 | break; | 1388 | break; |
1389 | case CISTPL_NO_LINK: | 1389 | case CISTPL_NO_LINK: |
1390 | case CISTPL_LINKTARGET: | 1390 | case CISTPL_LINKTARGET: |
1391 | ret = CS_SUCCESS; | 1391 | ret = 0; |
1392 | break; | 1392 | break; |
1393 | default: | 1393 | default: |
1394 | ret = CS_UNSUPPORTED_FUNCTION; | 1394 | ret = CS_UNSUPPORTED_FUNCTION; |
@@ -1416,12 +1416,14 @@ int pccard_read_tuple(struct pcmcia_socket *s, unsigned int function, cisdata_t | |||
1416 | tuple.DesiredTuple = code; | 1416 | tuple.DesiredTuple = code; |
1417 | tuple.Attributes = TUPLE_RETURN_COMMON; | 1417 | tuple.Attributes = TUPLE_RETURN_COMMON; |
1418 | ret = pccard_get_first_tuple(s, function, &tuple); | 1418 | ret = pccard_get_first_tuple(s, function, &tuple); |
1419 | if (ret != CS_SUCCESS) goto done; | 1419 | if (ret != 0) |
1420 | goto done; | ||
1420 | tuple.TupleData = buf; | 1421 | tuple.TupleData = buf; |
1421 | tuple.TupleOffset = 0; | 1422 | tuple.TupleOffset = 0; |
1422 | tuple.TupleDataMax = 255; | 1423 | tuple.TupleDataMax = 255; |
1423 | ret = pccard_get_tuple_data(s, &tuple); | 1424 | ret = pccard_get_tuple_data(s, &tuple); |
1424 | if (ret != CS_SUCCESS) goto done; | 1425 | if (ret != 0) |
1426 | goto done; | ||
1425 | ret = pccard_parse_tuple(&tuple, parse); | 1427 | ret = pccard_parse_tuple(&tuple, parse); |
1426 | done: | 1428 | done: |
1427 | kfree(buf); | 1429 | kfree(buf); |
@@ -1462,21 +1464,21 @@ int pccard_validate_cis(struct pcmcia_socket *s, unsigned int function, unsigned | |||
1462 | tuple->DesiredTuple = RETURN_FIRST_TUPLE; | 1464 | tuple->DesiredTuple = RETURN_FIRST_TUPLE; |
1463 | tuple->Attributes = TUPLE_RETURN_COMMON; | 1465 | tuple->Attributes = TUPLE_RETURN_COMMON; |
1464 | ret = pccard_get_first_tuple(s, function, tuple); | 1466 | ret = pccard_get_first_tuple(s, function, tuple); |
1465 | if (ret != CS_SUCCESS) | 1467 | if (ret != 0) |
1466 | goto done; | 1468 | goto done; |
1467 | 1469 | ||
1468 | /* First tuple should be DEVICE; we should really have either that | 1470 | /* First tuple should be DEVICE; we should really have either that |
1469 | or a CFTABLE_ENTRY of some sort */ | 1471 | or a CFTABLE_ENTRY of some sort */ |
1470 | if ((tuple->TupleCode == CISTPL_DEVICE) || | 1472 | if ((tuple->TupleCode == CISTPL_DEVICE) || |
1471 | (pccard_read_tuple(s, function, CISTPL_CFTABLE_ENTRY, p) == CS_SUCCESS) || | 1473 | (pccard_read_tuple(s, function, CISTPL_CFTABLE_ENTRY, p) == 0) || |
1472 | (pccard_read_tuple(s, function, CISTPL_CFTABLE_ENTRY_CB, p) == CS_SUCCESS)) | 1474 | (pccard_read_tuple(s, function, CISTPL_CFTABLE_ENTRY_CB, p) == 0)) |
1473 | dev_ok++; | 1475 | dev_ok++; |
1474 | 1476 | ||
1475 | /* All cards should have a MANFID tuple, and/or a VERS_1 or VERS_2 | 1477 | /* All cards should have a MANFID tuple, and/or a VERS_1 or VERS_2 |
1476 | tuple, for card identification. Certain old D-Link and Linksys | 1478 | tuple, for card identification. Certain old D-Link and Linksys |
1477 | cards have only a broken VERS_2 tuple; hence the bogus test. */ | 1479 | cards have only a broken VERS_2 tuple; hence the bogus test. */ |
1478 | if ((pccard_read_tuple(s, function, CISTPL_MANFID, p) == CS_SUCCESS) || | 1480 | if ((pccard_read_tuple(s, function, CISTPL_MANFID, p) == 0) || |
1479 | (pccard_read_tuple(s, function, CISTPL_VERS_1, p) == CS_SUCCESS) || | 1481 | (pccard_read_tuple(s, function, CISTPL_VERS_1, p) == 0) || |
1480 | (pccard_read_tuple(s, function, CISTPL_VERS_2, p) != CS_NO_MORE_ITEMS)) | 1482 | (pccard_read_tuple(s, function, CISTPL_VERS_2, p) != CS_NO_MORE_ITEMS)) |
1481 | ident_ok++; | 1483 | ident_ok++; |
1482 | 1484 | ||
@@ -1485,7 +1487,8 @@ int pccard_validate_cis(struct pcmcia_socket *s, unsigned int function, unsigned | |||
1485 | 1487 | ||
1486 | for (count = 1; count < MAX_TUPLES; count++) { | 1488 | for (count = 1; count < MAX_TUPLES; count++) { |
1487 | ret = pccard_get_next_tuple(s, function, tuple); | 1489 | ret = pccard_get_next_tuple(s, function, tuple); |
1488 | if (ret != CS_SUCCESS) break; | 1490 | if (ret != 0) |
1491 | break; | ||
1489 | if (((tuple->TupleCode > 0x23) && (tuple->TupleCode < 0x40)) || | 1492 | if (((tuple->TupleCode > 0x23) && (tuple->TupleCode < 0x40)) || |
1490 | ((tuple->TupleCode > 0x47) && (tuple->TupleCode < 0x80)) || | 1493 | ((tuple->TupleCode > 0x47) && (tuple->TupleCode < 0x80)) || |
1491 | ((tuple->TupleCode > 0x90) && (tuple->TupleCode < 0xff))) | 1494 | ((tuple->TupleCode > 0x90) && (tuple->TupleCode < 0xff))) |
@@ -1500,6 +1503,6 @@ done: | |||
1500 | *info = count; | 1503 | *info = count; |
1501 | kfree(tuple); | 1504 | kfree(tuple); |
1502 | kfree(p); | 1505 | kfree(p); |
1503 | return CS_SUCCESS; | 1506 | return 0; |
1504 | } | 1507 | } |
1505 | EXPORT_SYMBOL(pccard_validate_cis); | 1508 | EXPORT_SYMBOL(pccard_validate_cis); |