summaryrefslogtreecommitdiff
path: root/package/b43/src
diff options
context:
space:
mode:
authorFelix Fietkau <nbd@openwrt.org>2007-11-11 11:44:59 +0000
committerFelix Fietkau <nbd@openwrt.org>2007-11-11 11:44:59 +0000
commit1eb35dd1c8098556de0c174f780cff15eb212d4f (patch)
tree5041c300eadaa3d1ea18f435f7c98ee17ddaee8b /package/b43/src
parent1bca0cc51704b5ef57c5e3a9d7a1b80633486d16 (diff)
downloadmtk-20170518-1eb35dd1c8098556de0c174f780cff15eb212d4f.zip
mtk-20170518-1eb35dd1c8098556de0c174f780cff15eb212d4f.tar.gz
mtk-20170518-1eb35dd1c8098556de0c174f780cff15eb212d4f.tar.bz2
add b43 fixes from #2677
SVN-Revision: 9535
Diffstat (limited to 'package/b43/src')
-rw-r--r--package/b43/src/debugfs.c31
-rw-r--r--package/b43/src/leds.c1
-rw-r--r--package/b43/src/leds.h1
-rw-r--r--package/b43/src/main.c49
-rw-r--r--package/b43/src/pcmcia.c3
-rw-r--r--package/b43/src/phy.c1
-rw-r--r--package/b43/src/pio.c18
-rw-r--r--package/b43/src/pio.h4
-rw-r--r--package/b43/src/sysfs.c5
-rw-r--r--package/b43/src/xmit.c8
10 files changed, 87 insertions, 34 deletions
diff --git a/package/b43/src/debugfs.c b/package/b43/src/debugfs.c
index b5c589e..734e70e 100644
--- a/package/b43/src/debugfs.c
+++ b/package/b43/src/debugfs.c
@@ -39,7 +39,7 @@
/* The root directory. */
-struct dentry *rootdir;
+static struct dentry *rootdir;
struct b43_debugfs_fops {
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,
/* wl->irq_lock is locked */
-ssize_t tsf_read_file(struct b43_wldev *dev, char *buf, size_t bufsize)
+static ssize_t tsf_read_file(struct b43_wldev *dev,
+ char *buf, size_t bufsize)
{
ssize_t count = 0;
u64 tsf;
@@ -90,7 +91,8 @@ ssize_t tsf_read_file(struct b43_wldev *dev, char *buf, size_t bufsize)
}
/* wl->irq_lock is locked */
-int tsf_write_file(struct b43_wldev *dev, const char *buf, size_t count)
+static int tsf_write_file(struct b43_wldev *dev,
+ const char *buf, size_t count)
{
u64 tsf;
@@ -102,7 +104,8 @@ int tsf_write_file(struct b43_wldev *dev, const char *buf, size_t count)
}
/* wl->irq_lock is locked */
-ssize_t ucode_regs_read_file(struct b43_wldev *dev, char *buf, size_t bufsize)
+static ssize_t ucode_regs_read_file(struct b43_wldev *dev,
+ char *buf, size_t bufsize)
{
ssize_t count = 0;
int i;
@@ -116,7 +119,8 @@ ssize_t ucode_regs_read_file(struct b43_wldev *dev, char *buf, size_t bufsize)
}
/* wl->irq_lock is locked */
-ssize_t shm_read_file(struct b43_wldev *dev, char *buf, size_t bufsize)
+static ssize_t shm_read_file(struct b43_wldev *dev,
+ char *buf, size_t bufsize)
{
ssize_t count = 0;
int i;
@@ -135,7 +139,8 @@ ssize_t shm_read_file(struct b43_wldev *dev, char *buf, size_t bufsize)
return count;
}
-ssize_t txstat_read_file(struct b43_wldev *dev, char *buf, size_t bufsize)
+static ssize_t txstat_read_file(struct b43_wldev *dev,
+ char *buf, size_t bufsize)
{
struct b43_txstatus_log *log = &dev->dfsentry->txstatlog;
ssize_t count = 0;
@@ -182,7 +187,8 @@ out_unlock:
return count;
}
-ssize_t txpower_g_read_file(struct b43_wldev *dev, char *buf, size_t bufsize)
+static ssize_t txpower_g_read_file(struct b43_wldev *dev,
+ char *buf, size_t bufsize)
{
ssize_t count = 0;
@@ -214,7 +220,8 @@ out:
return count;
}
-int txpower_g_write_file(struct b43_wldev *dev, const char *buf, size_t count)
+static int txpower_g_write_file(struct b43_wldev *dev,
+ const char *buf, size_t count)
{
unsigned long phy_flags;
@@ -253,7 +260,8 @@ int txpower_g_write_file(struct b43_wldev *dev, const char *buf, size_t count)
}
/* wl->irq_lock is locked */
-int restart_write_file(struct b43_wldev *dev, const char *buf, size_t count)
+static int restart_write_file(struct b43_wldev *dev,
+ const char *buf, size_t count)
{
int err = 0;
@@ -285,7 +293,8 @@ static ssize_t append_lo_table(ssize_t count, char *buf, const size_t bufsize,
return count;
}
-ssize_t loctls_read_file(struct b43_wldev *dev, char *buf, size_t bufsize)
+static ssize_t loctls_read_file(struct b43_wldev *dev,
+ char *buf, size_t bufsize)
{
ssize_t count = 0;
struct b43_txpower_lo_control *lo;
@@ -374,6 +383,8 @@ static ssize_t b43_debugfs_read(struct file *file, char __user *userbuf,
err = -ENOMEM;
goto out_unlock;
}
+ /* Sparse warns about the following memset, because it has a big
+ * size value. That warning is bogus, so I will ignore it. --mb */
memset(buf, 0, bufsize);
if (dfops->take_irqlock) {
spin_lock_irq(&dev->wl->irq_lock);
diff --git a/package/b43/src/leds.c b/package/b43/src/leds.c
index 3099e62..19e5885 100644
--- a/package/b43/src/leds.c
+++ b/package/b43/src/leds.c
@@ -29,6 +29,7 @@
#include "b43.h"
#include "leds.h"
+
static void b43_led_turn_on(struct b43_wldev *dev, u8 led_index,
bool activelow)
{
diff --git a/package/b43/src/leds.h b/package/b43/src/leds.h
index 713e180..b8b1dd5 100644
--- a/package/b43/src/leds.h
+++ b/package/b43/src/leds.h
@@ -23,7 +23,6 @@ struct b43_led {
/* The unique name string for this LED device. */
char name[B43_LED_MAX_NAME_LEN + 1];
};
-#define b43_led_index(led) ((int)((led) - (led)->dev->leds))
#define B43_LED_BEHAVIOUR 0x7F
#define B43_LED_ACTIVELOW 0x80
diff --git a/package/b43/src/main.c b/package/b43/src/main.c
index 4146fdf..9f8175c 100644
--- a/package/b43/src/main.c
+++ b/package/b43/src/main.c
@@ -49,7 +49,6 @@
#include "pio.h"
#include "sysfs.h"
#include "xmit.h"
-#include "sysfs.h"
#include "lo.h"
#include "pcmcia.h"
@@ -107,6 +106,23 @@ static const struct ssb_device_id b43_ssb_tbl[] = {
MODULE_DEVICE_TABLE(ssb, b43_ssb_tbl);
+static const struct pci_device_id b43_pci_bridge_tbl[] = {
+ { PCI_DEVICE(PCI_VENDOR_ID_BROADCOM, 0x4311) },
+ { PCI_DEVICE(PCI_VENDOR_ID_BROADCOM, 0x4312) },
+ { PCI_DEVICE(PCI_VENDOR_ID_BROADCOM, 0x4318) },
+ { PCI_DEVICE(PCI_VENDOR_ID_BROADCOM, 0x4319) },
+ { PCI_DEVICE(PCI_VENDOR_ID_BROADCOM, 0x4320) },
+ { PCI_DEVICE(PCI_VENDOR_ID_BROADCOM, 0x4321) },
+ { PCI_DEVICE(PCI_VENDOR_ID_BROADCOM, 0x4324) },
+ { PCI_DEVICE(PCI_VENDOR_ID_BROADCOM, 0x4325) },
+ { 0, },
+};
+MODULE_DEVICE_TABLE(pci, b43_pci_bridge_tbl);
+
+static struct pci_driver b43_pci_bridge_driver = {
+ .name = "b43-pci-bridge",
+ .id_table = b43_pci_bridge_tbl,
+};
/* Channel and ratetables are shared for all devices.
* They can't be const, because ieee80211 puts some precalculated
* data in there. This data is the same for all devices, so we don't
@@ -1045,7 +1061,7 @@ static void handle_irq_noise(struct b43_wldev *dev)
B43_WARN_ON(!dev->noisecalc.calculation_running);
if (dev->noisecalc.channel_at_start != phy->channel)
goto drop_calculation;
- *((u32 *) noise) = cpu_to_le32(b43_jssi_read(dev));
+ *((__le32 *)noise) = cpu_to_le32(b43_jssi_read(dev));
if (noise[0] == 0x7F || noise[1] == 0x7F ||
noise[2] == 0x7F || noise[3] == 0x7F)
goto generate_new;
@@ -1575,8 +1591,7 @@ static int do_request_fw(struct b43_wldev *dev,
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 b43_fw_header *hdr;
u32 size;
int err;
@@ -2393,7 +2408,7 @@ out_requeue:
if (b43_debug(dev, B43_DBG_PWORK_FAST))
delay = msecs_to_jiffies(50);
else
- delay = round_jiffies(HZ * 15);
+ delay = round_jiffies_relative(HZ * 15);
queue_delayed_work(wl->hw->workqueue, &dev->periodic_work, delay);
out:
mutex_unlock(&wl->mutex);
@@ -3495,7 +3510,7 @@ static int b43_start(struct ieee80211_hw *hw)
struct b43_wl *wl = hw_to_b43_wl(hw);
struct b43_wldev *dev = wl->current_dev;
int did_init = 0;
- int err;
+ int err = 0;
mutex_lock(&wl->mutex);
@@ -3521,7 +3536,7 @@ static int b43_start(struct ieee80211_hw *hw)
return err;
}
-void b43_stop(struct ieee80211_hw *hw)
+static void b43_stop(struct ieee80211_hw *hw)
{
struct b43_wl *wl = hw_to_b43_wl(hw);
struct b43_wldev *dev = wl->current_dev;
@@ -4038,6 +4053,16 @@ static struct ssb_driver b43_ssb_driver = {
.resume = b43_resume,
};
+inline int b43_pci_ssb_bridge_init(void)
+{
+ return ssb_pcihost_register(&b43_pci_bridge_driver);
+}
+
+inline void b43_pci_ssb_bridge_exit(void)
+{
+ ssb_pcihost_unregister(&b43_pci_bridge_driver);
+}
+
static int __init b43_init(void)
{
int err;
@@ -4046,12 +4071,19 @@ static int __init b43_init(void)
err = b43_pcmcia_init();
if (err)
goto err_dfs_exit;
- err = ssb_driver_register(&b43_ssb_driver);
+
+ err = b43_pci_ssb_bridge_init();
if (err)
goto err_pcmcia_exit;
+ err = ssb_driver_register(&b43_ssb_driver);
+ if (err)
+ goto err_pci_exit;
+
return err;
+err_pci_exit:
+ b43_pci_ssb_bridge_exit();
err_pcmcia_exit:
b43_pcmcia_exit();
err_dfs_exit:
@@ -4062,6 +4094,7 @@ err_dfs_exit:
static void __exit b43_exit(void)
{
ssb_driver_unregister(&b43_ssb_driver);
+ b43_pci_ssb_bridge_exit();
b43_pcmcia_exit();
b43_debugfs_exit();
}
diff --git a/package/b43/src/pcmcia.c b/package/b43/src/pcmcia.c
index 3e75a8a..b242a9a 100644
--- a/package/b43/src/pcmcia.c
+++ b/package/b43/src/pcmcia.c
@@ -21,6 +21,8 @@
*/
+#include "pcmcia.h"
+
#include <linux/ssb/ssb.h>
#include <pcmcia/cs_types.h>
@@ -30,6 +32,7 @@
#include <pcmcia/ds.h>
#include <pcmcia/cisreg.h>
+
static /*const */ struct pcmcia_device_id b43_pcmcia_tbl[] = {
PCMCIA_DEVICE_MANF_CARD(0x2D0, 0x448),
PCMCIA_DEVICE_NULL,
diff --git a/package/b43/src/phy.c b/package/b43/src/phy.c
index 5f7ffa0..3d4ed64 100644
--- a/package/b43/src/phy.c
+++ b/package/b43/src/phy.c
@@ -26,6 +26,7 @@
*/
#include <linux/delay.h>
+#include <linux/io.h>
#include <linux/types.h>
#include "b43.h"
diff --git a/package/b43/src/pio.c b/package/b43/src/pio.c
index 4ac91fd..67752a2 100644
--- a/package/b43/src/pio.c
+++ b/package/b43/src/pio.c
@@ -60,7 +60,7 @@ static u16 tx_get_next_word(const u8 * txhdr,
source = packet;
i -= txhdr_size;
}
- ret = le16_to_cpu(*((u16 *) (source + i)));
+ ret = le16_to_cpu(*((__le16 *)(source + i)));
*pos += 2;
return ret;
@@ -104,7 +104,7 @@ static u16 generate_cookie(struct b43_pioqueue *queue,
struct b43_pio_txpacket *packet)
{
u16 cookie = 0x0000;
- int packetindex;
+ u16 packetindex;
/* We use the upper 4 bits for the PIO
* controller ID and the lower 12 bits
@@ -125,7 +125,7 @@ static u16 generate_cookie(struct b43_pioqueue *queue,
default:
B43_WARN_ON(1);
}
- packetindex = pio_txpacket_getindex(packet);
+ packetindex = packet->index;
B43_WARN_ON(packetindex & ~0x0FFF);
cookie |= (u16) packetindex;
@@ -286,6 +286,7 @@ static void setup_txqueues(struct b43_pioqueue *queue)
packet->queue = queue;
INIT_LIST_HEAD(&packet->list);
+ packet->index = i;
list_add(&packet->list, &queue->txfree);
}
@@ -518,9 +519,10 @@ static void pio_rx_error(struct b43_pioqueue *queue,
void b43_pio_rx(struct b43_pioqueue *queue)
{
- u16 preamble[21] = { 0 };
+ __le16 preamble[21] = { 0 };
struct b43_rxhdr_fw4 *rxhdr;
- u16 tmp, len, macstat;
+ u16 tmp, len;
+ u32 macstat;
int i, preamble_readwords;
struct sk_buff *skb;
@@ -537,7 +539,7 @@ void b43_pio_rx(struct b43_pioqueue *queue)
}
b43dbg(queue->dev->wl, "PIO RX timed out\n");
return;
- data_ready:
+data_ready:
len = b43_pio_read(queue, B43_PIO_RXDATA);
if (unlikely(len > 0x700)) {
@@ -558,7 +560,7 @@ void b43_pio_rx(struct b43_pioqueue *queue)
preamble[i + 1] = cpu_to_le16(tmp);
}
rxhdr = (struct b43_rxhdr_fw4 *)preamble;
- macstat = le16_to_cpu(rxhdr->mac_status);
+ macstat = le32_to_cpu(rxhdr->mac_status);
if (macstat & B43_RX_MAC_FCSERR) {
pio_rx_error(queue,
(queue->mmio_base == B43_MMIO_PIO1_BASE),
@@ -583,7 +585,7 @@ void b43_pio_rx(struct b43_pioqueue *queue)
skb_put(skb, len);
for (i = 0; i < len - 1; i += 2) {
tmp = b43_pio_read(queue, B43_PIO_RXDATA);
- *((u16 *) (skb->data + i)) = cpu_to_le16(tmp);
+ *((__le16 *)(skb->data + i)) = cpu_to_le16(tmp);
}
if (len % 2) {
tmp = b43_pio_read(queue, B43_PIO_RXDATA);
diff --git a/package/b43/src/pio.h b/package/b43/src/pio.h
index 46d6d2e..3488f24 100644
--- a/package/b43/src/pio.h
+++ b/package/b43/src/pio.h
@@ -4,6 +4,7 @@
#include "b43.h"
#include <linux/interrupt.h>
+#include <linux/io.h>
#include <linux/list.h>
#include <linux/skbuff.h>
@@ -39,10 +40,9 @@ struct b43_pio_txpacket {
struct sk_buff *skb;
struct ieee80211_tx_status txstat;
struct list_head list;
+ u16 index; /* Index in the tx_packets_cache */
};
-#define pio_txpacket_getindex(packet) ((int)((packet) - (packet)->queue->tx_packets_cache))
-
struct b43_pioqueue {
struct b43_wldev *dev;
u16 mmio_base;
diff --git a/package/b43/src/sysfs.c b/package/b43/src/sysfs.c
index fcb7773..f4faff6 100644
--- a/package/b43/src/sysfs.c
+++ b/package/b43/src/sysfs.c
@@ -23,13 +23,14 @@
*/
+#include <linux/capability.h>
+#include <linux/io.h>
+
#include "b43.h"
#include "sysfs.h"
#include "main.h"
#include "phy.h"
-#include <linux/capability.h>
-
#define GENERIC_FILESIZE 64
static int get_integer(const char *buf, size_t count)
diff --git a/package/b43/src/xmit.c b/package/b43/src/xmit.c
index e6174b6..0bd6f8a 100644
--- a/package/b43/src/xmit.c
+++ b/package/b43/src/xmit.c
@@ -121,10 +121,12 @@ void b43_generate_plcp_hdr(struct b43_plcp_hdr4 *plcp,
__u8 *raw = plcp->raw;
if (b43_is_ofdm_rate(bitrate)) {
- *data = b43_plcp_get_ratecode_ofdm(bitrate);
+ u32 d;
+
+ d = b43_plcp_get_ratecode_ofdm(bitrate);
B43_WARN_ON(octets & 0xF000);
- *data |= (octets << 5);
- *data = cpu_to_le32(*data);
+ d |= (octets << 5);
+ *data = cpu_to_le32(d);
} else {
u32 plen;