David Woodhouse wrote:
> On Fri, 2007-09-14 at 14:05 -0500, Larry Finger wrote:
>> Are you using DMA or PIO? I did find some PIO endian problems, but
>> none with DMA so far.
> 
> I don't know -- which probably means DMA, right? I don't have > 1GiB of
> RAM (I have precisely 1GiB).

Yes, I would expect that you are using DMA. Up to 1 GiB RAM has no problems. 
AFAIK, even those with
> 1 GiB and 30-bit cards are OK.

I downloaded the newest version of sparse and there are some endian issues with 
DMA. These have
already been submitted as a patch, but are in Linville's inbox while he catches 
up. I have attached
a copy of that patch for you. It should be applied on top of the patch sent 
earlier today.

Larry
Fix most of the sparse warnings in b43legacy. Several are generated
in phy.c that cannot easily be fixed.

Signed-off-by: Larry Finger <[EMAIL PROTECTED]>
---

Index: wireless-dev/drivers/net/wireless/b43legacy/leds.c
===================================================================
--- wireless-dev.orig/drivers/net/wireless/b43legacy/leds.c
+++ wireless-dev/drivers/net/wireless/b43legacy/leds.c
@@ -33,14 +33,13 @@
 static void b43legacy_led_changestate(struct b43legacy_led *led)
 {
        struct b43legacy_wldev *dev = led->dev;
-       const int index = b43legacy_led_index(led);
-       const u16 mask = (1 << index);
+       const int index = led->index;
        u16 ledctl;
 
        B43legacy_WARN_ON(!(index >= 0 && index < B43legacy_NR_LEDS));
        B43legacy_WARN_ON(!led->blink_interval);
        ledctl = b43legacy_read16(dev, B43legacy_MMIO_GPIO_CONTROL);
-       ledctl = (ledctl & mask) ? (ledctl & ~mask) : (ledctl | mask);
+       ledctl ^= (1 << index);
        b43legacy_write16(dev, B43legacy_MMIO_GPIO_CONTROL, ledctl);
 }
 
