diff options
Diffstat (limited to 'drivers/scsi/esas2r/esas2r_flash.c')
-rw-r--r-- | drivers/scsi/esas2r/esas2r_flash.c | 34 |
1 files changed, 19 insertions, 15 deletions
diff --git a/drivers/scsi/esas2r/esas2r_flash.c b/drivers/scsi/esas2r/esas2r_flash.c index 2ec3c23275b8..b7dc59fca7a6 100644 --- a/drivers/scsi/esas2r/esas2r_flash.c +++ b/drivers/scsi/esas2r/esas2r_flash.c @@ -231,7 +231,7 @@ static bool load_image(struct esas2r_adapter *a, struct esas2r_request *rq) * RS_PENDING, FM API tasks will continue. */ rq->req_stat = RS_PENDING; - if (a->flags & AF_DEGRADED_MODE) + if (test_bit(AF_DEGRADED_MODE, &a->flags)) /* not suppported for now */; else build_flash_msg(a, rq); @@ -315,7 +315,7 @@ static bool complete_fmapi_req(struct esas2r_adapter *a, memset(fc->scratch, 0, FM_BUF_SZ); esas2r_enable_heartbeat(a); - esas2r_lock_clear_flags(&a->flags, AF_FLASH_LOCK); + clear_bit(AF_FLASH_LOCK, &a->flags); return false; } @@ -526,7 +526,7 @@ no_cfg: * The download is complete. If in degraded mode, * attempt a chip reset. */ - if (a->flags & AF_DEGRADED_MODE) + if (test_bit(AF_DEGRADED_MODE, &a->flags)) esas2r_local_reset_adapter(a); a->flash_ver = fi->cmp_hdr[CH_IT_BIOS].version; @@ -890,7 +890,7 @@ bool esas2r_process_fs_ioctl(struct esas2r_adapter *a, } } - if (a->flags & AF_DEGRADED_MODE) { + if (test_bit(AF_DEGRADED_MODE, &a->flags)) { fs->status = ATTO_STS_DEGRADED; return false; } @@ -945,8 +945,12 @@ static bool esas2r_flash_access(struct esas2r_adapter *a, u32 function) /* Now wait for the firmware to process it */ starttime = jiffies_to_msecs(jiffies); - timeout = a->flags & - (AF_CHPRST_PENDING | AF_DISC_PENDING) ? 40000 : 5000; + + if (test_bit(AF_CHPRST_PENDING, &a->flags) || + test_bit(AF_DISC_PENDING, &a->flags)) + timeout = 40000; + else + timeout = 5000; while (true) { intstat = esas2r_read_register_dword(a, MU_INT_STATUS_OUT); @@ -1008,7 +1012,7 @@ bool esas2r_read_flash_block(struct esas2r_adapter *a, u32 offset; u32 iatvr; - if (a->flags2 & AF2_SERIAL_FLASH) + if (test_bit(AF2_SERIAL_FLASH, &a->flags2)) iatvr = MW_DATA_ADDR_SER_FLASH + (from & -WINDOW_SIZE); else iatvr = MW_DATA_ADDR_PAR_FLASH + (from & -WINDOW_SIZE); @@ -1236,9 +1240,9 @@ static void esas2r_nvram_callback(struct esas2r_adapter *a, if (rq->req_stat != RS_PENDING) { /* update the NVRAM state */ if (rq->req_stat == RS_SUCCESS) - esas2r_lock_set_flags(&a->flags, AF_NVR_VALID); + set_bit(AF_NVR_VALID, &a->flags); else - esas2r_lock_clear_flags(&a->flags, AF_NVR_VALID); + clear_bit(AF_NVR_VALID, &a->flags); esas2r_enable_heartbeat(a); @@ -1258,7 +1262,7 @@ bool esas2r_nvram_write(struct esas2r_adapter *a, struct esas2r_request *rq, u32 *sas_address_dwords = (u32 *)&sas_address_bytes[0]; struct atto_vda_flash_req *vrq = &rq->vrq->flash; - if (a->flags & AF_DEGRADED_MODE) + if (test_bit(AF_DEGRADED_MODE, &a->flags)) return false; if (down_interruptible(&a->nvram_semaphore)) @@ -1302,7 +1306,7 @@ bool esas2r_nvram_write(struct esas2r_adapter *a, struct esas2r_request *rq, FLS_OFFSET_NVR, sizeof(struct esas2r_sas_nvram)); - if (a->flags & AF_LEGACY_SGE_MODE) { + if (test_bit(AF_LEGACY_SGE_MODE, &a->flags)) { vrq->data.sge[0].length = cpu_to_le32(SGE_LAST | @@ -1337,7 +1341,7 @@ bool esas2r_nvram_validate(struct esas2r_adapter *a) } else if (n->version > SASNVR_VERSION) { esas2r_hdebug("invalid NVRAM version"); } else { - esas2r_lock_set_flags(&a->flags, AF_NVR_VALID); + set_bit(AF_NVR_VALID, &a->flags); rslt = true; } @@ -1359,7 +1363,7 @@ void esas2r_nvram_set_defaults(struct esas2r_adapter *a) struct esas2r_sas_nvram *n = a->nvram; u32 time = jiffies_to_msecs(jiffies); - esas2r_lock_clear_flags(&a->flags, AF_NVR_VALID); + clear_bit(AF_NVR_VALID, &a->flags); *n = default_sas_nvram; n->sas_addr[3] |= 0x0F; n->sas_addr[4] = HIBYTE(LOWORD(time)); @@ -1389,7 +1393,7 @@ bool esas2r_fm_api(struct esas2r_adapter *a, struct esas2r_flash_img *fi, u8 j; struct esas2r_component_header *ch; - if (esas2r_lock_set_flags(&a->flags, AF_FLASH_LOCK) & AF_FLASH_LOCK) { + if (test_and_set_bit(AF_FLASH_LOCK, &a->flags)) { /* flag was already set */ fi->status = FI_STAT_BUSY; return false; @@ -1413,7 +1417,7 @@ bool esas2r_fm_api(struct esas2r_adapter *a, struct esas2r_flash_img *fi, return complete_fmapi_req(a, rq, FI_STAT_IMG_VER); } - if (a->flags & AF_DEGRADED_MODE) + if (test_bit(AF_DEGRADED_MODE, &a->flags)) return complete_fmapi_req(a, rq, FI_STAT_DEGRADED); switch (fi->action) { |