Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 24723
b: refs/heads/master
c: efccb64
h: refs/heads/master
i:
  24721: 356b6c8
  24719: 0ffb672
v: v3
  • Loading branch information
Michael Buesch authored and John W. Linville committed Mar 27, 2006
1 parent 390d7fb commit b80cb38
Show file tree
Hide file tree
Showing 8 changed files with 143 additions and 125 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 4d5a9e0eeb7ec928c6bd55db410f09ed3779bc2a
refs/heads/master: efccb647f486ff8174b4db0ab8145df8dd42ce6d
20 changes: 19 additions & 1 deletion trunk/drivers/net/wireless/bcm43xx/bcm43xx.h
Original file line number Diff line number Diff line change
Expand Up @@ -619,7 +619,9 @@ struct bcm43xx_private {
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 */
Expand Down Expand Up @@ -721,6 +723,22 @@ struct bcm43xx_private {
#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)
{
Expand Down
26 changes: 13 additions & 13 deletions trunk/drivers/net/wireless/bcm43xx/bcm43xx_debugfs.c
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ static ssize_t devinfo_read_file(struct file *file, char __user *userbuf,

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;
Expand Down Expand Up @@ -124,7 +124,7 @@ static ssize_t devinfo_read_file(struct file *file, char __user *userbuf,
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;
Expand Down Expand Up @@ -162,7 +162,7 @@ static ssize_t spromdump_read_file(struct file *file, char __user *userbuf,
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;
Expand All @@ -172,7 +172,7 @@ static ssize_t spromdump_read_file(struct file *file, char __user *userbuf,
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;
Expand All @@ -191,7 +191,7 @@ static ssize_t tsf_read_file(struct file *file, char __user *userbuf,
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;
Expand All @@ -202,7 +202,7 @@ static ssize_t tsf_read_file(struct file *file, char __user *userbuf,
(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;
Expand All @@ -224,7 +224,7 @@ static ssize_t tsf_write_file(struct file *file, const char __user *user_buf,
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;
Expand All @@ -239,7 +239,7 @@ static ssize_t tsf_write_file(struct file *file, const char __user *user_buf,
res = buf_size;

out_unlock:
spin_unlock_irqrestore(&bcm->lock, flags);
bcm43xx_unlock_mmio(bcm, flags);
out_up:
up(&big_buffer_sem);
return res;
Expand All @@ -260,7 +260,7 @@ static ssize_t txstat_read_file(struct file *file, char __user *userbuf,
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);
Expand Down Expand Up @@ -296,14 +296,14 @@ static ssize_t txstat_read_file(struct file *file, char __user *userbuf,
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;
}
Expand Down Expand Up @@ -419,7 +419,7 @@ void bcm43xx_debugfs_log_txstat(struct bcm43xx_private *bcm,
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;
Expand Down
4 changes: 2 additions & 2 deletions trunk/drivers/net/wireless/bcm43xx/bcm43xx_leds.c
Original file line number Diff line number Diff line change
Expand Up @@ -51,12 +51,12 @@ static void bcm43xx_led_blink(unsigned long d)
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,
Expand Down
Loading

0 comments on commit b80cb38

Please sign in to comment.