Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 255864
b: refs/heads/master
c: 7a1d656
h: refs/heads/master
v: v3
  • Loading branch information
Jussi Kivilinna authored and John W. Linville committed Jun 22, 2011
1 parent 6ccacb1 commit b75cc9f
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 3 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: 670dc2833d144375eac36ad74111495a825a9288
refs/heads/master: 7a1d6564a15183cb5994656040966df09af8390f
6 changes: 6 additions & 0 deletions trunk/drivers/net/wireless/zd1211rw/zd_def.h
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,15 @@ typedef u16 __nocast zd_addr_t;
if (net_ratelimit()) \
dev_printk_f(KERN_DEBUG, dev, fmt, ## args); \
} while (0)
# define dev_dbg_f_cond(dev, cond, fmt, args...) ({ \
bool __cond = !!(cond); \
if (unlikely(__cond)) \
dev_printk_f(KERN_DEBUG, dev, fmt, ## args); \
})
#else
# define dev_dbg_f(dev, fmt, args...) do { (void)(dev); } while (0)
# define dev_dbg_f_limit(dev, fmt, args...) do { (void)(dev); } while (0)
# define dev_dbg_f_cond(dev, cond, fmt, args...) do { (void)(dev); } while (0)
#endif /* DEBUG */

#ifdef DEBUG
Expand Down
20 changes: 18 additions & 2 deletions trunk/drivers/net/wireless/zd1211rw/zd_mac.c
Original file line number Diff line number Diff line change
Expand Up @@ -160,6 +160,22 @@ static int zd_reg2alpha2(u8 regdomain, char *alpha2)
return 1;
}

static int zd_check_signal(struct ieee80211_hw *hw, int signal)
{
struct zd_mac *mac = zd_hw_mac(hw);

dev_dbg_f_cond(zd_mac_dev(mac), signal < 0 || signal > 100,
"%s: signal value from device not in range 0..100, "
"but %d.\n", __func__, signal);

if (signal < 0)
signal = 0;
else if (signal > 100)
signal = 100;

return signal;
}

int zd_mac_preinit_hw(struct ieee80211_hw *hw)
{
int r;
Expand Down Expand Up @@ -461,7 +477,7 @@ static void zd_mac_tx_status(struct ieee80211_hw *hw, struct sk_buff *skb,
if (i<IEEE80211_TX_MAX_RATES)
info->status.rates[i].idx = -1; /* terminate */

info->status.ack_signal = ackssi;
info->status.ack_signal = zd_check_signal(hw, ackssi);
ieee80211_tx_status_irqsafe(hw, skb);
}

Expand Down Expand Up @@ -982,7 +998,7 @@ int zd_mac_rx(struct ieee80211_hw *hw, const u8 *buffer, unsigned int length)

stats.freq = zd_channels[_zd_chip_get_channel(&mac->chip) - 1].center_freq;
stats.band = IEEE80211_BAND_2GHZ;
stats.signal = status->signal_strength;
stats.signal = zd_check_signal(hw, status->signal_strength);

rate = zd_rx_rate(buffer, status);

Expand Down

0 comments on commit b75cc9f

Please sign in to comment.