Staging: et131x: Correct WRAP bit handling
add_10bit loses the existing wrap value Signed-off-by: Alan Cox <alan@linux.intel.com> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
This commit is contained in:
committed by
Greg Kroah-Hartman
parent
4439c93535
commit
b9d2dde055
@@ -1178,9 +1178,17 @@ void et131x_handle_recv_interrupt(struct et131x_adapter *etdev)
|
|||||||
static inline u32 bump_fbr(u32 *fbr, u32 limit)
|
static inline u32 bump_fbr(u32 *fbr, u32 limit)
|
||||||
{
|
{
|
||||||
u32 v = *fbr;
|
u32 v = *fbr;
|
||||||
add_10bit(&v, 1);
|
v++;
|
||||||
if (v > limit)
|
/* This works for all cases where limit < 1024. The 1023 case
|
||||||
v = (*fbr & ~ET_DMA10_MASK) ^ ET_DMA10_WRAP;
|
works because 1023++ is 1024 which means the if condition is not
|
||||||
|
taken but the carry of the bit into the wrap bit toggles the wrap
|
||||||
|
value correctly */
|
||||||
|
if ((v & ET_DMA10_MASK) > limit) {
|
||||||
|
v &= ~ET_DMA10_MASK;
|
||||||
|
v ^= ET_DMA10_WRAP;
|
||||||
|
}
|
||||||
|
/* For the 1023 case */
|
||||||
|
v &= (ET_DMA10_MASK|ET_DMA10_WRAP);
|
||||||
*fbr = v;
|
*fbr = v;
|
||||||
return v;
|
return v;
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user