diff options
author | Michael Buesch <mb@bu3sch.de> | 2009-09-04 16:51:29 -0400 |
---|---|---|
committer | John W. Linville <linville@tuxdriver.com> | 2009-09-08 16:31:06 -0400 |
commit | 36dbd9548e92268127b0c31b0e121e63e9207108 (patch) | |
tree | 41d95c5dd824ea43c5f0055bd790b64d7ba8a33a /drivers/net/wireless/b43/debugfs.c | |
parent | b275f28535fc774325bb8ad5f664e6c44a8fbc9b (diff) |
b43: Use a threaded IRQ handler
Use a threaded IRQ handler to allow locking the mutex and
sleeping while executing an interrupt.
This removes usage of the irq_lock spinlock, but introduces
a new hardirq_lock, which is _only_ used for the PCI/SSB lowlevel
hard-irq handler. Sleeping busses (SDIO) will use mutex instead.
Signed-off-by: Michael Buesch <mb@bu3sch.de>
Tested-by: Larry Finger <Larry.Finger@lwfinger.net>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers/net/wireless/b43/debugfs.c')
-rw-r--r-- | drivers/net/wireless/b43/debugfs.c | 53 |
1 files changed, 16 insertions, 37 deletions
diff --git a/drivers/net/wireless/b43/debugfs.c b/drivers/net/wireless/b43/debugfs.c index 45e3d6af69f5..bf23a3a863fa 100644 --- a/drivers/net/wireless/b43/debugfs.c +++ b/drivers/net/wireless/b43/debugfs.c | |||
@@ -46,8 +46,6 @@ struct b43_debugfs_fops { | |||
46 | struct file_operations fops; | 46 | struct file_operations fops; |
47 | /* Offset of struct b43_dfs_file in struct b43_dfsentry */ | 47 | /* Offset of struct b43_dfs_file in struct b43_dfsentry */ |
48 | size_t file_struct_offset; | 48 | size_t file_struct_offset; |
49 | /* Take wl->irq_lock before calling read/write? */ | ||
50 | bool take_irqlock; | ||
51 | }; | 49 | }; |
52 | 50 | ||
53 | static inline | 51 | static inline |
@@ -372,14 +370,12 @@ static ssize_t txstat_read_file(struct b43_wldev *dev, | |||
372 | { | 370 | { |
373 | struct b43_txstatus_log *log = &dev->dfsentry->txstatlog; | 371 | struct b43_txstatus_log *log = &dev->dfsentry->txstatlog; |
374 | ssize_t count = 0; | 372 | ssize_t count = 0; |
375 | unsigned long flags; | ||
376 | int i, idx; | 373 | int i, idx; |
377 | struct b43_txstatus *stat; | 374 | struct b43_txstatus *stat; |
378 | 375 | ||
379 | spin_lock_irqsave(&log->lock, flags); | ||
380 | if (log->end < 0) { | 376 | if (log->end < 0) { |
381 | fappend("Nothing transmitted, yet\n"); | 377 | fappend("Nothing transmitted, yet\n"); |
382 | goto out_unlock; | 378 | goto out; |
383 | } | 379 | } |
384 | fappend("b43 TX status reports:\n\n" | 380 | fappend("b43 TX status reports:\n\n" |
385 | "index | cookie | seq | phy_stat | frame_count | " | 381 | "index | cookie | seq | phy_stat | frame_count | " |
@@ -409,13 +405,11 @@ static ssize_t txstat_read_file(struct b43_wldev *dev, | |||
409 | break; | 405 | break; |
410 | i++; | 406 | i++; |
411 | } | 407 | } |
412 | out_unlock: | 408 | out: |
413 | spin_unlock_irqrestore(&log->lock, flags); | ||
414 | 409 | ||
415 | return count; | 410 | return count; |
416 | } | 411 | } |
417 | 412 | ||
418 | /* wl->irq_lock is locked */ | ||
419 | static int restart_write_file(struct b43_wldev *dev, | 413 | static int restart_write_file(struct b43_wldev *dev, |
420 | const char *buf, size_t count) | 414 | const char *buf, size_t count) |
421 | { | 415 | { |
@@ -556,12 +550,7 @@ static ssize_t b43_debugfs_read(struct file *file, char __user *userbuf, | |||
556 | goto out_unlock; | 550 | goto out_unlock; |
557 | } | 551 | } |
558 | memset(buf, 0, bufsize); | 552 | memset(buf, 0, bufsize); |
559 | if (dfops->take_irqlock) { | 553 | ret = dfops->read(dev, buf, bufsize); |
560 | spin_lock_irq(&dev->wl->irq_lock); | ||
561 | ret = dfops->read(dev, buf, bufsize); | ||
562 | spin_unlock_irq(&dev->wl->irq_lock); | ||
563 | } else | ||
564 | ret = dfops->read(dev, buf, bufsize); | ||
565 | if (ret <= 0) { | 554 | if (ret <= 0) { |
566 | free_pages((unsigned long)buf, buforder); | 555 | free_pages((unsigned long)buf, buforder); |
567 | err = ret; | 556 | err = ret; |
@@ -623,12 +612,7 @@ static ssize_t b43_debugfs_write(struct file *file, | |||
623 | err = -EFAULT; | 612 | err = -EFAULT; |
624 | goto out_freepage; | 613 | goto out_freepage; |
625 | } | 614 | } |
626 | if (dfops->take_irqlock) { | 615 | err = dfops->write(dev, buf, count); |
627 | spin_lock_irq(&dev->wl->irq_lock); | ||
628 | err = dfops->write(dev, buf, count); | ||
629 | spin_unlock_irq(&dev->wl->irq_lock); | ||
630 | } else | ||
631 | err = dfops->write(dev, buf, count); | ||
632 | if (err) | 616 | if (err) |
633 | goto out_freepage; | 617 | goto out_freepage; |
634 | 618 | ||
@@ -641,7 +625,7 @@ out_unlock: | |||
641 | } | 625 | } |
642 | 626 | ||
643 | 627 | ||
644 | #define B43_DEBUGFS_FOPS(name, _read, _write, _take_irqlock) \ | 628 | #define B43_DEBUGFS_FOPS(name, _read, _write) \ |
645 | static struct b43_debugfs_fops fops_##name = { \ | 629 | static struct b43_debugfs_fops fops_##name = { \ |
646 | .read = _read, \ | 630 | .read = _read, \ |
647 | .write = _write, \ | 631 | .write = _write, \ |
@@ -652,20 +636,19 @@ out_unlock: | |||
652 | }, \ | 636 | }, \ |
653 | .file_struct_offset = offsetof(struct b43_dfsentry, \ | 637 | .file_struct_offset = offsetof(struct b43_dfsentry, \ |
654 | file_##name), \ | 638 | file_##name), \ |
655 | .take_irqlock = _take_irqlock, \ | ||
656 | } | 639 | } |
657 | 640 | ||
658 | B43_DEBUGFS_FOPS(shm16read, shm16read__read_file, shm16read__write_file, 1); | 641 | B43_DEBUGFS_FOPS(shm16read, shm16read__read_file, shm16read__write_file); |
659 | B43_DEBUGFS_FOPS(shm16write, NULL, shm16write__write_file, 1); | 642 | B43_DEBUGFS_FOPS(shm16write, NULL, shm16write__write_file); |
660 | B43_DEBUGFS_FOPS(shm32read, shm32read__read_file, shm32read__write_file, 1); | 643 | B43_DEBUGFS_FOPS(shm32read, shm32read__read_file, shm32read__write_file); |
661 | B43_DEBUGFS_FOPS(shm32write, NULL, shm32write__write_file, 1); | 644 | B43_DEBUGFS_FOPS(shm32write, NULL, shm32write__write_file); |
662 | B43_DEBUGFS_FOPS(mmio16read, mmio16read__read_file, mmio16read__write_file, 1); | 645 | B43_DEBUGFS_FOPS(mmio16read, mmio16read__read_file, mmio16read__write_file); |
663 | B43_DEBUGFS_FOPS(mmio16write, NULL, mmio16write__write_file, 1); | 646 | B43_DEBUGFS_FOPS(mmio16write, NULL, mmio16write__write_file); |
664 | B43_DEBUGFS_FOPS(mmio32read, mmio32read__read_file, mmio32read__write_file, 1); | 647 | B43_DEBUGFS_FOPS(mmio32read, mmio32read__read_file, mmio32read__write_file); |
665 | B43_DEBUGFS_FOPS(mmio32write, NULL, mmio32write__write_file, 1); | 648 | B43_DEBUGFS_FOPS(mmio32write, NULL, mmio32write__write_file); |
666 | B43_DEBUGFS_FOPS(txstat, txstat_read_file, NULL, 0); | 649 | B43_DEBUGFS_FOPS(txstat, txstat_read_file, NULL); |
667 | B43_DEBUGFS_FOPS(restart, NULL, restart_write_file, 1); | 650 | B43_DEBUGFS_FOPS(restart, NULL, restart_write_file); |
668 | B43_DEBUGFS_FOPS(loctls, loctls_read_file, NULL, 0); | 651 | B43_DEBUGFS_FOPS(loctls, loctls_read_file, NULL); |
669 | 652 | ||
670 | 653 | ||
671 | bool b43_debug(struct b43_wldev *dev, enum b43_dyndbg feature) | 654 | bool b43_debug(struct b43_wldev *dev, enum b43_dyndbg feature) |
@@ -738,7 +721,6 @@ void b43_debugfs_add_device(struct b43_wldev *dev) | |||
738 | return; | 721 | return; |
739 | } | 722 | } |
740 | log->end = -1; | 723 | log->end = -1; |
741 | spin_lock_init(&log->lock); | ||
742 | 724 | ||
743 | dev->dfsentry = e; | 725 | dev->dfsentry = e; |
744 | 726 | ||
@@ -822,7 +804,6 @@ void b43_debugfs_remove_device(struct b43_wldev *dev) | |||
822 | kfree(e); | 804 | kfree(e); |
823 | } | 805 | } |
824 | 806 | ||
825 | /* Called with IRQs disabled. */ | ||
826 | void b43_debugfs_log_txstat(struct b43_wldev *dev, | 807 | void b43_debugfs_log_txstat(struct b43_wldev *dev, |
827 | const struct b43_txstatus *status) | 808 | const struct b43_txstatus *status) |
828 | { | 809 | { |
@@ -834,14 +815,12 @@ void b43_debugfs_log_txstat(struct b43_wldev *dev, | |||
834 | if (!e) | 815 | if (!e) |
835 | return; | 816 | return; |
836 | log = &e->txstatlog; | 817 | log = &e->txstatlog; |
837 | spin_lock(&log->lock); /* IRQs are already disabled. */ | ||
838 | i = log->end + 1; | 818 | i = log->end + 1; |
839 | if (i == B43_NR_LOGGED_TXSTATUS) | 819 | if (i == B43_NR_LOGGED_TXSTATUS) |
840 | i = 0; | 820 | i = 0; |
841 | log->end = i; | 821 | log->end = i; |
842 | cur = &(log->log[i]); | 822 | cur = &(log->log[i]); |
843 | memcpy(cur, status, sizeof(*cur)); | 823 | memcpy(cur, status, sizeof(*cur)); |
844 | spin_unlock(&log->lock); | ||
845 | } | 824 | } |
846 | 825 | ||
847 | void b43_debugfs_init(void) | 826 | void b43_debugfs_init(void) |