Commit b3e3d4c6 authored by John Garry's avatar John Garry Committed by Martin K. Petersen

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.comSigned-off-by: default avatarJohn Garry <john.garry@huawei.com>
Signed-off-by: default avatarMartin K. Petersen <martin.petersen@oracle.com>
parent 6d67e847
...@@ -137,7 +137,7 @@ static void sas_ata_task_done(struct sas_task *task) ...@@ -137,7 +137,7 @@ static void sas_ata_task_done(struct sas_task *task)
} else { } else {
ac = sas_to_ata_err(stat); ac = sas_to_ata_err(stat);
if (ac) { if (ac) {
pr_warn("%s: SAS error %x\n", __func__, stat->stat); pr_warn("%s: SAS error 0x%x\n", __func__, stat->stat);
/* We saw a SAS error. Send a vague error. */ /* We saw a SAS error. Send a vague error. */
if (!link->sactive) { if (!link->sactive) {
qc->err_mask = ac; qc->err_mask = ac;
......
...@@ -179,7 +179,7 @@ int sas_notify_lldd_dev_found(struct domain_device *dev) ...@@ -179,7 +179,7 @@ int sas_notify_lldd_dev_found(struct domain_device *dev)
res = i->dft->lldd_dev_found(dev); res = i->dft->lldd_dev_found(dev);
if (res) { if (res) {
pr_warn("driver on host %s cannot handle device %llx, error:%d\n", pr_warn("driver on host %s cannot handle device %016llx, error:%d\n",
dev_name(sas_ha->dev), dev_name(sas_ha->dev),
SAS_ADDR(dev->sas_addr), res); SAS_ADDR(dev->sas_addr), res);
} }
......
...@@ -500,7 +500,7 @@ static int sas_ex_general(struct domain_device *dev) ...@@ -500,7 +500,7 @@ static int sas_ex_general(struct domain_device *dev)
ex_assign_report_general(dev, rg_resp); ex_assign_report_general(dev, rg_resp);
if (dev->ex_dev.configuring) { if (dev->ex_dev.configuring) {
pr_debug("RG: ex %llx self-configuring...\n", pr_debug("RG: ex %016llx self-configuring...\n",
SAS_ADDR(dev->sas_addr)); SAS_ADDR(dev->sas_addr));
schedule_timeout_interruptible(5*HZ); schedule_timeout_interruptible(5*HZ);
} else } else
...@@ -881,7 +881,7 @@ static struct domain_device *sas_ex_discover_end_dev( ...@@ -881,7 +881,7 @@ static struct domain_device *sas_ex_discover_end_dev(
res = sas_discover_end_dev(child); res = sas_discover_end_dev(child);
if (res) { if (res) {
pr_notice("sas_discover_end_dev() for device %16llx at %016llx:%02d returned 0x%x\n", pr_notice("sas_discover_end_dev() for device %016llx at %016llx:%02d returned 0x%x\n",
SAS_ADDR(child->sas_addr), SAS_ADDR(child->sas_addr),
SAS_ADDR(parent->sas_addr), phy_id, res); SAS_ADDR(parent->sas_addr), phy_id, res);
goto out_list_del; goto out_list_del;
......
...@@ -107,7 +107,7 @@ static inline void sas_smp_host_handler(struct bsg_job *job, ...@@ -107,7 +107,7 @@ static inline void sas_smp_host_handler(struct bsg_job *job,
static inline void sas_fail_probe(struct domain_device *dev, const char *func, int err) static inline void sas_fail_probe(struct domain_device *dev, const char *func, int err)
{ {
pr_warn("%s: for %s device %16llx returned %d\n", pr_warn("%s: for %s device %016llx returned %d\n",
func, dev->parent ? "exp-attached" : func, dev->parent ? "exp-attached" :
"direct-attached", "direct-attached",
SAS_ADDR(dev->sas_addr), err); SAS_ADDR(dev->sas_addr), err);
......
...@@ -165,7 +165,7 @@ static void sas_form_port(struct asd_sas_phy *phy) ...@@ -165,7 +165,7 @@ static void sas_form_port(struct asd_sas_phy *phy)
} }
sas_port_add_phy(port->port, phy->phy); sas_port_add_phy(port->port, phy->phy);
pr_debug("%s added to %s, phy_mask:0x%x (%16llx)\n", pr_debug("%s added to %s, phy_mask:0x%x (%016llx)\n",
dev_name(&phy->phy->dev), dev_name(&port->port->dev), dev_name(&phy->phy->dev), dev_name(&port->port->dev),
port->phy_mask, port->phy_mask,
SAS_ADDR(port->attached_sas_addr)); SAS_ADDR(port->attached_sas_addr));
......
...@@ -330,7 +330,7 @@ static int sas_recover_lu(struct domain_device *dev, struct scsi_cmnd *cmd) ...@@ -330,7 +330,7 @@ static int sas_recover_lu(struct domain_device *dev, struct scsi_cmnd *cmd)
int_to_scsilun(cmd->device->lun, &lun); int_to_scsilun(cmd->device->lun, &lun);
pr_notice("eh: device %llx LUN %llx has the task\n", pr_notice("eh: device %016llx LUN 0x%llx has the task\n",
SAS_ADDR(dev->sas_addr), SAS_ADDR(dev->sas_addr),
cmd->device->lun); cmd->device->lun);
...@@ -615,7 +615,7 @@ static void sas_eh_handle_sas_errors(struct Scsi_Host *shost, struct list_head * ...@@ -615,7 +615,7 @@ static void sas_eh_handle_sas_errors(struct Scsi_Host *shost, struct list_head *
reset: reset:
tmf_resp = sas_recover_lu(task->dev, cmd); tmf_resp = sas_recover_lu(task->dev, cmd);
if (tmf_resp == TMF_RESP_FUNC_COMPLETE) { if (tmf_resp == TMF_RESP_FUNC_COMPLETE) {
pr_notice("dev %016llx LU %llx is recovered\n", pr_notice("dev %016llx LU 0x%llx is recovered\n",
SAS_ADDR(task->dev), SAS_ADDR(task->dev),
cmd->device->lun); cmd->device->lun);
sas_eh_finish_cmd(cmd); sas_eh_finish_cmd(cmd);
...@@ -666,7 +666,7 @@ static void sas_eh_handle_sas_errors(struct Scsi_Host *shost, struct list_head * ...@@ -666,7 +666,7 @@ static void sas_eh_handle_sas_errors(struct Scsi_Host *shost, struct list_head *
* of effort could recover from errors. Quite * of effort could recover from errors. Quite
* possibly the HA just disappeared. * possibly the HA just disappeared.
*/ */
pr_err("error from device %llx, LUN %llx couldn't be recovered in any way\n", pr_err("error from device %016llx, LUN 0x%llx couldn't be recovered in any way\n",
SAS_ADDR(task->dev->sas_addr), SAS_ADDR(task->dev->sas_addr),
cmd->device->lun); cmd->device->lun);
...@@ -851,7 +851,7 @@ int sas_slave_configure(struct scsi_device *scsi_dev) ...@@ -851,7 +851,7 @@ int sas_slave_configure(struct scsi_device *scsi_dev)
if (scsi_dev->tagged_supported) { if (scsi_dev->tagged_supported) {
scsi_change_queue_depth(scsi_dev, SAS_DEF_QD); scsi_change_queue_depth(scsi_dev, SAS_DEF_QD);
} else { } else {
pr_notice("device %llx, LUN %llx doesn't support TCQ\n", pr_notice("device %016llx, LUN 0x%llx doesn't support TCQ\n",
SAS_ADDR(dev->sas_addr), scsi_dev->lun); SAS_ADDR(dev->sas_addr), scsi_dev->lun);
scsi_change_queue_depth(scsi_dev, 1); scsi_change_queue_depth(scsi_dev, 1);
} }
......
...@@ -27,7 +27,7 @@ void sas_ssp_task_response(struct device *dev, struct sas_task *task, ...@@ -27,7 +27,7 @@ void sas_ssp_task_response(struct device *dev, struct sas_task *task,
memcpy(tstat->buf, iu->sense_data, tstat->buf_valid_size); memcpy(tstat->buf, iu->sense_data, tstat->buf_valid_size);
if (iu->status != SAM_STAT_CHECK_CONDITION) if (iu->status != SAM_STAT_CHECK_CONDITION)
dev_warn(dev, "dev %llx sent sense data, but stat(%x) is not CHECK CONDITION\n", dev_warn(dev, "dev %016llx sent sense data, but stat(0x%x) is not CHECK CONDITION\n",
SAS_ADDR(task->dev->sas_addr), iu->status); SAS_ADDR(task->dev->sas_addr), iu->status);
} }
else else
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment