aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/staging/vt6655/tether.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/staging/vt6655/tether.c')
-rw-r--r--drivers/staging/vt6655/tether.c50
1 files changed, 23 insertions, 27 deletions
diff --git a/drivers/staging/vt6655/tether.c b/drivers/staging/vt6655/tether.c
index 28554bf75549..a5dc3c09cfd7 100644
--- a/drivers/staging/vt6655/tether.c
+++ b/drivers/staging/vt6655/tether.c
@@ -47,8 +47,6 @@
/*--------------------- Export Variables --------------------------*/
-
-
/*
* Description: Calculate multicast hash value by CRC32
*
@@ -61,28 +59,27 @@
* Return Value: Hash value
*
*/
-unsigned char ETHbyGetHashIndexByCrc32 (unsigned char *pbyMultiAddr)
+unsigned char ETHbyGetHashIndexByCrc32(unsigned char *pbyMultiAddr)
{
- int ii;
- unsigned char byTmpHash;
- unsigned char byHash = 0;
+ int ii;
+ unsigned char byTmpHash;
+ unsigned char byHash = 0;
- // get the least 6-bits from CRC generator
- byTmpHash = (unsigned char)(CRCdwCrc32(pbyMultiAddr, ETH_ALEN,
- 0xFFFFFFFFL) & 0x3F);
- // reverse most bit to least bit
- for (ii = 0; ii < (sizeof(byTmpHash) * 8); ii++) {
- byHash <<= 1;
- if (byTmpHash & 0x01)
- byHash |= 1;
- byTmpHash >>= 1;
- }
+ // get the least 6-bits from CRC generator
+ byTmpHash = (unsigned char)(CRCdwCrc32(pbyMultiAddr, ETH_ALEN,
+ 0xFFFFFFFFL) & 0x3F);
+ // reverse most bit to least bit
+ for (ii = 0; ii < (sizeof(byTmpHash) * 8); ii++) {
+ byHash <<= 1;
+ if (byTmpHash & 0x01)
+ byHash |= 1;
+ byTmpHash >>= 1;
+ }
- // adjust 6-bits to the right most
- return (byHash >> 2);
+ // adjust 6-bits to the right most
+ return byHash >> 2;
}
-
/*
* Description: Check CRC value of the buffer if Ok or not
*
@@ -96,14 +93,13 @@ unsigned char ETHbyGetHashIndexByCrc32 (unsigned char *pbyMultiAddr)
* Return Value: true if ok; false if error.
*
*/
-bool ETHbIsBufferCrc32Ok (unsigned char *pbyBuffer, unsigned int cbFrameLength)
+bool ETHbIsBufferCrc32Ok(unsigned char *pbyBuffer, unsigned int cbFrameLength)
{
- unsigned long dwCRC;
+ unsigned long dwCRC;
- dwCRC = CRCdwGetCrc32(pbyBuffer, cbFrameLength - 4);
- if (cpu_to_le32(*((unsigned long *)(pbyBuffer + cbFrameLength - 4))) != dwCRC) {
- return false;
- }
- return true;
+ dwCRC = CRCdwGetCrc32(pbyBuffer, cbFrameLength - 4);
+ if (cpu_to_le32(*((unsigned long *)(pbyBuffer + cbFrameLength - 4))) != dwCRC) {
+ return false;
+ }
+ return true;
}
-