Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

staging: vt6656: rxtx.c endian correct wTimeStampOff

wTimeStampOff needs to be endian corrected

Create new function vnt_time_stamp_off to return little endian u16 value.

Private variable byPreambleType is common to all calling functions is included.

variable rate to set the desired rate.

Signed-off-by: Malcolm Priestley <tvboxspy@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

authored by

Malcolm Priestley and committed by
Greg Kroah-Hartman
f115e76a 9c3806d5

+22 -11
+22 -11
drivers/staging/vt6656/rxtx.c
··· 323 323 } 324 324 } 325 325 326 + static u16 vnt_time_stamp_off(struct vnt_private *priv, u16 rate) 327 + { 328 + return cpu_to_le16(wTimeStampOff[priv->byPreambleType % 2] 329 + [rate % MAX_RATE]); 330 + } 331 + 326 332 /*byPktType : PK_TYPE_11A 0 327 333 PK_TYPE_11B 1 328 334 PK_TYPE_11GB 2 ··· 525 519 pBuf->wDuration_b = s_uGetDataDuration(pDevice, 526 520 PK_TYPE_11B, bNeedAck); 527 521 528 - pBuf->wTimeStampOff_a = wTimeStampOff[pDevice->byPreambleType%2][wCurrentRate%MAX_RATE]; 529 - pBuf->wTimeStampOff_b = wTimeStampOff[pDevice->byPreambleType%2][pDevice->byTopCCKBasicRate%MAX_RATE]; 522 + pBuf->wTimeStampOff_a = vnt_time_stamp_off(pDevice, 523 + wCurrentRate); 524 + pBuf->wTimeStampOff_b = vnt_time_stamp_off(pDevice, 525 + pDevice->byTopCCKBasicRate); 530 526 return (pBuf->wDuration_a); 531 527 } else { 532 528 // Auto Fallback ··· 548 540 byPktType, bNeedAck); 549 541 pBuf->wDuration_a_f1 = s_uGetDataDuration(pDevice, 550 542 byPktType, bNeedAck); 551 - pBuf->wTimeStampOff_a = wTimeStampOff[pDevice->byPreambleType%2][wCurrentRate%MAX_RATE]; 552 - pBuf->wTimeStampOff_b = wTimeStampOff[pDevice->byPreambleType%2][pDevice->byTopCCKBasicRate%MAX_RATE]; 543 + pBuf->wTimeStampOff_a = vnt_time_stamp_off(pDevice, 544 + wCurrentRate); 545 + pBuf->wTimeStampOff_b = vnt_time_stamp_off(pDevice, 546 + pDevice->byTopCCKBasicRate); 553 547 return (pBuf->wDuration_a); 554 548 } //if (byFBOption == AUTO_FB_NONE) 555 549 } ··· 569 559 byPktType, bNeedAck); 570 560 pBuf->wDuration_f1 = s_uGetDataDuration(pDevice, 571 561 byPktType, bNeedAck); 572 - pBuf->wTimeStampOff = wTimeStampOff[pDevice->byPreambleType%2][wCurrentRate%MAX_RATE]; 562 + pBuf->wTimeStampOff = vnt_time_stamp_off(pDevice, 563 + wCurrentRate); 573 564 return (pBuf->wDuration); 574 565 } else { 575 566 struct vnt_tx_datahead_ab *pBuf = ··· 581 570 //Get Duration and TimeStampOff 582 571 pBuf->wDuration = s_uGetDataDuration(pDevice, 583 572 byPktType, bNeedAck); 584 - pBuf->wTimeStampOff = wTimeStampOff[pDevice->byPreambleType%2][wCurrentRate%MAX_RATE]; 585 - 573 + pBuf->wTimeStampOff = vnt_time_stamp_off(pDevice, 574 + wCurrentRate); 586 575 return (pBuf->wDuration); 587 576 } 588 577 } ··· 595 584 //Get Duration and TimeStampOff 596 585 pBuf->wDuration = s_uGetDataDuration(pDevice, 597 586 byPktType, bNeedAck); 598 - pBuf->wTimeStampOff = wTimeStampOff[pDevice->byPreambleType%2][wCurrentRate%MAX_RATE]; 599 - 587 + pBuf->wTimeStampOff = vnt_time_stamp_off(pDevice, 588 + wCurrentRate); 600 589 return (pBuf->wDuration); 601 590 } 602 591 return 0; ··· 1841 1830 //Get Duration and TimeStampOff 1842 1831 pTxDataHead->wDuration = s_uGetDataDuration(pDevice, 1843 1832 PK_TYPE_11A, false); 1844 - pTxDataHead->wTimeStampOff = wTimeStampOff[pDevice->byPreambleType%2][wCurrentRate%MAX_RATE]; 1833 + pTxDataHead->wTimeStampOff = vnt_time_stamp_off(pDevice, wCurrentRate); 1845 1834 cbHeaderSize = wTxBufSize + sizeof(struct vnt_tx_datahead_ab); 1846 1835 } else { 1847 1836 wCurrentRate = RATE_1M; ··· 1854 1843 //Get Duration and TimeStampOff 1855 1844 pTxDataHead->wDuration = s_uGetDataDuration(pDevice, 1856 1845 PK_TYPE_11B, false); 1857 - pTxDataHead->wTimeStampOff = wTimeStampOff[pDevice->byPreambleType%2][wCurrentRate%MAX_RATE]; 1846 + pTxDataHead->wTimeStampOff = vnt_time_stamp_off(pDevice, wCurrentRate); 1858 1847 cbHeaderSize = wTxBufSize + sizeof(struct vnt_tx_datahead_ab); 1859 1848 } 1860 1849