summaryrefslogtreecommitdiffstats
path: root/drivers/scsi/libsas/sas_internal.h
diff options
context:
space:
mode:
authorDan Williams <dan.j.williams@intel.com>2011-11-17 17:59:49 -0800
committerJames Bottomley <JBottomley@Parallels.com>2012-02-19 13:41:04 -0600
commitb15ebe0b5d0b95aeb1d84cae3649df1e0e065e9b (patch)
treeff93ad5f8be5fe91c7e6cf4963253491ddd058fb /drivers/scsi/libsas/sas_internal.h
parent756f173fb5fa90ec15222e80fb579288be7794fd (diff)
downloadop-kernel-dev-b15ebe0b5d0b95aeb1d84cae3649df1e0e065e9b.zip
op-kernel-dev-b15ebe0b5d0b95aeb1d84cae3649df1e0e065e9b.tar.gz
[SCSI] libsas: replace event locks with atomic bitops
The locks only served to make sure the pending event bitmask was updated consistently. Signed-off-by: Dan Williams <dan.j.williams@intel.com> Signed-off-by: James Bottomley <JBottomley@Parallels.com>
Diffstat (limited to 'drivers/scsi/libsas/sas_internal.h')
-rw-r--r--drivers/scsi/libsas/sas_internal.h32
1 files changed, 7 insertions, 25 deletions
diff --git a/drivers/scsi/libsas/sas_internal.h b/drivers/scsi/libsas/sas_internal.h
index 0d43408..7fe4ede 100644
--- a/drivers/scsi/libsas/sas_internal.h
+++ b/drivers/scsi/libsas/sas_internal.h
@@ -92,36 +92,18 @@ static inline int sas_smp_host_handler(struct Scsi_Host *shost,
}
#endif
-static inline void sas_queue_event(int event, spinlock_t *lock,
- unsigned long *pending,
+static inline void sas_queue_event(int event, unsigned long *pending,
struct work_struct *work,
struct sas_ha_struct *sas_ha)
{
- unsigned long flags;
+ if (!test_and_set_bit(event, pending)) {
+ unsigned long flags;
- spin_lock_irqsave(lock, flags);
- if (test_bit(event, pending)) {
- spin_unlock_irqrestore(lock, flags);
- return;
+ spin_lock_irqsave(&sas_ha->state_lock, flags);
+ if (sas_ha->state != SAS_HA_UNREGISTERED)
+ scsi_queue_work(sas_ha->core.shost, work);
+ spin_unlock_irqrestore(&sas_ha->state_lock, flags);
}
- __set_bit(event, pending);
- spin_unlock_irqrestore(lock, flags);
-
- spin_lock_irqsave(&sas_ha->state_lock, flags);
- if (sas_ha->state != SAS_HA_UNREGISTERED) {
- scsi_queue_work(sas_ha->core.shost, work);
- }
- spin_unlock_irqrestore(&sas_ha->state_lock, flags);
-}
-
-static inline void sas_begin_event(int event, spinlock_t *lock,
- unsigned long *pending)
-{
- unsigned long flags;
-
- spin_lock_irqsave(lock, flags);
- __clear_bit(event, pending);
- spin_unlock_irqrestore(lock, flags);
}
static inline void sas_fill_in_rphy(struct domain_device *dev,
OpenPOWER on IntegriCloud