@@ -72,7 +71,7 @@ static void b43legacy_led_blink_start(st
 static void b43legacy_led_blink_stop(struct b43legacy_led *led, int sync)
 {
        struct b43legacy_wldev *dev = led->dev;
-       const int index = b43legacy_led_index(led);
+       const int index = led->index;
        u16 ledctl;
 
        if (!led->blink_interval)
@@ -142,6 +141,7 @@ int b43legacy_leds_init(struct b43legacy
 
        for (i = 0; i < B43legacy_NR_LEDS; i++) {
                led = &(dev->leds[i]);
+               led->index = i;
                led->dev = dev;
                setup_timer(&led->blink_timer,
                            b43legacy_led_blink,
Index: wireless-dev/drivers/net/wireless/b43legacy/leds.h
===================================================================
--- wireless-dev.orig/drivers/net/wireless/b43legacy/leds.h
+++ wireless-dev/drivers/net/wireless/b43legacy/leds.h
@@ -6,14 +6,14 @@
 
 
 struct b43legacy_led {
-       u8 behaviour:7;
-       u8 activelow:1;
-
+       u8 behaviour;
+       bool activelow;
+       /* Index in the "leds" array in b43legacy_wldev */
+       u8 index;
        struct b43legacy_wldev *dev;
        struct timer_list blink_timer;
        unsigned long blink_interval;
 };
-#define b43legacy_led_index(led)       ((int)((led) - (led)->dev->leds))
 
 /* Delay between state changes when blinking in jiffies */
 #define B43legacy_LEDBLINK_SLOW                (HZ / 1)
Index: wireless-dev/drivers/net/wireless/b43legacy/main.c
===================================================================
--- wireless-dev.orig/drivers/net/wireless/b43legacy/main.c
+++ wireless-dev/drivers/net/wireless/b43legacy/main.c
@@ -850,7 +850,7 @@ static void handle_irq_noise(struct b43l
        B43legacy_WARN_ON(!dev->noisecalc.calculation_running);
        if (dev->noisecalc.channel_at_start != phy->channel)
                goto drop_calculation;
-       *((u32 *)noise) = cpu_to_le32(b43legacy_jssi_read(dev));
+       *((__le32 *)noise) = cpu_to_le32(b43legacy_jssi_read(dev));
        if (noise[0] == 0x7F || noise[1] == 0x7F ||
            noise[2] == 0x7F || noise[3] == 0x7F)
                goto generate_new;
@@ -1436,8 +1436,7 @@ static int do_request_fw(struct b43legac
                         const char *name,
                         const struct firmware **fw)
 {
-       const size_t plen = sizeof(modparam_fwpostfix) + 32;
-       char path[plen];
+       char path[sizeof(modparam_fwpostfix) + 32];
        struct b43legacy_fw_header *hdr;
        u32 size;
        int err;
Index: wireless-dev/drivers/net/wireless/b43legacy/xmit.c
===================================================================
--- wireless-dev.orig/drivers/net/wireless/b43legacy/xmit.c
+++ wireless-dev/drivers/net/wireless/b43legacy/xmit.c
@@ -125,10 +125,12 @@ void b43legacy_generate_plcp_hdr(struct 
        __u8 *raw = plcp->raw;
 
        if (b43legacy_is_ofdm_rate(bitrate)) {
-               *data = b43legacy_plcp_get_ratecode_ofdm(bitrate);
+               u16 d;
+
+               d = b43legacy_plcp_get_ratecode_ofdm(bitrate);
                B43legacy_WARN_ON(octets & 0xF000);
-               *data |= (octets << 5);
-               *data = cpu_to_le32(*data);
+               d |= (octets << 5);
+               *data = cpu_to_le32(d);
        } else {
                u32 plen;
 
@@ -442,7 +444,7 @@ void b43legacy_rx(struct b43legacy_wldev
        phystat0 = le16_to_cpu(rxhdr->phy_status0);
        phystat3 = le16_to_cpu(rxhdr->phy_status3);
        jssi = rxhdr->jssi;
-       macstat = le32_to_cpu(rxhdr->mac_status);
+       macstat = le16_to_cpu(rxhdr->mac_status);
        mactime = le16_to_cpu(rxhdr->mac_time);
        chanstat = le16_to_cpu(rxhdr->channel);
 
Index: wireless-dev/drivers/net/wireless/b43legacy/pio.c
===================================================================
--- wireless-dev.orig/drivers/net/wireless/b43legacy/pio.c
+++ wireless-dev/drivers/net/wireless/b43legacy/pio.c
@@ -66,7 +66,7 @@ static u16 tx_get_next_word(const u8 *tx
                source = packet;
                i -= txhdr_size;
        }
-       ret = le16_to_cpu(*((u16 *)(source + i)));
+       ret = le16_to_cpu(*((__le16 *)(source + i)));
        *pos += 2;
 
        return ret;
@@ -539,7 +539,7 @@ static void pio_rx_error(struct b43legac
 
 void b43legacy_pio_rx(struct b43legacy_pioqueue *queue)
 {
-       u16 preamble[21] = { 0 };
+       __le16 preamble[21] = { 0 };
        struct b43legacy_rxhdr_fw3 *rxhdr;
        u16 tmp;
        u16 len;
@@ -609,7 +609,7 @@ data_ready:
        skb_put(skb, len);
        for (i = 0; i < len - 1; i += 2) {
                tmp = b43legacy_pio_read(queue, B43legacy_PIO_RXDATA);
-               *((u16 *)(skb->data + i)) = cpu_to_le16(tmp);
+               *((__le16 *)(skb->data + i)) = cpu_to_le16(tmp);
        }
        if (len % 2) {
                tmp = b43legacy_pio_read(queue, B43legacy_PIO_RXDATA);
_______________________________________________
Bcm43xx-dev mailing list
[email protected]
https://lists.berlios.de/mailman/listinfo/bcm43xx-dev

Reply via email to