From: Stanislaw Gruszka Date: Fri, 5 Oct 2012 11:44:10 +0000 (+0200) Subject: rt2800: limit TX_PWR_CFG_ values to 0xc X-Git-Tag: v3.8-rc1~139^2~17^2~331 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=19f3fa248174b2611d47229db847427092c1849f;p=profile%2Fivi%2Fkernel-x86-ivi.git rt2800: limit TX_PWR_CFG_ values to 0xc Based on AsicAdjustTxPower function from vendor driver (2011_0719_RT3070_RT3370_RT5370_RT5372_Linux_STA_V2.5.0.3_DPO) limit per rate TX power values we program into TX_PWR_CFG_ registers. Note that on some configurations (devices/rates) is allowed to use bigger values than 0xc, but we use safe maximum value for now. Further work need to be done to allow use bigger values than 0xc. Signed-off-by: Stanislaw Gruszka Acked-by: Gertjan van Wingerde Acked-by: Ivo van Doorn Signed-off-by: John W. Linville --- diff --git a/drivers/net/wireless/rt2x00/rt2800lib.c b/drivers/net/wireless/rt2x00/rt2800lib.c index 934dd9d..6bbd602 100644 --- a/drivers/net/wireless/rt2x00/rt2800lib.c +++ b/drivers/net/wireless/rt2x00/rt2800lib.c @@ -2563,7 +2563,8 @@ static u8 rt2800_compensate_txpower(struct rt2x00_dev *rt2x00dev, int is_rate_b, } else reg_limit = 0; - return txpower + delta - reg_limit; + txpower = max(0, txpower + delta - reg_limit); + return min_t(u8, txpower, 0xc); } static void rt2800_config_txpower(struct rt2x00_dev *rt2x00dev,