1 From stable-bounces@linux.kernel.org Sat Jun 14 14:48:30 2008
2 From: Michael Buesch <mb@bu3sch.de>
3 Date: Sat, 14 Jun 2008 23:00:14 +0200
4 Subject: b43: Fix noise calculation WARN_ON
6 Cc: linux-wireless@vger.kernel.org, bcm43xx-dev@lists.berlios.de
7 Message-ID: <200806142300.15391.mb@bu3sch.de>
8 Content-Disposition: inline
10 From: Michael Buesch <mb@bu3sch.de>
12 commit 98a3b2fe435ae76170936c14f5c9e6a87548e3ef upstream.
14 This removes a WARN_ON that is responsible for the following koops:
15 http://www.kerneloops.org/searchweek.php?search=b43_generate_noise_sample
17 The comment in the patch describes why it's safe to simply remove
20 Signed-off-by: Michael Buesch <mb@bu3sch.de>
21 Signed-off-by: John W. Linville <linville@tuxdriver.com>
22 Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
26 drivers/net/wireless/b43/b43.h | 1 -
27 drivers/net/wireless/b43/main.c | 16 ++++++++++------
28 2 files changed, 10 insertions(+), 7 deletions(-)
30 --- a/drivers/net/wireless/b43/b43.h
31 +++ b/drivers/net/wireless/b43/b43.h
32 @@ -596,7 +596,6 @@ struct b43_dma {
34 /* Context information for a noise calculation (Link Quality). */
35 struct b43_noise_calculation {
36 - u8 channel_at_start;
37 bool calculation_running;
40 --- a/drivers/net/wireless/b43/main.c
41 +++ b/drivers/net/wireless/b43/main.c
42 @@ -1027,7 +1027,6 @@ static void b43_generate_noise_sample(st
43 b43_jssi_write(dev, 0x7F7F7F7F);
44 b43_write32(dev, B43_MMIO_MACCMD,
45 b43_read32(dev, B43_MMIO_MACCMD) | B43_MACCMD_BGNOISE);
46 - B43_WARN_ON(dev->noisecalc.channel_at_start != dev->phy.channel);
49 static void b43_calculate_link_quality(struct b43_wldev *dev)
50 @@ -1036,7 +1035,6 @@ static void b43_calculate_link_quality(s
52 if (dev->noisecalc.calculation_running)
54 - dev->noisecalc.channel_at_start = dev->phy.channel;
55 dev->noisecalc.calculation_running = 1;
56 dev->noisecalc.nr_samples = 0;
58 @@ -1053,9 +1051,16 @@ static void handle_irq_noise(struct b43_
60 /* Bottom half of Link Quality calculation. */
62 + /* Possible race condition: It might be possible that the user
63 + * changed to a different channel in the meantime since we
64 + * started the calculation. We ignore that fact, since it's
65 + * not really that much of a problem. The background noise is
66 + * an estimation only anyway. Slightly wrong results will get damped
67 + * by the averaging of the 8 sample rounds. Additionally the
68 + * value is shortlived. So it will be replaced by the next noise
69 + * calculation round soon. */
71 B43_WARN_ON(!dev->noisecalc.calculation_running);
72 - if (dev->noisecalc.channel_at_start != phy->channel)
73 - goto drop_calculation;
74 *((__le32 *)noise) = cpu_to_le32(b43_jssi_read(dev));
75 if (noise[0] == 0x7F || noise[1] == 0x7F ||
76 noise[2] == 0x7F || noise[3] == 0x7F)
77 @@ -1096,11 +1101,10 @@ static void handle_irq_noise(struct b43_
80 dev->stats.link_noise = average;
82 dev->noisecalc.calculation_running = 0;
87 b43_generate_noise_sample(dev);