Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

b43: Remove DMA/PIO queue locks

This removes the DMA/PIO queue locks. Locking is handled by
wl->mutex now.

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>

authored by

Michael Buesch and committed by
John W. Linville
637dae3f f5d40eed

+13 -60
+5 -25
drivers/net/wireless/b43/dma.c
··· 856 856 } else 857 857 B43_WARN_ON(1); 858 858 } 859 - spin_lock_init(&ring->lock); 860 859 #ifdef CONFIG_B43_DEBUG 861 860 ring->last_injected_overflow = jiffies; 862 861 #endif ··· 1314 1315 struct b43_dmaring *ring; 1315 1316 struct ieee80211_hdr *hdr; 1316 1317 int err = 0; 1317 - unsigned long flags; 1318 1318 struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb); 1319 1319 1320 1320 hdr = (struct ieee80211_hdr *)skb->data; ··· 1329 1331 dev, skb_get_queue_mapping(skb)); 1330 1332 } 1331 1333 1332 - spin_lock_irqsave(&ring->lock, flags); 1333 - 1334 1334 B43_WARN_ON(!ring->tx); 1335 1335 1336 1336 if (unlikely(ring->stopped)) { ··· 1339 1343 if (b43_debug(dev, B43_DBG_DMAVERBOSE)) 1340 1344 b43err(dev->wl, "Packet after queue stopped\n"); 1341 1345 err = -ENOSPC; 1342 - goto out_unlock; 1346 + goto out; 1343 1347 } 1344 1348 1345 1349 if (unlikely(WARN_ON(free_slots(ring) < TX_SLOTS_PER_FRAME))) { ··· 1347 1351 * full, but queues not stopped. */ 1348 1352 b43err(dev->wl, "DMA queue overflow\n"); 1349 1353 err = -ENOSPC; 1350 - goto out_unlock; 1354 + goto out; 1351 1355 } 1352 1356 1353 1357 /* Assign the queue number to the ring (if not already done before) ··· 1361 1365 * anymore and must not transmit it unencrypted. */ 1362 1366 dev_kfree_skb_any(skb); 1363 1367 err = 0; 1364 - goto out_unlock; 1368 + goto out; 1365 1369 } 1366 1370 if (unlikely(err)) { 1367 1371 b43err(dev->wl, "DMA tx mapping failure\n"); 1368 - goto out_unlock; 1372 + goto out; 1369 1373 } 1370 1374 ring->nr_tx_packets++; 1371 1375 if ((free_slots(ring) < TX_SLOTS_PER_FRAME) || ··· 1377 1381 b43dbg(dev->wl, "Stopped TX ring %d\n", ring->index); 1378 1382 } 1379 1383 } 1380 - out_unlock: 1381 - spin_unlock_irqrestore(&ring->lock, flags); 1384 + out: 1382 1385 1383 1386 return err; 1384 1387 } ··· 1395 1400 ring = parse_cookie(dev, status->cookie, &slot); 1396 1401 if (unlikely(!ring)) 1397 1402 return; 1398 - 1399 - spin_lock_irq(&ring->lock); 1400 1403 1401 1404 B43_WARN_ON(!ring->tx); 1402 1405 ops = ring->ops; ··· 1454 1461 b43dbg(dev->wl, "Woke up TX ring %d\n", ring->index); 1455 1462 } 1456 1463 } 1457 - 1458 - spin_unlock_irq(&ring->lock); 1459 1464 } 1460 1465 1461 1466 void b43_dma_get_tx_stats(struct b43_wldev *dev, ··· 1461 1470 { 1462 1471 const int nr_queues = dev->wl->hw->queues; 1463 1472 struct b43_dmaring *ring; 1464 - unsigned long flags; 1465 1473 int i; 1466 1474 1467 1475 for (i = 0; i < nr_queues; i++) { 1468 1476 ring = select_ring_by_priority(dev, i); 1469 1477 1470 - spin_lock_irqsave(&ring->lock, flags); 1471 1478 stats[i].len = ring->used_slots / TX_SLOTS_PER_FRAME; 1472 1479 stats[i].limit = ring->nr_slots / TX_SLOTS_PER_FRAME; 1473 1480 stats[i].count = ring->nr_tx_packets; 1474 - spin_unlock_irqrestore(&ring->lock, flags); 1475 1481 } 1476 1482 } 1477 1483 ··· 1579 1591 1580 1592 static void b43_dma_tx_suspend_ring(struct b43_dmaring *ring) 1581 1593 { 1582 - unsigned long flags; 1583 - 1584 - spin_lock_irqsave(&ring->lock, flags); 1585 1594 B43_WARN_ON(!ring->tx); 1586 1595 ring->ops->tx_suspend(ring); 1587 - spin_unlock_irqrestore(&ring->lock, flags); 1588 1596 } 1589 1597 1590 1598 static void b43_dma_tx_resume_ring(struct b43_dmaring *ring) 1591 1599 { 1592 - unsigned long flags; 1593 - 1594 - spin_lock_irqsave(&ring->lock, flags); 1595 1600 B43_WARN_ON(!ring->tx); 1596 1601 ring->ops->tx_resume(ring); 1597 - spin_unlock_irqrestore(&ring->lock, flags); 1598 1602 } 1599 1603 1600 1604 void b43_dma_tx_suspend(struct b43_wldev *dev)
-3
drivers/net/wireless/b43/dma.h
··· 2 2 #define B43_DMA_H_ 3 3 4 4 #include <linux/ieee80211.h> 5 - #include <linux/spinlock.h> 6 5 7 6 #include "b43.h" 8 7 ··· 243 244 /* The QOS priority assigned to this ring. Only used for TX rings. 244 245 * This is the mac80211 "queue" value. */ 245 246 u8 queue_prio; 246 - /* Lock, only used for TX. */ 247 - spinlock_t lock; 248 247 struct b43_wldev *dev; 249 248 #ifdef CONFIG_B43_DEBUG 250 249 /* Maximum number of used slots. */
+8 -30
drivers/net/wireless/b43/pio.c
··· 144 144 q = kzalloc(sizeof(*q), GFP_KERNEL); 145 145 if (!q) 146 146 return NULL; 147 - spin_lock_init(&q->lock); 148 147 q->dev = dev; 149 148 q->rev = dev->dev->id.revision; 150 149 q->mmio_base = index_to_pioqueue_base(dev, index) + ··· 178 179 q = kzalloc(sizeof(*q), GFP_KERNEL); 179 180 if (!q) 180 181 return NULL; 181 - spin_lock_init(&q->lock); 182 182 q->dev = dev; 183 183 q->rev = dev->dev->id.revision; 184 184 q->mmio_base = index_to_pioqueue_base(dev, index) + ··· 492 494 { 493 495 struct b43_pio_txqueue *q; 494 496 struct ieee80211_hdr *hdr; 495 - unsigned long flags; 496 497 unsigned int hdrlen, total_len; 497 498 int err = 0; 498 499 struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb); ··· 509 512 q = select_queue_by_priority(dev, skb_get_queue_mapping(skb)); 510 513 } 511 514 512 - spin_lock_irqsave(&q->lock, flags); 513 - 514 515 hdrlen = b43_txhdr_size(dev); 515 516 total_len = roundup(skb->len + hdrlen, 4); 516 517 517 518 if (unlikely(total_len > q->buffer_size)) { 518 519 err = -ENOBUFS; 519 520 b43dbg(dev->wl, "PIO: TX packet longer than queue.\n"); 520 - goto out_unlock; 521 + goto out; 521 522 } 522 523 if (unlikely(q->free_packet_slots == 0)) { 523 524 err = -ENOBUFS; 524 525 b43warn(dev->wl, "PIO: TX packet overflow.\n"); 525 - goto out_unlock; 526 + goto out; 526 527 } 527 528 B43_WARN_ON(q->buffer_used > q->buffer_size); 528 529 ··· 529 534 err = -EBUSY; 530 535 ieee80211_stop_queue(dev->wl->hw, skb_get_queue_mapping(skb)); 531 536 q->stopped = 1; 532 - goto out_unlock; 537 + goto out; 533 538 } 534 539 535 540 /* Assign the queue number to the ring (if not already done before) ··· 543 548 * anymore and must not transmit it unencrypted. */ 544 549 dev_kfree_skb_any(skb); 545 550 err = 0; 546 - goto out_unlock; 551 + goto out; 547 552 } 548 553 if (unlikely(err)) { 549 554 b43err(dev->wl, "PIO transmission failure\n"); 550 - goto out_unlock; 555 + goto out; 551 556 } 552 557 q->nr_tx_packets++; 553 558 ··· 559 564 q->stopped = 1; 560 565 } 561 566 562 - out_unlock: 563 - spin_unlock_irqrestore(&q->lock, flags); 564 - 567 + out: 565 568 return err; 566 569 } 567 570 ··· 575 582 if (unlikely(!q)) 576 583 return; 577 584 B43_WARN_ON(!pack); 578 - 579 - spin_lock_irq(&q->lock); 580 585 581 586 info = IEEE80211_SKB_CB(pack->skb); 582 587 ··· 593 602 ieee80211_wake_queue(dev->wl->hw, q->queue_prio); 594 603 q->stopped = 0; 595 604 } 596 - 597 - spin_unlock_irq(&q->lock); 598 605 } 599 606 600 607 void b43_pio_get_tx_stats(struct b43_wldev *dev, ··· 600 611 { 601 612 const int nr_queues = dev->wl->hw->queues; 602 613 struct b43_pio_txqueue *q; 603 - unsigned long flags; 604 614 int i; 605 615 606 616 for (i = 0; i < nr_queues; i++) { 607 617 q = select_queue_by_priority(dev, i); 608 618 609 - spin_lock_irqsave(&q->lock, flags); 610 619 stats[i].len = B43_PIO_MAX_NR_TXPACKETS - q->free_packet_slots; 611 620 stats[i].limit = B43_PIO_MAX_NR_TXPACKETS; 612 621 stats[i].count = q->nr_tx_packets; 613 - spin_unlock_irqrestore(&q->lock, flags); 614 622 } 615 623 } 616 624 ··· 754 768 bool stop; 755 769 756 770 do { 757 - spin_lock_irq(&q->lock); 771 + mutex_lock(&q->dev->wl->mutex); 758 772 stop = (pio_rx_frame(q) == 0); 759 - spin_unlock_irq(&q->lock); 773 + mutex_unlock(&q->dev->wl->mutex); 760 774 cond_resched(); 761 775 if (stop) 762 776 break; ··· 773 787 774 788 static void b43_pio_tx_suspend_queue(struct b43_pio_txqueue *q) 775 789 { 776 - unsigned long flags; 777 - 778 - spin_lock_irqsave(&q->lock, flags); 779 790 if (q->rev >= 8) { 780 791 b43_piotx_write32(q, B43_PIO8_TXCTL, 781 792 b43_piotx_read32(q, B43_PIO8_TXCTL) ··· 782 799 b43_piotx_read16(q, B43_PIO_TXCTL) 783 800 | B43_PIO_TXCTL_SUSPREQ); 784 801 } 785 - spin_unlock_irqrestore(&q->lock, flags); 786 802 } 787 803 788 804 static void b43_pio_tx_resume_queue(struct b43_pio_txqueue *q) 789 805 { 790 - unsigned long flags; 791 - 792 - spin_lock_irqsave(&q->lock, flags); 793 806 if (q->rev >= 8) { 794 807 b43_piotx_write32(q, B43_PIO8_TXCTL, 795 808 b43_piotx_read32(q, B43_PIO8_TXCTL) ··· 795 816 b43_piotx_read16(q, B43_PIO_TXCTL) 796 817 & ~B43_PIO_TXCTL_SUSPREQ); 797 818 } 798 - spin_unlock_irqrestore(&q->lock, flags); 799 819 } 800 820 801 821 void b43_pio_tx_suspend(struct b43_wldev *dev)
-2
drivers/net/wireless/b43/pio.h
··· 70 70 71 71 struct b43_pio_txqueue { 72 72 struct b43_wldev *dev; 73 - spinlock_t lock; 74 73 u16 mmio_base; 75 74 76 75 /* The device queue buffer size in bytes. */ ··· 102 103 103 104 struct b43_pio_rxqueue { 104 105 struct b43_wldev *dev; 105 - spinlock_t lock; 106 106 u16 mmio_base; 107 107 108 108 /* Work to reduce latency issues on RX. */