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

Configure Feed

Select the types of activity you want to include in your feed.

scsi: scsi_debug: Stop printing extra function name in debug logs

The driver defines as follows pr_fmt:

#define pr_fmt(fmt) KBUILD_MODNAME ":%s: " fmt, __func__

...meaning that we already get the function name added in any debug
statements.

Remove using of __func__ in debug logs to avoid the duplication.

For instances of where the function name was being printed, add some
verbose comment to avoid using "" (which would be a bit silly).

It would be nicer to stop using pr_fmt(), but that would mean rewriting
approx 100 debug statements to have a sensible and clear message.

Signed-off-by: John Garry <john.g.garry@oracle.com>
Link: https://patch.msgid.link/20251113133645.2898748-2-john.g.garry@oracle.com
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>

authored by

John Garry and committed by
Martin K. Petersen
a743b120 e642331c

+45 -56
+45 -56
drivers/scsi/scsi_debug.c
··· 1371 1371 1372 1372 sbuff = scp->sense_buffer; 1373 1373 if (!sbuff) { 1374 - sdev_printk(KERN_ERR, scp->device, 1375 - "%s: sense_buffer is NULL\n", __func__); 1374 + sdev_printk(KERN_ERR, scp->device, "sense_buffer is NULL\n"); 1376 1375 return; 1377 1376 } 1378 1377 asc = c_d ? INVALID_FIELD_IN_CDB : INVALID_FIELD_IN_PARAM_LIST; ··· 1403 1404 static void mk_sense_buffer(struct scsi_cmnd *scp, int key, int asc, int asq) 1404 1405 { 1405 1406 if (!scp->sense_buffer) { 1406 - sdev_printk(KERN_ERR, scp->device, 1407 - "%s: sense_buffer is NULL\n", __func__); 1407 + sdev_printk(KERN_ERR, scp->device, "sense_buffer is NULL\n"); 1408 1408 return; 1409 1409 } 1410 1410 memset(scp->sense_buffer, 0, SCSI_SENSE_BUFFERSIZE); ··· 1421 1423 unsigned int information, unsigned char tape_flags) 1422 1424 { 1423 1425 if (!scp->sense_buffer) { 1424 - sdev_printk(KERN_ERR, scp->device, 1425 - "%s: sense_buffer is NULL\n", __func__); 1426 + sdev_printk(KERN_ERR, scp->device, "sense_buffer is NULL\n"); 1426 1427 return; 1427 1428 } 1428 1429 memset(scp->sense_buffer, 0, SCSI_SENSE_BUFFERSIZE); ··· 1449 1452 { 1450 1453 if (sdebug_verbose) { 1451 1454 if (0x1261 == cmd) 1452 - sdev_printk(KERN_INFO, dev, 1453 - "%s: BLKFLSBUF [0x1261]\n", __func__); 1455 + sdev_printk(KERN_INFO, dev, "BLKFLSBUF [0x1261]\n"); 1454 1456 else if (0x5331 == cmd) 1455 1457 sdev_printk(KERN_INFO, dev, 1456 - "%s: CDROM_GET_CAPABILITY [0x5331]\n", 1457 - __func__); 1458 + "CDROM_GET_CAPABILITY [0x5331]\n"); 1458 1459 else 1459 - sdev_printk(KERN_INFO, dev, "%s: cmd=0x%x\n", 1460 - __func__, cmd); 1460 + sdev_printk(KERN_INFO, dev, "cmd=0x%x\n", cmd); 1461 1461 } 1462 1462 return -EINVAL; 1463 1463 /* return -ENOTTY; // correct return but upsets fdisk */ ··· 1658 1664 1659 1665 act_len = sg_pcopy_from_buffer(sdb->table.sgl, sdb->table.nents, 1660 1666 arr, arr_len, skip); 1661 - pr_debug("%s: off_dst=%u, scsi_bufflen=%u, act_len=%u, resid=%d\n", 1662 - __func__, off_dst, scsi_bufflen(scp), act_len, 1667 + pr_debug("off_dst=%u, scsi_bufflen=%u, act_len=%u, resid=%d\n", 1668 + off_dst, scsi_bufflen(scp), act_len, 1663 1669 scsi_get_resid(scp)); 1664 1670 n = scsi_bufflen(scp) - (off_dst + act_len); 1665 1671 scsi_set_resid(scp, min_t(u32, scsi_get_resid(scp), n)); ··· 3182 3188 return DID_ERROR << 16; 3183 3189 else if (sdebug_verbose && (res < param_len)) 3184 3190 sdev_printk(KERN_INFO, scp->device, 3185 - "%s: cdb indicated=%d, IO sent=%d bytes\n", 3186 - __func__, param_len, res); 3191 + "cdb indicated=%d, IO sent=%d bytes\n", 3192 + param_len, res); 3187 3193 md_len = mselect6 ? (arr[0] + 1) : (get_unaligned_be16(arr + 0) + 2); 3188 3194 bd_len = mselect6 ? arr[3] : get_unaligned_be16(arr + 6); 3189 3195 off = (mselect6 ? 4 : 8); ··· 5127 5133 if (lbdof == 0) { 5128 5134 if (sdebug_verbose) 5129 5135 sdev_printk(KERN_INFO, scp->device, 5130 - "%s: %s: LB Data Offset field bad\n", 5131 - my_name, __func__); 5136 + "%s: LB Data Offset field bad\n", my_name); 5132 5137 mk_sense_buffer(scp, ILLEGAL_REQUEST, INVALID_FIELD_IN_CDB, 0); 5133 5138 return illegal_condition_result; 5134 5139 } ··· 5135 5142 if ((lrd_size + (num_lrd * lrd_size)) > lbdof_blen) { 5136 5143 if (sdebug_verbose) 5137 5144 sdev_printk(KERN_INFO, scp->device, 5138 - "%s: %s: LBA range descriptors don't fit\n", 5139 - my_name, __func__); 5145 + "%s: LBA range descriptors don't fit\n", my_name); 5140 5146 mk_sense_buffer(scp, ILLEGAL_REQUEST, INVALID_FIELD_IN_CDB, 0); 5141 5147 return illegal_condition_result; 5142 5148 } ··· 5144 5152 return SCSI_MLQUEUE_HOST_BUSY; 5145 5153 if (sdebug_verbose) 5146 5154 sdev_printk(KERN_INFO, scp->device, 5147 - "%s: %s: Fetch header+scatter_list, lbdof_blen=%u\n", 5148 - my_name, __func__, lbdof_blen); 5155 + "%s: Fetch header+scatter_list, lbdof_blen=%u\n", 5156 + my_name, lbdof_blen); 5149 5157 res = fetch_to_dev_buffer(scp, lrdp, lbdof_blen); 5150 5158 if (res == -1) { 5151 5159 ret = DID_ERROR << 16; ··· 5162 5170 num = get_unaligned_be32(up + 8); 5163 5171 if (sdebug_verbose) 5164 5172 sdev_printk(KERN_INFO, scp->device, 5165 - "%s: %s: k=%d LBA=0x%llx num=%u sg_off=%u\n", 5166 - my_name, __func__, k, lba, num, sg_off); 5173 + "%s: k=%d LBA=0x%llx num=%u sg_off=%u\n", 5174 + my_name, k, lba, num, sg_off); 5167 5175 if (num == 0) 5168 5176 continue; 5169 5177 ret = check_device_access_params(scp, lba, num, true); ··· 5175 5183 if ((cum_lb + num) > bt_len) { 5176 5184 if (sdebug_verbose) 5177 5185 sdev_printk(KERN_INFO, scp->device, 5178 - "%s: %s: sum of blocks > data provided\n", 5179 - my_name, __func__); 5186 + "%s: sum of blocks > data provided\n", 5187 + my_name); 5180 5188 mk_sense_buffer(scp, ILLEGAL_REQUEST, WRITE_ERROR_ASC, 5181 5189 0); 5182 5190 ret = illegal_condition_result; ··· 5868 5876 goto cleanup; 5869 5877 } else if (sdebug_verbose && (ret < (a_num * lb_size))) { 5870 5878 sdev_printk(KERN_INFO, scp->device, 5871 - "%s: %s: cdb indicated=%u, IO sent=%d bytes\n", 5872 - my_name, __func__, a_num * lb_size, ret); 5879 + "%s: cdb indicated=%u, IO sent=%d bytes\n", 5880 + my_name, a_num * lb_size, ret); 5873 5881 } 5874 5882 if (is_bytchk3) { 5875 5883 for (j = 1, off = lb_size; j < vnum; ++j, off += lb_size) ··· 6677 6685 devip->debugfs_entry = debugfs_create_dir(dev_name(&sdp->sdev_dev), 6678 6686 sdebug_debugfs_root); 6679 6687 if (IS_ERR_OR_NULL(devip->debugfs_entry)) 6680 - pr_info("%s: failed to create debugfs directory for device %s\n", 6681 - __func__, dev_name(&sdp->sdev_gendev)); 6688 + pr_info("failed to create debugfs directory for device %s\n", 6689 + dev_name(&sdp->sdev_gendev)); 6682 6690 6683 6691 dentry = debugfs_create_file("error", 0600, devip->debugfs_entry, sdp, 6684 6692 &sdebug_error_fops); 6685 6693 if (IS_ERR_OR_NULL(dentry)) 6686 - pr_info("%s: failed to create error file for device %s\n", 6687 - __func__, dev_name(&sdp->sdev_gendev)); 6694 + pr_info("failed to create error file for device %s\n", 6695 + dev_name(&sdp->sdev_gendev)); 6688 6696 6689 6697 return 0; 6690 6698 } ··· 6872 6880 6873 6881 if (SDEBUG_OPT_ALL_NOISE & sdebug_opts) 6874 6882 sdev_printk(KERN_INFO, SCpnt->device, 6875 - "%s: command%s found\n", __func__, 6883 + "command%s found\n", 6876 6884 aborted ? "" : " not"); 6877 6885 6878 6886 ··· 6960 6968 ++num_dev_resets; 6961 6969 6962 6970 if (SDEBUG_OPT_ALL_NOISE & sdebug_opts) 6963 - sdev_printk(KERN_INFO, sdp, "%s\n", __func__); 6971 + sdev_printk(KERN_INFO, sdp, "doing device reset"); 6964 6972 6965 6973 scsi_debug_stop_all_queued(sdp); 6966 6974 if (devip) { ··· 7000 7008 7001 7009 ++num_target_resets; 7002 7010 if (SDEBUG_OPT_ALL_NOISE & sdebug_opts) 7003 - sdev_printk(KERN_INFO, sdp, "%s\n", __func__); 7011 + sdev_printk(KERN_INFO, sdp, "doing target reset\n"); 7004 7012 7005 7013 list_for_each_entry(devip, &sdbg_host->dev_info_list, dev_list) { 7006 7014 if (devip->target == sdp->id) { ··· 7013 7021 7014 7022 if (SDEBUG_OPT_RESET_NOISE & sdebug_opts) 7015 7023 sdev_printk(KERN_INFO, sdp, 7016 - "%s: %d device(s) found in target\n", __func__, k); 7024 + "%d device(s) found in target\n", k); 7017 7025 7018 7026 if (sdebug_fail_target_reset(SCpnt)) { 7019 7027 scmd_printk(KERN_INFO, SCpnt, "fail target reset 0x%x\n", ··· 7034 7042 ++num_bus_resets; 7035 7043 7036 7044 if (SDEBUG_OPT_ALL_NOISE & sdebug_opts) 7037 - sdev_printk(KERN_INFO, sdp, "%s\n", __func__); 7045 + sdev_printk(KERN_INFO, sdp, "doing bus reset\n"); 7038 7046 7039 7047 list_for_each_entry(devip, &sdbg_host->dev_info_list, dev_list) { 7040 7048 set_bit(SDEBUG_UA_BUS_RESET, devip->uas_bm); ··· 7045 7053 7046 7054 if (SDEBUG_OPT_RESET_NOISE & sdebug_opts) 7047 7055 sdev_printk(KERN_INFO, sdp, 7048 - "%s: %d device(s) found in host\n", __func__, k); 7056 + "%d device(s) found in host\n", k); 7049 7057 return SUCCESS; 7050 7058 } 7051 7059 ··· 7057 7065 7058 7066 ++num_host_resets; 7059 7067 if (SDEBUG_OPT_ALL_NOISE & sdebug_opts) 7060 - sdev_printk(KERN_INFO, SCpnt->device, "%s\n", __func__); 7068 + sdev_printk(KERN_INFO, SCpnt->device, "doing host reset\n"); 7061 7069 mutex_lock(&sdebug_host_list_mutex); 7062 7070 list_for_each_entry(sdbg_host, &sdebug_host_list, host_list) { 7063 7071 list_for_each_entry(devip, &sdbg_host->dev_info_list, ··· 7072 7080 stop_all_queued(); 7073 7081 if (SDEBUG_OPT_RESET_NOISE & sdebug_opts) 7074 7082 sdev_printk(KERN_INFO, SCpnt->device, 7075 - "%s: %d device(s) found\n", __func__, k); 7083 + "%d device(s) found\n", k); 7076 7084 return SUCCESS; 7077 7085 } 7078 7086 ··· 7223 7231 scsi_result = device_qfull_result; 7224 7232 7225 7233 if (unlikely(SDEBUG_OPT_Q_NOISE & sdebug_opts)) 7226 - sdev_printk(KERN_INFO, sdp, "%s: num_in_q=%d +1, <inject> status: TASK SET FULL\n", 7227 - __func__, num_in_q); 7234 + sdev_printk(KERN_INFO, sdp, "num_in_q=%d +1, <inject> status: TASK SET FULL\n", 7235 + num_in_q); 7228 7236 } 7229 7237 } 7230 7238 ··· 7250 7258 } 7251 7259 7252 7260 if (unlikely(sdebug_verbose && cmnd->result)) 7253 - sdev_printk(KERN_INFO, sdp, "%s: non-zero result=0x%x\n", 7254 - __func__, cmnd->result); 7261 + sdev_printk(KERN_INFO, sdp, "non-zero result=0x%x\n", 7262 + cmnd->result); 7255 7263 7256 7264 if (delta_jiff > 0 || ndelay > 0) { 7257 7265 ktime_t kt; ··· 8689 8697 8690 8698 sdebug_debugfs_root = debugfs_create_dir("scsi_debug", NULL); 8691 8699 if (IS_ERR_OR_NULL(sdebug_debugfs_root)) 8692 - pr_info("%s: failed to create initial debugfs directory\n", __func__); 8700 + pr_info("failed to create initial debugfs directory\n"); 8693 8701 8694 8702 for (k = 0; k < hosts_to_add; k++) { 8695 8703 if (want_store && k == 0) { ··· 8805 8813 if (unlikely(res < 0)) { 8806 8814 xa_unlock_irqrestore(per_store_ap, iflags); 8807 8815 kfree(sip); 8808 - pr_warn("%s: xa_alloc() errno=%d\n", __func__, -res); 8816 + pr_warn("xa_alloc() errno=%d\n", -res); 8809 8817 return res; 8810 8818 } 8811 8819 sdeb_most_recent_idx = n_idx; ··· 8862 8870 return (int)n_idx; 8863 8871 err: 8864 8872 sdebug_erase_store((int)n_idx, sip); 8865 - pr_warn("%s: failed, errno=%d\n", __func__, -res); 8873 + pr_warn("failed, errno=%d\n", -res); 8866 8874 return res; 8867 8875 } 8868 8876 ··· 8921 8929 put_device(&sdbg_host->dev); 8922 8930 else 8923 8931 kfree(sdbg_host); 8924 - pr_warn("%s: failed, errno=%d\n", __func__, -error); 8932 + pr_warn("failed, errno=%d\n", -error); 8925 8933 return error; 8926 8934 } 8927 8935 ··· 8989 8997 8990 8998 if (qdepth > SDEBUG_CANQUEUE) { 8991 8999 qdepth = SDEBUG_CANQUEUE; 8992 - pr_warn("%s: requested qdepth [%d] exceeds canqueue [%d], trim\n", __func__, 9000 + pr_warn("requested qdepth [%d] exceeds canqueue [%d], trim\n", 8993 9001 qdepth, SDEBUG_CANQUEUE); 8994 9002 } 8995 9003 if (qdepth < 1) ··· 9001 9009 mutex_unlock(&sdebug_host_list_mutex); 9002 9010 9003 9011 if (SDEBUG_OPT_Q_NOISE & sdebug_opts) 9004 - sdev_printk(KERN_INFO, sdev, "%s: qdepth=%d\n", __func__, qdepth); 9012 + sdev_printk(KERN_INFO, sdev, "qdepth=%d\n", qdepth); 9005 9013 9006 9014 return sdev->queue_depth; 9007 9015 } ··· 9274 9282 bool res = false; 9275 9283 9276 9284 if (!to_be_aborted_scmd) { 9277 - pr_err("%s: command with tag %#x not found\n", __func__, 9278 - unique_tag); 9285 + pr_err("command with tag %#x not found\n", unique_tag); 9279 9286 return; 9280 9287 } 9281 9288 ··· 9282 9291 res = scsi_debug_stop_cmnd(to_be_aborted_scmd); 9283 9292 9284 9293 if (res) 9285 - pr_info("%s: aborted command with tag %#x\n", 9286 - __func__, unique_tag); 9294 + pr_info("aborted command with tag %#x\n", unique_tag); 9287 9295 else 9288 - pr_err("%s: failed to abort command with tag %#x\n", 9289 - __func__, unique_tag); 9296 + pr_err("failed to abort command with tag %#x\n", unique_tag); 9290 9297 9291 9298 set_host_byte(scp, res ? DID_OK : DID_ERROR); 9292 9299 }