diff options
author | Franky Lin <frankyl@broadcom.com> | 2012-11-05 19:22:26 -0500 |
---|---|---|
committer | John W. Linville <linville@tuxdriver.com> | 2012-11-14 14:55:58 -0500 |
commit | 105105891980e639a012bbc9fbce1fc8a63ec38d (patch) | |
tree | d9e27e6db1b4a7bde825c8f125b8be34e4a10ea3 /drivers/net/wireless/brcm80211/brcmfmac/dhd_sdio.c | |
parent | fd67dc834a62abeadee07d454093475fbcdc0897 (diff) |
brcmfmac: change return type of brcmf_sdio_hdparser
Use int instead of bool as the return type of function
brcmf_sdio_hdparser to explicitly describe error returns.
Signed-off-by: Franky Lin <frankyl@broadcom.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers/net/wireless/brcm80211/brcmfmac/dhd_sdio.c')
-rw-r--r-- | drivers/net/wireless/brcm80211/brcmfmac/dhd_sdio.c | 47 |
1 files changed, 23 insertions, 24 deletions
diff --git a/drivers/net/wireless/brcm80211/brcmfmac/dhd_sdio.c b/drivers/net/wireless/brcm80211/brcmfmac/dhd_sdio.c index eec1cbf2c3a3..ba339f798aa5 100644 --- a/drivers/net/wireless/brcm80211/brcmfmac/dhd_sdio.c +++ b/drivers/net/wireless/brcm80211/brcmfmac/dhd_sdio.c | |||
@@ -1037,9 +1037,9 @@ static void brcmf_sdbrcm_free_glom(struct brcmf_sdio *bus) | |||
1037 | } | 1037 | } |
1038 | } | 1038 | } |
1039 | 1039 | ||
1040 | static bool brcmf_sdio_hdparser(struct brcmf_sdio *bus, u8 *header, | 1040 | static int brcmf_sdio_hdparser(struct brcmf_sdio *bus, u8 *header, |
1041 | struct brcmf_sdio_read *rd, | 1041 | struct brcmf_sdio_read *rd, |
1042 | enum brcmf_sdio_frmtype type) | 1042 | enum brcmf_sdio_frmtype type) |
1043 | { | 1043 | { |
1044 | u16 len, checksum; | 1044 | u16 len, checksum; |
1045 | u8 rx_seq, fc, tx_seq_max; | 1045 | u8 rx_seq, fc, tx_seq_max; |
@@ -1054,26 +1054,26 @@ static bool brcmf_sdio_hdparser(struct brcmf_sdio *bus, u8 *header, | |||
1054 | /* All zero means no more to read */ | 1054 | /* All zero means no more to read */ |
1055 | if (!(len | checksum)) { | 1055 | if (!(len | checksum)) { |
1056 | bus->rxpending = false; | 1056 | bus->rxpending = false; |
1057 | return false; | 1057 | return -ENODATA; |
1058 | } | 1058 | } |
1059 | if ((u16)(~(len ^ checksum))) { | 1059 | if ((u16)(~(len ^ checksum))) { |
1060 | brcmf_dbg(ERROR, "HW header checksum error\n"); | 1060 | brcmf_dbg(ERROR, "HW header checksum error\n"); |
1061 | bus->sdcnt.rx_badhdr++; | 1061 | bus->sdcnt.rx_badhdr++; |
1062 | brcmf_sdbrcm_rxfail(bus, false, false); | 1062 | brcmf_sdbrcm_rxfail(bus, false, false); |
1063 | return false; | 1063 | return -EIO; |
1064 | } | 1064 | } |
1065 | if (len < SDPCM_HDRLEN) { | 1065 | if (len < SDPCM_HDRLEN) { |
1066 | brcmf_dbg(ERROR, "HW header length error\n"); | 1066 | brcmf_dbg(ERROR, "HW header length error\n"); |
1067 | return false; | 1067 | return -EPROTO; |
1068 | } | 1068 | } |
1069 | if (type == BRCMF_SDIO_FT_SUPER && | 1069 | if (type == BRCMF_SDIO_FT_SUPER && |
1070 | (roundup(len, bus->blocksize) != rd->len)) { | 1070 | (roundup(len, bus->blocksize) != rd->len)) { |
1071 | brcmf_dbg(ERROR, "HW superframe header length error\n"); | 1071 | brcmf_dbg(ERROR, "HW superframe header length error\n"); |
1072 | return false; | 1072 | return -EPROTO; |
1073 | } | 1073 | } |
1074 | if (type == BRCMF_SDIO_FT_SUB && len > rd->len) { | 1074 | if (type == BRCMF_SDIO_FT_SUB && len > rd->len) { |
1075 | brcmf_dbg(ERROR, "HW subframe header length error\n"); | 1075 | brcmf_dbg(ERROR, "HW subframe header length error\n"); |
1076 | return false; | 1076 | return -EPROTO; |
1077 | } | 1077 | } |
1078 | rd->len = len; | 1078 | rd->len = len; |
1079 | 1079 | ||
@@ -1091,7 +1091,7 @@ static bool brcmf_sdio_hdparser(struct brcmf_sdio *bus, u8 *header, | |||
1091 | SDPCM_GLOMDESC(&header[SDPCM_FRAMETAG_LEN])) { | 1091 | SDPCM_GLOMDESC(&header[SDPCM_FRAMETAG_LEN])) { |
1092 | brcmf_dbg(ERROR, "Glom descriptor found in superframe head\n"); | 1092 | brcmf_dbg(ERROR, "Glom descriptor found in superframe head\n"); |
1093 | rd->len = 0; | 1093 | rd->len = 0; |
1094 | return false; | 1094 | return -EINVAL; |
1095 | } | 1095 | } |
1096 | rx_seq = SDPCM_PACKET_SEQUENCE(&header[SDPCM_FRAMETAG_LEN]); | 1096 | rx_seq = SDPCM_PACKET_SEQUENCE(&header[SDPCM_FRAMETAG_LEN]); |
1097 | rd->channel = SDPCM_PACKET_CHANNEL(&header[SDPCM_FRAMETAG_LEN]); | 1097 | rd->channel = SDPCM_PACKET_CHANNEL(&header[SDPCM_FRAMETAG_LEN]); |
@@ -1102,18 +1102,18 @@ static bool brcmf_sdio_hdparser(struct brcmf_sdio *bus, u8 *header, | |||
1102 | bus->sdcnt.rx_toolong++; | 1102 | bus->sdcnt.rx_toolong++; |
1103 | brcmf_sdbrcm_rxfail(bus, false, false); | 1103 | brcmf_sdbrcm_rxfail(bus, false, false); |
1104 | rd->len = 0; | 1104 | rd->len = 0; |
1105 | return false; | 1105 | return -EPROTO; |
1106 | } | 1106 | } |
1107 | if (type == BRCMF_SDIO_FT_SUPER && rd->channel != SDPCM_GLOM_CHANNEL) { | 1107 | if (type == BRCMF_SDIO_FT_SUPER && rd->channel != SDPCM_GLOM_CHANNEL) { |
1108 | brcmf_dbg(ERROR, "Wrong channel for superframe\n"); | 1108 | brcmf_dbg(ERROR, "Wrong channel for superframe\n"); |
1109 | rd->len = 0; | 1109 | rd->len = 0; |
1110 | return false; | 1110 | return -EINVAL; |
1111 | } | 1111 | } |
1112 | if (type == BRCMF_SDIO_FT_SUB && rd->channel != SDPCM_DATA_CHANNEL && | 1112 | if (type == BRCMF_SDIO_FT_SUB && rd->channel != SDPCM_DATA_CHANNEL && |
1113 | rd->channel != SDPCM_EVENT_CHANNEL) { | 1113 | rd->channel != SDPCM_EVENT_CHANNEL) { |
1114 | brcmf_dbg(ERROR, "Wrong channel for subframe\n"); | 1114 | brcmf_dbg(ERROR, "Wrong channel for subframe\n"); |
1115 | rd->len = 0; | 1115 | rd->len = 0; |
1116 | return false; | 1116 | return -EINVAL; |
1117 | } | 1117 | } |
1118 | rd->dat_offset = SDPCM_DOFFSET_VALUE(&header[SDPCM_FRAMETAG_LEN]); | 1118 | rd->dat_offset = SDPCM_DOFFSET_VALUE(&header[SDPCM_FRAMETAG_LEN]); |
1119 | if (rd->dat_offset < SDPCM_HDRLEN || rd->dat_offset > rd->len) { | 1119 | if (rd->dat_offset < SDPCM_HDRLEN || rd->dat_offset > rd->len) { |
@@ -1121,7 +1121,7 @@ static bool brcmf_sdio_hdparser(struct brcmf_sdio *bus, u8 *header, | |||
1121 | bus->sdcnt.rx_badhdr++; | 1121 | bus->sdcnt.rx_badhdr++; |
1122 | brcmf_sdbrcm_rxfail(bus, false, false); | 1122 | brcmf_sdbrcm_rxfail(bus, false, false); |
1123 | rd->len = 0; | 1123 | rd->len = 0; |
1124 | return false; | 1124 | return -ENXIO; |
1125 | } | 1125 | } |
1126 | if (rd->seq_num != rx_seq) { | 1126 | if (rd->seq_num != rx_seq) { |
1127 | brcmf_dbg(ERROR, "seq %d: sequence number error, expect %d\n", | 1127 | brcmf_dbg(ERROR, "seq %d: sequence number error, expect %d\n", |
@@ -1131,7 +1131,7 @@ static bool brcmf_sdio_hdparser(struct brcmf_sdio *bus, u8 *header, | |||
1131 | } | 1131 | } |
1132 | /* no need to check the reset for subframe */ | 1132 | /* no need to check the reset for subframe */ |
1133 | if (type == BRCMF_SDIO_FT_SUB) | 1133 | if (type == BRCMF_SDIO_FT_SUB) |
1134 | return true; | 1134 | return 0; |
1135 | rd->len_nxtfrm = header[SDPCM_FRAMETAG_LEN + SDPCM_NEXTLEN_OFFSET]; | 1135 | rd->len_nxtfrm = header[SDPCM_FRAMETAG_LEN + SDPCM_NEXTLEN_OFFSET]; |
1136 | if (rd->len_nxtfrm << 4 > MAX_RX_DATASZ) { | 1136 | if (rd->len_nxtfrm << 4 > MAX_RX_DATASZ) { |
1137 | /* only warm for NON glom packet */ | 1137 | /* only warm for NON glom packet */ |
@@ -1155,7 +1155,7 @@ static bool brcmf_sdio_hdparser(struct brcmf_sdio *bus, u8 *header, | |||
1155 | } | 1155 | } |
1156 | bus->tx_max = tx_seq_max; | 1156 | bus->tx_max = tx_seq_max; |
1157 | 1157 | ||
1158 | return true; | 1158 | return 0; |
1159 | } | 1159 | } |
1160 | 1160 | ||
1161 | static u8 brcmf_sdbrcm_rxglom(struct brcmf_sdio *bus, u8 rxseq) | 1161 | static u8 brcmf_sdbrcm_rxglom(struct brcmf_sdio *bus, u8 rxseq) |
@@ -1323,8 +1323,8 @@ static u8 brcmf_sdbrcm_rxglom(struct brcmf_sdio *bus, u8 rxseq) | |||
1323 | rd_new.seq_num = rxseq; | 1323 | rd_new.seq_num = rxseq; |
1324 | rd_new.len = dlen; | 1324 | rd_new.len = dlen; |
1325 | sdio_claim_host(bus->sdiodev->func[1]); | 1325 | sdio_claim_host(bus->sdiodev->func[1]); |
1326 | errcode = -!brcmf_sdio_hdparser(bus, pfirst->data, &rd_new, | 1326 | errcode = brcmf_sdio_hdparser(bus, pfirst->data, &rd_new, |
1327 | BRCMF_SDIO_FT_SUPER); | 1327 | BRCMF_SDIO_FT_SUPER); |
1328 | sdio_release_host(bus->sdiodev->func[1]); | 1328 | sdio_release_host(bus->sdiodev->func[1]); |
1329 | bus->cur_read.len = rd_new.len_nxtfrm << 4; | 1329 | bus->cur_read.len = rd_new.len_nxtfrm << 4; |
1330 | 1330 | ||
@@ -1342,9 +1342,8 @@ static u8 brcmf_sdbrcm_rxglom(struct brcmf_sdio *bus, u8 rxseq) | |||
1342 | rd_new.len = pnext->len; | 1342 | rd_new.len = pnext->len; |
1343 | rd_new.seq_num = rxseq++; | 1343 | rd_new.seq_num = rxseq++; |
1344 | sdio_claim_host(bus->sdiodev->func[1]); | 1344 | sdio_claim_host(bus->sdiodev->func[1]); |
1345 | errcode = -!brcmf_sdio_hdparser(bus, pnext->data, | 1345 | errcode = brcmf_sdio_hdparser(bus, pnext->data, &rd_new, |
1346 | &rd_new, | 1346 | BRCMF_SDIO_FT_SUB); |
1347 | BRCMF_SDIO_FT_SUB); | ||
1348 | sdio_release_host(bus->sdiodev->func[1]); | 1347 | sdio_release_host(bus->sdiodev->func[1]); |
1349 | brcmf_dbg_hex_dump(BRCMF_GLOM_ON(), | 1348 | brcmf_dbg_hex_dump(BRCMF_GLOM_ON(), |
1350 | pnext->data, 32, "subframe:\n"); | 1349 | pnext->data, 32, "subframe:\n"); |
@@ -1612,8 +1611,8 @@ static uint brcmf_sdio_readframes(struct brcmf_sdio *bus, uint maxframes) | |||
1612 | bus->rxhdr, SDPCM_HDRLEN, | 1611 | bus->rxhdr, SDPCM_HDRLEN, |
1613 | "RxHdr:\n"); | 1612 | "RxHdr:\n"); |
1614 | 1613 | ||
1615 | if (!brcmf_sdio_hdparser(bus, bus->rxhdr, rd, | 1614 | if (brcmf_sdio_hdparser(bus, bus->rxhdr, rd, |
1616 | BRCMF_SDIO_FT_NORMAL)) { | 1615 | BRCMF_SDIO_FT_NORMAL)) { |
1617 | sdio_release_host(bus->sdiodev->func[1]); | 1616 | sdio_release_host(bus->sdiodev->func[1]); |
1618 | if (!bus->rxpending) | 1617 | if (!bus->rxpending) |
1619 | break; | 1618 | break; |
@@ -1679,8 +1678,8 @@ static uint brcmf_sdio_readframes(struct brcmf_sdio *bus, uint maxframes) | |||
1679 | memcpy(bus->rxhdr, pkt->data, SDPCM_HDRLEN); | 1678 | memcpy(bus->rxhdr, pkt->data, SDPCM_HDRLEN); |
1680 | rd_new.seq_num = rd->seq_num; | 1679 | rd_new.seq_num = rd->seq_num; |
1681 | sdio_claim_host(bus->sdiodev->func[1]); | 1680 | sdio_claim_host(bus->sdiodev->func[1]); |
1682 | if (!brcmf_sdio_hdparser(bus, bus->rxhdr, &rd_new, | 1681 | if (brcmf_sdio_hdparser(bus, bus->rxhdr, &rd_new, |
1683 | BRCMF_SDIO_FT_NORMAL)) { | 1682 | BRCMF_SDIO_FT_NORMAL)) { |
1684 | rd->len = 0; | 1683 | rd->len = 0; |
1685 | brcmu_pkt_buf_free_skb(pkt); | 1684 | brcmu_pkt_buf_free_skb(pkt); |
1686 | } | 1685 | } |