This is the starting point to make the driver out-of-order-MMIO-stores safe.
There are more mmiowb() needed.
Signed-off-by: Michael Buesch <mbuesch@freenet.de>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
void __iomem *mmio_addr;
unsigned int mmio_len;
- spinlock_t lock;
+ /* Do not use the lock directly. Use the bcm43xx_lock* helper
+ * functions, to be MMIO-safe. */
+ spinlock_t _lock;
/* Driver status flags. */
u32 initialized:1, /* init_board() succeed */
#endif
};
+/* bcm43xx_(un)lock() protect struct bcm43xx_private.
+ * Note that _NO_ MMIO writes are allowed. If you want to
+ * write to the device through MMIO in the critical section, use
+ * the *_mmio lock functions.
+ * MMIO read-access is allowed, though.
+ */
+#define bcm43xx_lock(bcm, flags) spin_lock_irqsave(&(bcm)->_lock, flags)
+#define bcm43xx_unlock(bcm, flags) spin_unlock_irqrestore(&(bcm)->_lock, flags)
+/* bcm43xx_(un)lock_mmio() protect struct bcm43xx_private and MMIO.
+ * MMIO write-access to the device is allowed.
+ * All MMIO writes are flushed on unlock, so it is guaranteed to not
+ * interfere with other threads writing MMIO registers.
+ */
+#define bcm43xx_lock_mmio(bcm, flags) bcm43xx_lock(bcm, flags)
+#define bcm43xx_unlock_mmio(bcm, flags) do { mmiowb(); bcm43xx_unlock(bcm, flags); } while (0)
+
static inline
struct bcm43xx_private * bcm43xx_priv(struct net_device *dev)
{
down(&big_buffer_sem);
- spin_lock_irqsave(&bcm->lock, flags);
+ bcm43xx_lock_mmio(bcm, flags);
if (!bcm->initialized) {
fappend("Board not initialized.\n");
goto out;
fappend("\n");
out:
- spin_unlock_irqrestore(&bcm->lock, flags);
+ bcm43xx_unlock_mmio(bcm, flags);
res = simple_read_from_buffer(userbuf, count, ppos, buf, pos);
up(&big_buffer_sem);
return res;
unsigned long flags;
down(&big_buffer_sem);
- spin_lock_irqsave(&bcm->lock, flags);
+ bcm43xx_lock_mmio(bcm, flags);
if (!bcm->initialized) {
fappend("Board not initialized.\n");
goto out;
fappend("boardflags: 0x%04x\n", bcm->sprom.boardflags);
out:
- spin_unlock_irqrestore(&bcm->lock, flags);
+ bcm43xx_unlock_mmio(bcm, flags);
res = simple_read_from_buffer(userbuf, count, ppos, buf, pos);
up(&big_buffer_sem);
return res;
u64 tsf;
down(&big_buffer_sem);
- spin_lock_irqsave(&bcm->lock, flags);
+ bcm43xx_lock_mmio(bcm, flags);
if (!bcm->initialized) {
fappend("Board not initialized.\n");
goto out;
(unsigned int)(tsf & 0xFFFFFFFFULL));
out:
- spin_unlock_irqrestore(&bcm->lock, flags);
+ bcm43xx_unlock_mmio(bcm, flags);
res = simple_read_from_buffer(userbuf, count, ppos, buf, pos);
up(&big_buffer_sem);
return res;
res = -EFAULT;
goto out_up;
}
- spin_lock_irqsave(&bcm->lock, flags);
+ bcm43xx_lock_mmio(bcm, flags);
if (!bcm->initialized) {
printk(KERN_INFO PFX "debugfs: Board not initialized.\n");
res = -EFAULT;
res = buf_size;
out_unlock:
- spin_unlock_irqrestore(&bcm->lock, flags);
+ bcm43xx_unlock_mmio(bcm, flags);
out_up:
up(&big_buffer_sem);
return res;
int i, cnt, j = 0;
down(&big_buffer_sem);
- spin_lock_irqsave(&bcm->lock, flags);
+ bcm43xx_lock(bcm, flags);
fappend("Last %d logged xmitstatus blobs (Latest first):\n\n",
BCM43xx_NR_LOGGED_XMITSTATUS);
i = BCM43xx_NR_LOGGED_XMITSTATUS - 1;
}
- spin_unlock_irqrestore(&bcm->lock, flags);
+ bcm43xx_unlock(bcm, flags);
res = simple_read_from_buffer(userbuf, count, ppos, buf, pos);
- spin_lock_irqsave(&bcm->lock, flags);
+ bcm43xx_lock(bcm, flags);
if (*ppos == pos) {
/* Done. Drop the copied data. */
e->xmitstatus_printing = 0;
}
- spin_unlock_irqrestore(&bcm->lock, flags);
+ bcm43xx_unlock(bcm, flags);
up(&big_buffer_sem);
return res;
}
struct bcm43xx_dfsentry *e;
struct bcm43xx_xmitstatus *savedstatus;
- /* This is protected by bcm->lock */
+ /* This is protected by bcm->_lock */
e = bcm->dfsentry;
assert(e);
savedstatus = e->xmitstatus_buffer + e->xmitstatus_ptr;
struct bcm43xx_private *bcm = led->bcm;
unsigned long flags;
- spin_lock_irqsave(&bcm->lock, flags);
+ bcm43xx_lock_mmio(bcm, flags);
if (led->blink_interval) {
bcm43xx_led_changestate(led);
mod_timer(&led->blink_timer, jiffies + led->blink_interval);
}
- spin_unlock_irqrestore(&bcm->lock, flags);
+ bcm43xx_unlock_mmio(bcm, flags);
}
static void bcm43xx_led_blink_start(struct bcm43xx_led *led,
u32 old;
unsigned long flags;
- spin_lock_irqsave(&bcm->lock, flags);
+ bcm43xx_lock_mmio(bcm, flags);
if (bcm43xx_is_initializing(bcm) || bcm->shutting_down) {
- spin_unlock_irqrestore(&bcm->lock, flags);
+ bcm43xx_unlock_mmio(bcm, flags);
return -EBUSY;
}
old = bcm43xx_interrupt_disable(bcm, BCM43xx_IRQ_ALL);
tasklet_disable(&bcm->isr_tasklet);
- spin_unlock_irqrestore(&bcm->lock, flags);
+ bcm43xx_unlock_mmio(bcm, flags);
if (oldstate)
*oldstate = old;
else if (i % 2)
printk(".");
bcm43xx_write16(bcm, BCM43xx_SPROM_BASE + (i * 2), sprom[i]);
+ mmiowb();
mdelay(20);
}
spromctl &= ~0x10; /* SPROM WRITE enable. */
# define bcmirq_handled(irq) do { /* nothing */ } while (0)
#endif /* CONFIG_BCM43XX_DEBUG*/
- spin_lock_irqsave(&bcm->lock, flags);
+ bcm43xx_lock_mmio(bcm, flags);
reason = bcm->irq_reason;
dma_reason[0] = bcm->dma_reason[0];
dma_reason[1] = bcm->dma_reason[1];
if (!modparam_noleds)
bcm43xx_leds_update(bcm, activity);
bcm43xx_interrupt_enable(bcm, bcm->irq_savedstate);
- spin_unlock_irqrestore(&bcm->lock, flags);
+ bcm43xx_unlock_mmio(bcm, flags);
}
#undef bcmirq_print_reasons
/* Interrupt handler top-half */
static irqreturn_t bcm43xx_interrupt_handler(int irq, void *dev_id, struct pt_regs *regs)
{
+ irqreturn_t ret = IRQ_HANDLED;
struct bcm43xx_private *bcm = dev_id;
u32 reason, mask;
if (!bcm)
return IRQ_NONE;
- spin_lock(&bcm->lock);
+ spin_lock(&bcm->_lock);
reason = bcm43xx_read32(bcm, BCM43xx_MMIO_GEN_IRQ_REASON);
if (reason == 0xffffffff) {
/* irq not for us (shared irq) */
- spin_unlock(&bcm->lock);
- return IRQ_NONE;
+ ret = IRQ_NONE;
+ goto out;
}
mask = bcm43xx_read32(bcm, BCM43xx_MMIO_GEN_IRQ_MASK);
- if (!(reason & mask)) {
- spin_unlock(&bcm->lock);
- return IRQ_HANDLED;
- }
+ if (!(reason & mask))
+ goto out;
bcm43xx_interrupt_ack(bcm, reason, mask);
tasklet_schedule(&bcm->isr_tasklet);
}
- spin_unlock(&bcm->lock);
+out:
+ mmiowb();
+ spin_unlock(&bcm->_lock);
- return IRQ_HANDLED;
+ return ret;
}
static void bcm43xx_release_firmware(struct bcm43xx_private *bcm, int force)
unsigned long flags;
unsigned int state;
- spin_lock_irqsave(&bcm->lock, flags);
+ bcm43xx_lock_mmio(bcm, flags);
assert(bcm->initialized);
state = bcm->periodic_state;
mod_timer(&bcm->periodic_tasks, jiffies + (HZ * 15));
- spin_unlock_irqrestore(&bcm->lock, flags);
+ bcm43xx_unlock_mmio(bcm, flags);
}
static void bcm43xx_periodic_tasks_delete(struct bcm43xx_private *bcm)
bcm43xx_periodic_tasks_delete(bcm);
- spin_lock_irqsave(&bcm->lock, flags);
+ bcm43xx_lock(bcm, flags);
bcm->initialized = 0;
bcm->shutting_down = 1;
- spin_unlock_irqrestore(&bcm->lock, flags);
+ bcm43xx_unlock(bcm, flags);
for (i = 0; i < BCM43xx_MAX_80211_CORES; i++) {
if (!(bcm->core_80211[i].flags & BCM43xx_COREFLAG_AVAILABLE))
bcm43xx_pctl_set_crystal(bcm, 0);
- spin_lock_irqsave(&bcm->lock, flags);
+ bcm43xx_lock(bcm, flags);
bcm->shutting_down = 0;
- spin_unlock_irqrestore(&bcm->lock, flags);
+ bcm43xx_unlock(bcm, flags);
}
static int bcm43xx_init_board(struct bcm43xx_private *bcm)
might_sleep();
- spin_lock_irqsave(&bcm->lock, flags);
+ bcm43xx_lock(bcm, flags);
bcm->initialized = 0;
bcm->shutting_down = 0;
- spin_unlock_irqrestore(&bcm->lock, flags);
+ bcm43xx_unlock(bcm, flags);
err = bcm43xx_pctl_set_crystal(bcm, 1);
if (err)
}
/* Initialization of the board is done. Flag it as such. */
- spin_lock_irqsave(&bcm->lock, flags);
+ bcm43xx_lock(bcm, flags);
bcm->initialized = 1;
- spin_unlock_irqrestore(&bcm->lock, flags);
+ bcm43xx_unlock(bcm, flags);
bcm43xx_periodic_tasks_setup(bcm);
bcm43xx_sysfs_register(bcm);
struct bcm43xx_private *bcm = bcm43xx_priv(net_dev);
unsigned long flags;
- spin_lock_irqsave(&bcm->lock, flags);
+ bcm43xx_lock_mmio(bcm, flags);
bcm43xx_mac_suspend(bcm);
bcm43xx_radio_selectchannel(bcm, channel, 0);
bcm43xx_mac_enable(bcm);
- spin_unlock_irqrestore(&bcm->lock, flags);
+ bcm43xx_unlock_mmio(bcm, flags);
}
/* set_security() callback in struct ieee80211_device */
int keyidx;
dprintk(KERN_INFO PFX "set security called\n");
-
- spin_lock_irqsave(&bcm->lock, flags);
-
+
+ bcm43xx_lock_mmio(bcm, flags);
+
for (keyidx = 0; keyidx<WEP_KEYS; keyidx++)
if (sec->flags & (1<<keyidx)) {
secinfo->encode_alg[keyidx] = sec->encode_alg[keyidx];
} else
bcm43xx_clear_keys(bcm);
}
- spin_unlock_irqrestore(&bcm->lock, flags);
+ bcm43xx_unlock_mmio(bcm, flags);
}
/* hard_start_xmit() callback in struct ieee80211_device */
int err = -ENODEV;
unsigned long flags;
- spin_lock_irqsave(&bcm->lock, flags);
+ bcm43xx_lock_mmio(bcm, flags);
if (likely(bcm->initialized))
err = bcm43xx_tx(bcm, txb);
- spin_unlock_irqrestore(&bcm->lock, flags);
+ bcm43xx_unlock_mmio(bcm, flags);
return err;
}
static void bcm43xx_net_tx_timeout(struct net_device *net_dev)
{
struct bcm43xx_private *bcm = bcm43xx_priv(net_dev);
+ unsigned long flags;
+ bcm43xx_lock_mmio(bcm, flags);
bcm43xx_controller_restart(bcm, "TX timeout");
+ bcm43xx_unlock_mmio(bcm, flags);
}
#ifdef CONFIG_NET_POLL_CONTROLLER
bcm->pci_dev = pci_dev;
bcm->net_dev = net_dev;
bcm->bad_frames_preempt = modparam_bad_frames_preempt;
- spin_lock_init(&bcm->lock);
+ spin_lock_init(&bcm->_lock);
tasklet_init(&bcm->isr_tasklet,
(void (*)(unsigned long))bcm43xx_interrupt_tasklet,
(unsigned long)bcm);
dprintk(KERN_INFO PFX "Suspending...\n");
- spin_lock_irqsave(&bcm->lock, flags);
+ bcm43xx_lock(bcm, flags);
bcm->was_initialized = bcm->initialized;
if (bcm->initialized)
try_to_shutdown = 1;
- spin_unlock_irqrestore(&bcm->lock, flags);
+ bcm43xx_unlock(bcm, flags);
netif_device_detach(net_dev);
if (try_to_shutdown) {
struct bcm43xx_pio_txpacket *packet, *tmp_packet;
int err;
- spin_lock_irqsave(&bcm->lock, flags);
+ bcm43xx_lock_mmio(bcm, flags);
list_for_each_entry_safe(packet, tmp_packet, &queue->txqueue, list) {
assert(packet->xmitted_frags < packet->txb->nr_frags);
if (packet->xmitted_frags == 0) {
next_packet:
continue;
}
- spin_unlock_irqrestore(&bcm->lock, flags);
+ bcm43xx_unlock_mmio(bcm, flags);
}
static void setup_txqueues(struct bcm43xx_pioqueue *queue)
GFP_KERNEL);
if (!sprom)
return -ENOMEM;
- spin_lock_irqsave(&bcm->lock, flags);
+ bcm43xx_lock_mmio(bcm, flags);
assert(bcm->initialized);
err = bcm43xx_sprom_read(bcm, sprom);
if (!err) {
buf[i * 2 + 1] = (sprom[i] & 0xFF00) >> 8;
}
}
- spin_unlock_irqrestore(&bcm->lock, flags);
+ bcm43xx_unlock_mmio(bcm, flags);
kfree(sprom);
return err ? err : BCM43xx_SPROM_SIZE * sizeof(u16);
sprom[i] = buf[i * 2] & 0xFF;
sprom[i] |= ((u16)(buf[i * 2 + 1] & 0xFF)) << 8;
}
- spin_lock_irqsave(&bcm->lock, flags);
+ bcm43xx_lock_mmio(bcm, flags);
assert(bcm->initialized);
err = bcm43xx_sprom_write(bcm, sprom);
- spin_unlock_irqrestore(&bcm->lock, flags);
+ bcm43xx_unlock_mmio(bcm, flags);
kfree(sprom);
return err ? err : count;
if (!capable(CAP_NET_ADMIN))
return -EPERM;
- spin_lock_irqsave(&bcm->lock, flags);
+ bcm43xx_lock(bcm, flags);
assert(bcm->initialized);
switch (bcm->current_core->radio->interfmode) {
}
err = 0;
- spin_unlock_irqrestore(&bcm->lock, flags);
+ bcm43xx_unlock(bcm, flags);
+
return err ? err : count;
}
return -EINVAL;
}
- spin_lock_irqsave(&bcm->lock, flags);
+ bcm43xx_lock_mmio(bcm, flags);
assert(bcm->initialized);
err = bcm43xx_radio_set_interference_mitigation(bcm, mode);
"supported by device\n");
}
- spin_unlock_irqrestore(&bcm->lock, flags);
+ bcm43xx_unlock_mmio(bcm, flags);
return err ? err : count;
}
if (!capable(CAP_NET_ADMIN))
return -EPERM;
- spin_lock_irqsave(&bcm->lock, flags);
+ bcm43xx_lock(bcm, flags);
assert(bcm->initialized);
if (bcm->short_preamble)
count = snprintf(buf, PAGE_SIZE, "0 (Short Preamble disabled)\n");
err = 0;
- spin_unlock_irqrestore(&bcm->lock, flags);
+ bcm43xx_unlock(bcm, flags);
return err ? err : count;
}
value = get_boolean(buf, count);
if (value < 0)
return value;
- spin_lock_irqsave(&bcm->lock, flags);
+ bcm43xx_lock(bcm, flags);
assert(bcm->initialized);
bcm->short_preamble = !!value;
err = 0;
- spin_unlock_irqrestore(&bcm->lock, flags);
+ bcm43xx_unlock(bcm, flags);
return err ? err : count;
}
char suffix[7] = { 0 };
int have_a = 0, have_b = 0, have_g = 0;
- spin_lock_irqsave(&bcm->lock, flags);
+ bcm43xx_lock(bcm, flags);
nr_80211 = bcm43xx_num_80211_cores(bcm);
for (i = 0; i < nr_80211; i++) {
phy = bcm->phy + i;
assert(0);
}
}
- spin_unlock_irqrestore(&bcm->lock, flags);
+ bcm43xx_unlock(bcm, flags);
i = 0;
if (have_a) {
int freq;
int err = -EINVAL;
- spin_lock_irqsave(&bcm->lock, flags);
+ bcm43xx_lock_mmio(bcm, flags);
if ((data->freq.m >= 0) && (data->freq.m <= 1000)) {
channel = data->freq.m;
freq = bcm43xx_channel_to_freq(bcm, channel);
err = 0;
}
out_unlock:
- spin_unlock_irqrestore(&bcm->lock, flags);
+ bcm43xx_unlock_mmio(bcm, flags);
return err;
}
int err = -ENODEV;
u16 channel;
- spin_lock_irqsave(&bcm->lock, flags);
+ bcm43xx_lock(bcm, flags);
channel = bcm->current_core->radio->channel;
if (channel == 0xFF) {
assert(!bcm->initialized);
err = 0;
out_unlock:
- spin_unlock_irqrestore(&bcm->lock, flags);
+ bcm43xx_unlock(bcm, flags);
return err;
}
if (mode == IW_MODE_AUTO)
mode = BCM43xx_INITIAL_IWMODE;
- spin_lock_irqsave(&bcm->lock, flags);
+ bcm43xx_lock_mmio(bcm, flags);
if (bcm->ieee->iw_mode != mode)
bcm43xx_set_iwmode(bcm, mode);
- spin_unlock_irqrestore(&bcm->lock, flags);
+ bcm43xx_unlock_mmio(bcm, flags);
return 0;
}
struct bcm43xx_private *bcm = bcm43xx_priv(net_dev);
unsigned long flags;
- spin_lock_irqsave(&bcm->lock, flags);
+ bcm43xx_lock(bcm, flags);
data->mode = bcm->ieee->iw_mode;
- spin_unlock_irqrestore(&bcm->lock, flags);
+ bcm43xx_unlock(bcm, flags);
return 0;
}
IW_ENC_CAPA_CIPHER_TKIP |
IW_ENC_CAPA_CIPHER_CCMP;
- spin_lock_irqsave(&bcm->lock, flags);
+ bcm43xx_lock(bcm, flags);
range->num_bitrates = 0;
i = 0;
}
range->num_frequency = j;
- spin_unlock_irqrestore(&bcm->lock, flags);
+ bcm43xx_unlock(bcm, flags);
return 0;
}
unsigned long flags;
size_t len;
- spin_lock_irqsave(&bcm->lock, flags);
+ bcm43xx_lock(bcm, flags);
len = min((size_t)data->data.length, (size_t)IW_ESSID_MAX_SIZE);
memcpy(bcm->nick, extra, len);
bcm->nick[len] = '\0';
- spin_unlock_irqrestore(&bcm->lock, flags);
+ bcm43xx_unlock(bcm, flags);
return 0;
}
unsigned long flags;
size_t len;
- spin_lock_irqsave(&bcm->lock, flags);
+ bcm43xx_lock(bcm, flags);
len = strlen(bcm->nick) + 1;
memcpy(extra, bcm->nick, len);
data->data.length = (__u16)len;
data->data.flags = 1;
- spin_unlock_irqrestore(&bcm->lock, flags);
+ bcm43xx_unlock(bcm, flags);
return 0;
}
unsigned long flags;
int err = -EINVAL;
- spin_lock_irqsave(&bcm->lock, flags);
+ bcm43xx_lock(bcm, flags);
if (data->rts.disabled) {
bcm->rts_threshold = BCM43xx_MAX_RTS_THRESHOLD;
err = 0;
err = 0;
}
}
- spin_unlock_irqrestore(&bcm->lock, flags);
+ bcm43xx_unlock(bcm, flags);
return err;
}
struct bcm43xx_private *bcm = bcm43xx_priv(net_dev);
unsigned long flags;
- spin_lock_irqsave(&bcm->lock, flags);
+ bcm43xx_lock(bcm, flags);
data->rts.value = bcm->rts_threshold;
data->rts.fixed = 0;
data->rts.disabled = (bcm->rts_threshold == BCM43xx_MAX_RTS_THRESHOLD);
- spin_unlock_irqrestore(&bcm->lock, flags);
+ bcm43xx_unlock(bcm, flags);
return 0;
}
unsigned long flags;
int err = -EINVAL;
- spin_lock_irqsave(&bcm->lock, flags);
+ bcm43xx_lock(bcm, flags);
if (data->frag.disabled) {
bcm->ieee->fts = MAX_FRAG_THRESHOLD;
err = 0;
err = 0;
}
}
- spin_unlock_irqrestore(&bcm->lock, flags);
+ bcm43xx_unlock(bcm, flags);
return err;
}
struct bcm43xx_private *bcm = bcm43xx_priv(net_dev);
unsigned long flags;
- spin_lock_irqsave(&bcm->lock, flags);
+ bcm43xx_lock(bcm, flags);
data->frag.value = bcm->ieee->fts;
data->frag.fixed = 0;
data->frag.disabled = (bcm->ieee->fts == MAX_FRAG_THRESHOLD);
- spin_unlock_irqrestore(&bcm->lock, flags);
+ bcm43xx_unlock(bcm, flags);
return 0;
}
return -EOPNOTSUPP;
}
- spin_lock_irqsave(&bcm->lock, flags);
+ bcm43xx_lock_mmio(bcm, flags);
if (!bcm->initialized)
goto out_unlock;
radio = bcm->current_core->radio;
err = 0;
out_unlock:
- spin_unlock_irqrestore(&bcm->lock, flags);
+ bcm43xx_unlock_mmio(bcm, flags);
return err;
}
unsigned long flags;
int err = -ENODEV;
- spin_lock_irqsave(&bcm->lock, flags);
+ bcm43xx_lock(bcm, flags);
if (!bcm->initialized)
goto out_unlock;
radio = bcm->current_core->radio;
err = 0;
out_unlock:
- spin_unlock_irqrestore(&bcm->lock, flags);
+ bcm43xx_unlock(bcm, flags);
return err;
}
return -EINVAL;
}
- spin_lock_irqsave(&bcm->lock, flags);
+ bcm43xx_lock_mmio(bcm, flags);
if (bcm->initialized) {
err = bcm43xx_radio_set_interference_mitigation(bcm, mode);
if (err) {
} else
bcm->current_core->radio->interfmode = mode;
}
- spin_unlock_irqrestore(&bcm->lock, flags);
+ bcm43xx_unlock_mmio(bcm, flags);
return err;
}
unsigned long flags;
int mode;
- spin_lock_irqsave(&bcm->lock, flags);
+ bcm43xx_lock(bcm, flags);
mode = bcm->current_core->radio->interfmode;
- spin_unlock_irqrestore(&bcm->lock, flags);
+ bcm43xx_unlock(bcm, flags);
switch (mode) {
case BCM43xx_RADIO_INTERFMODE_NONE:
int on;
on = *((int *)extra);
- spin_lock_irqsave(&bcm->lock, flags);
+ bcm43xx_lock(bcm, flags);
bcm->short_preamble = !!on;
- spin_unlock_irqrestore(&bcm->lock, flags);
+ bcm43xx_unlock(bcm, flags);
return 0;
}
unsigned long flags;
int on;
- spin_lock_irqsave(&bcm->lock, flags);
+ bcm43xx_lock(bcm, flags);
on = bcm->short_preamble;
- spin_unlock_irqrestore(&bcm->lock, flags);
+ bcm43xx_unlock(bcm, flags);
if (on)
strncpy(extra, "1 (Short Preamble enabled)", MAX_WX_STRING);
int on;
on = *((int *)extra);
- spin_lock_irqsave(&bcm->lock, flags);
+
+ bcm43xx_lock(bcm, flags);
bcm->ieee->host_encrypt = !!on;
bcm->ieee->host_decrypt = !!on;
bcm->ieee->host_build_iv = !on;
-
- spin_unlock_irqrestore(&bcm->lock, flags);
-
+ bcm43xx_unlock(bcm, flags);
+
return 0;
}
struct bcm43xx_private *bcm = bcm43xx_priv(net_dev);
unsigned long flags;
int on;
-
- spin_lock_irqsave(&bcm->lock, flags);
+
+ bcm43xx_lock(bcm, flags);
on = bcm->ieee->host_encrypt;
- spin_unlock_irqrestore(&bcm->lock, flags);
-
+ bcm43xx_unlock(bcm, flags);
+
if (on)
strncpy(extra, "1 (SW encryption enabled) ", MAX_WX_STRING);
else
strncpy(extra, "0 (SW encryption disabled) ", MAX_WX_STRING);
data->data.length = strlen(extra + 1);
-
+
return 0;
}
if (!sprom)
goto out;
- spin_lock_irqsave(&bcm->lock, flags);
+ bcm43xx_lock_mmio(bcm, flags);
err = -ENODEV;
- if (!bcm->initialized) {
- spin_unlock_irqrestore(&bcm->lock, flags);
- goto out_kfree;
- }
- err = bcm43xx_sprom_read(bcm, sprom);
- spin_unlock_irqrestore(&bcm->lock, flags);
+ if (bcm->initialized)
+ err = bcm43xx_sprom_read(bcm, sprom);
+ bcm43xx_unlock_mmio(bcm, flags);
if (!err)
data->data.length = sprom2hex(sprom, extra);
-out_kfree:
kfree(sprom);
out:
return err;
if (err)
goto out_kfree;
- spin_lock_irqsave(&bcm->lock, flags);
+ bcm43xx_lock_mmio(bcm, flags);
err = -ENODEV;
- if (!bcm->initialized)
- goto out_unlock;
- err = bcm43xx_sprom_write(bcm, sprom);
-out_unlock:
- spin_unlock_irqrestore(&bcm->lock, flags);
+ if (bcm->initialized)
+ err = bcm43xx_sprom_write(bcm, sprom);
+ bcm43xx_unlock_mmio(bcm, flags);
out_kfree:
kfree(sprom);
out: