diff options
author | Douglas Gilbert <dgilbert@interlog.com> | 2016-04-30 22:44:42 -0400 |
---|---|---|
committer | Martin K. Petersen <martin.petersen@oracle.com> | 2016-05-03 22:39:32 -0400 |
commit | b01f6f8316af5226b0cada03e3b121e72dd4c17f (patch) | |
tree | b857ee2f2ea93543ef886d4b821a6aef14d0c95e | |
parent | f46eb0e9fc763b7b66c325eb94e6aefa960146d2 (diff) |
scsi_debug: use pdt constants
Use TYPE_* constants for SCSI peripheral device types instead of
numbers. Further cleanups requested by checkpatch.pl.
Signed-off-by: Douglas Gilbert <dgilbert@interlog.com>
Reviewed-by: Hannes Reinicke <hare@suse.de>
Reviewed-by: Bart Van Assche <bart.vanassche@sandisk.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
-rw-r--r-- | drivers/scsi/scsi_debug.c | 86 |
1 files changed, 45 insertions, 41 deletions
diff --git a/drivers/scsi/scsi_debug.c b/drivers/scsi/scsi_debug.c index 6b2d00675ee2..fc0246c32294 100644 --- a/drivers/scsi/scsi_debug.c +++ b/drivers/scsi/scsi_debug.c | |||
@@ -59,8 +59,8 @@ | |||
59 | #include "scsi_logging.h" | 59 | #include "scsi_logging.h" |
60 | 60 | ||
61 | /* make sure inq_product_rev string corresponds to this version */ | 61 | /* make sure inq_product_rev string corresponds to this version */ |
62 | #define SCSI_DEBUG_VERSION "1.86" | 62 | #define SDEBUG_VERSION "1.86" |
63 | static const char *sdebug_version_date = "20160422"; | 63 | static const char *sdebug_version_date = "20160430"; |
64 | 64 | ||
65 | #define MY_NAME "scsi_debug" | 65 | #define MY_NAME "scsi_debug" |
66 | 66 | ||
@@ -123,7 +123,7 @@ static const char *sdebug_version_date = "20160422"; | |||
123 | #define DEF_OPTS 0 | 123 | #define DEF_OPTS 0 |
124 | #define DEF_OPT_BLKS 1024 | 124 | #define DEF_OPT_BLKS 1024 |
125 | #define DEF_PHYSBLK_EXP 0 | 125 | #define DEF_PHYSBLK_EXP 0 |
126 | #define DEF_PTYPE 0 | 126 | #define DEF_PTYPE TYPE_DISK |
127 | #define DEF_REMOVABLE false | 127 | #define DEF_REMOVABLE false |
128 | #define DEF_SCSI_LEVEL 6 /* INQUIRY, byte2 [6->SPC-4] */ | 128 | #define DEF_SCSI_LEVEL 6 /* INQUIRY, byte2 [6->SPC-4] */ |
129 | #define DEF_SECTOR_SIZE 512 | 129 | #define DEF_SECTOR_SIZE 512 |
@@ -137,6 +137,8 @@ static const char *sdebug_version_date = "20160422"; | |||
137 | #define DEF_STRICT 0 | 137 | #define DEF_STRICT 0 |
138 | #define JDELAY_OVERRIDDEN -9999 | 138 | #define JDELAY_OVERRIDDEN -9999 |
139 | 139 | ||
140 | #define SDEBUG_LUN_0_VAL 0 | ||
141 | |||
140 | /* bit mask values for sdebug_opts */ | 142 | /* bit mask values for sdebug_opts */ |
141 | #define SDEBUG_OPT_NOISE 1 | 143 | #define SDEBUG_OPT_NOISE 1 |
142 | #define SDEBUG_OPT_MEDIUM_ERR 2 | 144 | #define SDEBUG_OPT_MEDIUM_ERR 2 |
@@ -232,7 +234,7 @@ static const char *sdebug_version_date = "20160422"; | |||
232 | 234 | ||
233 | #define SDEBUG_MAX_PARTS 4 | 235 | #define SDEBUG_MAX_PARTS 4 |
234 | 236 | ||
235 | #define SCSI_DEBUG_MAX_CMD_LEN 32 | 237 | #define SDEBUG_MAX_CMD_LEN 32 |
236 | 238 | ||
237 | 239 | ||
238 | struct sdebug_dev_info { | 240 | struct sdebug_dev_info { |
@@ -278,8 +280,8 @@ struct sdebug_scmd_extra_t { | |||
278 | }; | 280 | }; |
279 | 281 | ||
280 | struct opcode_info_t { | 282 | struct opcode_info_t { |
281 | u8 num_attached; /* 0 if this is it (i.e. a leaf); use 0xff | 283 | u8 num_attached; /* 0 if this is it (i.e. a leaf); use 0xff */ |
282 | * for terminating element */ | 284 | /* for terminating element */ |
283 | u8 opcode; /* if num_attached > 0, preferred */ | 285 | u8 opcode; /* if num_attached > 0, preferred */ |
284 | u16 sa; /* service action */ | 286 | u16 sa; /* service action */ |
285 | u32 flags; /* OR-ed set of SDEB_F_* */ | 287 | u32 flags; /* OR-ed set of SDEB_F_* */ |
@@ -571,7 +573,7 @@ static int sdebug_num_tgts = DEF_NUM_TGTS; /* targets per host */ | |||
571 | static int sdebug_opt_blks = DEF_OPT_BLKS; | 573 | static int sdebug_opt_blks = DEF_OPT_BLKS; |
572 | static int sdebug_opts = DEF_OPTS; | 574 | static int sdebug_opts = DEF_OPTS; |
573 | static int sdebug_physblk_exp = DEF_PHYSBLK_EXP; | 575 | static int sdebug_physblk_exp = DEF_PHYSBLK_EXP; |
574 | static int sdebug_ptype = DEF_PTYPE; /* SCSI peripheral type (0==disk) */ | 576 | static int sdebug_ptype = DEF_PTYPE; /* SCSI peripheral device type */ |
575 | static int sdebug_scsi_level = DEF_SCSI_LEVEL; | 577 | static int sdebug_scsi_level = DEF_SCSI_LEVEL; |
576 | static int sdebug_sector_size = DEF_SECTOR_SIZE; | 578 | static int sdebug_sector_size = DEF_SECTOR_SIZE; |
577 | static int sdebug_virtual_gb = DEF_VIRTUAL_GB; | 579 | static int sdebug_virtual_gb = DEF_VIRTUAL_GB; |
@@ -649,7 +651,7 @@ static const int device_qfull_result = | |||
649 | (DID_OK << 16) | (COMMAND_COMPLETE << 8) | SAM_STAT_TASK_SET_FULL; | 651 | (DID_OK << 16) | (COMMAND_COMPLETE << 8) | SAM_STAT_TASK_SET_FULL; |
650 | 652 | ||
651 | 653 | ||
652 | static unsigned int scsi_debug_lbp(void) | 654 | static inline unsigned int scsi_debug_lbp(void) |
653 | { | 655 | { |
654 | return 0 == sdebug_fake_rw && | 656 | return 0 == sdebug_fake_rw && |
655 | (sdebug_lbpu || sdebug_lbpws || sdebug_lbpws10); | 657 | (sdebug_lbpu || sdebug_lbpws || sdebug_lbpws10); |
@@ -825,7 +827,8 @@ static int make_ua(struct scsi_cmnd *scp, struct sdebug_dev_info *devip) | |||
825 | break; | 827 | break; |
826 | case SDEBUG_UA_MICROCODE_CHANGED: | 828 | case SDEBUG_UA_MICROCODE_CHANGED: |
827 | mk_sense_buffer(scp, UNIT_ATTENTION, | 829 | mk_sense_buffer(scp, UNIT_ATTENTION, |
828 | TARGET_CHANGED_ASC, MICROCODE_CHANGED_ASCQ); | 830 | TARGET_CHANGED_ASC, |
831 | MICROCODE_CHANGED_ASCQ); | ||
829 | if (sdebug_verbose) | 832 | if (sdebug_verbose) |
830 | cp = "microcode has been changed"; | 833 | cp = "microcode has been changed"; |
831 | break; | 834 | break; |
@@ -1225,11 +1228,11 @@ static int resp_inquiry(struct scsi_cmnd *scp, struct sdebug_dev_info *devip) | |||
1225 | arr = kzalloc(SDEBUG_MAX_INQ_ARR_SZ, GFP_ATOMIC); | 1228 | arr = kzalloc(SDEBUG_MAX_INQ_ARR_SZ, GFP_ATOMIC); |
1226 | if (! arr) | 1229 | if (! arr) |
1227 | return DID_REQUEUE << 16; | 1230 | return DID_REQUEUE << 16; |
1228 | have_wlun = (scp->device->lun == SCSI_W_LUN_REPORT_LUNS); | 1231 | have_wlun = scsi_is_wlun(scp->device->lun); |
1229 | if (have_wlun) | 1232 | if (have_wlun) |
1230 | pq_pdt = 0x1e; /* present, wlun */ | 1233 | pq_pdt = TYPE_WLUN; /* present, wlun */ |
1231 | else if (sdebug_no_lun_0 && (0 == devip->lun)) | 1234 | else if (sdebug_no_lun_0 && (devip->lun == SDEBUG_LUN_0_VAL)) |
1232 | pq_pdt = 0x7f; /* not present, no device type */ | 1235 | pq_pdt = 0x7f; /* not present, PQ=3, PDT=0x1f */ |
1233 | else | 1236 | else |
1234 | pq_pdt = (sdebug_ptype & 0x1f); | 1237 | pq_pdt = (sdebug_ptype & 0x1f); |
1235 | arr[0] = pq_pdt; | 1238 | arr[0] = pq_pdt; |
@@ -1244,7 +1247,7 @@ static int resp_inquiry(struct scsi_cmnd *scp, struct sdebug_dev_info *devip) | |||
1244 | 1247 | ||
1245 | port_group_id = (((host_no + 1) & 0x7f) << 8) + | 1248 | port_group_id = (((host_no + 1) & 0x7f) << 8) + |
1246 | (devip->channel & 0x7f); | 1249 | (devip->channel & 0x7f); |
1247 | if (0 == sdebug_vpd_use_hostno) | 1250 | if (sdebug_vpd_use_hostno == 0) |
1248 | host_no = 0; | 1251 | host_no = 0; |
1249 | lu_id_num = have_wlun ? -1 : (((host_no + 1) * 2000) + | 1252 | lu_id_num = have_wlun ? -1 : (((host_no + 1) * 2000) + |
1250 | (devip->target * 1000) + devip->lun); | 1253 | (devip->target * 1000) + devip->lun); |
@@ -1333,7 +1336,7 @@ static int resp_inquiry(struct scsi_cmnd *scp, struct sdebug_dev_info *devip) | |||
1333 | arr[3] = 2; /* response_data_format==2 */ | 1336 | arr[3] = 2; /* response_data_format==2 */ |
1334 | arr[4] = SDEBUG_LONG_INQ_SZ - 5; | 1337 | arr[4] = SDEBUG_LONG_INQ_SZ - 5; |
1335 | arr[5] = (int)have_dif_prot; /* PROTECT bit */ | 1338 | arr[5] = (int)have_dif_prot; /* PROTECT bit */ |
1336 | if (0 == sdebug_vpd_use_hostno) | 1339 | if (sdebug_vpd_use_hostno == 0) |
1337 | arr[5] = 0x10; /* claim: implicit TGPS */ | 1340 | arr[5] = 0x10; /* claim: implicit TGPS */ |
1338 | arr[6] = 0x10; /* claim: MultiP */ | 1341 | arr[6] = 0x10; /* claim: MultiP */ |
1339 | /* arr[6] |= 0x40; ... claim: EncServ (enclosure services) */ | 1342 | /* arr[6] |= 0x40; ... claim: EncServ (enclosure services) */ |
@@ -1345,9 +1348,9 @@ static int resp_inquiry(struct scsi_cmnd *scp, struct sdebug_dev_info *devip) | |||
1345 | arr[58] = 0x0; arr[59] = 0xa2; /* SAM-5 rev 4 */ | 1348 | arr[58] = 0x0; arr[59] = 0xa2; /* SAM-5 rev 4 */ |
1346 | arr[60] = 0x4; arr[61] = 0x68; /* SPC-4 rev 37 */ | 1349 | arr[60] = 0x4; arr[61] = 0x68; /* SPC-4 rev 37 */ |
1347 | n = 62; | 1350 | n = 62; |
1348 | if (sdebug_ptype == 0) { | 1351 | if (sdebug_ptype == TYPE_DISK) { |
1349 | arr[n++] = 0x4; arr[n++] = 0xc5; /* SBC-4 rev 36 */ | 1352 | arr[n++] = 0x4; arr[n++] = 0xc5; /* SBC-4 rev 36 */ |
1350 | } else if (sdebug_ptype == 1) { | 1353 | } else if (sdebug_ptype == TYPE_TAPE) { |
1351 | arr[n++] = 0x5; arr[n++] = 0x25; /* SSC-4 rev 3 */ | 1354 | arr[n++] = 0x5; arr[n++] = 0x25; /* SSC-4 rev 3 */ |
1352 | } | 1355 | } |
1353 | arr[n++] = 0x20; arr[n++] = 0xe6; /* SPL-3 rev 7 */ | 1356 | arr[n++] = 0x20; arr[n++] = 0xe6; /* SPL-3 rev 7 */ |
@@ -1534,7 +1537,7 @@ static int resp_report_tgtpgs(struct scsi_cmnd * scp, | |||
1534 | * The asymmetric access state is cycled according to the host_id. | 1537 | * The asymmetric access state is cycled according to the host_id. |
1535 | */ | 1538 | */ |
1536 | n = 4; | 1539 | n = 4; |
1537 | if (0 == sdebug_vpd_use_hostno) { | 1540 | if (sdebug_vpd_use_hostno == 0) { |
1538 | arr[n++] = host_no % 3; /* Asymm access state */ | 1541 | arr[n++] = host_no % 3; /* Asymm access state */ |
1539 | arr[n++] = 0x0F; /* claim: all states are supported */ | 1542 | arr[n++] = 0x0F; /* claim: all states are supported */ |
1540 | } else { | 1543 | } else { |
@@ -1938,7 +1941,7 @@ static int resp_mode_sense(struct scsi_cmnd *scp, | |||
1938 | subpcode = cmd[3]; | 1941 | subpcode = cmd[3]; |
1939 | msense_6 = (MODE_SENSE == cmd[0]); | 1942 | msense_6 = (MODE_SENSE == cmd[0]); |
1940 | llbaa = msense_6 ? 0 : !!(cmd[1] & 0x10); | 1943 | llbaa = msense_6 ? 0 : !!(cmd[1] & 0x10); |
1941 | if ((0 == sdebug_ptype) && (0 == dbd)) | 1944 | if ((sdebug_ptype == TYPE_DISK) && (dbd == 0)) |
1942 | bd_len = llbaa ? 16 : 8; | 1945 | bd_len = llbaa ? 16 : 8; |
1943 | else | 1946 | else |
1944 | bd_len = 0; | 1947 | bd_len = 0; |
@@ -1950,9 +1953,9 @@ static int resp_mode_sense(struct scsi_cmnd *scp, | |||
1950 | } | 1953 | } |
1951 | target_dev_id = ((devip->sdbg_host->shost->host_no + 1) * 2000) + | 1954 | target_dev_id = ((devip->sdbg_host->shost->host_no + 1) * 2000) + |
1952 | (devip->target * 1000) - 3; | 1955 | (devip->target * 1000) - 3; |
1953 | /* set DPOFUA bit for disks */ | 1956 | /* for disks set DPOFUA bit and clear write protect (WP) bit */ |
1954 | if (0 == sdebug_ptype) | 1957 | if (sdebug_ptype == TYPE_DISK) |
1955 | dev_spec = 0x10; /* would be 0x90 if read-only */ | 1958 | dev_spec = 0x10; /* =0x90 if WP=1 implies read-only */ |
1956 | else | 1959 | else |
1957 | dev_spec = 0x0; | 1960 | dev_spec = 0x0; |
1958 | if (msense_6) { | 1961 | if (msense_6) { |
@@ -3345,7 +3348,7 @@ static void sdebug_q_cmd_complete(struct sdebug_defer *sd_dp) | |||
3345 | spin_lock_irqsave(&queued_arr_lock, iflags); | 3348 | spin_lock_irqsave(&queued_arr_lock, iflags); |
3346 | sqcp = &queued_arr[qa_indx]; | 3349 | sqcp = &queued_arr[qa_indx]; |
3347 | scp = sqcp->a_cmnd; | 3350 | scp = sqcp->a_cmnd; |
3348 | if (unlikely(NULL == scp)) { | 3351 | if (unlikely(scp == NULL)) { |
3349 | spin_unlock_irqrestore(&queued_arr_lock, iflags); | 3352 | spin_unlock_irqrestore(&queued_arr_lock, iflags); |
3350 | pr_err("scp is NULL\n"); | 3353 | pr_err("scp is NULL\n"); |
3351 | return; | 3354 | return; |
@@ -3470,11 +3473,11 @@ static int scsi_debug_slave_configure(struct scsi_device *sdp) | |||
3470 | if (sdebug_verbose) | 3473 | if (sdebug_verbose) |
3471 | pr_info("slave_configure <%u %u %u %llu>\n", | 3474 | pr_info("slave_configure <%u %u %u %llu>\n", |
3472 | sdp->host->host_no, sdp->channel, sdp->id, sdp->lun); | 3475 | sdp->host->host_no, sdp->channel, sdp->id, sdp->lun); |
3473 | if (sdp->host->max_cmd_len != SCSI_DEBUG_MAX_CMD_LEN) | 3476 | if (sdp->host->max_cmd_len != SDEBUG_MAX_CMD_LEN) |
3474 | sdp->host->max_cmd_len = SCSI_DEBUG_MAX_CMD_LEN; | 3477 | sdp->host->max_cmd_len = SDEBUG_MAX_CMD_LEN; |
3475 | if (NULL == devip) { | 3478 | if (devip == NULL) { |
3476 | devip = find_build_dev_info(sdp); | 3479 | devip = find_build_dev_info(sdp); |
3477 | if (NULL == devip) | 3480 | if (devip == NULL) |
3478 | return 1; /* no resources, will be marked offline */ | 3481 | return 1; /* no resources, will be marked offline */ |
3479 | } | 3482 | } |
3480 | sdp->hostdata = devip; | 3483 | sdp->hostdata = devip; |
@@ -3528,7 +3531,7 @@ static bool stop_queued_cmnd(struct scsi_cmnd *cmnd) | |||
3528 | sd_dp = sqcp->sd_dp; | 3531 | sd_dp = sqcp->sd_dp; |
3529 | spin_unlock_irqrestore(&queued_arr_lock, | 3532 | spin_unlock_irqrestore(&queued_arr_lock, |
3530 | iflags); | 3533 | iflags); |
3531 | if ((sdebug_jdelay > 0) || (sdebug_ndelay > 0)) { | 3534 | if (sdebug_jdelay > 0 || sdebug_ndelay > 0) { |
3532 | if (sd_dp) | 3535 | if (sd_dp) |
3533 | hrtimer_cancel(&sd_dp->hrt); | 3536 | hrtimer_cancel(&sd_dp->hrt); |
3534 | } else if (sdebug_jdelay < 0) { | 3537 | } else if (sdebug_jdelay < 0) { |
@@ -3565,7 +3568,7 @@ static void stop_all_queued(void) | |||
3565 | sqcp->a_cmnd = NULL; | 3568 | sqcp->a_cmnd = NULL; |
3566 | sd_dp = sqcp->sd_dp; | 3569 | sd_dp = sqcp->sd_dp; |
3567 | spin_unlock_irqrestore(&queued_arr_lock, iflags); | 3570 | spin_unlock_irqrestore(&queued_arr_lock, iflags); |
3568 | if ((sdebug_jdelay > 0) || (sdebug_ndelay > 0)) { | 3571 | if (sdebug_jdelay > 0 || sdebug_ndelay > 0) { |
3569 | if (sd_dp) | 3572 | if (sd_dp) |
3570 | hrtimer_cancel(&sd_dp->hrt); | 3573 | hrtimer_cancel(&sd_dp->hrt); |
3571 | } else if (sdebug_jdelay < 0) { | 3574 | } else if (sdebug_jdelay < 0) { |
@@ -3779,8 +3782,8 @@ static int schedule_resp(struct scsi_cmnd *cmnd, struct sdebug_dev_info *devip, | |||
3779 | if (unlikely(WARN_ON(!cmnd))) | 3782 | if (unlikely(WARN_ON(!cmnd))) |
3780 | return SCSI_MLQUEUE_HOST_BUSY; | 3783 | return SCSI_MLQUEUE_HOST_BUSY; |
3781 | 3784 | ||
3782 | if (unlikely(NULL == devip)) { | 3785 | if (unlikely(devip == NULL)) { |
3783 | if (0 == scsi_result) | 3786 | if (scsi_result == 0) |
3784 | scsi_result = DID_NO_CONNECT << 16; | 3787 | scsi_result = DID_NO_CONNECT << 16; |
3785 | goto respond_in_thread; | 3788 | goto respond_in_thread; |
3786 | } | 3789 | } |
@@ -3841,7 +3844,7 @@ static int schedule_resp(struct scsi_cmnd *cmnd, struct sdebug_dev_info *devip, | |||
3841 | cmnd->result = scsi_result; | 3844 | cmnd->result = scsi_result; |
3842 | spin_unlock_irqrestore(&queued_arr_lock, iflags); | 3845 | spin_unlock_irqrestore(&queued_arr_lock, iflags); |
3843 | sd_dp = sqcp->sd_dp; | 3846 | sd_dp = sqcp->sd_dp; |
3844 | if ((delta_jiff > 0) || (sdebug_ndelay > 0)) { | 3847 | if (delta_jiff > 0 || sdebug_ndelay > 0) { |
3845 | ktime_t kt; | 3848 | ktime_t kt; |
3846 | 3849 | ||
3847 | if (delta_jiff > 0) { | 3850 | if (delta_jiff > 0) { |
@@ -3938,7 +3941,7 @@ module_param_named(write_same_length, sdebug_write_same_length, int, | |||
3938 | MODULE_AUTHOR("Eric Youngdale + Douglas Gilbert"); | 3941 | MODULE_AUTHOR("Eric Youngdale + Douglas Gilbert"); |
3939 | MODULE_DESCRIPTION("SCSI debug adapter driver"); | 3942 | MODULE_DESCRIPTION("SCSI debug adapter driver"); |
3940 | MODULE_LICENSE("GPL"); | 3943 | MODULE_LICENSE("GPL"); |
3941 | MODULE_VERSION(SCSI_DEBUG_VERSION); | 3944 | MODULE_VERSION(SDEBUG_VERSION); |
3942 | 3945 | ||
3943 | MODULE_PARM_DESC(add_host, "0..127 hosts allowed(def=1)"); | 3946 | MODULE_PARM_DESC(add_host, "0..127 hosts allowed(def=1)"); |
3944 | MODULE_PARM_DESC(ato, "application tag ownership: 0=disk 1=host (def=1)"); | 3947 | MODULE_PARM_DESC(ato, "application tag ownership: 0=disk 1=host (def=1)"); |
@@ -3984,9 +3987,10 @@ static char sdebug_info[256]; | |||
3984 | 3987 | ||
3985 | static const char * scsi_debug_info(struct Scsi_Host * shp) | 3988 | static const char * scsi_debug_info(struct Scsi_Host * shp) |
3986 | { | 3989 | { |
3987 | sprintf(sdebug_info, "scsi_debug, version %s [%s], " | 3990 | sprintf(sdebug_info, |
3988 | "dev_size_mb=%d, opts=0x%x", SCSI_DEBUG_VERSION, | 3991 | "scsi_debug, version %s [%s], dev_size_mb=%d, opts=0x%x", |
3989 | sdebug_version_date, sdebug_dev_size_mb, sdebug_opts); | 3992 | SDEBUG_VERSION, sdebug_version_date, sdebug_dev_size_mb, |
3993 | sdebug_opts); | ||
3990 | return sdebug_info; | 3994 | return sdebug_info; |
3991 | } | 3995 | } |
3992 | 3996 | ||
@@ -4036,7 +4040,7 @@ static int scsi_debug_show_info(struct seq_file *m, struct Scsi_Host *host) | |||
4036 | "command aborts=%d; RESETs: device=%d, target=%d, bus=%d, " | 4040 | "command aborts=%d; RESETs: device=%d, target=%d, bus=%d, " |
4037 | "host=%d\ndix_reads=%d dix_writes=%d dif_errors=%d " | 4041 | "host=%d\ndix_reads=%d dix_writes=%d dif_errors=%d " |
4038 | "usec_in_jiffy=%lu\n", | 4042 | "usec_in_jiffy=%lu\n", |
4039 | SCSI_DEBUG_VERSION, sdebug_version_date, | 4043 | SDEBUG_VERSION, sdebug_version_date, |
4040 | sdebug_num_tgts, sdebug_dev_size_mb, sdebug_opts, | 4044 | sdebug_num_tgts, sdebug_dev_size_mb, sdebug_opts, |
4041 | sdebug_every_nth, b, sdebug_jdelay, sdebug_ndelay, | 4045 | sdebug_every_nth, b, sdebug_jdelay, sdebug_ndelay, |
4042 | sdebug_max_luns, atomic_read(&sdebug_completions), | 4046 | sdebug_max_luns, atomic_read(&sdebug_completions), |
@@ -4064,7 +4068,7 @@ static ssize_t delay_store(struct device_driver *ddp, const char *buf, | |||
4064 | { | 4068 | { |
4065 | int jdelay, res; | 4069 | int jdelay, res; |
4066 | 4070 | ||
4067 | if ((count > 0) && (1 == sscanf(buf, "%d", &jdelay))) { | 4071 | if (count > 0 && sscanf(buf, "%d", &jdelay) == 1) { |
4068 | res = count; | 4072 | res = count; |
4069 | if (sdebug_jdelay != jdelay) { | 4073 | if (sdebug_jdelay != jdelay) { |
4070 | unsigned long iflags; | 4074 | unsigned long iflags; |
@@ -4672,7 +4676,7 @@ static int __init scsi_debug_init(void) | |||
4672 | (sdebug_sectors_per * sdebug_heads); | 4676 | (sdebug_sectors_per * sdebug_heads); |
4673 | } | 4677 | } |
4674 | 4678 | ||
4675 | if (0 == sdebug_fake_rw) { | 4679 | if (sdebug_fake_rw == 0) { |
4676 | fake_storep = vmalloc(sz); | 4680 | fake_storep = vmalloc(sz); |
4677 | if (NULL == fake_storep) { | 4681 | if (NULL == fake_storep) { |
4678 | pr_err("out of memory, 1\n"); | 4682 | pr_err("out of memory, 1\n"); |
@@ -5044,8 +5048,8 @@ static int scsi_debug_queuecommand(struct Scsi_Host *shost, | |||
5044 | } | 5048 | } |
5045 | } | 5049 | } |
5046 | if (unlikely(!(F_SKIP_UA & flags) && | 5050 | if (unlikely(!(F_SKIP_UA & flags) && |
5047 | SDEBUG_NUM_UAS != find_first_bit(devip->uas_bm, | 5051 | find_first_bit(devip->uas_bm, |
5048 | SDEBUG_NUM_UAS))) { | 5052 | SDEBUG_NUM_UAS) != SDEBUG_NUM_UAS)) { |
5049 | errsts = make_ua(scp, devip); | 5053 | errsts = make_ua(scp, devip); |
5050 | if (errsts) | 5054 | if (errsts) |
5051 | goto check_cond; | 5055 | goto check_cond; |