aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless/bcm43xx/bcm43xx_debugfs.c
diff options
context:
space:
mode:
authorMichael Buesch <mb@bu3sch.de>2006-06-05 14:24:10 -0400
committerJohn W. Linville <linville@tuxdriver.com>2006-06-15 15:48:13 -0400
commit78ff56a06edc3407996173daf63e48f6b90c7062 (patch)
tree93ddfccd648ee84faeb95bcf8f5183ac91d873f7 /drivers/net/wireless/bcm43xx/bcm43xx_debugfs.c
parent74f4903363579d3336c294ebb11f02c8f35845ca (diff)
[PATCH] bcm43xx: redesign locking
Redesign the bcm43xx locking. This is pre-work to get a preemptible periodic work handler. Signed-off-by: Michael Buesch <mb@bu3sch.de> Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers/net/wireless/bcm43xx/bcm43xx_debugfs.c')
-rw-r--r--drivers/net/wireless/bcm43xx/bcm43xx_debugfs.c33
1 files changed, 17 insertions, 16 deletions
diff --git a/drivers/net/wireless/bcm43xx/bcm43xx_debugfs.c b/drivers/net/wireless/bcm43xx/bcm43xx_debugfs.c
index 7497fb16076e..ce2e40b29b4f 100644
--- a/drivers/net/wireless/bcm43xx/bcm43xx_debugfs.c
+++ b/drivers/net/wireless/bcm43xx/bcm43xx_debugfs.c
@@ -77,8 +77,8 @@ static ssize_t devinfo_read_file(struct file *file, char __user *userbuf,
77 77
78 down(&big_buffer_sem); 78 down(&big_buffer_sem);
79 79
80 bcm43xx_lock_mmio(bcm, flags); 80 bcm43xx_lock_irqsafe(bcm, flags);
81 if (!bcm->initialized) { 81 if (bcm43xx_status(bcm) != BCM43xx_STAT_INITIALIZED) {
82 fappend("Board not initialized.\n"); 82 fappend("Board not initialized.\n");
83 goto out; 83 goto out;
84 } 84 }
@@ -121,7 +121,7 @@ static ssize_t devinfo_read_file(struct file *file, char __user *userbuf,
121 fappend("\n"); 121 fappend("\n");
122 122
123out: 123out:
124 bcm43xx_unlock_mmio(bcm, flags); 124 bcm43xx_unlock_irqsafe(bcm, flags);
125 res = simple_read_from_buffer(userbuf, count, ppos, buf, pos); 125 res = simple_read_from_buffer(userbuf, count, ppos, buf, pos);
126 up(&big_buffer_sem); 126 up(&big_buffer_sem);
127 return res; 127 return res;
@@ -159,8 +159,8 @@ static ssize_t spromdump_read_file(struct file *file, char __user *userbuf,
159 unsigned long flags; 159 unsigned long flags;
160 160
161 down(&big_buffer_sem); 161 down(&big_buffer_sem);
162 bcm43xx_lock_mmio(bcm, flags); 162 bcm43xx_lock_irqsafe(bcm, flags);
163 if (!bcm->initialized) { 163 if (bcm43xx_status(bcm) != BCM43xx_STAT_INITIALIZED) {
164 fappend("Board not initialized.\n"); 164 fappend("Board not initialized.\n");
165 goto out; 165 goto out;
166 } 166 }
@@ -169,7 +169,7 @@ static ssize_t spromdump_read_file(struct file *file, char __user *userbuf,
169 fappend("boardflags: 0x%04x\n", bcm->sprom.boardflags); 169 fappend("boardflags: 0x%04x\n", bcm->sprom.boardflags);
170 170
171out: 171out:
172 bcm43xx_unlock_mmio(bcm, flags); 172 bcm43xx_unlock_irqsafe(bcm, flags);
173 res = simple_read_from_buffer(userbuf, count, ppos, buf, pos); 173 res = simple_read_from_buffer(userbuf, count, ppos, buf, pos);
174 up(&big_buffer_sem); 174 up(&big_buffer_sem);
175 return res; 175 return res;
@@ -188,8 +188,8 @@ static ssize_t tsf_read_file(struct file *file, char __user *userbuf,
188 u64 tsf; 188 u64 tsf;
189 189
190 down(&big_buffer_sem); 190 down(&big_buffer_sem);
191 bcm43xx_lock_mmio(bcm, flags); 191 bcm43xx_lock_irqsafe(bcm, flags);
192 if (!bcm->initialized) { 192 if (bcm43xx_status(bcm) != BCM43xx_STAT_INITIALIZED) {
193 fappend("Board not initialized.\n"); 193 fappend("Board not initialized.\n");
194 goto out; 194 goto out;
195 } 195 }
@@ -199,7 +199,7 @@ static ssize_t tsf_read_file(struct file *file, char __user *userbuf,
199 (unsigned int)(tsf & 0xFFFFFFFFULL)); 199 (unsigned int)(tsf & 0xFFFFFFFFULL));
200 200
201out: 201out:
202 bcm43xx_unlock_mmio(bcm, flags); 202 bcm43xx_unlock_irqsafe(bcm, flags);
203 res = simple_read_from_buffer(userbuf, count, ppos, buf, pos); 203 res = simple_read_from_buffer(userbuf, count, ppos, buf, pos);
204 up(&big_buffer_sem); 204 up(&big_buffer_sem);
205 return res; 205 return res;
@@ -221,8 +221,8 @@ static ssize_t tsf_write_file(struct file *file, const char __user *user_buf,
221 res = -EFAULT; 221 res = -EFAULT;
222 goto out_up; 222 goto out_up;
223 } 223 }
224 bcm43xx_lock_mmio(bcm, flags); 224 bcm43xx_lock_irqsafe(bcm, flags);
225 if (!bcm->initialized) { 225 if (bcm43xx_status(bcm) != BCM43xx_STAT_INITIALIZED) {
226 printk(KERN_INFO PFX "debugfs: Board not initialized.\n"); 226 printk(KERN_INFO PFX "debugfs: Board not initialized.\n");
227 res = -EFAULT; 227 res = -EFAULT;
228 goto out_unlock; 228 goto out_unlock;
@@ -233,10 +233,11 @@ static ssize_t tsf_write_file(struct file *file, const char __user *user_buf,
233 goto out_unlock; 233 goto out_unlock;
234 } 234 }
235 bcm43xx_tsf_write(bcm, tsf); 235 bcm43xx_tsf_write(bcm, tsf);
236 mmiowb();
236 res = buf_size; 237 res = buf_size;
237 238
238out_unlock: 239out_unlock:
239 bcm43xx_unlock_mmio(bcm, flags); 240 bcm43xx_unlock_irqsafe(bcm, flags);
240out_up: 241out_up:
241 up(&big_buffer_sem); 242 up(&big_buffer_sem);
242 return res; 243 return res;
@@ -257,7 +258,7 @@ static ssize_t txstat_read_file(struct file *file, char __user *userbuf,
257 int i, cnt, j = 0; 258 int i, cnt, j = 0;
258 259
259 down(&big_buffer_sem); 260 down(&big_buffer_sem);
260 bcm43xx_lock(bcm, flags); 261 bcm43xx_lock_irqsafe(bcm, flags);
261 262
262 fappend("Last %d logged xmitstatus blobs (Latest first):\n\n", 263 fappend("Last %d logged xmitstatus blobs (Latest first):\n\n",
263 BCM43xx_NR_LOGGED_XMITSTATUS); 264 BCM43xx_NR_LOGGED_XMITSTATUS);
@@ -293,14 +294,14 @@ static ssize_t txstat_read_file(struct file *file, char __user *userbuf,
293 i = BCM43xx_NR_LOGGED_XMITSTATUS - 1; 294 i = BCM43xx_NR_LOGGED_XMITSTATUS - 1;
294 } 295 }
295 296
296 bcm43xx_unlock(bcm, flags); 297 bcm43xx_unlock_irqsafe(bcm, flags);
297 res = simple_read_from_buffer(userbuf, count, ppos, buf, pos); 298 res = simple_read_from_buffer(userbuf, count, ppos, buf, pos);
298 bcm43xx_lock(bcm, flags); 299 bcm43xx_lock_irqsafe(bcm, flags);
299 if (*ppos == pos) { 300 if (*ppos == pos) {
300 /* Done. Drop the copied data. */ 301 /* Done. Drop the copied data. */
301 e->xmitstatus_printing = 0; 302 e->xmitstatus_printing = 0;
302 } 303 }
303 bcm43xx_unlock(bcm, flags); 304 bcm43xx_unlock_irqsafe(bcm, flags);
304 up(&big_buffer_sem); 305 up(&big_buffer_sem);
305 return res; 306 return res;
306} 307}