diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2013-11-14 04:25:38 +0100 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2013-11-14 04:25:38 +0100 |
commit | 0d522ee7499e4abe7189b2f1728e838959b8ddde (patch) | |
tree | 094f60e8bdb0083b58a43a0decbca59443a66e39 /drivers/scsi/esas2r/esas2r_disc.c | |
parent | Merge branch 'for-3.13/drivers' of git://git.kernel.dk/linux-block (diff) | |
parent | Merge tag 'fcoe-3.13' into for-linus (diff) | |
download | linux-0d522ee7499e4abe7189b2f1728e838959b8ddde.tar.xz linux-0d522ee7499e4abe7189b2f1728e838959b8ddde.zip |
Merge tag 'scsi-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsi
Pull first round of SCSI updates from James Bottomley:
"This patch set is driver updates for qla4xxx, scsi_debug, pm80xx,
fcoe/libfc, eas2r, lpfc, be2iscsi and megaraid_sas plus some assorted
bug fixes and cleanups"
* tag 'scsi-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsi: (106 commits)
[SCSI] scsi_error: Escalate to LUN reset if abort fails
[SCSI] Add 'eh_deadline' to limit SCSI EH runtime
[SCSI] remove check for 'resetting'
[SCSI] dc395: Move 'last_reset' into internal host structure
[SCSI] tmscsim: Move 'last_reset' into host structure
[SCSI] advansys: Remove 'last_reset' references
[SCSI] dpt_i2o: return SCSI_MLQUEUE_HOST_BUSY when in reset
[SCSI] dpt_i2o: Remove DPTI_STATE_IOCTL
[SCSI] megaraid_sas: Fix synchronization problem between sysPD IO path and AEN path
[SCSI] lpfc: Fix typo on NULL assignment
[SCSI] scsi_dh_alua: ALUA handler attach should succeed while TPG is transitioning
[SCSI] scsi_dh_alua: ALUA check sense should retry device internal reset unit attention
[SCSI] esas2r: Cleanup snprinf formatting of firmware version
[SCSI] esas2r: Remove superfluous mask of pcie_cap_reg
[SCSI] esas2r: Fixes for big-endian platforms
[SCSI] esas2r: Directly call kernel functions for atomic bit operations
[SCSI] lpfc 8.3.43: Update lpfc version to driver version 8.3.43
[SCSI] lpfc 8.3.43: Fixed not processing task management IOCB response status
[SCSI] lpfc 8.3.43: Fixed spinlock hang.
[SCSI] lpfc 8.3.43: Fixed invalid Total_Data_Placed value received for els and ct command responses
...
Diffstat (limited to 'drivers/scsi/esas2r/esas2r_disc.c')
-rw-r--r-- | drivers/scsi/esas2r/esas2r_disc.c | 55 |
1 files changed, 25 insertions, 30 deletions
diff --git a/drivers/scsi/esas2r/esas2r_disc.c b/drivers/scsi/esas2r/esas2r_disc.c index dec6c334ce3e..1c079f4300a5 100644 --- a/drivers/scsi/esas2r/esas2r_disc.c +++ b/drivers/scsi/esas2r/esas2r_disc.c @@ -86,9 +86,9 @@ void esas2r_disc_initialize(struct esas2r_adapter *a) esas2r_trace_enter(); - esas2r_lock_clear_flags(&a->flags, AF_DISC_IN_PROG); - esas2r_lock_clear_flags(&a->flags2, AF2_DEV_SCAN); - esas2r_lock_clear_flags(&a->flags2, AF2_DEV_CNT_OK); + clear_bit(AF_DISC_IN_PROG, &a->flags); + clear_bit(AF2_DEV_SCAN, &a->flags2); + clear_bit(AF2_DEV_CNT_OK, &a->flags2); a->disc_start_time = jiffies_to_msecs(jiffies); a->disc_wait_time = nvr->dev_wait_time * 1000; @@ -107,7 +107,8 @@ void esas2r_disc_initialize(struct esas2r_adapter *a) a->general_req.interrupt_cx = NULL; - if (a->flags & (AF_CHPRST_DETECTED | AF_POWER_MGT)) { + if (test_bit(AF_CHPRST_DETECTED, &a->flags) || + test_bit(AF_POWER_MGT, &a->flags)) { if (a->prev_dev_cnt == 0) { /* Don't bother waiting if there is nothing to wait * for. @@ -212,9 +213,7 @@ void esas2r_disc_check_complete(struct esas2r_adapter *a) || a->disc_wait_cnt == 0)) { /* After three seconds of waiting, schedule a scan. */ if (time >= 3000 - && !(esas2r_lock_set_flags(&a->flags2, - AF2_DEV_SCAN) & - ilog2(AF2_DEV_SCAN))) { + && !test_and_set_bit(AF2_DEV_SCAN, &a->flags2)) { spin_lock_irqsave(&a->mem_lock, flags); esas2r_disc_queue_event(a, DCDE_DEV_SCAN); spin_unlock_irqrestore(&a->mem_lock, flags); @@ -228,18 +227,14 @@ void esas2r_disc_check_complete(struct esas2r_adapter *a) * We are done waiting...we think. Adjust the wait time to * consume events after the count is met. */ - if (!(esas2r_lock_set_flags(&a->flags2, AF2_DEV_CNT_OK) - & ilog2(AF2_DEV_CNT_OK))) + if (!test_and_set_bit(AF2_DEV_CNT_OK, &a->flags2)) a->disc_wait_time = time + 3000; /* If we haven't done a full scan yet, do it now. */ - if (!(esas2r_lock_set_flags(&a->flags2, - AF2_DEV_SCAN) & - ilog2(AF2_DEV_SCAN))) { + if (!test_and_set_bit(AF2_DEV_SCAN, &a->flags2)) { spin_lock_irqsave(&a->mem_lock, flags); esas2r_disc_queue_event(a, DCDE_DEV_SCAN); spin_unlock_irqrestore(&a->mem_lock, flags); - esas2r_trace_exit(); return; } @@ -253,9 +248,7 @@ void esas2r_disc_check_complete(struct esas2r_adapter *a) return; } } else { - if (!(esas2r_lock_set_flags(&a->flags2, - AF2_DEV_SCAN) & - ilog2(AF2_DEV_SCAN))) { + if (!test_and_set_bit(AF2_DEV_SCAN, &a->flags2)) { spin_lock_irqsave(&a->mem_lock, flags); esas2r_disc_queue_event(a, DCDE_DEV_SCAN); spin_unlock_irqrestore(&a->mem_lock, flags); @@ -265,8 +258,8 @@ void esas2r_disc_check_complete(struct esas2r_adapter *a) /* We want to stop waiting for devices. */ a->disc_wait_time = 0; - if ((a->flags & AF_DISC_POLLED) - && (a->flags & AF_DISC_IN_PROG)) { + if (test_bit(AF_DISC_POLLED, &a->flags) && + test_bit(AF_DISC_IN_PROG, &a->flags)) { /* * Polled discovery is still pending so continue the active * discovery until it is done. At that point, we will stop @@ -280,14 +273,14 @@ void esas2r_disc_check_complete(struct esas2r_adapter *a) * driven; i.e. There is no transition. */ esas2r_disc_fix_curr_requests(a); - esas2r_lock_clear_flags(&a->flags, AF_DISC_PENDING); + clear_bit(AF_DISC_PENDING, &a->flags); /* * We have deferred target state changes until now because we * don't want to report any removals (due to the first arrival) * until the device wait time expires. */ - esas2r_lock_set_flags(&a->flags, AF_PORT_CHANGE); + set_bit(AF_PORT_CHANGE, &a->flags); } esas2r_trace_exit(); @@ -308,7 +301,8 @@ void esas2r_disc_queue_event(struct esas2r_adapter *a, u8 disc_evt) * Don't start discovery before or during polled discovery. if we did, * we would have a deadlock if we are in the ISR already. */ - if (!(a->flags & (AF_CHPRST_PENDING | AF_DISC_POLLED))) + if (!test_bit(AF_CHPRST_PENDING, &a->flags) && + !test_bit(AF_DISC_POLLED, &a->flags)) esas2r_disc_start_port(a); esas2r_trace_exit(); @@ -322,7 +316,7 @@ bool esas2r_disc_start_port(struct esas2r_adapter *a) esas2r_trace_enter(); - if (a->flags & AF_DISC_IN_PROG) { + if (test_bit(AF_DISC_IN_PROG, &a->flags)) { esas2r_trace_exit(); return false; @@ -330,7 +324,7 @@ bool esas2r_disc_start_port(struct esas2r_adapter *a) /* If there is a discovery waiting, process it. */ if (dc->disc_evt) { - if ((a->flags & AF_DISC_POLLED) + if (test_bit(AF_DISC_POLLED, &a->flags) && a->disc_wait_time == 0) { /* * We are doing polled discovery, but we no longer want @@ -347,7 +341,7 @@ bool esas2r_disc_start_port(struct esas2r_adapter *a) esas2r_hdebug("disc done"); - esas2r_lock_set_flags(&a->flags, AF_PORT_CHANGE); + set_bit(AF_PORT_CHANGE, &a->flags); esas2r_trace_exit(); @@ -356,10 +350,10 @@ bool esas2r_disc_start_port(struct esas2r_adapter *a) /* Handle the discovery context */ esas2r_trace("disc_evt: %d", dc->disc_evt); - esas2r_lock_set_flags(&a->flags, AF_DISC_IN_PROG); + set_bit(AF_DISC_IN_PROG, &a->flags); dc->flags = 0; - if (a->flags & AF_DISC_POLLED) + if (test_bit(AF_DISC_POLLED, &a->flags)) dc->flags |= DCF_POLLED; rq->interrupt_cx = dc; @@ -379,7 +373,7 @@ bool esas2r_disc_start_port(struct esas2r_adapter *a) } /* Continue interrupt driven discovery */ - if (!(a->flags & AF_DISC_POLLED)) + if (!test_bit(AF_DISC_POLLED, &a->flags)) ret = esas2r_disc_continue(a, rq); else ret = true; @@ -453,10 +447,10 @@ static bool esas2r_disc_continue(struct esas2r_adapter *a, /* Discovery is done...for now. */ rq->interrupt_cx = NULL; - if (!(a->flags & AF_DISC_PENDING)) + if (!test_bit(AF_DISC_PENDING, &a->flags)) esas2r_disc_fix_curr_requests(a); - esas2r_lock_clear_flags(&a->flags, AF_DISC_IN_PROG); + clear_bit(AF_DISC_IN_PROG, &a->flags); /* Start the next discovery. */ return esas2r_disc_start_port(a); @@ -480,7 +474,8 @@ static bool esas2r_disc_start_request(struct esas2r_adapter *a, spin_lock_irqsave(&a->queue_lock, flags); - if (!(a->flags & (AF_CHPRST_PENDING | AF_FLASHING))) + if (!test_bit(AF_CHPRST_PENDING, &a->flags) && + !test_bit(AF_FLASHING, &a->flags)) esas2r_disc_local_start_request(a, rq); else list_add_tail(&rq->req_list, &a->defer_list); |