Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

[SCSI] esas2r: Directly call kernel functions for atomic bit operations

Previously the code embedded the kernel's test_bit/clear_bit
functions in wrappers that accepted u32 parameters. The
wrapper cast these parameters to longs before passing them
to the kernel's bit functions. This did not work properly
on platforms with 64-bit longs.

Signed-off-by: Bradley Grove <bgrove@attotech.com>
Signed-off-by: James Bottomley <JBottomley@Parallels.com>

authored by

Bradley Grove and committed by
James Bottomley
9588d24e a1f7177a

+291 -306
+59 -66
drivers/scsi/esas2r/esas2r.h
··· 799 799 struct esas2r_target *targetdb_end; 800 800 unsigned char *regs; 801 801 unsigned char *data_window; 802 - u32 volatile flags; 803 - #define AF_PORT_CHANGE (u32)(0x00000001) 804 - #define AF_CHPRST_NEEDED (u32)(0x00000004) 805 - #define AF_CHPRST_PENDING (u32)(0x00000008) 806 - #define AF_CHPRST_DETECTED (u32)(0x00000010) 807 - #define AF_BUSRST_NEEDED (u32)(0x00000020) 808 - #define AF_BUSRST_PENDING (u32)(0x00000040) 809 - #define AF_BUSRST_DETECTED (u32)(0x00000080) 810 - #define AF_DISABLED (u32)(0x00000100) 811 - #define AF_FLASH_LOCK (u32)(0x00000200) 812 - #define AF_OS_RESET (u32)(0x00002000) 813 - #define AF_FLASHING (u32)(0x00004000) 814 - #define AF_POWER_MGT (u32)(0x00008000) 815 - #define AF_NVR_VALID (u32)(0x00010000) 816 - #define AF_DEGRADED_MODE (u32)(0x00020000) 817 - #define AF_DISC_PENDING (u32)(0x00040000) 818 - #define AF_TASKLET_SCHEDULED (u32)(0x00080000) 819 - #define AF_HEARTBEAT (u32)(0x00200000) 820 - #define AF_HEARTBEAT_ENB (u32)(0x00400000) 821 - #define AF_NOT_PRESENT (u32)(0x00800000) 822 - #define AF_CHPRST_STARTED (u32)(0x01000000) 823 - #define AF_FIRST_INIT (u32)(0x02000000) 824 - #define AF_POWER_DOWN (u32)(0x04000000) 825 - #define AF_DISC_IN_PROG (u32)(0x08000000) 826 - #define AF_COMM_LIST_TOGGLE (u32)(0x10000000) 827 - #define AF_LEGACY_SGE_MODE (u32)(0x20000000) 828 - #define AF_DISC_POLLED (u32)(0x40000000) 829 - u32 volatile flags2; 830 - #define AF2_SERIAL_FLASH (u32)(0x00000001) 831 - #define AF2_DEV_SCAN (u32)(0x00000002) 832 - #define AF2_DEV_CNT_OK (u32)(0x00000004) 833 - #define AF2_COREDUMP_AVAIL (u32)(0x00000008) 834 - #define AF2_COREDUMP_SAVED (u32)(0x00000010) 835 - #define AF2_VDA_POWER_DOWN (u32)(0x00000100) 836 - #define AF2_THUNDERLINK (u32)(0x00000200) 837 - #define AF2_THUNDERBOLT (u32)(0x00000400) 838 - #define AF2_INIT_DONE (u32)(0x00000800) 839 - #define AF2_INT_PENDING (u32)(0x00001000) 840 - #define AF2_TIMER_TICK (u32)(0x00002000) 841 - #define AF2_IRQ_CLAIMED (u32)(0x00004000) 842 - #define AF2_MSI_ENABLED (u32)(0x00008000) 802 + long flags; 803 + #define AF_PORT_CHANGE 0 804 + #define AF_CHPRST_NEEDED 1 805 + #define AF_CHPRST_PENDING 2 806 + #define AF_CHPRST_DETECTED 3 807 + #define AF_BUSRST_NEEDED 4 808 + #define AF_BUSRST_PENDING 5 809 + #define AF_BUSRST_DETECTED 6 810 + #define AF_DISABLED 7 811 + #define AF_FLASH_LOCK 8 812 + #define AF_OS_RESET 9 813 + #define AF_FLASHING 10 814 + #define AF_POWER_MGT 11 815 + #define AF_NVR_VALID 12 816 + #define AF_DEGRADED_MODE 13 817 + #define AF_DISC_PENDING 14 818 + #define AF_TASKLET_SCHEDULED 15 819 + #define AF_HEARTBEAT 16 820 + #define AF_HEARTBEAT_ENB 17 821 + #define AF_NOT_PRESENT 18 822 + #define AF_CHPRST_STARTED 19 823 + #define AF_FIRST_INIT 20 824 + #define AF_POWER_DOWN 21 825 + #define AF_DISC_IN_PROG 22 826 + #define AF_COMM_LIST_TOGGLE 23 827 + #define AF_LEGACY_SGE_MODE 24 828 + #define AF_DISC_POLLED 25 829 + long flags2; 830 + #define AF2_SERIAL_FLASH 0 831 + #define AF2_DEV_SCAN 1 832 + #define AF2_DEV_CNT_OK 2 833 + #define AF2_COREDUMP_AVAIL 3 834 + #define AF2_COREDUMP_SAVED 4 835 + #define AF2_VDA_POWER_DOWN 5 836 + #define AF2_THUNDERLINK 6 837 + #define AF2_THUNDERBOLT 7 838 + #define AF2_INIT_DONE 8 839 + #define AF2_INT_PENDING 9 840 + #define AF2_TIMER_TICK 10 841 + #define AF2_IRQ_CLAIMED 11 842 + #define AF2_MSI_ENABLED 12 843 843 atomic_t disable_cnt; 844 844 atomic_t dis_ints_cnt; 845 845 u32 int_stat; ··· 1150 1150 int data_sz); 1151 1151 1152 1152 /* Inline functions */ 1153 - static inline u32 esas2r_lock_set_flags(volatile u32 *flags, u32 bits) 1154 - { 1155 - return test_and_set_bit(ilog2(bits), (volatile unsigned long *)flags); 1156 - } 1157 - 1158 - static inline u32 esas2r_lock_clear_flags(volatile u32 *flags, u32 bits) 1159 - { 1160 - return test_and_clear_bit(ilog2(bits), 1161 - (volatile unsigned long *)flags); 1162 - } 1163 1153 1164 1154 /* Allocate a chip scatter/gather list entry */ 1165 1155 static inline struct esas2r_mem_desc *esas2r_alloc_sgl(struct esas2r_adapter *a) ··· 1293 1303 1294 1304 static inline bool esas2r_is_tasklet_pending(struct esas2r_adapter *a) 1295 1305 { 1296 - return (a->flags & (AF_BUSRST_NEEDED | AF_BUSRST_DETECTED 1297 - | AF_CHPRST_NEEDED | AF_CHPRST_DETECTED 1298 - | AF_PORT_CHANGE)) 1299 - ? true : false; 1306 + 1307 + return test_bit(AF_BUSRST_NEEDED, &a->flags) || 1308 + test_bit(AF_BUSRST_DETECTED, &a->flags) || 1309 + test_bit(AF_CHPRST_NEEDED, &a->flags) || 1310 + test_bit(AF_CHPRST_DETECTED, &a->flags) || 1311 + test_bit(AF_PORT_CHANGE, &a->flags); 1312 + 1300 1313 } 1301 1314 1302 1315 /* ··· 1338 1345 static inline void esas2r_schedule_tasklet(struct esas2r_adapter *a) 1339 1346 { 1340 1347 /* make sure we don't schedule twice */ 1341 - if (!(esas2r_lock_set_flags(&a->flags, AF_TASKLET_SCHEDULED) & 1342 - ilog2(AF_TASKLET_SCHEDULED))) 1348 + if (!test_and_set_bit(AF_TASKLET_SCHEDULED, &a->flags)) 1343 1349 tasklet_hi_schedule(&a->tasklet); 1344 1350 } 1345 1351 1346 1352 static inline void esas2r_enable_heartbeat(struct esas2r_adapter *a) 1347 1353 { 1348 - if (!(a->flags & (AF_DEGRADED_MODE | AF_CHPRST_PENDING)) 1349 - && (a->nvram->options2 & SASNVR2_HEARTBEAT)) 1350 - esas2r_lock_set_flags(&a->flags, AF_HEARTBEAT_ENB); 1354 + if (!test_bit(AF_DEGRADED_MODE, &a->flags) && 1355 + !test_bit(AF_CHPRST_PENDING, &a->flags) && 1356 + (a->nvram->options2 & SASNVR2_HEARTBEAT)) 1357 + set_bit(AF_HEARTBEAT_ENB, &a->flags); 1351 1358 else 1352 - esas2r_lock_clear_flags(&a->flags, AF_HEARTBEAT_ENB); 1359 + clear_bit(AF_HEARTBEAT_ENB, &a->flags); 1353 1360 } 1354 1361 1355 1362 static inline void esas2r_disable_heartbeat(struct esas2r_adapter *a) 1356 1363 { 1357 - esas2r_lock_clear_flags(&a->flags, AF_HEARTBEAT_ENB); 1358 - esas2r_lock_clear_flags(&a->flags, AF_HEARTBEAT); 1364 + clear_bit(AF_HEARTBEAT_ENB, &a->flags); 1365 + clear_bit(AF_HEARTBEAT, &a->flags); 1359 1366 } 1360 1367 1361 1368 /* Set the initial state for resetting the adapter on the next pass through ··· 1365 1372 { 1366 1373 esas2r_disable_heartbeat(a); 1367 1374 1368 - esas2r_lock_set_flags(&a->flags, AF_CHPRST_NEEDED); 1369 - esas2r_lock_set_flags(&a->flags, AF_CHPRST_PENDING); 1370 - esas2r_lock_set_flags(&a->flags, AF_DISC_PENDING); 1375 + set_bit(AF_CHPRST_NEEDED, &a->flags); 1376 + set_bit(AF_CHPRST_PENDING, &a->flags); 1377 + set_bit(AF_DISC_PENDING, &a->flags); 1371 1378 } 1372 1379 1373 1380 /* See if an interrupt is pending on the adapter. */
+25 -30
drivers/scsi/esas2r/esas2r_disc.c
··· 86 86 87 87 esas2r_trace_enter(); 88 88 89 - esas2r_lock_clear_flags(&a->flags, AF_DISC_IN_PROG); 90 - esas2r_lock_clear_flags(&a->flags2, AF2_DEV_SCAN); 91 - esas2r_lock_clear_flags(&a->flags2, AF2_DEV_CNT_OK); 89 + clear_bit(AF_DISC_IN_PROG, &a->flags); 90 + clear_bit(AF2_DEV_SCAN, &a->flags2); 91 + clear_bit(AF2_DEV_CNT_OK, &a->flags2); 92 92 93 93 a->disc_start_time = jiffies_to_msecs(jiffies); 94 94 a->disc_wait_time = nvr->dev_wait_time * 1000; ··· 107 107 108 108 a->general_req.interrupt_cx = NULL; 109 109 110 - if (a->flags & (AF_CHPRST_DETECTED | AF_POWER_MGT)) { 110 + if (test_bit(AF_CHPRST_DETECTED, &a->flags) || 111 + test_bit(AF_POWER_MGT, &a->flags)) { 111 112 if (a->prev_dev_cnt == 0) { 112 113 /* Don't bother waiting if there is nothing to wait 113 114 * for. ··· 213 212 || a->disc_wait_cnt == 0)) { 214 213 /* After three seconds of waiting, schedule a scan. */ 215 214 if (time >= 3000 216 - && !(esas2r_lock_set_flags(&a->flags2, 217 - AF2_DEV_SCAN) & 218 - ilog2(AF2_DEV_SCAN))) { 215 + && !test_and_set_bit(AF2_DEV_SCAN, &a->flags2)) { 219 216 spin_lock_irqsave(&a->mem_lock, flags); 220 217 esas2r_disc_queue_event(a, DCDE_DEV_SCAN); 221 218 spin_unlock_irqrestore(&a->mem_lock, flags); ··· 227 228 * We are done waiting...we think. Adjust the wait time to 228 229 * consume events after the count is met. 229 230 */ 230 - if (!(esas2r_lock_set_flags(&a->flags2, AF2_DEV_CNT_OK) 231 - & ilog2(AF2_DEV_CNT_OK))) 231 + if (!test_and_set_bit(AF2_DEV_CNT_OK, &a->flags2)) 232 232 a->disc_wait_time = time + 3000; 233 233 234 234 /* If we haven't done a full scan yet, do it now. */ 235 - if (!(esas2r_lock_set_flags(&a->flags2, 236 - AF2_DEV_SCAN) & 237 - ilog2(AF2_DEV_SCAN))) { 235 + if (!test_and_set_bit(AF2_DEV_SCAN, &a->flags2)) { 238 236 spin_lock_irqsave(&a->mem_lock, flags); 239 237 esas2r_disc_queue_event(a, DCDE_DEV_SCAN); 240 238 spin_unlock_irqrestore(&a->mem_lock, flags); 241 - 242 239 esas2r_trace_exit(); 243 240 return; 244 241 } ··· 248 253 return; 249 254 } 250 255 } else { 251 - if (!(esas2r_lock_set_flags(&a->flags2, 252 - AF2_DEV_SCAN) & 253 - ilog2(AF2_DEV_SCAN))) { 256 + if (!test_and_set_bit(AF2_DEV_SCAN, &a->flags2)) { 254 257 spin_lock_irqsave(&a->mem_lock, flags); 255 258 esas2r_disc_queue_event(a, DCDE_DEV_SCAN); 256 259 spin_unlock_irqrestore(&a->mem_lock, flags); ··· 258 265 /* We want to stop waiting for devices. */ 259 266 a->disc_wait_time = 0; 260 267 261 - if ((a->flags & AF_DISC_POLLED) 262 - && (a->flags & AF_DISC_IN_PROG)) { 268 + if (test_bit(AF_DISC_POLLED, &a->flags) && 269 + test_bit(AF_DISC_IN_PROG, &a->flags)) { 263 270 /* 264 271 * Polled discovery is still pending so continue the active 265 272 * discovery until it is done. At that point, we will stop ··· 273 280 * driven; i.e. There is no transition. 274 281 */ 275 282 esas2r_disc_fix_curr_requests(a); 276 - esas2r_lock_clear_flags(&a->flags, AF_DISC_PENDING); 283 + clear_bit(AF_DISC_PENDING, &a->flags); 277 284 278 285 /* 279 286 * We have deferred target state changes until now because we 280 287 * don't want to report any removals (due to the first arrival) 281 288 * until the device wait time expires. 282 289 */ 283 - esas2r_lock_set_flags(&a->flags, AF_PORT_CHANGE); 290 + set_bit(AF_PORT_CHANGE, &a->flags); 284 291 } 285 292 286 293 esas2r_trace_exit(); ··· 301 308 * Don't start discovery before or during polled discovery. if we did, 302 309 * we would have a deadlock if we are in the ISR already. 303 310 */ 304 - if (!(a->flags & (AF_CHPRST_PENDING | AF_DISC_POLLED))) 311 + if (!test_bit(AF_CHPRST_PENDING, &a->flags) && 312 + !test_bit(AF_DISC_POLLED, &a->flags)) 305 313 esas2r_disc_start_port(a); 306 314 307 315 esas2r_trace_exit(); ··· 316 322 317 323 esas2r_trace_enter(); 318 324 319 - if (a->flags & AF_DISC_IN_PROG) { 325 + if (test_bit(AF_DISC_IN_PROG, &a->flags)) { 320 326 esas2r_trace_exit(); 321 327 322 328 return false; ··· 324 330 325 331 /* If there is a discovery waiting, process it. */ 326 332 if (dc->disc_evt) { 327 - if ((a->flags & AF_DISC_POLLED) 333 + if (test_bit(AF_DISC_POLLED, &a->flags) 328 334 && a->disc_wait_time == 0) { 329 335 /* 330 336 * We are doing polled discovery, but we no longer want ··· 341 347 342 348 esas2r_hdebug("disc done"); 343 349 344 - esas2r_lock_set_flags(&a->flags, AF_PORT_CHANGE); 350 + set_bit(AF_PORT_CHANGE, &a->flags); 345 351 346 352 esas2r_trace_exit(); 347 353 ··· 350 356 351 357 /* Handle the discovery context */ 352 358 esas2r_trace("disc_evt: %d", dc->disc_evt); 353 - esas2r_lock_set_flags(&a->flags, AF_DISC_IN_PROG); 359 + set_bit(AF_DISC_IN_PROG, &a->flags); 354 360 dc->flags = 0; 355 361 356 - if (a->flags & AF_DISC_POLLED) 362 + if (test_bit(AF_DISC_POLLED, &a->flags)) 357 363 dc->flags |= DCF_POLLED; 358 364 359 365 rq->interrupt_cx = dc; ··· 373 379 } 374 380 375 381 /* Continue interrupt driven discovery */ 376 - if (!(a->flags & AF_DISC_POLLED)) 382 + if (!test_bit(AF_DISC_POLLED, &a->flags)) 377 383 ret = esas2r_disc_continue(a, rq); 378 384 else 379 385 ret = true; ··· 447 453 /* Discovery is done...for now. */ 448 454 rq->interrupt_cx = NULL; 449 455 450 - if (!(a->flags & AF_DISC_PENDING)) 456 + if (!test_bit(AF_DISC_PENDING, &a->flags)) 451 457 esas2r_disc_fix_curr_requests(a); 452 458 453 - esas2r_lock_clear_flags(&a->flags, AF_DISC_IN_PROG); 459 + clear_bit(AF_DISC_IN_PROG, &a->flags); 454 460 455 461 /* Start the next discovery. */ 456 462 return esas2r_disc_start_port(a); ··· 474 480 475 481 spin_lock_irqsave(&a->queue_lock, flags); 476 482 477 - if (!(a->flags & (AF_CHPRST_PENDING | AF_FLASHING))) 483 + if (!test_bit(AF_CHPRST_PENDING, &a->flags) && 484 + !test_bit(AF_FLASHING, &a->flags)) 478 485 esas2r_disc_local_start_request(a, rq); 479 486 else 480 487 list_add_tail(&rq->req_list, &a->defer_list);
+19 -15
drivers/scsi/esas2r/esas2r_flash.c
··· 231 231 * RS_PENDING, FM API tasks will continue. 232 232 */ 233 233 rq->req_stat = RS_PENDING; 234 - if (a->flags & AF_DEGRADED_MODE) 234 + if (test_bit(AF_DEGRADED_MODE, &a->flags)) 235 235 /* not suppported for now */; 236 236 else 237 237 build_flash_msg(a, rq); ··· 315 315 memset(fc->scratch, 0, FM_BUF_SZ); 316 316 317 317 esas2r_enable_heartbeat(a); 318 - esas2r_lock_clear_flags(&a->flags, AF_FLASH_LOCK); 318 + clear_bit(AF_FLASH_LOCK, &a->flags); 319 319 return false; 320 320 } 321 321 ··· 526 526 * The download is complete. If in degraded mode, 527 527 * attempt a chip reset. 528 528 */ 529 - if (a->flags & AF_DEGRADED_MODE) 529 + if (test_bit(AF_DEGRADED_MODE, &a->flags)) 530 530 esas2r_local_reset_adapter(a); 531 531 532 532 a->flash_ver = fi->cmp_hdr[CH_IT_BIOS].version; ··· 890 890 } 891 891 } 892 892 893 - if (a->flags & AF_DEGRADED_MODE) { 893 + if (test_bit(AF_DEGRADED_MODE, &a->flags)) { 894 894 fs->status = ATTO_STS_DEGRADED; 895 895 return false; 896 896 } ··· 945 945 946 946 /* Now wait for the firmware to process it */ 947 947 starttime = jiffies_to_msecs(jiffies); 948 - timeout = a->flags & 949 - (AF_CHPRST_PENDING | AF_DISC_PENDING) ? 40000 : 5000; 948 + 949 + if (test_bit(AF_CHPRST_PENDING, &a->flags) || 950 + test_bit(AF_DISC_PENDING, &a->flags)) 951 + timeout = 40000; 952 + else 953 + timeout = 5000; 950 954 951 955 while (true) { 952 956 intstat = esas2r_read_register_dword(a, MU_INT_STATUS_OUT); ··· 1012 1008 u32 offset; 1013 1009 u32 iatvr; 1014 1010 1015 - if (a->flags2 & AF2_SERIAL_FLASH) 1011 + if (test_bit(AF2_SERIAL_FLASH, &a->flags2)) 1016 1012 iatvr = MW_DATA_ADDR_SER_FLASH + (from & -WINDOW_SIZE); 1017 1013 else 1018 1014 iatvr = MW_DATA_ADDR_PAR_FLASH + (from & -WINDOW_SIZE); ··· 1240 1236 if (rq->req_stat != RS_PENDING) { 1241 1237 /* update the NVRAM state */ 1242 1238 if (rq->req_stat == RS_SUCCESS) 1243 - esas2r_lock_set_flags(&a->flags, AF_NVR_VALID); 1239 + set_bit(AF_NVR_VALID, &a->flags); 1244 1240 else 1245 - esas2r_lock_clear_flags(&a->flags, AF_NVR_VALID); 1241 + clear_bit(AF_NVR_VALID, &a->flags); 1246 1242 1247 1243 esas2r_enable_heartbeat(a); 1248 1244 ··· 1262 1258 u32 *sas_address_dwords = (u32 *)&sas_address_bytes[0]; 1263 1259 struct atto_vda_flash_req *vrq = &rq->vrq->flash; 1264 1260 1265 - if (a->flags & AF_DEGRADED_MODE) 1261 + if (test_bit(AF_DEGRADED_MODE, &a->flags)) 1266 1262 return false; 1267 1263 1268 1264 if (down_interruptible(&a->nvram_semaphore)) ··· 1306 1302 FLS_OFFSET_NVR, 1307 1303 sizeof(struct esas2r_sas_nvram)); 1308 1304 1309 - if (a->flags & AF_LEGACY_SGE_MODE) { 1305 + if (test_bit(AF_LEGACY_SGE_MODE, &a->flags)) { 1310 1306 1311 1307 vrq->data.sge[0].length = 1312 1308 cpu_to_le32(SGE_LAST | ··· 1341 1337 } else if (n->version > SASNVR_VERSION) { 1342 1338 esas2r_hdebug("invalid NVRAM version"); 1343 1339 } else { 1344 - esas2r_lock_set_flags(&a->flags, AF_NVR_VALID); 1340 + set_bit(AF_NVR_VALID, &a->flags); 1345 1341 rslt = true; 1346 1342 } 1347 1343 ··· 1363 1359 struct esas2r_sas_nvram *n = a->nvram; 1364 1360 u32 time = jiffies_to_msecs(jiffies); 1365 1361 1366 - esas2r_lock_clear_flags(&a->flags, AF_NVR_VALID); 1362 + clear_bit(AF_NVR_VALID, &a->flags); 1367 1363 *n = default_sas_nvram; 1368 1364 n->sas_addr[3] |= 0x0F; 1369 1365 n->sas_addr[4] = HIBYTE(LOWORD(time)); ··· 1393 1389 u8 j; 1394 1390 struct esas2r_component_header *ch; 1395 1391 1396 - if (esas2r_lock_set_flags(&a->flags, AF_FLASH_LOCK) & AF_FLASH_LOCK) { 1392 + if (test_and_set_bit(AF_FLASH_LOCK, &a->flags)) { 1397 1393 /* flag was already set */ 1398 1394 fi->status = FI_STAT_BUSY; 1399 1395 return false; ··· 1417 1413 return complete_fmapi_req(a, rq, FI_STAT_IMG_VER); 1418 1414 } 1419 1415 1420 - if (a->flags & AF_DEGRADED_MODE) 1416 + if (test_bit(AF_DEGRADED_MODE, &a->flags)) 1421 1417 return complete_fmapi_req(a, rq, FI_STAT_DEGRADED); 1422 1418 1423 1419 switch (fi->action) {
+69 -74
drivers/scsi/esas2r/esas2r_init.c
··· 216 216 goto use_legacy_interrupts; 217 217 } 218 218 a->intr_mode = INTR_MODE_MSI; 219 - esas2r_lock_set_flags(&a->flags2, AF2_MSI_ENABLED); 219 + set_bit(AF2_MSI_ENABLED, &a->flags2); 220 220 break; 221 221 222 222 ··· 252 252 return; 253 253 } 254 254 255 - esas2r_lock_set_flags(&a->flags2, AF2_IRQ_CLAIMED); 255 + set_bit(AF2_IRQ_CLAIMED, &a->flags2); 256 256 esas2r_log(ESAS2R_LOG_INFO, 257 257 "claimed IRQ %d flags: 0x%lx", 258 258 a->pcid->irq, flags); ··· 380 380 /* interrupts will be disabled until we are done with init */ 381 381 atomic_inc(&a->dis_ints_cnt); 382 382 atomic_inc(&a->disable_cnt); 383 - a->flags |= AF_CHPRST_PENDING 384 - | AF_DISC_PENDING 385 - | AF_FIRST_INIT 386 - | AF_LEGACY_SGE_MODE; 383 + set_bit(AF_CHPRST_PENDING, &a->flags); 384 + set_bit(AF_DISC_PENDING, &a->flags); 385 + set_bit(AF_FIRST_INIT, &a->flags); 386 + set_bit(AF_LEGACY_SGE_MODE, &a->flags); 387 387 388 388 a->init_msg = ESAS2R_INIT_MSG_START; 389 389 a->max_vdareq_size = 128; ··· 440 440 441 441 esas2r_claim_interrupts(a); 442 442 443 - if (a->flags2 & AF2_IRQ_CLAIMED) 443 + if (test_bit(AF2_IRQ_CLAIMED, &a->flags2)) 444 444 esas2r_enable_chip_interrupts(a); 445 445 446 - esas2r_lock_set_flags(&a->flags2, AF2_INIT_DONE); 447 - if (!(a->flags & AF_DEGRADED_MODE)) 446 + set_bit(AF2_INIT_DONE, &a->flags2); 447 + if (!test_bit(AF_DEGRADED_MODE, &a->flags)) 448 448 esas2r_kickoff_timer(a); 449 449 esas2r_debug("esas2r_init_adapter done for %p (%d)", 450 450 a, a->disable_cnt); ··· 457 457 { 458 458 struct esas2r_mem_desc *memdesc, *next; 459 459 460 - if ((a->flags2 & AF2_INIT_DONE) 461 - && (!(a->flags & AF_DEGRADED_MODE))) { 460 + if ((test_bit(AF2_INIT_DONE, &a->flags2)) 461 + && (!test_bit(AF_DEGRADED_MODE, &a->flags))) { 462 462 if (!power_management) { 463 463 del_timer_sync(&a->timer); 464 464 tasklet_kill(&a->tasklet); ··· 508 508 } 509 509 510 510 /* Clean up interrupts */ 511 - if (a->flags2 & AF2_IRQ_CLAIMED) { 511 + if (test_bit(AF2_IRQ_CLAIMED, &a->flags2)) { 512 512 esas2r_log_dev(ESAS2R_LOG_INFO, 513 513 &(a->pcid->dev), 514 514 "free_irq(%d) called", a->pcid->irq); 515 515 516 516 free_irq(a->pcid->irq, a); 517 517 esas2r_debug("IRQ released"); 518 - esas2r_lock_clear_flags(&a->flags2, AF2_IRQ_CLAIMED); 518 + clear_bit(AF2_IRQ_CLAIMED, &a->flags2); 519 519 } 520 520 521 - if (a->flags2 & AF2_MSI_ENABLED) { 521 + if (test_bit(AF2_MSI_ENABLED, &a->flags2)) { 522 522 pci_disable_msi(a->pcid); 523 - esas2r_lock_clear_flags(&a->flags2, AF2_MSI_ENABLED); 523 + clear_bit(AF2_MSI_ENABLED, &a->flags2); 524 524 esas2r_debug("MSI disabled"); 525 525 } 526 526 ··· 641 641 pci_set_drvdata(a->pcid, NULL); 642 642 esas2r_adapters[i] = NULL; 643 643 644 - if (a->flags2 & AF2_INIT_DONE) { 645 - esas2r_lock_clear_flags(&a->flags2, 646 - AF2_INIT_DONE); 644 + if (test_bit(AF2_INIT_DONE, &a->flags2)) { 645 + clear_bit(AF2_INIT_DONE, &a->flags2); 647 646 648 - esas2r_lock_set_flags(&a->flags, 649 - AF_DEGRADED_MODE); 647 + set_bit(AF_DEGRADED_MODE, &a->flags); 650 648 651 649 esas2r_log_dev(ESAS2R_LOG_INFO, 652 650 &(a->host->shost_gendev), ··· 757 759 758 760 esas2r_claim_interrupts(a); 759 761 760 - if (a->flags2 & AF2_IRQ_CLAIMED) { 762 + if (test_bit(AF2_IRQ_CLAIMED, &a->flags2)) { 761 763 /* 762 764 * Now that system interrupt(s) are claimed, we can enable 763 765 * chip interrupts. ··· 779 781 780 782 bool esas2r_set_degraded_mode(struct esas2r_adapter *a, char *error_str) 781 783 { 782 - esas2r_lock_set_flags(&a->flags, AF_DEGRADED_MODE); 784 + set_bit(AF_DEGRADED_MODE, &a->flags); 783 785 esas2r_log(ESAS2R_LOG_CRIT, 784 786 "setting adapter to degraded mode: %s\n", error_str); 785 787 return false; ··· 894 896 && (a->pcid->subsystem_device & ATTO_SSDID_TBT)) 895 897 a->flags2 |= AF2_THUNDERBOLT; 896 898 897 - if (a->flags2 & AF2_THUNDERBOLT) 899 + if (test_bit(AF2_THUNDERBOLT, &a->flags2)) 898 900 a->flags2 |= AF2_SERIAL_FLASH; 899 901 900 902 if (a->pcid->subsystem_device == ATTO_TLSH_1068) ··· 954 956 a->outbound_copy = (u32 volatile *)high; 955 957 high += sizeof(u32); 956 958 957 - if (!(a->flags & AF_NVR_VALID)) 959 + if (!test_bit(AF_NVR_VALID, &a->flags)) 958 960 esas2r_nvram_set_defaults(a); 959 961 960 962 /* update the caller's uncached memory area pointer */ 961 963 *uncached_area = (void *)high; 962 964 963 965 /* initialize the allocated memory */ 964 - if (a->flags & AF_FIRST_INIT) { 966 + if (test_bit(AF_FIRST_INIT, &a->flags)) { 965 967 memset(a->req_table, 0, 966 968 (num_requests + num_ae_requests + 967 969 1) * sizeof(struct esas2r_request *)); ··· 1017 1019 * if the chip reset detected flag is set, we can bypass a bunch of 1018 1020 * stuff. 1019 1021 */ 1020 - if (a->flags & AF_CHPRST_DETECTED) 1022 + if (test_bit(AF_CHPRST_DETECTED, &a->flags)) 1021 1023 goto skip_chip_reset; 1022 1024 1023 1025 /* ··· 1055 1057 doorbell); 1056 1058 1057 1059 if (ver == DRBL_FW_VER_0) { 1058 - esas2r_lock_set_flags(&a->flags, 1059 - AF_LEGACY_SGE_MODE); 1060 + set_bit(AF_LEGACY_SGE_MODE, &a->flags); 1060 1061 1061 1062 a->max_vdareq_size = 128; 1062 1063 a->build_sgl = esas2r_build_sg_list_sge; 1063 1064 } else if (ver == DRBL_FW_VER_1) { 1064 - esas2r_lock_clear_flags(&a->flags, 1065 - AF_LEGACY_SGE_MODE); 1065 + clear_bit(AF_LEGACY_SGE_MODE, &a->flags); 1066 1066 1067 1067 a->max_vdareq_size = 1024; 1068 1068 a->build_sgl = esas2r_build_sg_list_prd; ··· 1135 1139 *a->outbound_copy = 1136 1140 a->last_write = 1137 1141 a->last_read = a->list_size - 1; 1138 - esas2r_lock_set_flags(&a->flags, AF_COMM_LIST_TOGGLE); 1142 + set_bit(AF_COMM_LIST_TOGGLE, &a->flags); 1139 1143 esas2r_write_register_dword(a, MU_IN_LIST_WRITE, MU_ILW_TOGGLE | 1140 1144 a->last_write); 1141 1145 esas2r_write_register_dword(a, MU_OUT_LIST_COPY, MU_OLC_TOGGLE | ··· 1200 1204 */ 1201 1205 doorbell = esas2r_read_register_dword(a, MU_DOORBELL_IN_ENB); 1202 1206 if (doorbell & DRBL_POWER_DOWN) 1203 - esas2r_lock_set_flags(&a->flags2, AF2_VDA_POWER_DOWN); 1207 + set_bit(AF2_VDA_POWER_DOWN, &a->flags2); 1204 1208 else 1205 - esas2r_lock_clear_flags(&a->flags2, AF2_VDA_POWER_DOWN); 1209 + clear_bit(AF2_VDA_POWER_DOWN, &a->flags2); 1206 1210 1207 1211 /* 1208 1212 * enable assertion of outbound queue and doorbell interrupts in the ··· 1262 1266 * unsupported config requests correctly. 1263 1267 */ 1264 1268 1265 - if ((a->flags2 & AF2_THUNDERBOLT) 1266 - || (be32_to_cpu(a->fw_version) > 1267 - be32_to_cpu(0x47020052))) { 1269 + if ((test_bit(AF2_THUNDERBOLT, &a->flags2)) 1270 + || (be32_to_cpu(a->fw_version) > 0x00524702)) { 1268 1271 esas2r_hdebug("CFG get init"); 1269 1272 esas2r_build_cfg_req(a, 1270 1273 rq, ··· 1356 1361 struct esas2r_request *rq; 1357 1362 u32 i; 1358 1363 1359 - if (a->flags & AF_DEGRADED_MODE) 1364 + if (test_bit(AF_DEGRADED_MODE, &a->flags)) 1360 1365 goto exit; 1361 1366 1362 - if (!(a->flags & AF_NVR_VALID)) { 1367 + if (!test_bit(AF_NVR_VALID, &a->flags)) { 1363 1368 if (!esas2r_nvram_read_direct(a)) 1364 1369 esas2r_log(ESAS2R_LOG_WARN, 1365 1370 "invalid/missing NVRAM parameters"); ··· 1371 1376 } 1372 1377 1373 1378 /* The firmware is ready. */ 1374 - esas2r_lock_clear_flags(&a->flags, AF_DEGRADED_MODE); 1375 - esas2r_lock_clear_flags(&a->flags, AF_CHPRST_PENDING); 1379 + clear_bit(AF_DEGRADED_MODE, &a->flags); 1380 + clear_bit(AF_CHPRST_PENDING, &a->flags); 1376 1381 1377 1382 /* Post all the async event requests */ 1378 1383 for (i = 0, rq = a->first_ae_req; i < num_ae_requests; i++, rq++) ··· 1393 1398 1394 1399 esas2r_hdebug("firmware revision: %s", a->fw_rev); 1395 1400 1396 - if ((a->flags & AF_CHPRST_DETECTED) 1397 - && (a->flags & AF_FIRST_INIT)) { 1401 + if (test_bit(AF_CHPRST_DETECTED, &a->flags) 1402 + && (test_bit(AF_FIRST_INIT, &a->flags))) { 1398 1403 esas2r_enable_chip_interrupts(a); 1399 1404 return true; 1400 1405 } ··· 1418 1423 * Block Tasklets from getting scheduled and indicate this is 1419 1424 * polled discovery. 1420 1425 */ 1421 - esas2r_lock_set_flags(&a->flags, AF_TASKLET_SCHEDULED); 1422 - esas2r_lock_set_flags(&a->flags, AF_DISC_POLLED); 1426 + set_bit(AF_TASKLET_SCHEDULED, &a->flags); 1427 + set_bit(AF_DISC_POLLED, &a->flags); 1423 1428 1424 1429 /* 1425 1430 * Temporarily bring the disable count to zero to enable 1426 1431 * deferred processing. Note that the count is already zero 1427 1432 * after the first initialization. 1428 1433 */ 1429 - if (a->flags & AF_FIRST_INIT) 1434 + if (test_bit(AF_FIRST_INIT, &a->flags)) 1430 1435 atomic_dec(&a->disable_cnt); 1431 1436 1432 - while (a->flags & AF_DISC_PENDING) { 1437 + while (test_bit(AF_DISC_PENDING, &a->flags)) { 1433 1438 schedule_timeout_interruptible(msecs_to_jiffies(100)); 1434 1439 1435 1440 /* ··· 1448 1453 * we have to make sure the timer tick processes the 1449 1454 * doorbell indicating the firmware is ready. 1450 1455 */ 1451 - if (!(a->flags & AF_CHPRST_PENDING)) 1456 + if (!test_bit(AF_CHPRST_PENDING, &a->flags)) 1452 1457 esas2r_disc_check_for_work(a); 1453 1458 1454 1459 /* Simulate a timer tick. */ ··· 1468 1473 1469 1474 } 1470 1475 1471 - if (a->flags & AF_FIRST_INIT) 1476 + if (test_bit(AF_FIRST_INIT, &a->flags)) 1472 1477 atomic_inc(&a->disable_cnt); 1473 1478 1474 - esas2r_lock_clear_flags(&a->flags, AF_DISC_POLLED); 1475 - esas2r_lock_clear_flags(&a->flags, AF_TASKLET_SCHEDULED); 1479 + clear_bit(AF_DISC_POLLED, &a->flags); 1480 + clear_bit(AF_TASKLET_SCHEDULED, &a->flags); 1476 1481 } 1477 1482 1478 1483 ··· 1499 1504 * need to get done before we exit. 1500 1505 */ 1501 1506 1502 - if ((a->flags & AF_CHPRST_DETECTED) 1503 - && (a->flags & AF_FIRST_INIT)) { 1507 + if (test_bit(AF_CHPRST_DETECTED, &a->flags) && 1508 + test_bit(AF_FIRST_INIT, &a->flags)) { 1504 1509 /* 1505 1510 * Reinitialization was performed during the first 1506 1511 * initialization. Only clear the chip reset flag so the 1507 1512 * original device polling is not cancelled. 1508 1513 */ 1509 1514 if (!rslt) 1510 - esas2r_lock_clear_flags(&a->flags, AF_CHPRST_PENDING); 1515 + clear_bit(AF_CHPRST_PENDING, &a->flags); 1511 1516 } else { 1512 1517 /* First initialization or a subsequent re-init is complete. */ 1513 1518 if (!rslt) { 1514 - esas2r_lock_clear_flags(&a->flags, AF_CHPRST_PENDING); 1515 - esas2r_lock_clear_flags(&a->flags, AF_DISC_PENDING); 1519 + clear_bit(AF_CHPRST_PENDING, &a->flags); 1520 + clear_bit(AF_DISC_PENDING, &a->flags); 1516 1521 } 1517 1522 1518 1523 1519 1524 /* Enable deferred processing after the first initialization. */ 1520 - if (a->flags & AF_FIRST_INIT) { 1521 - esas2r_lock_clear_flags(&a->flags, AF_FIRST_INIT); 1525 + if (test_bit(AF_FIRST_INIT, &a->flags)) { 1526 + clear_bit(AF_FIRST_INIT, &a->flags); 1522 1527 1523 1528 if (atomic_dec_return(&a->disable_cnt) == 0) 1524 1529 esas2r_do_deferred_processes(a); ··· 1530 1535 1531 1536 void esas2r_reset_adapter(struct esas2r_adapter *a) 1532 1537 { 1533 - esas2r_lock_set_flags(&a->flags, AF_OS_RESET); 1538 + set_bit(AF_OS_RESET, &a->flags); 1534 1539 esas2r_local_reset_adapter(a); 1535 1540 esas2r_schedule_tasklet(a); 1536 1541 } ··· 1545 1550 * dump is located in the upper 512KB of the onchip SRAM. Make sure 1546 1551 * to not overwrite a previous crash that was saved. 1547 1552 */ 1548 - if ((a->flags2 & AF2_COREDUMP_AVAIL) 1549 - && !(a->flags2 & AF2_COREDUMP_SAVED)) { 1553 + if (test_bit(AF2_COREDUMP_AVAIL, &a->flags2) && 1554 + !test_bit(AF2_COREDUMP_SAVED, &a->flags2)) { 1550 1555 esas2r_read_mem_block(a, 1551 1556 a->fw_coredump_buff, 1552 1557 MW_DATA_ADDR_SRAM + 0x80000, 1553 1558 ESAS2R_FWCOREDUMP_SZ); 1554 1559 1555 - esas2r_lock_set_flags(&a->flags2, AF2_COREDUMP_SAVED); 1560 + set_bit(AF2_COREDUMP_SAVED, &a->flags2); 1556 1561 } 1557 1562 1558 - esas2r_lock_clear_flags(&a->flags2, AF2_COREDUMP_AVAIL); 1563 + clear_bit(AF2_COREDUMP_AVAIL, &a->flags2); 1559 1564 1560 1565 /* Reset the chip */ 1561 1566 if (a->pcid->revision == MVR_FREY_B2) ··· 1601 1606 */ 1602 1607 void esas2r_power_down(struct esas2r_adapter *a) 1603 1608 { 1604 - esas2r_lock_set_flags(&a->flags, AF_POWER_MGT); 1605 - esas2r_lock_set_flags(&a->flags, AF_POWER_DOWN); 1609 + set_bit(AF_POWER_MGT, &a->flags); 1610 + set_bit(AF_POWER_DOWN, &a->flags); 1606 1611 1607 - if (!(a->flags & AF_DEGRADED_MODE)) { 1612 + if (!test_bit(AF_DEGRADED_MODE, &a->flags)) { 1608 1613 u32 starttime; 1609 1614 u32 doorbell; 1610 1615 ··· 1644 1649 * For versions of firmware that support it tell them the driver 1645 1650 * is powering down. 1646 1651 */ 1647 - if (a->flags2 & AF2_VDA_POWER_DOWN) 1652 + if (test_bit(AF2_VDA_POWER_DOWN, &a->flags2)) 1648 1653 esas2r_power_down_notify_firmware(a); 1649 1654 } 1650 1655 1651 1656 /* Suspend I/O processing. */ 1652 - esas2r_lock_set_flags(&a->flags, AF_OS_RESET); 1653 - esas2r_lock_set_flags(&a->flags, AF_DISC_PENDING); 1654 - esas2r_lock_set_flags(&a->flags, AF_CHPRST_PENDING); 1657 + set_bit(AF_OS_RESET, &a->flags); 1658 + set_bit(AF_DISC_PENDING, &a->flags); 1659 + set_bit(AF_CHPRST_PENDING, &a->flags); 1655 1660 1656 1661 esas2r_process_adapter_reset(a); 1657 1662 ··· 1668 1673 { 1669 1674 bool ret; 1670 1675 1671 - esas2r_lock_clear_flags(&a->flags, AF_POWER_DOWN); 1676 + clear_bit(AF_POWER_DOWN, &a->flags); 1672 1677 esas2r_init_pci_cfg_space(a); 1673 - esas2r_lock_set_flags(&a->flags, AF_FIRST_INIT); 1678 + set_bit(AF_FIRST_INIT, &a->flags); 1674 1679 atomic_inc(&a->disable_cnt); 1675 1680 1676 1681 /* reinitialize the adapter */ ··· 1682 1687 esas2r_send_reset_ae(a, true); 1683 1688 1684 1689 /* clear this flag after initialization. */ 1685 - esas2r_lock_clear_flags(&a->flags, AF_POWER_MGT); 1690 + clear_bit(AF_POWER_MGT, &a->flags); 1686 1691 return ret; 1687 1692 } 1688 1693 1689 1694 bool esas2r_is_adapter_present(struct esas2r_adapter *a) 1690 1695 { 1691 - if (a->flags & AF_NOT_PRESENT) 1696 + if (test_bit(AF_NOT_PRESENT, &a->flags)) 1692 1697 return false; 1693 1698 1694 1699 if (esas2r_read_register_dword(a, MU_DOORBELL_OUT) == 0xFFFFFFFF) { 1695 - esas2r_lock_set_flags(&a->flags, AF_NOT_PRESENT); 1700 + set_bit(AF_NOT_PRESENT, &a->flags); 1696 1701 1697 1702 return false; 1698 1703 }
+49 -48
drivers/scsi/esas2r/esas2r_int.c
··· 96 96 if (!esas2r_adapter_interrupt_pending(a)) 97 97 return IRQ_NONE; 98 98 99 - esas2r_lock_set_flags(&a->flags2, AF2_INT_PENDING); 99 + set_bit(AF2_INT_PENDING, &a->flags2); 100 100 esas2r_schedule_tasklet(a); 101 101 102 102 return IRQ_HANDLED; ··· 317 317 * = 2 - can start any request 318 318 */ 319 319 320 - if (a->flags & (AF_CHPRST_PENDING | AF_FLASHING)) 320 + if (test_bit(AF_CHPRST_PENDING, &a->flags) || 321 + test_bit(AF_FLASHING, &a->flags)) 321 322 startreqs = 0; 322 - else if (a->flags & AF_DISC_PENDING) 323 + else if (test_bit(AF_DISC_PENDING, &a->flags)) 323 324 startreqs = 1; 324 325 325 326 atomic_inc(&a->disable_cnt); ··· 368 367 * Flashing could have been set by last local 369 368 * start 370 369 */ 371 - if (a->flags & AF_FLASHING) 370 + if (test_bit(AF_FLASHING, &a->flags)) 372 371 break; 373 372 } 374 373 } ··· 405 404 406 405 dc->disc_evt = 0; 407 406 408 - esas2r_lock_clear_flags(&a->flags, AF_DISC_IN_PROG); 407 + clear_bit(AF_DISC_IN_PROG, &a->flags); 409 408 } 410 409 411 410 /* ··· 426 425 a->last_write = 427 426 a->last_read = a->list_size - 1; 428 427 429 - esas2r_lock_set_flags(&a->flags, AF_COMM_LIST_TOGGLE); 428 + set_bit(AF_COMM_LIST_TOGGLE, &a->flags); 430 429 431 430 /* Kill all the requests on the active list */ 432 431 list_for_each(element, &a->defer_list) { ··· 471 470 if (atomic_read(&a->disable_cnt) == 0) 472 471 esas2r_do_deferred_processes(a); 473 472 474 - esas2r_lock_clear_flags(&a->flags, AF_OS_RESET); 473 + clear_bit(AF_OS_RESET, &a->flags); 475 474 476 475 esas2r_trace_exit(); 477 476 } ··· 479 478 static void esas2r_chip_rst_needed_during_tasklet(struct esas2r_adapter *a) 480 479 { 481 480 482 - esas2r_lock_clear_flags(&a->flags, AF_CHPRST_NEEDED); 483 - esas2r_lock_clear_flags(&a->flags, AF_BUSRST_NEEDED); 484 - esas2r_lock_clear_flags(&a->flags, AF_BUSRST_DETECTED); 485 - esas2r_lock_clear_flags(&a->flags, AF_BUSRST_PENDING); 481 + clear_bit(AF_CHPRST_NEEDED, &a->flags); 482 + clear_bit(AF_BUSRST_NEEDED, &a->flags); 483 + clear_bit(AF_BUSRST_DETECTED, &a->flags); 484 + clear_bit(AF_BUSRST_PENDING, &a->flags); 486 485 /* 487 486 * Make sure we don't get attempt more than 3 resets 488 487 * when the uptime between resets does not exceed one ··· 508 507 * prevent the heartbeat from trying to recover. 509 508 */ 510 509 511 - esas2r_lock_set_flags(&a->flags, AF_DEGRADED_MODE); 512 - esas2r_lock_set_flags(&a->flags, AF_DISABLED); 513 - esas2r_lock_clear_flags(&a->flags, AF_CHPRST_PENDING); 514 - esas2r_lock_clear_flags(&a->flags, AF_DISC_PENDING); 510 + set_bit(AF_DEGRADED_MODE, &a->flags); 511 + set_bit(AF_DISABLED, &a->flags); 512 + clear_bit(AF_CHPRST_PENDING, &a->flags); 513 + clear_bit(AF_DISC_PENDING, &a->flags); 515 514 516 515 esas2r_disable_chip_interrupts(a); 517 516 a->int_mask = 0; ··· 520 519 esas2r_log(ESAS2R_LOG_CRIT, 521 520 "Adapter disabled because of hardware failure"); 522 521 } else { 523 - u32 flags = 524 - esas2r_lock_set_flags(&a->flags, AF_CHPRST_STARTED); 522 + bool alrdyrst = test_and_set_bit(AF_CHPRST_STARTED, &a->flags); 525 523 526 - if (!(flags & AF_CHPRST_STARTED)) 524 + if (!alrdyrst) 527 525 /* 528 526 * Only disable interrupts if this is 529 527 * the first reset attempt. 530 528 */ 531 529 esas2r_disable_chip_interrupts(a); 532 530 533 - if ((a->flags & AF_POWER_MGT) && !(a->flags & AF_FIRST_INIT) && 534 - !(flags & AF_CHPRST_STARTED)) { 531 + if ((test_bit(AF_POWER_MGT, &a->flags)) && 532 + !test_bit(AF_FIRST_INIT, &a->flags) && !alrdyrst) { 535 533 /* 536 534 * Don't reset the chip on the first 537 535 * deferred power up attempt. ··· 543 543 /* Kick off the reinitialization */ 544 544 a->chip_uptime += ESAS2R_CHP_UPTIME_CNT; 545 545 a->chip_init_time = jiffies_to_msecs(jiffies); 546 - if (!(a->flags & AF_POWER_MGT)) { 546 + if (!test_bit(AF_POWER_MGT, &a->flags)) { 547 547 esas2r_process_adapter_reset(a); 548 548 549 - if (!(flags & AF_CHPRST_STARTED)) { 549 + if (!alrdyrst) { 550 550 /* Remove devices now that I/O is cleaned up. */ 551 551 a->prev_dev_cnt = 552 552 esas2r_targ_db_get_tgt_cnt(a); ··· 560 560 561 561 static void esas2r_handle_chip_rst_during_tasklet(struct esas2r_adapter *a) 562 562 { 563 - while (a->flags & AF_CHPRST_DETECTED) { 563 + while (test_bit(AF_CHPRST_DETECTED, &a->flags)) { 564 564 /* 565 565 * Balance the enable in esas2r_initadapter_hw. 566 566 * Esas2r_power_down already took care of it for power 567 567 * management. 568 568 */ 569 - if (!(a->flags & AF_DEGRADED_MODE) && !(a->flags & 570 - AF_POWER_MGT)) 569 + if (!test_bit(AF_DEGRADED_MODE, &a->flags) && 570 + !test_bit(AF_POWER_MGT, &a->flags)) 571 571 esas2r_disable_chip_interrupts(a); 572 572 573 573 /* Reinitialize the chip. */ 574 574 esas2r_check_adapter(a); 575 575 esas2r_init_adapter_hw(a, 0); 576 576 577 - if (a->flags & AF_CHPRST_NEEDED) 577 + if (test_bit(AF_CHPRST_NEEDED, &a->flags)) 578 578 break; 579 579 580 - if (a->flags & AF_POWER_MGT) { 580 + if (test_bit(AF_POWER_MGT, &a->flags)) { 581 581 /* Recovery from power management. */ 582 - if (a->flags & AF_FIRST_INIT) { 582 + if (test_bit(AF_FIRST_INIT, &a->flags)) { 583 583 /* Chip reset during normal power up */ 584 584 esas2r_log(ESAS2R_LOG_CRIT, 585 585 "The firmware was reset during a normal power-up sequence"); 586 586 } else { 587 587 /* Deferred power up complete. */ 588 - esas2r_lock_clear_flags(&a->flags, 589 - AF_POWER_MGT); 588 + clear_bit(AF_POWER_MGT, &a->flags); 590 589 esas2r_send_reset_ae(a, true); 591 590 } 592 591 } else { 593 592 /* Recovery from online chip reset. */ 594 - if (a->flags & AF_FIRST_INIT) { 593 + if (test_bit(AF_FIRST_INIT, &a->flags)) { 595 594 /* Chip reset during driver load */ 596 595 } else { 597 596 /* Chip reset after driver load */ ··· 601 602 "Recovering from a chip reset while the chip was online"); 602 603 } 603 604 604 - esas2r_lock_clear_flags(&a->flags, AF_CHPRST_STARTED); 605 + clear_bit(AF_CHPRST_STARTED, &a->flags); 605 606 esas2r_enable_chip_interrupts(a); 606 607 607 608 /* 608 609 * Clear this flag last! this indicates that the chip has been 609 610 * reset already during initialization. 610 611 */ 611 - esas2r_lock_clear_flags(&a->flags, AF_CHPRST_DETECTED); 612 + clear_bit(AF_CHPRST_DETECTED, &a->flags); 612 613 } 613 614 } 614 615 ··· 616 617 /* Perform deferred tasks when chip interrupts are disabled */ 617 618 void esas2r_do_tasklet_tasks(struct esas2r_adapter *a) 618 619 { 619 - if (a->flags & (AF_CHPRST_NEEDED | AF_CHPRST_DETECTED)) { 620 - if (a->flags & AF_CHPRST_NEEDED) 620 + 621 + if (test_bit(AF_CHPRST_NEEDED, &a->flags) || 622 + test_bit(AF_CHPRST_DETECTED, &a->flags)) { 623 + if (test_bit(AF_CHPRST_NEEDED, &a->flags)) 621 624 esas2r_chip_rst_needed_during_tasklet(a); 622 625 623 626 esas2r_handle_chip_rst_during_tasklet(a); 624 627 } 625 628 626 - if (a->flags & AF_BUSRST_NEEDED) { 629 + if (test_bit(AF_BUSRST_NEEDED, &a->flags)) { 627 630 esas2r_hdebug("hard resetting bus"); 628 631 629 - esas2r_lock_clear_flags(&a->flags, AF_BUSRST_NEEDED); 632 + clear_bit(AF_BUSRST_NEEDED, &a->flags); 630 633 631 - if (a->flags & AF_FLASHING) 632 - esas2r_lock_set_flags(&a->flags, AF_BUSRST_DETECTED); 634 + if (test_bit(AF_FLASHING, &a->flags)) 635 + set_bit(AF_BUSRST_DETECTED, &a->flags); 633 636 else 634 637 esas2r_write_register_dword(a, MU_DOORBELL_IN, 635 638 DRBL_RESET_BUS); 636 639 } 637 640 638 - if (a->flags & AF_BUSRST_DETECTED) { 641 + if (test_bit(AF_BUSRST_DETECTED, &a->flags)) { 639 642 esas2r_process_bus_reset(a); 640 643 641 644 esas2r_log_dev(ESAS2R_LOG_WARN, ··· 646 645 647 646 scsi_report_bus_reset(a->host, 0); 648 647 649 - esas2r_lock_clear_flags(&a->flags, AF_BUSRST_DETECTED); 650 - esas2r_lock_clear_flags(&a->flags, AF_BUSRST_PENDING); 648 + clear_bit(AF_BUSRST_DETECTED, &a->flags); 649 + clear_bit(AF_BUSRST_PENDING, &a->flags); 651 650 652 651 esas2r_log(ESAS2R_LOG_WARN, "Bus reset complete"); 653 652 } 654 653 655 - if (a->flags & AF_PORT_CHANGE) { 656 - esas2r_lock_clear_flags(&a->flags, AF_PORT_CHANGE); 654 + if (test_bit(AF_PORT_CHANGE, &a->flags)) { 655 + clear_bit(AF_PORT_CHANGE, &a->flags); 657 656 658 657 esas2r_targ_db_report_changes(a); 659 658 } ··· 673 672 esas2r_write_register_dword(a, MU_DOORBELL_OUT, doorbell); 674 673 675 674 if (doorbell & DRBL_RESET_BUS) 676 - esas2r_lock_set_flags(&a->flags, AF_BUSRST_DETECTED); 675 + set_bit(AF_BUSRST_DETECTED, &a->flags); 677 676 678 677 if (doorbell & DRBL_FORCE_INT) 679 - esas2r_lock_clear_flags(&a->flags, AF_HEARTBEAT); 678 + clear_bit(AF_HEARTBEAT, &a->flags); 680 679 681 680 if (doorbell & DRBL_PANIC_REASON_MASK) { 682 681 esas2r_hdebug("*** Firmware Panic ***"); ··· 684 683 } 685 684 686 685 if (doorbell & DRBL_FW_RESET) { 687 - esas2r_lock_set_flags(&a->flags2, AF2_COREDUMP_AVAIL); 686 + set_bit(AF2_COREDUMP_AVAIL, &a->flags2); 688 687 esas2r_local_reset_adapter(a); 689 688 } 690 689 ··· 919 918 { 920 919 if (rq->vrq->scsi.function == VDA_FUNC_FLASH 921 920 && rq->vrq->flash.sub_func == VDA_FLASH_COMMIT) 922 - esas2r_lock_clear_flags(&a->flags, AF_FLASHING); 921 + clear_bit(AF_FLASHING, &a->flags); 923 922 924 923 /* See if we setup a callback to do special processing */ 925 924
+35 -38
drivers/scsi/esas2r/esas2r_io.c
··· 49 49 struct esas2r_request *startrq = rq; 50 50 unsigned long flags; 51 51 52 - if (unlikely(a->flags & (AF_DEGRADED_MODE | AF_POWER_DOWN))) { 52 + if (unlikely(test_bit(AF_DEGRADED_MODE, &a->flags) || 53 + test_bit(AF_POWER_DOWN, &a->flags))) { 53 54 if (rq->vrq->scsi.function == VDA_FUNC_SCSI) 54 55 rq->req_stat = RS_SEL2; 55 56 else ··· 70 69 * Note that if AF_DISC_PENDING is set than this will 71 70 * go on the defer queue. 72 71 */ 73 - if (unlikely(t->target_state != TS_PRESENT 74 - && !(a->flags & AF_DISC_PENDING))) 72 + if (unlikely(t->target_state != TS_PRESENT && 73 + !test_bit(AF_DISC_PENDING, &a->flags))) 75 74 rq->req_stat = RS_SEL; 76 75 } 77 76 } ··· 92 91 spin_lock_irqsave(&a->queue_lock, flags); 93 92 94 93 if (likely(list_empty(&a->defer_list) && 95 - !(a->flags & 96 - (AF_CHPRST_PENDING | AF_FLASHING | AF_DISC_PENDING)))) 94 + !test_bit(AF_CHPRST_PENDING, &a->flags) && 95 + !test_bit(AF_FLASHING, &a->flags) && 96 + !test_bit(AF_DISC_PENDING, &a->flags))) 97 97 esas2r_local_start_request(a, startrq); 98 98 else 99 99 list_add_tail(&startrq->req_list, &a->defer_list); ··· 126 124 127 125 if (unlikely(rq->vrq->scsi.function == VDA_FUNC_FLASH 128 126 && rq->vrq->flash.sub_func == VDA_FLASH_COMMIT)) 129 - esas2r_lock_set_flags(&a->flags, AF_FLASHING); 127 + set_bit(AF_FLASHING, &a->flags); 130 128 131 129 list_add_tail(&rq->req_list, &a->active_list); 132 130 esas2r_start_vda_request(a, rq); ··· 149 147 if (a->last_write >= a->list_size) { 150 148 a->last_write = 0; 151 149 /* update the toggle bit */ 152 - if (a->flags & AF_COMM_LIST_TOGGLE) 153 - esas2r_lock_clear_flags(&a->flags, 154 - AF_COMM_LIST_TOGGLE); 150 + if (test_bit(AF_COMM_LIST_TOGGLE, &a->flags)) 151 + clear_bit(AF_COMM_LIST_TOGGLE, &a->flags); 155 152 else 156 - esas2r_lock_set_flags(&a->flags, AF_COMM_LIST_TOGGLE); 153 + set_bit(AF_COMM_LIST_TOGGLE, &a->flags); 157 154 } 158 155 159 156 element = ··· 170 169 /* Update the write pointer */ 171 170 dw = a->last_write; 172 171 173 - if (a->flags & AF_COMM_LIST_TOGGLE) 172 + if (test_bit(AF_COMM_LIST_TOGGLE, &a->flags)) 174 173 dw |= MU_ILW_TOGGLE; 175 174 176 175 esas2r_trace("rq->vrq->scsi.handle:%x", rq->vrq->scsi.handle); ··· 688 687 esas2r_write_register_dword(a, MU_DOORBELL_OUT, 689 688 doorbell); 690 689 if (ver == DRBL_FW_VER_0) { 691 - esas2r_lock_set_flags(&a->flags, 692 - AF_CHPRST_DETECTED); 693 - esas2r_lock_set_flags(&a->flags, 694 - AF_LEGACY_SGE_MODE); 690 + set_bit(AF_CHPRST_DETECTED, &a->flags); 691 + set_bit(AF_LEGACY_SGE_MODE, &a->flags); 695 692 696 693 a->max_vdareq_size = 128; 697 694 a->build_sgl = esas2r_build_sg_list_sge; 698 695 } else if (ver == DRBL_FW_VER_1) { 699 - esas2r_lock_set_flags(&a->flags, 700 - AF_CHPRST_DETECTED); 701 - esas2r_lock_clear_flags(&a->flags, 702 - AF_LEGACY_SGE_MODE); 696 + set_bit(AF_CHPRST_DETECTED, &a->flags); 697 + clear_bit(AF_LEGACY_SGE_MODE, &a->flags); 703 698 704 699 a->max_vdareq_size = 1024; 705 700 a->build_sgl = esas2r_build_sg_list_prd; ··· 716 719 a->last_tick_time = currtime; 717 720 718 721 /* count down the uptime */ 719 - if (a->chip_uptime 720 - && !(a->flags & (AF_CHPRST_PENDING | AF_DISC_PENDING))) { 722 + if (a->chip_uptime && 723 + !test_bit(AF_CHPRST_PENDING, &a->flags) && 724 + !test_bit(AF_DISC_PENDING, &a->flags)) { 721 725 if (deltatime >= a->chip_uptime) 722 726 a->chip_uptime = 0; 723 727 else 724 728 a->chip_uptime -= deltatime; 725 729 } 726 730 727 - if (a->flags & AF_CHPRST_PENDING) { 728 - if (!(a->flags & AF_CHPRST_NEEDED) 729 - && !(a->flags & AF_CHPRST_DETECTED)) 731 + if (test_bit(AF_CHPRST_PENDING, &a->flags)) { 732 + if (!test_bit(AF_CHPRST_NEEDED, &a->flags) && 733 + !test_bit(AF_CHPRST_DETECTED, &a->flags)) 730 734 esas2r_handle_pending_reset(a, currtime); 731 735 } else { 732 - if (a->flags & AF_DISC_PENDING) 736 + if (test_bit(AF_DISC_PENDING, &a->flags)) 733 737 esas2r_disc_check_complete(a); 734 - 735 - if (a->flags & AF_HEARTBEAT_ENB) { 736 - if (a->flags & AF_HEARTBEAT) { 738 + if (test_bit(AF_HEARTBEAT_ENB, &a->flags)) { 739 + if (test_bit(AF_HEARTBEAT, &a->flags)) { 737 740 if ((currtime - a->heartbeat_time) >= 738 741 ESAS2R_HEARTBEAT_TIME) { 739 - esas2r_lock_clear_flags(&a->flags, 740 - AF_HEARTBEAT); 742 + clear_bit(AF_HEARTBEAT, &a->flags); 741 743 esas2r_hdebug("heartbeat failed"); 742 744 esas2r_log(ESAS2R_LOG_CRIT, 743 745 "heartbeat failed"); ··· 744 748 esas2r_local_reset_adapter(a); 745 749 } 746 750 } else { 747 - esas2r_lock_set_flags(&a->flags, AF_HEARTBEAT); 751 + set_bit(AF_HEARTBEAT, &a->flags); 748 752 a->heartbeat_time = currtime; 749 753 esas2r_force_interrupt(a); 750 754 } ··· 808 812 rqaux->vrq->scsi.flags |= 809 813 cpu_to_le16(task_mgt_func * LOBIT(FCP_CMND_TM_MASK)); 810 814 811 - if (a->flags & AF_FLASHING) { 815 + if (test_bit(AF_FLASHING, &a->flags)) { 812 816 /* Assume success. if there are active requests, return busy */ 813 817 rqaux->req_stat = RS_SUCCESS; 814 818 ··· 827 831 828 832 spin_unlock_irqrestore(&a->queue_lock, flags); 829 833 830 - if (!(a->flags & AF_FLASHING)) 834 + if (!test_bit(AF_FLASHING, &a->flags)) 831 835 esas2r_start_request(a, rqaux); 832 836 833 837 esas2r_comp_list_drain(a, &comp_list); ··· 844 848 { 845 849 esas2r_log(ESAS2R_LOG_INFO, "performing a bus reset"); 846 850 847 - if (!(a->flags & AF_DEGRADED_MODE) 848 - && !(a->flags & (AF_CHPRST_PENDING | AF_DISC_PENDING))) { 849 - esas2r_lock_set_flags(&a->flags, AF_BUSRST_NEEDED); 850 - esas2r_lock_set_flags(&a->flags, AF_BUSRST_PENDING); 851 - esas2r_lock_set_flags(&a->flags, AF_OS_RESET); 851 + if (!test_bit(AF_DEGRADED_MODE, &a->flags) && 852 + !test_bit(AF_CHPRST_PENDING, &a->flags) && 853 + !test_bit(AF_DISC_PENDING, &a->flags)) { 854 + set_bit(AF_BUSRST_NEEDED, &a->flags); 855 + set_bit(AF_BUSRST_PENDING, &a->flags); 856 + set_bit(AF_OS_RESET, &a->flags); 852 857 853 858 esas2r_schedule_tasklet(a); 854 859 }
+14 -14
drivers/scsi/esas2r/esas2r_ioctl.c
··· 347 347 { 348 348 struct atto_vda_ioctl_req *ioctl = &rq->vrq->ioctl; 349 349 350 - if (a->flags & AF_DEGRADED_MODE) 350 + if (test_bit(AF_DEGRADED_MODE, &a->flags)) 351 351 return false; 352 352 353 353 esas2r_sgc_init(sgc, a, rq, rq->vrq->ioctl.sge); ··· 463 463 gcc->bios_minor_rev = LOBYTE(HIWORD(a->flash_ver)); 464 464 gcc->bios_build_rev = LOWORD(a->flash_ver); 465 465 466 - if (a->flags2 & AF2_THUNDERLINK) 466 + if (test_bit(AF2_THUNDERLINK, &a->flags2)) 467 467 gcc->cntlr_flags = CSMI_CNTLRF_SAS_HBA 468 468 | CSMI_CNTLRF_SATA_HBA; 469 469 else ··· 485 485 { 486 486 struct atto_csmi_get_cntlr_sts *gcs = &ioctl_csmi->cntlr_sts; 487 487 488 - if (a->flags & AF_DEGRADED_MODE) 488 + if (test_bit(AF_DEGRADED_MODE, &a->flags)) 489 489 gcs->status = CSMI_CNTLR_STS_FAILED; 490 490 else 491 491 gcs->status = CSMI_CNTLR_STS_GOOD; ··· 819 819 820 820 gai->adap_type = ATTO_GAI_AT_ESASRAID2; 821 821 822 - if (a->flags2 & AF2_THUNDERLINK) 822 + if (test_bit(AF2_THUNDERLINK, &a->flags2)) 823 823 gai->adap_type = ATTO_GAI_AT_TLSASHBA; 824 824 825 - if (a->flags & AF_DEGRADED_MODE) 825 + if (test_bit(AF_DEGRADED_MODE, &a->flags)) 826 826 gai->adap_flags |= ATTO_GAI_AF_DEGRADED; 827 827 828 828 gai->adap_flags |= ATTO_GAI_AF_SPT_SUPP | ··· 938 938 u32 total_len = ESAS2R_FWCOREDUMP_SZ; 939 939 940 940 /* Size is zero if a core dump isn't present */ 941 - if (!(a->flags2 & AF2_COREDUMP_SAVED)) 941 + if (!test_bit(AF2_COREDUMP_SAVED, &a->flags2)) 942 942 total_len = 0; 943 943 944 944 if (len > total_len) ··· 960 960 memset(a->fw_coredump_buff, 0, 961 961 ESAS2R_FWCOREDUMP_SZ); 962 962 963 - esas2r_lock_clear_flags(&a->flags2, 964 - AF2_COREDUMP_SAVED); 963 + clear_bit(AF2_COREDUMP_SAVED, &a->flags2); 965 964 } else if (trc->trace_func != ATTO_TRC_TF_GET_INFO) { 966 965 hi->status = ATTO_STS_UNSUPPORTED; 967 966 break; ··· 972 973 trc->total_length = ESAS2R_FWCOREDUMP_SZ; 973 974 974 975 /* Return zero length buffer if core dump not present */ 975 - if (!(a->flags2 & AF2_COREDUMP_SAVED)) 976 + if (!test_bit(AF2_COREDUMP_SAVED, &a->flags2)) 976 977 trc->total_length = 0; 977 978 } else { 978 979 hi->status = ATTO_STS_UNSUPPORTED; ··· 1046 1047 cpu_to_le32(FCP_CMND_TA_ORDRD_Q); 1047 1048 else if (spt->flags & ATTO_SPTF_HEAD_OF_Q) 1048 1049 rq->vrq->scsi.flags |= cpu_to_le32(FCP_CMND_TA_HEAD_Q); 1050 + 1049 1051 1050 1052 if (!esas2r_build_sg_list(a, rq, sgc)) { 1051 1053 hi->status = ATTO_STS_OUT_OF_RSRC; ··· 1139 1139 break; 1140 1140 } 1141 1141 1142 - if (a->flags & AF_CHPRST_NEEDED) 1142 + if (test_bit(AF_CHPRST_NEEDED, &a->flags)) 1143 1143 ac->adap_state = ATTO_AC_AS_RST_SCHED; 1144 - else if (a->flags & AF_CHPRST_PENDING) 1144 + else if (test_bit(AF_CHPRST_PENDING, &a->flags)) 1145 1145 ac->adap_state = ATTO_AC_AS_RST_IN_PROG; 1146 - else if (a->flags & AF_DISC_PENDING) 1146 + else if (test_bit(AF_DISC_PENDING, &a->flags)) 1147 1147 ac->adap_state = ATTO_AC_AS_RST_DISC; 1148 - else if (a->flags & AF_DISABLED) 1148 + else if (test_bit(AF_DISABLED, &a->flags)) 1149 1149 ac->adap_state = ATTO_AC_AS_DISABLED; 1150 - else if (a->flags & AF_DEGRADED_MODE) 1150 + else if (test_bit(AF_DEGRADED_MODE, &a->flags)) 1151 1151 ac->adap_state = ATTO_AC_AS_DEGRADED; 1152 1152 else 1153 1153 ac->adap_state = ATTO_AC_AS_OK;
+17 -17
drivers/scsi/esas2r/esas2r_main.c
··· 889 889 /* Assume success, if it fails we will fix the result later. */ 890 890 cmd->result = DID_OK << 16; 891 891 892 - if (unlikely(a->flags & AF_DEGRADED_MODE)) { 892 + if (unlikely(test_bit(AF_DEGRADED_MODE, &a->flags))) { 893 893 cmd->result = DID_NO_CONNECT << 16; 894 894 cmd->scsi_done(cmd); 895 895 return 0; ··· 1050 1050 1051 1051 esas2r_log(ESAS2R_LOG_INFO, "eh_abort (%p)", cmd); 1052 1052 1053 - if (a->flags & AF_DEGRADED_MODE) { 1053 + if (test_bit(AF_DEGRADED_MODE, &a->flags)) { 1054 1054 cmd->result = DID_ABORT << 16; 1055 1055 1056 1056 scsi_set_resid(cmd, 0); ··· 1131 1131 struct esas2r_adapter *a = 1132 1132 (struct esas2r_adapter *)cmd->device->host->hostdata; 1133 1133 1134 - if (a->flags & AF_DEGRADED_MODE) 1134 + if (test_bit(AF_DEGRADED_MODE, &a->flags)) 1135 1135 return FAILED; 1136 1136 1137 1137 if (host_reset) ··· 1141 1141 1142 1142 /* above call sets the AF_OS_RESET flag. wait for it to clear. */ 1143 1143 1144 - while (a->flags & AF_OS_RESET) { 1144 + while (test_bit(AF_OS_RESET, &a->flags)) { 1145 1145 msleep(10); 1146 1146 1147 - if (a->flags & AF_DEGRADED_MODE) 1147 + if (test_bit(AF_DEGRADED_MODE, &a->flags)) 1148 1148 return FAILED; 1149 1149 } 1150 1150 1151 - if (a->flags & AF_DEGRADED_MODE) 1151 + if (test_bit(AF_DEGRADED_MODE, &a->flags)) 1152 1152 return FAILED; 1153 1153 1154 1154 return SUCCESS; ··· 1176 1176 u8 task_management_status = RS_PENDING; 1177 1177 bool completed; 1178 1178 1179 - if (a->flags & AF_DEGRADED_MODE) 1179 + if (test_bit(AF_DEGRADED_MODE, &a->flags)) 1180 1180 return FAILED; 1181 1181 1182 1182 retry: ··· 1229 1229 msleep(10); 1230 1230 } 1231 1231 1232 - if (a->flags & AF_DEGRADED_MODE) 1232 + if (test_bit(AF_DEGRADED_MODE, &a->flags)) 1233 1233 return FAILED; 1234 1234 1235 1235 if (task_management_status == RS_BUSY) { ··· 1666 1666 { 1667 1667 struct esas2r_adapter *a = (struct esas2r_adapter *)context; 1668 1668 1669 - if (unlikely(a->flags2 & AF2_TIMER_TICK)) { 1670 - esas2r_lock_clear_flags(&a->flags2, AF2_TIMER_TICK); 1669 + if (unlikely(test_bit(AF2_TIMER_TICK, &a->flags2))) { 1670 + clear_bit(AF2_TIMER_TICK, &a->flags2); 1671 1671 esas2r_timer_tick(a); 1672 1672 } 1673 1673 1674 - if (likely(a->flags2 & AF2_INT_PENDING)) { 1675 - esas2r_lock_clear_flags(&a->flags2, AF2_INT_PENDING); 1674 + if (likely(test_bit(AF2_INT_PENDING, &a->flags2))) { 1675 + clear_bit(AF2_INT_PENDING, &a->flags2); 1676 1676 esas2r_adapter_interrupt(a); 1677 1677 } 1678 1678 ··· 1680 1680 esas2r_do_tasklet_tasks(a); 1681 1681 1682 1682 if (esas2r_is_tasklet_pending(a) 1683 - || (a->flags2 & AF2_INT_PENDING) 1684 - || (a->flags2 & AF2_TIMER_TICK)) { 1685 - esas2r_lock_clear_flags(&a->flags, AF_TASKLET_SCHEDULED); 1683 + || (test_bit(AF2_INT_PENDING, &a->flags2)) 1684 + || (test_bit(AF2_TIMER_TICK, &a->flags2))) { 1685 + clear_bit(AF_TASKLET_SCHEDULED, &a->flags); 1686 1686 esas2r_schedule_tasklet(a); 1687 1687 } else { 1688 - esas2r_lock_clear_flags(&a->flags, AF_TASKLET_SCHEDULED); 1688 + clear_bit(AF_TASKLET_SCHEDULED, &a->flags); 1689 1689 } 1690 1690 } 1691 1691 ··· 1707 1707 { 1708 1708 struct esas2r_adapter *a = (struct esas2r_adapter *)context; 1709 1709 1710 - esas2r_lock_set_flags(&a->flags2, AF2_TIMER_TICK); 1710 + set_bit(AF2_TIMER_TICK, &a->flags2); 1711 1711 1712 1712 esas2r_schedule_tasklet(a); 1713 1713
+1 -1
drivers/scsi/esas2r/esas2r_targdb.c
··· 86 86 87 87 esas2r_trace_enter(); 88 88 89 - if (a->flags & AF_DISC_PENDING) { 89 + if (test_bit(AF_DISC_PENDING, &a->flags)) { 90 90 esas2r_trace_exit(); 91 91 return; 92 92 }
+3 -3
drivers/scsi/esas2r/esas2r_vda.c
··· 84 84 return false; 85 85 } 86 86 87 - if (a->flags & AF_DEGRADED_MODE) { 87 + if (test_bit(AF_DEGRADED_MODE, &a->flags)) { 88 88 vi->status = ATTO_STS_DEGRADED; 89 89 return false; 90 90 } ··· 389 389 vrq->length = cpu_to_le32(length); 390 390 391 391 if (vrq->length) { 392 - if (a->flags & AF_LEGACY_SGE_MODE) { 392 + if (test_bit(AF_LEGACY_SGE_MODE, &a->flags)) { 393 393 vrq->sg_list_offset = (u8)offsetof( 394 394 struct atto_vda_mgmt_req, sge); 395 395 ··· 427 427 428 428 vrq->length = cpu_to_le32(sizeof(struct atto_vda_ae_data)); 429 429 430 - if (a->flags & AF_LEGACY_SGE_MODE) { 430 + if (test_bit(AF_LEGACY_SGE_MODE, &a->flags)) { 431 431 vrq->sg_list_offset = 432 432 (u8)offsetof(struct atto_vda_ae_req, sge); 433 433 vrq->sge[0].length = cpu_to_le32(SGE_LAST | vrq->length);