diff options
author | Alan Cox <alan@linux.intel.com> | 2009-10-12 10:38:17 -0400 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@suse.de> | 2009-10-14 17:14:38 -0400 |
commit | b9d2dde0556cde38105033cb39841658d81921d2 (patch) | |
tree | 98f07129cd2329adbbaba6839e32e4a7d7619a8d /drivers | |
parent | 4439c9353589f4def506b94f8f6344433333a4b9 (diff) |
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>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/staging/et131x/et1310_rx.c | 20 |
1 files changed, 14 insertions, 6 deletions
diff --git a/drivers/staging/et131x/et1310_rx.c b/drivers/staging/et131x/et1310_rx.c index 8f2e91fa0a86..10e21db57ac3 100644 --- a/drivers/staging/et131x/et1310_rx.c +++ b/drivers/staging/et131x/et1310_rx.c | |||
@@ -1177,12 +1177,20 @@ void et131x_handle_recv_interrupt(struct et131x_adapter *etdev) | |||
1177 | 1177 | ||
1178 | static inline u32 bump_fbr(u32 *fbr, u32 limit) | 1178 | static inline u32 bump_fbr(u32 *fbr, u32 limit) |
1179 | { | 1179 | { |
1180 | u32 v = *fbr; | 1180 | u32 v = *fbr; |
1181 | add_10bit(&v, 1); | 1181 | v++; |
1182 | if (v > limit) | 1182 | /* This works for all cases where limit < 1024. The 1023 case |
1183 | v = (*fbr & ~ET_DMA10_MASK) ^ ET_DMA10_WRAP; | 1183 | works because 1023++ is 1024 which means the if condition is not |
1184 | *fbr = v; | 1184 | taken but the carry of the bit into the wrap bit toggles the wrap |
1185 | return v; | 1185 | value correctly */ |
1186 | if ((v & ET_DMA10_MASK) > limit) { | ||
1187 | v &= ~ET_DMA10_MASK; | ||
1188 | v ^= ET_DMA10_WRAP; | ||
1189 | } | ||
1190 | /* For the 1023 case */ | ||
1191 | v &= (ET_DMA10_MASK|ET_DMA10_WRAP); | ||
1192 | *fbr = v; | ||
1193 | return v; | ||
1186 | } | 1194 | } |
1187 | 1195 | ||
1188 | /** | 1196 | /** |