Commit f8daa6e6 authored by Dan Williams's avatar Dan Williams Committed by James Bottomley

[SCSI] libsas: convert ha->state to flags

In preparation for adding new states (SAS_HA_DRAINING, SAS_HA_FROZEN),
convert ha->state into a set of flags.
Signed-off-by: default avatarDan Williams <dan.j.williams@intel.com>
Signed-off-by: default avatarJames Bottomley <JBottomley@Parallels.com>
parent b15ebe0b
...@@ -112,7 +112,7 @@ int sas_register_ha(struct sas_ha_struct *sas_ha) ...@@ -112,7 +112,7 @@ int sas_register_ha(struct sas_ha_struct *sas_ha)
else if (sas_ha->lldd_queue_size == -1) else if (sas_ha->lldd_queue_size == -1)
sas_ha->lldd_queue_size = 128; /* Sanity */ sas_ha->lldd_queue_size = 128; /* Sanity */
sas_ha->state = SAS_HA_REGISTERED; set_bit(SAS_HA_REGISTERED, &sas_ha->state);
spin_lock_init(&sas_ha->state_lock); spin_lock_init(&sas_ha->state_lock);
error = sas_register_phys(sas_ha); error = sas_register_phys(sas_ha);
...@@ -160,7 +160,7 @@ int sas_unregister_ha(struct sas_ha_struct *sas_ha) ...@@ -160,7 +160,7 @@ int sas_unregister_ha(struct sas_ha_struct *sas_ha)
/* Set the state to unregistered to avoid further /* Set the state to unregistered to avoid further
* events to be queued */ * events to be queued */
spin_lock_irqsave(&sas_ha->state_lock, flags); spin_lock_irqsave(&sas_ha->state_lock, flags);
sas_ha->state = SAS_HA_UNREGISTERED; clear_bit(SAS_HA_REGISTERED, &sas_ha->state);
spin_unlock_irqrestore(&sas_ha->state_lock, flags); spin_unlock_irqrestore(&sas_ha->state_lock, flags);
scsi_flush_work(sas_ha->core.shost); scsi_flush_work(sas_ha->core.shost);
......
...@@ -100,7 +100,7 @@ static inline void sas_queue_event(int event, unsigned long *pending, ...@@ -100,7 +100,7 @@ static inline void sas_queue_event(int event, unsigned long *pending,
unsigned long flags; unsigned long flags;
spin_lock_irqsave(&sas_ha->state_lock, flags); spin_lock_irqsave(&sas_ha->state_lock, flags);
if (sas_ha->state != SAS_HA_UNREGISTERED) if (test_bit(SAS_HA_REGISTERED, &sas_ha->state))
scsi_queue_work(sas_ha->core.shost, work); scsi_queue_work(sas_ha->core.shost, work);
spin_unlock_irqrestore(&sas_ha->state_lock, flags); spin_unlock_irqrestore(&sas_ha->state_lock, flags);
} }
......
...@@ -330,7 +330,6 @@ struct sas_ha_event { ...@@ -330,7 +330,6 @@ struct sas_ha_event {
enum sas_ha_state { enum sas_ha_state {
SAS_HA_REGISTERED, SAS_HA_REGISTERED,
SAS_HA_UNREGISTERED
}; };
struct sas_ha_struct { struct sas_ha_struct {
...@@ -338,7 +337,7 @@ struct sas_ha_struct { ...@@ -338,7 +337,7 @@ struct sas_ha_struct {
struct sas_ha_event ha_events[HA_NUM_EVENTS]; struct sas_ha_event ha_events[HA_NUM_EVENTS];
unsigned long pending; unsigned long pending;
enum sas_ha_state state; unsigned long state;
spinlock_t state_lock; spinlock_t state_lock;
struct scsi_core core; struct scsi_core core;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment