aic94xx: use bitops
PATCH 6/7 aic94xx: use bitops
Use bitops for testing, setting and clearing bits
Signed-off-by Alexis Bruemmer <[email protected]>
---
drivers/scsi/sas/sas_internal.h +5 -4
@@ -76,21 +76,22 @@unsigned long flags;spin_lock_irqsave (lock, flags); -if (*pending & (1 << event)) { +if (test_bit (event, pending)) {spin_unlock_irqrestore (lock, flags);return ; } - *pending |= (1 << event); +__set_bit (event, pending);spin_unlock_irqrestore (lock, flags);scsi_queue_work (shost, work); } -static inline void sas_begin_event (int event,spinlock_t *lock,u32 *pending) +static inline void sas_begin_event (int event,spinlock_t *lock, +unsigned long *pending) {unsigned long flags;spin_lock_irqsave (lock, flags); - *pending &= ~(1 << event); +__clear_bit (event, pending);spin_unlock_irqrestore (lock, flags); }
Quoted 13 lines
drivers/scsi/sas/sas_internal.h +2
-3spin_lock_irqsave (lock, flags); -if (*pending & (1 << event)) { +if (test_bit (event, pending)) {spin_unlock_irqrestore (lock, flags);return ; } - *pending |= (1 << event); +__set_bit (event, pending);spin_unlock_irqrestore (lock, flags);scsi_queue_work (shost, work); } -static inline void sas_begin_event (int event,spinlock_t *lock,u32 *pending)
drivers/scsi/sas/sas_internal.h line 96
Quoted 10 lines
drivers/scsi/sas/sas_internal.h +3
-1+static inline void sas_begin_event (int event,spinlock_t *lock, +unsigned long *pending) {unsigned long flags;spin_lock_irqsave (lock, flags); - *pending &= ~(1 << event); +__clear_bit (event, pending);spin_unlock_irqrestore (lock, flags); }
What else does the spinlock protect? By using test_and_set_bit/clear_bit you could get rid of them unless it's needed elsewhere.