diff options
author | Dan Williams <dan.j.williams@intel.com> | 2011-11-17 20:59:49 -0500 |
---|---|---|
committer | James Bottomley <JBottomley@Parallels.com> | 2012-02-19 14:41:04 -0500 |
commit | b15ebe0b5d0b95aeb1d84cae3649df1e0e065e9b (patch) | |
tree | ff93ad5f8be5fe91c7e6cf4963253491ddd058fb /drivers/scsi/libsas/sas_internal.h | |
parent | 756f173fb5fa90ec15222e80fb579288be7794fd (diff) |
[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.h | 32 |
1 files changed, 7 insertions, 25 deletions
diff --git a/drivers/scsi/libsas/sas_internal.h b/drivers/scsi/libsas/sas_internal.h index 0d43408196f9..7fe4eded2866 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, | |||
92 | } | 92 | } |
93 | #endif | 93 | #endif |
94 | 94 | ||
95 | static inline void sas_queue_event(int event, spinlock_t *lock, | 95 | static inline void sas_queue_event(int event, unsigned long *pending, |
96 | unsigned long *pending, | ||
97 | struct work_struct *work, | 96 | struct work_struct *work, |
98 | struct sas_ha_struct *sas_ha) | 97 | struct sas_ha_struct *sas_ha) |
99 | { | 98 | { |
100 | unsigned long flags; | 99 | if (!test_and_set_bit(event, pending)) { |
100 | unsigned long flags; | ||
101 | 101 | ||
102 | spin_lock_irqsave(lock, flags); | 102 | spin_lock_irqsave(&sas_ha->state_lock, flags); |
103 | if (test_bit(event, pending)) { | 103 | if (sas_ha->state != SAS_HA_UNREGISTERED) |
104 | spin_unlock_irqrestore(lock, flags); | 104 | scsi_queue_work(sas_ha->core.shost, work); |
105 | return; | 105 | spin_unlock_irqrestore(&sas_ha->state_lock, flags); |
106 | } | 106 | } |
107 | __set_bit(event, pending); | ||
108 | spin_unlock_irqrestore(lock, flags); | ||
109 | |||
110 | spin_lock_irqsave(&sas_ha->state_lock, flags); | ||
111 | if (sas_ha->state != SAS_HA_UNREGISTERED) { | ||
112 | scsi_queue_work(sas_ha->core.shost, work); | ||
113 | } | ||
114 | spin_unlock_irqrestore(&sas_ha->state_lock, flags); | ||
115 | } | ||
116 | |||
117 | static inline void sas_begin_event(int event, spinlock_t *lock, | ||
118 | unsigned long *pending) | ||
119 | { | ||
120 | unsigned long flags; | ||
121 | |||
122 | spin_lock_irqsave(lock, flags); | ||
123 | __clear_bit(event, pending); | ||
124 | spin_unlock_irqrestore(lock, flags); | ||
125 | } | 107 | } |
126 | 108 | ||
127 | static inline void sas_fill_in_rphy(struct domain_device *dev, | 109 | static inline void sas_fill_in_rphy(struct domain_device *dev, |