diff options
author | Helmut Schaa <helmut.schaa@googlemail.com> | 2011-03-03 13:45:16 -0500 |
---|---|---|
committer | John W. Linville <linville@tuxdriver.com> | 2011-03-04 14:06:48 -0500 |
commit | 0aa13b2e06fbb8327c7acb4ccf684b2b65c302ce (patch) | |
tree | 2393be04e8ea1015a8a67b52eaa13b33204aa532 /drivers/net/wireless/rt2x00/rt2500pci.c | |
parent | 567108ebd352f21640c536ea3b39584f9e7c28f8 (diff) |
rt2x00: Revise irqmask locking for PCI devices
The PCI device irqmask is locked by a spin_lock. Currently
spin_lock_irqsave is used everywhere. To reduce the locking overhead
replace spin_lock_irqsave in hard irq context with spin_lock and in
soft irq context with spin_lock_irq.
Signed-off-by: Helmut Schaa <helmut.schaa@googlemail.com>
Signed-off-by: Ivo van Doorn <IvDoorn@gmail.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers/net/wireless/rt2x00/rt2500pci.c')
-rw-r--r-- | drivers/net/wireless/rt2x00/rt2500pci.c | 15 |
1 files changed, 6 insertions, 9 deletions
diff --git a/drivers/net/wireless/rt2x00/rt2500pci.c b/drivers/net/wireless/rt2x00/rt2500pci.c index 0fbc18cb7304..635f80466540 100644 --- a/drivers/net/wireless/rt2x00/rt2500pci.c +++ b/drivers/net/wireless/rt2x00/rt2500pci.c | |||
@@ -1449,27 +1449,25 @@ static void rt2500pci_txdone(struct rt2x00_dev *rt2x00dev, | |||
1449 | static void rt2500pci_enable_interrupt(struct rt2x00_dev *rt2x00dev, | 1449 | static void rt2500pci_enable_interrupt(struct rt2x00_dev *rt2x00dev, |
1450 | struct rt2x00_field32 irq_field) | 1450 | struct rt2x00_field32 irq_field) |
1451 | { | 1451 | { |
1452 | unsigned long flags; | ||
1453 | u32 reg; | 1452 | u32 reg; |
1454 | 1453 | ||
1455 | /* | 1454 | /* |
1456 | * Enable a single interrupt. The interrupt mask register | 1455 | * Enable a single interrupt. The interrupt mask register |
1457 | * access needs locking. | 1456 | * access needs locking. |
1458 | */ | 1457 | */ |
1459 | spin_lock_irqsave(&rt2x00dev->irqmask_lock, flags); | 1458 | spin_lock_irq(&rt2x00dev->irqmask_lock); |
1460 | 1459 | ||
1461 | rt2x00pci_register_read(rt2x00dev, CSR8, ®); | 1460 | rt2x00pci_register_read(rt2x00dev, CSR8, ®); |
1462 | rt2x00_set_field32(®, irq_field, 0); | 1461 | rt2x00_set_field32(®, irq_field, 0); |
1463 | rt2x00pci_register_write(rt2x00dev, CSR8, reg); | 1462 | rt2x00pci_register_write(rt2x00dev, CSR8, reg); |
1464 | 1463 | ||
1465 | spin_unlock_irqrestore(&rt2x00dev->irqmask_lock, flags); | 1464 | spin_unlock_irq(&rt2x00dev->irqmask_lock); |
1466 | } | 1465 | } |
1467 | 1466 | ||
1468 | static void rt2500pci_txstatus_tasklet(unsigned long data) | 1467 | static void rt2500pci_txstatus_tasklet(unsigned long data) |
1469 | { | 1468 | { |
1470 | struct rt2x00_dev *rt2x00dev = (struct rt2x00_dev *)data; | 1469 | struct rt2x00_dev *rt2x00dev = (struct rt2x00_dev *)data; |
1471 | u32 reg; | 1470 | u32 reg; |
1472 | unsigned long flags; | ||
1473 | 1471 | ||
1474 | /* | 1472 | /* |
1475 | * Handle all tx queues. | 1473 | * Handle all tx queues. |
@@ -1481,7 +1479,7 @@ static void rt2500pci_txstatus_tasklet(unsigned long data) | |||
1481 | /* | 1479 | /* |
1482 | * Enable all TXDONE interrupts again. | 1480 | * Enable all TXDONE interrupts again. |
1483 | */ | 1481 | */ |
1484 | spin_lock_irqsave(&rt2x00dev->irqmask_lock, flags); | 1482 | spin_lock_irq(&rt2x00dev->irqmask_lock); |
1485 | 1483 | ||
1486 | rt2x00pci_register_read(rt2x00dev, CSR8, ®); | 1484 | rt2x00pci_register_read(rt2x00dev, CSR8, ®); |
1487 | rt2x00_set_field32(®, CSR8_TXDONE_TXRING, 0); | 1485 | rt2x00_set_field32(®, CSR8_TXDONE_TXRING, 0); |
@@ -1489,7 +1487,7 @@ static void rt2500pci_txstatus_tasklet(unsigned long data) | |||
1489 | rt2x00_set_field32(®, CSR8_TXDONE_PRIORING, 0); | 1487 | rt2x00_set_field32(®, CSR8_TXDONE_PRIORING, 0); |
1490 | rt2x00pci_register_write(rt2x00dev, CSR8, reg); | 1488 | rt2x00pci_register_write(rt2x00dev, CSR8, reg); |
1491 | 1489 | ||
1492 | spin_unlock_irqrestore(&rt2x00dev->irqmask_lock, flags); | 1490 | spin_unlock_irq(&rt2x00dev->irqmask_lock); |
1493 | } | 1491 | } |
1494 | 1492 | ||
1495 | static void rt2500pci_tbtt_tasklet(unsigned long data) | 1493 | static void rt2500pci_tbtt_tasklet(unsigned long data) |
@@ -1510,7 +1508,6 @@ static irqreturn_t rt2500pci_interrupt(int irq, void *dev_instance) | |||
1510 | { | 1508 | { |
1511 | struct rt2x00_dev *rt2x00dev = dev_instance; | 1509 | struct rt2x00_dev *rt2x00dev = dev_instance; |
1512 | u32 reg, mask; | 1510 | u32 reg, mask; |
1513 | unsigned long flags; | ||
1514 | 1511 | ||
1515 | /* | 1512 | /* |
1516 | * Get the interrupt sources & saved to local variable. | 1513 | * Get the interrupt sources & saved to local variable. |
@@ -1552,13 +1549,13 @@ static irqreturn_t rt2500pci_interrupt(int irq, void *dev_instance) | |||
1552 | * Disable all interrupts for which a tasklet was scheduled right now, | 1549 | * Disable all interrupts for which a tasklet was scheduled right now, |
1553 | * the tasklet will reenable the appropriate interrupts. | 1550 | * the tasklet will reenable the appropriate interrupts. |
1554 | */ | 1551 | */ |
1555 | spin_lock_irqsave(&rt2x00dev->irqmask_lock, flags); | 1552 | spin_lock(&rt2x00dev->irqmask_lock); |
1556 | 1553 | ||
1557 | rt2x00pci_register_read(rt2x00dev, CSR8, ®); | 1554 | rt2x00pci_register_read(rt2x00dev, CSR8, ®); |
1558 | reg |= mask; | 1555 | reg |= mask; |
1559 | rt2x00pci_register_write(rt2x00dev, CSR8, reg); | 1556 | rt2x00pci_register_write(rt2x00dev, CSR8, reg); |
1560 | 1557 | ||
1561 | spin_unlock_irqrestore(&rt2x00dev->irqmask_lock, flags); | 1558 | spin_unlock(&rt2x00dev->irqmask_lock); |
1562 | 1559 | ||
1563 | return IRQ_HANDLED; | 1560 | return IRQ_HANDLED; |
1564 | } | 1561 | } |