Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 278441
b: refs/heads/master
c: 9a39169
h: refs/heads/master
i:
  278439: 9f03c7e
v: v3
  • Loading branch information
Nick Kossifidis authored and John W. Linville committed Nov 28, 2011
1 parent 08c46ff commit d8771eb
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 5 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: b4cfb5d574cd9e23e41462061941f6ac68a41c80
refs/heads/master: 9a3916910548e419f4da438406f84af9e05f72eb
17 changes: 13 additions & 4 deletions trunk/drivers/net/wireless/ath/ath5k/qcu.c
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ Queue Control Unit, DCF Control Unit Functions
#include "ath5k.h"
#include "reg.h"
#include "debug.h"
#include <linux/log2.h>

/**
* DOC: Queue Control Unit (QCU)/DCF Control Unit (DCU) functions
Expand Down Expand Up @@ -108,13 +109,21 @@ ath5k_hw_release_tx_queue(struct ath5k_hw *ah, unsigned int queue)
static u16
ath5k_cw_validate(u16 cw_req)
{
u32 cw = 1;
cw_req = min(cw_req, (u16)1023);

while (cw < cw_req)
cw = (cw << 1) | 1;
/* Check if cw_req + 1 a power of 2 */
if (is_power_of_2(cw_req + 1))
return cw_req;

return cw;
/* Check if cw_req is a power of 2 */
if (is_power_of_2(cw_req))
return cw_req - 1;

/* If none of the above is correct
* find the closest power of 2 */
cw_req = (u16) roundup_pow_of_two(cw_req) - 1;

return cw_req;
}

/**
Expand Down

0 comments on commit d8771eb

Please sign in to comment.