diff options
author | Michael Buesch <mb@bu3sch.de> | 2007-09-20 14:13:40 -0400 |
---|---|---|
committer | David S. Miller <davem@sunset.davemloft.net> | 2007-10-10 19:52:07 -0400 |
commit | 1a09404a2338163f181d170c7abdc2242b6c6f03 (patch) | |
tree | 090a31041c1e294a2586f12679a17a5329129272 /drivers/net | |
parent | fb8e4444cc8c7719d9947e21a93e2e84bb1b36eb (diff) |
[B43]: Fix sparse warnings.
The remaining warning in phy.c will be fixed later.
Signed-off-by: Michael Buesch <mb@bu3sch.de>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net')
-rw-r--r-- | drivers/net/wireless/b43/debugfs.c | 31 | ||||
-rw-r--r-- | drivers/net/wireless/b43/leds.c | 8 | ||||
-rw-r--r-- | drivers/net/wireless/b43/leds.h | 8 | ||||
-rw-r--r-- | drivers/net/wireless/b43/main.c | 5 | ||||
-rw-r--r-- | drivers/net/wireless/b43/pcmcia.c | 3 | ||||
-rw-r--r-- | drivers/net/wireless/b43/pio.c | 18 | ||||
-rw-r--r-- | drivers/net/wireless/b43/pio.h | 3 | ||||
-rw-r--r-- | drivers/net/wireless/b43/xmit.c | 8 |
8 files changed, 50 insertions, 34 deletions
diff --git a/drivers/net/wireless/b43/debugfs.c b/drivers/net/wireless/b43/debugfs.c index f82e3ef9bd73..3aafde9f08a8 100644 --- a/drivers/net/wireless/b43/debugfs.c +++ b/drivers/net/wireless/b43/debugfs.c | |||
@@ -39,7 +39,7 @@ | |||
39 | 39 | ||
40 | 40 | ||
41 | /* The root directory. */ | 41 | /* The root directory. */ |
42 | struct dentry *rootdir; | 42 | static struct dentry *rootdir; |
43 | 43 | ||
44 | struct b43_debugfs_fops { | 44 | struct b43_debugfs_fops { |
45 | ssize_t (*read)(struct b43_wldev *dev, char *buf, size_t bufsize); | 45 | ssize_t (*read)(struct b43_wldev *dev, char *buf, size_t bufsize); |
@@ -76,7 +76,8 @@ struct b43_dfs_file * fops_to_dfs_file(struct b43_wldev *dev, | |||
76 | 76 | ||
77 | 77 | ||
78 | /* wl->irq_lock is locked */ | 78 | /* wl->irq_lock is locked */ |
79 | ssize_t tsf_read_file(struct b43_wldev *dev, char *buf, size_t bufsize) | 79 | static ssize_t tsf_read_file(struct b43_wldev *dev, |
80 | char *buf, size_t bufsize) | ||
80 | { | 81 | { |
81 | ssize_t count = 0; | 82 | ssize_t count = 0; |
82 | u64 tsf; | 83 | u64 tsf; |
@@ -90,7 +91,8 @@ ssize_t tsf_read_file(struct b43_wldev *dev, char *buf, size_t bufsize) | |||
90 | } | 91 | } |
91 | 92 | ||
92 | /* wl->irq_lock is locked */ | 93 | /* wl->irq_lock is locked */ |
93 | int tsf_write_file(struct b43_wldev *dev, const char *buf, size_t count) | 94 | static int tsf_write_file(struct b43_wldev *dev, |
95 | const char *buf, size_t count) | ||
94 | { | 96 | { |
95 | u64 tsf; | 97 | u64 tsf; |
96 | 98 | ||
@@ -102,7 +104,8 @@ int tsf_write_file(struct b43_wldev *dev, const char *buf, size_t count) | |||
102 | } | 104 | } |
103 | 105 | ||
104 | /* wl->irq_lock is locked */ | 106 | /* wl->irq_lock is locked */ |
105 | ssize_t ucode_regs_read_file(struct b43_wldev *dev, char *buf, size_t bufsize) | 107 | static ssize_t ucode_regs_read_file(struct b43_wldev *dev, |
108 | char *buf, size_t bufsize) | ||
106 | { | 109 | { |
107 | ssize_t count = 0; | 110 | ssize_t count = 0; |
108 | int i; | 111 | int i; |
@@ -116,7 +119,8 @@ ssize_t ucode_regs_read_file(struct b43_wldev *dev, char *buf, size_t bufsize) | |||
116 | } | 119 | } |
117 | 120 | ||
118 | /* wl->irq_lock is locked */ | 121 | /* wl->irq_lock is locked */ |
119 | ssize_t shm_read_file(struct b43_wldev *dev, char *buf, size_t bufsize) | 122 | static ssize_t shm_read_file(struct b43_wldev *dev, |
123 | char *buf, size_t bufsize) | ||
120 | { | 124 | { |
121 | ssize_t count = 0; | 125 | ssize_t count = 0; |
122 | int i; | 126 | int i; |
@@ -135,7 +139,8 @@ ssize_t shm_read_file(struct b43_wldev *dev, char *buf, size_t bufsize) | |||
135 | return count; | 139 | return count; |
136 | } | 140 | } |
137 | 141 | ||
138 | ssize_t txstat_read_file(struct b43_wldev *dev, char *buf, size_t bufsize) | 142 | static ssize_t txstat_read_file(struct b43_wldev *dev, |
143 | char *buf, size_t bufsize) | ||
139 | { | 144 | { |
140 | struct b43_txstatus_log *log = &dev->dfsentry->txstatlog; | 145 | struct b43_txstatus_log *log = &dev->dfsentry->txstatlog; |
141 | ssize_t count = 0; | 146 | ssize_t count = 0; |
@@ -182,7 +187,8 @@ out_unlock: | |||
182 | return count; | 187 | return count; |
183 | } | 188 | } |
184 | 189 | ||
185 | ssize_t txpower_g_read_file(struct b43_wldev *dev, char *buf, size_t bufsize) | 190 | static ssize_t txpower_g_read_file(struct b43_wldev *dev, |
191 | char *buf, size_t bufsize) | ||
186 | { | 192 | { |
187 | ssize_t count = 0; | 193 | ssize_t count = 0; |
188 | 194 | ||
@@ -214,7 +220,8 @@ out: | |||
214 | return count; | 220 | return count; |
215 | } | 221 | } |
216 | 222 | ||
217 | int txpower_g_write_file(struct b43_wldev *dev, const char *buf, size_t count) | 223 | static int txpower_g_write_file(struct b43_wldev *dev, |
224 | const char *buf, size_t count) | ||
218 | { | 225 | { |
219 | unsigned long flags; | 226 | unsigned long flags; |
220 | unsigned long phy_flags; | 227 | unsigned long phy_flags; |
@@ -262,7 +269,8 @@ out_unlock: | |||
262 | } | 269 | } |
263 | 270 | ||
264 | /* wl->irq_lock is locked */ | 271 | /* wl->irq_lock is locked */ |
265 | int restart_write_file(struct b43_wldev *dev, const char *buf, size_t count) | 272 | static int restart_write_file(struct b43_wldev *dev, |
273 | const char *buf, size_t count) | ||
266 | { | 274 | { |
267 | int err = 0; | 275 | int err = 0; |
268 | 276 | ||
@@ -294,7 +302,8 @@ static ssize_t append_lo_table(ssize_t count, char *buf, const size_t bufsize, | |||
294 | return count; | 302 | return count; |
295 | } | 303 | } |
296 | 304 | ||
297 | ssize_t loctls_read_file(struct b43_wldev *dev, char *buf, size_t bufsize) | 305 | static ssize_t loctls_read_file(struct b43_wldev *dev, |
306 | char *buf, size_t bufsize) | ||
298 | { | 307 | { |
299 | ssize_t count = 0; | 308 | ssize_t count = 0; |
300 | struct b43_txpower_lo_control *lo; | 309 | struct b43_txpower_lo_control *lo; |
@@ -383,6 +392,8 @@ static ssize_t b43_debugfs_read(struct file *file, char __user *userbuf, | |||
383 | err = -ENOMEM; | 392 | err = -ENOMEM; |
384 | goto out_unlock; | 393 | goto out_unlock; |
385 | } | 394 | } |
395 | /* Sparse warns about the following memset, because it has a big | ||
396 | * size value. That warning is bogus, so I will ignore it. --mb */ | ||
386 | memset(buf, 0, bufsize); | 397 | memset(buf, 0, bufsize); |
387 | if (dfops->take_irqlock) { | 398 | if (dfops->take_irqlock) { |
388 | spin_lock_irq(&dev->wl->irq_lock); | 399 | spin_lock_irq(&dev->wl->irq_lock); |
diff --git a/drivers/net/wireless/b43/leds.c b/drivers/net/wireless/b43/leds.c index 535f960412d7..85d965de5791 100644 --- a/drivers/net/wireless/b43/leds.c +++ b/drivers/net/wireless/b43/leds.c | |||
@@ -32,14 +32,13 @@ | |||
32 | static void b43_led_changestate(struct b43_led *led) | 32 | static void b43_led_changestate(struct b43_led *led) |
33 | { | 33 | { |
34 | struct b43_wldev *dev = led->dev; | 34 | struct b43_wldev *dev = led->dev; |
35 | const int index = b43_led_index(led); | 35 | const int index = led->index; |
36 | const u16 mask = (1 << index); | ||
37 | u16 ledctl; | 36 | u16 ledctl; |
38 | 37 | ||
39 | B43_WARN_ON(!(index >= 0 && index < B43_NR_LEDS)); | 38 | B43_WARN_ON(!(index >= 0 && index < B43_NR_LEDS)); |
40 | B43_WARN_ON(!led->blink_interval); | 39 | B43_WARN_ON(!led->blink_interval); |
41 | ledctl = b43_read16(dev, B43_MMIO_GPIO_CONTROL); | 40 | ledctl = b43_read16(dev, B43_MMIO_GPIO_CONTROL); |
42 | ledctl = (ledctl & mask) ? (ledctl & ~mask) : (ledctl | mask); | 41 | ledctl ^= (1 << index); |
43 | b43_write16(dev, B43_MMIO_GPIO_CONTROL, ledctl); | 42 | b43_write16(dev, B43_MMIO_GPIO_CONTROL, ledctl); |
44 | } | 43 | } |
45 | 44 | ||
@@ -70,7 +69,7 @@ static void b43_led_blink_start(struct b43_led *led, unsigned long interval) | |||
70 | static void b43_led_blink_stop(struct b43_led *led, int sync) | 69 | static void b43_led_blink_stop(struct b43_led *led, int sync) |
71 | { | 70 | { |
72 | struct b43_wldev *dev = led->dev; | 71 | struct b43_wldev *dev = led->dev; |
73 | const int index = b43_led_index(led); | 72 | const int index = led->index; |
74 | u16 ledctl; | 73 | u16 ledctl; |
75 | 74 | ||
76 | if (!led->blink_interval) | 75 | if (!led->blink_interval) |
@@ -139,6 +138,7 @@ int b43_leds_init(struct b43_wldev *dev) | |||
139 | 138 | ||
140 | for (i = 0; i < B43_NR_LEDS; i++) { | 139 | for (i = 0; i < B43_NR_LEDS; i++) { |
141 | led = &(dev->leds[i]); | 140 | led = &(dev->leds[i]); |
141 | led->index = i; | ||
142 | led->dev = dev; | 142 | led->dev = dev; |
143 | setup_timer(&led->blink_timer, | 143 | setup_timer(&led->blink_timer, |
144 | b43_led_blink, (unsigned long)led); | 144 | b43_led_blink, (unsigned long)led); |
diff --git a/drivers/net/wireless/b43/leds.h b/drivers/net/wireless/b43/leds.h index 36b46cfda220..d94851d291c0 100644 --- a/drivers/net/wireless/b43/leds.h +++ b/drivers/net/wireless/b43/leds.h | |||
@@ -5,14 +5,14 @@ | |||
5 | #include <linux/timer.h> | 5 | #include <linux/timer.h> |
6 | 6 | ||
7 | struct b43_led { | 7 | struct b43_led { |
8 | u8 behaviour:7; | 8 | u8 behaviour; |
9 | u8 activelow:1; | 9 | bool activelow; |
10 | 10 | /* Index in the "leds" array in b43_wldev */ | |
11 | u8 index; | ||
11 | struct b43_wldev *dev; | 12 | struct b43_wldev *dev; |
12 | struct timer_list blink_timer; | 13 | struct timer_list blink_timer; |
13 | unsigned long blink_interval; | 14 | unsigned long blink_interval; |
14 | }; | 15 | }; |
15 | #define b43_led_index(led) ((int)((led) - (led)->dev->leds)) | ||
16 | 16 | ||
17 | /* Delay between state changes when blinking in jiffies */ | 17 | /* Delay between state changes when blinking in jiffies */ |
18 | #define B43_LEDBLINK_SLOW (HZ / 1) | 18 | #define B43_LEDBLINK_SLOW (HZ / 1) |
diff --git a/drivers/net/wireless/b43/main.c b/drivers/net/wireless/b43/main.c index fd4ef27fcf25..66c89df51fb8 100644 --- a/drivers/net/wireless/b43/main.c +++ b/drivers/net/wireless/b43/main.c | |||
@@ -1062,7 +1062,7 @@ static void handle_irq_noise(struct b43_wldev *dev) | |||
1062 | B43_WARN_ON(!dev->noisecalc.calculation_running); | 1062 | B43_WARN_ON(!dev->noisecalc.calculation_running); |
1063 | if (dev->noisecalc.channel_at_start != phy->channel) | 1063 | if (dev->noisecalc.channel_at_start != phy->channel) |
1064 | goto drop_calculation; | 1064 | goto drop_calculation; |
1065 | *((u32 *) noise) = cpu_to_le32(b43_jssi_read(dev)); | 1065 | *((__le32 *)noise) = cpu_to_le32(b43_jssi_read(dev)); |
1066 | if (noise[0] == 0x7F || noise[1] == 0x7F || | 1066 | if (noise[0] == 0x7F || noise[1] == 0x7F || |
1067 | noise[2] == 0x7F || noise[3] == 0x7F) | 1067 | noise[2] == 0x7F || noise[3] == 0x7F) |
1068 | goto generate_new; | 1068 | goto generate_new; |
@@ -1598,8 +1598,7 @@ static int do_request_fw(struct b43_wldev *dev, | |||
1598 | const char *name, | 1598 | const char *name, |
1599 | const struct firmware **fw) | 1599 | const struct firmware **fw) |
1600 | { | 1600 | { |
1601 | const size_t plen = sizeof(modparam_fwpostfix) + 32; | 1601 | char path[sizeof(modparam_fwpostfix) + 32]; |
1602 | char path[plen]; | ||
1603 | struct b43_fw_header *hdr; | 1602 | struct b43_fw_header *hdr; |
1604 | u32 size; | 1603 | u32 size; |
1605 | int err; | 1604 | int err; |
diff --git a/drivers/net/wireless/b43/pcmcia.c b/drivers/net/wireless/b43/pcmcia.c index 3e75a8a12c96..b242a9a90dd2 100644 --- a/drivers/net/wireless/b43/pcmcia.c +++ b/drivers/net/wireless/b43/pcmcia.c | |||
@@ -21,6 +21,8 @@ | |||
21 | 21 | ||
22 | */ | 22 | */ |
23 | 23 | ||
24 | #include "pcmcia.h" | ||
25 | |||
24 | #include <linux/ssb/ssb.h> | 26 | #include <linux/ssb/ssb.h> |
25 | 27 | ||
26 | #include <pcmcia/cs_types.h> | 28 | #include <pcmcia/cs_types.h> |
@@ -30,6 +32,7 @@ | |||
30 | #include <pcmcia/ds.h> | 32 | #include <pcmcia/ds.h> |
31 | #include <pcmcia/cisreg.h> | 33 | #include <pcmcia/cisreg.h> |
32 | 34 | ||
35 | |||
33 | static /*const */ struct pcmcia_device_id b43_pcmcia_tbl[] = { | 36 | static /*const */ struct pcmcia_device_id b43_pcmcia_tbl[] = { |
34 | PCMCIA_DEVICE_MANF_CARD(0x2D0, 0x448), | 37 | PCMCIA_DEVICE_MANF_CARD(0x2D0, 0x448), |
35 | PCMCIA_DEVICE_NULL, | 38 | PCMCIA_DEVICE_NULL, |
diff --git a/drivers/net/wireless/b43/pio.c b/drivers/net/wireless/b43/pio.c index 4ac91fdd356e..67752a28eb9c 100644 --- a/drivers/net/wireless/b43/pio.c +++ b/drivers/net/wireless/b43/pio.c | |||
@@ -60,7 +60,7 @@ static u16 tx_get_next_word(const u8 * txhdr, | |||
60 | source = packet; | 60 | source = packet; |
61 | i -= txhdr_size; | 61 | i -= txhdr_size; |
62 | } | 62 | } |
63 | ret = le16_to_cpu(*((u16 *) (source + i))); | 63 | ret = le16_to_cpu(*((__le16 *)(source + i))); |
64 | *pos += 2; | 64 | *pos += 2; |
65 | 65 | ||
66 | return ret; | 66 | return ret; |
@@ -104,7 +104,7 @@ static u16 generate_cookie(struct b43_pioqueue *queue, | |||
104 | struct b43_pio_txpacket *packet) | 104 | struct b43_pio_txpacket *packet) |
105 | { | 105 | { |
106 | u16 cookie = 0x0000; | 106 | u16 cookie = 0x0000; |
107 | int packetindex; | 107 | u16 packetindex; |
108 | 108 | ||
109 | /* We use the upper 4 bits for the PIO | 109 | /* We use the upper 4 bits for the PIO |
110 | * controller ID and the lower 12 bits | 110 | * controller ID and the lower 12 bits |
@@ -125,7 +125,7 @@ static u16 generate_cookie(struct b43_pioqueue *queue, | |||
125 | default: | 125 | default: |
126 | B43_WARN_ON(1); | 126 | B43_WARN_ON(1); |
127 | } | 127 | } |
128 | packetindex = pio_txpacket_getindex(packet); | 128 | packetindex = packet->index; |
129 | B43_WARN_ON(packetindex & ~0x0FFF); | 129 | B43_WARN_ON(packetindex & ~0x0FFF); |
130 | cookie |= (u16) packetindex; | 130 | cookie |= (u16) packetindex; |
131 | 131 | ||
@@ -286,6 +286,7 @@ static void setup_txqueues(struct b43_pioqueue *queue) | |||
286 | 286 | ||
287 | packet->queue = queue; | 287 | packet->queue = queue; |
288 | INIT_LIST_HEAD(&packet->list); | 288 | INIT_LIST_HEAD(&packet->list); |
289 | packet->index = i; | ||
289 | 290 | ||
290 | list_add(&packet->list, &queue->txfree); | 291 | list_add(&packet->list, &queue->txfree); |
291 | } | 292 | } |
@@ -518,9 +519,10 @@ static void pio_rx_error(struct b43_pioqueue *queue, | |||
518 | 519 | ||
519 | void b43_pio_rx(struct b43_pioqueue *queue) | 520 | void b43_pio_rx(struct b43_pioqueue *queue) |
520 | { | 521 | { |
521 | u16 preamble[21] = { 0 }; | 522 | __le16 preamble[21] = { 0 }; |
522 | struct b43_rxhdr_fw4 *rxhdr; | 523 | struct b43_rxhdr_fw4 *rxhdr; |
523 | u16 tmp, len, macstat; | 524 | u16 tmp, len; |
525 | u32 macstat; | ||
524 | int i, preamble_readwords; | 526 | int i, preamble_readwords; |
525 | struct sk_buff *skb; | 527 | struct sk_buff *skb; |
526 | 528 | ||
@@ -537,7 +539,7 @@ void b43_pio_rx(struct b43_pioqueue *queue) | |||
537 | } | 539 | } |
538 | b43dbg(queue->dev->wl, "PIO RX timed out\n"); | 540 | b43dbg(queue->dev->wl, "PIO RX timed out\n"); |
539 | return; | 541 | return; |
540 | data_ready: | 542 | data_ready: |
541 | 543 | ||
542 | len = b43_pio_read(queue, B43_PIO_RXDATA); | 544 | len = b43_pio_read(queue, B43_PIO_RXDATA); |
543 | if (unlikely(len > 0x700)) { | 545 | if (unlikely(len > 0x700)) { |
@@ -558,7 +560,7 @@ void b43_pio_rx(struct b43_pioqueue *queue) | |||
558 | preamble[i + 1] = cpu_to_le16(tmp); | 560 | preamble[i + 1] = cpu_to_le16(tmp); |
559 | } | 561 | } |
560 | rxhdr = (struct b43_rxhdr_fw4 *)preamble; | 562 | rxhdr = (struct b43_rxhdr_fw4 *)preamble; |
561 | macstat = le16_to_cpu(rxhdr->mac_status); | 563 | macstat = le32_to_cpu(rxhdr->mac_status); |
562 | if (macstat & B43_RX_MAC_FCSERR) { | 564 | if (macstat & B43_RX_MAC_FCSERR) { |
563 | pio_rx_error(queue, | 565 | pio_rx_error(queue, |
564 | (queue->mmio_base == B43_MMIO_PIO1_BASE), | 566 | (queue->mmio_base == B43_MMIO_PIO1_BASE), |
@@ -583,7 +585,7 @@ void b43_pio_rx(struct b43_pioqueue *queue) | |||
583 | skb_put(skb, len); | 585 | skb_put(skb, len); |
584 | for (i = 0; i < len - 1; i += 2) { | 586 | for (i = 0; i < len - 1; i += 2) { |
585 | tmp = b43_pio_read(queue, B43_PIO_RXDATA); | 587 | tmp = b43_pio_read(queue, B43_PIO_RXDATA); |
586 | *((u16 *) (skb->data + i)) = cpu_to_le16(tmp); | 588 | *((__le16 *)(skb->data + i)) = cpu_to_le16(tmp); |
587 | } | 589 | } |
588 | if (len % 2) { | 590 | if (len % 2) { |
589 | tmp = b43_pio_read(queue, B43_PIO_RXDATA); | 591 | tmp = b43_pio_read(queue, B43_PIO_RXDATA); |
diff --git a/drivers/net/wireless/b43/pio.h b/drivers/net/wireless/b43/pio.h index 46d6d2ea9b5f..34a44c1b6314 100644 --- a/drivers/net/wireless/b43/pio.h +++ b/drivers/net/wireless/b43/pio.h | |||
@@ -39,10 +39,9 @@ struct b43_pio_txpacket { | |||
39 | struct sk_buff *skb; | 39 | struct sk_buff *skb; |
40 | struct ieee80211_tx_status txstat; | 40 | struct ieee80211_tx_status txstat; |
41 | struct list_head list; | 41 | struct list_head list; |
42 | u16 index; /* Index in the tx_packets_cache */ | ||
42 | }; | 43 | }; |
43 | 44 | ||
44 | #define pio_txpacket_getindex(packet) ((int)((packet) - (packet)->queue->tx_packets_cache)) | ||
45 | |||
46 | struct b43_pioqueue { | 45 | struct b43_pioqueue { |
47 | struct b43_wldev *dev; | 46 | struct b43_wldev *dev; |
48 | u16 mmio_base; | 47 | u16 mmio_base; |
diff --git a/drivers/net/wireless/b43/xmit.c b/drivers/net/wireless/b43/xmit.c index e6174b6f11fb..0bd6f8a348a8 100644 --- a/drivers/net/wireless/b43/xmit.c +++ b/drivers/net/wireless/b43/xmit.c | |||
@@ -121,10 +121,12 @@ void b43_generate_plcp_hdr(struct b43_plcp_hdr4 *plcp, | |||
121 | __u8 *raw = plcp->raw; | 121 | __u8 *raw = plcp->raw; |
122 | 122 | ||
123 | if (b43_is_ofdm_rate(bitrate)) { | 123 | if (b43_is_ofdm_rate(bitrate)) { |
124 | *data = b43_plcp_get_ratecode_ofdm(bitrate); | 124 | u32 d; |
125 | |||
126 | d = b43_plcp_get_ratecode_ofdm(bitrate); | ||
125 | B43_WARN_ON(octets & 0xF000); | 127 | B43_WARN_ON(octets & 0xF000); |
126 | *data |= (octets << 5); | 128 | d |= (octets << 5); |
127 | *data = cpu_to_le32(*data); | 129 | *data = cpu_to_le32(d); |
128 | } else { | 130 | } else { |
129 | u32 plen; | 131 | u32 plen; |
130 | 132 | ||