summaryrefslogtreecommitdiff
path: root/drivers/cxl
diff options
context:
space:
mode:
authorAlison Schofield <alison.schofield@intel.com>2022-03-31 04:27:15 +0300
committerDan Williams <dan.j.williams@intel.com>2022-04-13 02:07:01 +0300
commit82b8ba29538e5dae0a4e481dbbea4d5015c683af (patch)
tree2257abf0ccf7a1af77a0ad210bf79796d6eb24de /drivers/cxl
parent9ae016aeb722504703c67e6e59c673719868f467 (diff)
downloadlinux-82b8ba29538e5dae0a4e481dbbea4d5015c683af.tar.xz
cxl/mbox: Remove dependency on cxl_mem_command for a debug msg
In preparation for removing access to struct cxl_mem_command, change this debug message to use cxl_mbox_cmd fields instead. Retrieve the pretty command name from cxl_mbox_cmd using a new opcode to command name helper. Signed-off-by: Alison Schofield <alison.schofield@intel.com> Reviewed-by: Jonathan Cameron <Jonathan.Cameron@huawei.com> Reviewed-by: Dan Williams <dan.j.williams@intel.com> Link: https://lore.kernel.org/r/57265751d336a6e95f5ca31a9c77189408b05742.1648687552.git.alison.schofield@intel.com Signed-off-by: Dan Williams <dan.j.williams@intel.com>
Diffstat (limited to 'drivers/cxl')
-rw-r--r--drivers/cxl/core/mbox.c17
1 files changed, 14 insertions, 3 deletions
diff --git a/drivers/cxl/core/mbox.c b/drivers/cxl/core/mbox.c
index 47f39c6131c4..8c59c6959c15 100644
--- a/drivers/cxl/core/mbox.c
+++ b/drivers/cxl/core/mbox.c
@@ -127,6 +127,17 @@ static struct cxl_mem_command *cxl_mem_find_command(u16 opcode)
return NULL;
}
+static const char *cxl_mem_opcode_to_name(u16 opcode)
+{
+ struct cxl_mem_command *c;
+
+ c = cxl_mem_find_command(opcode);
+ if (!c)
+ return NULL;
+
+ return cxl_command_names[c->info.id].name;
+}
+
/**
* cxl_mbox_send_cmd() - Send a mailbox command to a device.
* @cxlds: The device data for the operation
@@ -452,9 +463,9 @@ static int handle_mailbox_cmd_from_user(struct cxl_dev_state *cxlds,
dev_dbg(dev,
"Submitting %s command for user\n"
"\topcode: %x\n"
- "\tsize: %ub\n",
- cxl_command_names[cmd->info.id].name, mbox_cmd.opcode,
- cmd->info.size_in);
+ "\tsize: %zx\n",
+ cxl_mem_opcode_to_name(mbox_cmd.opcode),
+ mbox_cmd.opcode, mbox_cmd.size_in);
rc = cxlds->mbox_send(cxlds, &mbox_cmd);
if (rc)