aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless/b43/pio.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/net/wireless/b43/pio.c')
-rw-r--r--drivers/net/wireless/b43/pio.c38
1 files changed, 8 insertions, 30 deletions
diff --git a/drivers/net/wireless/b43/pio.c b/drivers/net/wireless/b43/pio.c
index ce6f36eb88ca..4635baa9b998 100644
--- a/drivers/net/wireless/b43/pio.c
+++ b/drivers/net/wireless/b43/pio.c
@@ -144,7 +144,6 @@ static struct b43_pio_txqueue *b43_setup_pioqueue_tx(struct b43_wldev *dev,
144 q = kzalloc(sizeof(*q), GFP_KERNEL); 144 q = kzalloc(sizeof(*q), GFP_KERNEL);
145 if (!q) 145 if (!q)
146 return NULL; 146 return NULL;
147 spin_lock_init(&q->lock);
148 q->dev = dev; 147 q->dev = dev;
149 q->rev = dev->dev->id.revision; 148 q->rev = dev->dev->id.revision;
150 q->mmio_base = index_to_pioqueue_base(dev, index) + 149 q->mmio_base = index_to_pioqueue_base(dev, index) +
@@ -179,7 +178,6 @@ static struct b43_pio_rxqueue *b43_setup_pioqueue_rx(struct b43_wldev *dev,
179 q = kzalloc(sizeof(*q), GFP_KERNEL); 178 q = kzalloc(sizeof(*q), GFP_KERNEL);
180 if (!q) 179 if (!q)
181 return NULL; 180 return NULL;
182 spin_lock_init(&q->lock);
183 q->dev = dev; 181 q->dev = dev;
184 q->rev = dev->dev->id.revision; 182 q->rev = dev->dev->id.revision;
185 q->mmio_base = index_to_pioqueue_base(dev, index) + 183 q->mmio_base = index_to_pioqueue_base(dev, index) +
@@ -494,7 +492,6 @@ int b43_pio_tx(struct b43_wldev *dev, struct sk_buff *skb)
494{ 492{
495 struct b43_pio_txqueue *q; 493 struct b43_pio_txqueue *q;
496 struct ieee80211_hdr *hdr; 494 struct ieee80211_hdr *hdr;
497 unsigned long flags;
498 unsigned int hdrlen, total_len; 495 unsigned int hdrlen, total_len;
499 int err = 0; 496 int err = 0;
500 struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb); 497 struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb);
@@ -512,20 +509,18 @@ int b43_pio_tx(struct b43_wldev *dev, struct sk_buff *skb)
512 q = select_queue_by_priority(dev, skb_get_queue_mapping(skb)); 509 q = select_queue_by_priority(dev, skb_get_queue_mapping(skb));
513 } 510 }
514 511
515 spin_lock_irqsave(&q->lock, flags);
516
517 hdrlen = b43_txhdr_size(dev); 512 hdrlen = b43_txhdr_size(dev);
518 total_len = roundup(skb->len + hdrlen, 4); 513 total_len = roundup(skb->len + hdrlen, 4);
519 514
520 if (unlikely(total_len > q->buffer_size)) { 515 if (unlikely(total_len > q->buffer_size)) {
521 err = -ENOBUFS; 516 err = -ENOBUFS;
522 b43dbg(dev->wl, "PIO: TX packet longer than queue.\n"); 517 b43dbg(dev->wl, "PIO: TX packet longer than queue.\n");
523 goto out_unlock; 518 goto out;
524 } 519 }
525 if (unlikely(q->free_packet_slots == 0)) { 520 if (unlikely(q->free_packet_slots == 0)) {
526 err = -ENOBUFS; 521 err = -ENOBUFS;
527 b43warn(dev->wl, "PIO: TX packet overflow.\n"); 522 b43warn(dev->wl, "PIO: TX packet overflow.\n");
528 goto out_unlock; 523 goto out;
529 } 524 }
530 B43_WARN_ON(q->buffer_used > q->buffer_size); 525 B43_WARN_ON(q->buffer_used > q->buffer_size);
531 526
@@ -534,7 +529,7 @@ int b43_pio_tx(struct b43_wldev *dev, struct sk_buff *skb)
534 err = -EBUSY; 529 err = -EBUSY;
535 ieee80211_stop_queue(dev->wl->hw, skb_get_queue_mapping(skb)); 530 ieee80211_stop_queue(dev->wl->hw, skb_get_queue_mapping(skb));
536 q->stopped = 1; 531 q->stopped = 1;
537 goto out_unlock; 532 goto out;
538 } 533 }
539 534
540 /* Assign the queue number to the ring (if not already done before) 535 /* Assign the queue number to the ring (if not already done before)
@@ -548,11 +543,11 @@ int b43_pio_tx(struct b43_wldev *dev, struct sk_buff *skb)
548 * anymore and must not transmit it unencrypted. */ 543 * anymore and must not transmit it unencrypted. */
549 dev_kfree_skb_any(skb); 544 dev_kfree_skb_any(skb);
550 err = 0; 545 err = 0;
551 goto out_unlock; 546 goto out;
552 } 547 }
553 if (unlikely(err)) { 548 if (unlikely(err)) {
554 b43err(dev->wl, "PIO transmission failure\n"); 549 b43err(dev->wl, "PIO transmission failure\n");
555 goto out_unlock; 550 goto out;
556 } 551 }
557 q->nr_tx_packets++; 552 q->nr_tx_packets++;
558 553
@@ -564,9 +559,7 @@ int b43_pio_tx(struct b43_wldev *dev, struct sk_buff *skb)
564 q->stopped = 1; 559 q->stopped = 1;
565 } 560 }
566 561
567out_unlock: 562out:
568 spin_unlock_irqrestore(&q->lock, flags);
569
570 return err; 563 return err;
571} 564}
572 565
@@ -583,8 +576,6 @@ void b43_pio_handle_txstatus(struct b43_wldev *dev,
583 return; 576 return;
584 B43_WARN_ON(!pack); 577 B43_WARN_ON(!pack);
585 578
586 spin_lock_irq(&q->lock);
587
588 info = IEEE80211_SKB_CB(pack->skb); 579 info = IEEE80211_SKB_CB(pack->skb);
589 580
590 b43_fill_txstatus_report(dev, info, status); 581 b43_fill_txstatus_report(dev, info, status);
@@ -602,8 +593,6 @@ void b43_pio_handle_txstatus(struct b43_wldev *dev,
602 ieee80211_wake_queue(dev->wl->hw, q->queue_prio); 593 ieee80211_wake_queue(dev->wl->hw, q->queue_prio);
603 q->stopped = 0; 594 q->stopped = 0;
604 } 595 }
605
606 spin_unlock_irq(&q->lock);
607} 596}
608 597
609void b43_pio_get_tx_stats(struct b43_wldev *dev, 598void b43_pio_get_tx_stats(struct b43_wldev *dev,
@@ -611,17 +600,14 @@ void b43_pio_get_tx_stats(struct b43_wldev *dev,
611{ 600{
612 const int nr_queues = dev->wl->hw->queues; 601 const int nr_queues = dev->wl->hw->queues;
613 struct b43_pio_txqueue *q; 602 struct b43_pio_txqueue *q;
614 unsigned long flags;
615 int i; 603 int i;
616 604
617 for (i = 0; i < nr_queues; i++) { 605 for (i = 0; i < nr_queues; i++) {
618 q = select_queue_by_priority(dev, i); 606 q = select_queue_by_priority(dev, i);
619 607
620 spin_lock_irqsave(&q->lock, flags);
621 stats[i].len = B43_PIO_MAX_NR_TXPACKETS - q->free_packet_slots; 608 stats[i].len = B43_PIO_MAX_NR_TXPACKETS - q->free_packet_slots;
622 stats[i].limit = B43_PIO_MAX_NR_TXPACKETS; 609 stats[i].limit = B43_PIO_MAX_NR_TXPACKETS;
623 stats[i].count = q->nr_tx_packets; 610 stats[i].count = q->nr_tx_packets;
624 spin_unlock_irqrestore(&q->lock, flags);
625 } 611 }
626} 612}
627 613
@@ -768,9 +754,9 @@ static void b43_pio_rx_work(struct work_struct *work)
768 bool stop; 754 bool stop;
769 755
770 do { 756 do {
771 spin_lock_irq(&q->lock); 757 mutex_lock(&q->dev->wl->mutex);
772 stop = (pio_rx_frame(q) == 0); 758 stop = (pio_rx_frame(q) == 0);
773 spin_unlock_irq(&q->lock); 759 mutex_unlock(&q->dev->wl->mutex);
774 cond_resched(); 760 cond_resched();
775 if (stop) 761 if (stop)
776 break; 762 break;
@@ -787,9 +773,6 @@ void b43_pio_rx(struct b43_pio_rxqueue *q)
787 773
788static void b43_pio_tx_suspend_queue(struct b43_pio_txqueue *q) 774static void b43_pio_tx_suspend_queue(struct b43_pio_txqueue *q)
789{ 775{
790 unsigned long flags;
791
792 spin_lock_irqsave(&q->lock, flags);
793 if (q->rev >= 8) { 776 if (q->rev >= 8) {
794 b43_piotx_write32(q, B43_PIO8_TXCTL, 777 b43_piotx_write32(q, B43_PIO8_TXCTL,
795 b43_piotx_read32(q, B43_PIO8_TXCTL) 778 b43_piotx_read32(q, B43_PIO8_TXCTL)
@@ -799,14 +782,10 @@ static void b43_pio_tx_suspend_queue(struct b43_pio_txqueue *q)
799 b43_piotx_read16(q, B43_PIO_TXCTL) 782 b43_piotx_read16(q, B43_PIO_TXCTL)
800 | B43_PIO_TXCTL_SUSPREQ); 783 | B43_PIO_TXCTL_SUSPREQ);
801 } 784 }
802 spin_unlock_irqrestore(&q->lock, flags);
803} 785}
804 786
805static void b43_pio_tx_resume_queue(struct b43_pio_txqueue *q) 787static void b43_pio_tx_resume_queue(struct b43_pio_txqueue *q)
806{ 788{
807 unsigned long flags;
808
809 spin_lock_irqsave(&q->lock, flags);
810 if (q->rev >= 8) { 789 if (q->rev >= 8) {
811 b43_piotx_write32(q, B43_PIO8_TXCTL, 790 b43_piotx_write32(q, B43_PIO8_TXCTL,
812 b43_piotx_read32(q, B43_PIO8_TXCTL) 791 b43_piotx_read32(q, B43_PIO8_TXCTL)
@@ -816,7 +795,6 @@ static void b43_pio_tx_resume_queue(struct b43_pio_txqueue *q)
816 b43_piotx_read16(q, B43_PIO_TXCTL) 795 b43_piotx_read16(q, B43_PIO_TXCTL)
817 & ~B43_PIO_TXCTL_SUSPREQ); 796 & ~B43_PIO_TXCTL_SUSPREQ);
818 } 797 }
819 spin_unlock_irqrestore(&q->lock, flags);
820} 798}
821 799
822void b43_pio_tx_suspend(struct b43_wldev *dev) 800void b43_pio_tx_suspend(struct b43_wldev *dev)