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

scsi: libsas: Tidy SAS address print format

Currently we use a mixture of %016llx, %llx, and %16llx when printing a SAS
address.

Since the most significant nibble of the SAS address is always 5 - as per
standard - this formatting is not so important; but some fake SAS addresses
for SATA devices may not be. And we have mangled/invalid address to
consider also. And it's better to be consistent in the code, so use a fixed
format.

The SAS address is a fixed size at 64b, so we want to 0 byte extend to 16
nibbles, so use %016llx globally.

Also make some prints to be explicitly hex, and tidy some whitespace issue.

Link: https://lore.kernel.org/r/1576758957-227350-1-git-send-email-john.garry@huawei.com
Signed-off-by: John Garry <john.garry@huawei.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>

authored by

John Garry and committed by
Martin K. Petersen
b3e3d4c6 6d67e847

+11 -11
+1 -1
drivers/scsi/libsas/sas_ata.c
··· 137 137 } else { 138 138 ac = sas_to_ata_err(stat); 139 139 if (ac) { 140 - pr_warn("%s: SAS error %x\n", __func__, stat->stat); 140 + pr_warn("%s: SAS error 0x%x\n", __func__, stat->stat); 141 141 /* We saw a SAS error. Send a vague error. */ 142 142 if (!link->sactive) { 143 143 qc->err_mask = ac;
+1 -1
drivers/scsi/libsas/sas_discover.c
··· 179 179 180 180 res = i->dft->lldd_dev_found(dev); 181 181 if (res) { 182 - pr_warn("driver on host %s cannot handle device %llx, error:%d\n", 182 + pr_warn("driver on host %s cannot handle device %016llx, error:%d\n", 183 183 dev_name(sas_ha->dev), 184 184 SAS_ADDR(dev->sas_addr), res); 185 185 }
+2 -2
drivers/scsi/libsas/sas_expander.c
··· 500 500 ex_assign_report_general(dev, rg_resp); 501 501 502 502 if (dev->ex_dev.configuring) { 503 - pr_debug("RG: ex %llx self-configuring...\n", 503 + pr_debug("RG: ex %016llx self-configuring...\n", 504 504 SAS_ADDR(dev->sas_addr)); 505 505 schedule_timeout_interruptible(5*HZ); 506 506 } else ··· 881 881 882 882 res = sas_discover_end_dev(child); 883 883 if (res) { 884 - pr_notice("sas_discover_end_dev() for device %16llx at %016llx:%02d returned 0x%x\n", 884 + pr_notice("sas_discover_end_dev() for device %016llx at %016llx:%02d returned 0x%x\n", 885 885 SAS_ADDR(child->sas_addr), 886 886 SAS_ADDR(parent->sas_addr), phy_id, res); 887 887 goto out_list_del;
+1 -1
drivers/scsi/libsas/sas_internal.h
··· 107 107 108 108 static inline void sas_fail_probe(struct domain_device *dev, const char *func, int err) 109 109 { 110 - pr_warn("%s: for %s device %16llx returned %d\n", 110 + pr_warn("%s: for %s device %016llx returned %d\n", 111 111 func, dev->parent ? "exp-attached" : 112 112 "direct-attached", 113 113 SAS_ADDR(dev->sas_addr), err);
+1 -1
drivers/scsi/libsas/sas_port.c
··· 165 165 } 166 166 sas_port_add_phy(port->port, phy->phy); 167 167 168 - pr_debug("%s added to %s, phy_mask:0x%x (%16llx)\n", 168 + pr_debug("%s added to %s, phy_mask:0x%x (%016llx)\n", 169 169 dev_name(&phy->phy->dev), dev_name(&port->port->dev), 170 170 port->phy_mask, 171 171 SAS_ADDR(port->attached_sas_addr));
+4 -4
drivers/scsi/libsas/sas_scsi_host.c
··· 330 330 331 331 int_to_scsilun(cmd->device->lun, &lun); 332 332 333 - pr_notice("eh: device %llx LUN %llx has the task\n", 333 + pr_notice("eh: device %016llx LUN 0x%llx has the task\n", 334 334 SAS_ADDR(dev->sas_addr), 335 335 cmd->device->lun); 336 336 ··· 615 615 reset: 616 616 tmf_resp = sas_recover_lu(task->dev, cmd); 617 617 if (tmf_resp == TMF_RESP_FUNC_COMPLETE) { 618 - pr_notice("dev %016llx LU %llx is recovered\n", 618 + pr_notice("dev %016llx LU 0x%llx is recovered\n", 619 619 SAS_ADDR(task->dev), 620 620 cmd->device->lun); 621 621 sas_eh_finish_cmd(cmd); ··· 666 666 * of effort could recover from errors. Quite 667 667 * possibly the HA just disappeared. 668 668 */ 669 - pr_err("error from device %llx, LUN %llx couldn't be recovered in any way\n", 669 + pr_err("error from device %016llx, LUN 0x%llx couldn't be recovered in any way\n", 670 670 SAS_ADDR(task->dev->sas_addr), 671 671 cmd->device->lun); 672 672 ··· 851 851 if (scsi_dev->tagged_supported) { 852 852 scsi_change_queue_depth(scsi_dev, SAS_DEF_QD); 853 853 } else { 854 - pr_notice("device %llx, LUN %llx doesn't support TCQ\n", 854 + pr_notice("device %016llx, LUN 0x%llx doesn't support TCQ\n", 855 855 SAS_ADDR(dev->sas_addr), scsi_dev->lun); 856 856 scsi_change_queue_depth(scsi_dev, 1); 857 857 }
+1 -1
drivers/scsi/libsas/sas_task.c
··· 27 27 memcpy(tstat->buf, iu->sense_data, tstat->buf_valid_size); 28 28 29 29 if (iu->status != SAM_STAT_CHECK_CONDITION) 30 - dev_warn(dev, "dev %llx sent sense data, but stat(%x) is not CHECK CONDITION\n", 30 + dev_warn(dev, "dev %016llx sent sense data, but stat(0x%x) is not CHECK CONDITION\n", 31 31 SAS_ADDR(task->dev->sas_addr), iu->status); 32 32 } 33 33 else