Message ID | 20220324011126.1144504-6-alison.schofield@intel.com |
---|---|
State | Superseded |
Headers | show |
Series | Do not allow set-partition immediate mode | expand |
On Wed, 23 Mar 2022 18:11:22 -0700 alison.schofield@intel.com wrote: > From: Alison Schofield <alison.schofield@intel.com> > > 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> > --- > drivers/cxl/core/mbox.c | 17 ++++++++++++++--- > 1 file changed, 14 insertions(+), 3 deletions(-) > > diff --git a/drivers/cxl/core/mbox.c b/drivers/cxl/core/mbox.c > index 205e671307c3..d6d582baa1ee 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 cxl_command_names[c->info.id].name; nitpick, but i'd prefer the error path out of line. if (!c) return NULL; return cxl_command_names[c->info.id].name; Otherwise Reviewed-by: Jonathan Cameron <Jonathan.Cameron@huawei.com> > + > + return NULL; > +} > + > /** > * cxl_mbox_send_cmd() - Send a mailbox command to a device. > * @cxlds: The device data for the operation > @@ -450,9 +461,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)
On Fri, Mar 25, 2022 at 10:56:00AM +0000, Jonathan Cameron wrote: > On Wed, 23 Mar 2022 18:11:22 -0700 > alison.schofield@intel.com wrote: > > > From: Alison Schofield <alison.schofield@intel.com> > > > > 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> > > --- > > drivers/cxl/core/mbox.c | 17 ++++++++++++++--- > > 1 file changed, 14 insertions(+), 3 deletions(-) > > > > diff --git a/drivers/cxl/core/mbox.c b/drivers/cxl/core/mbox.c > > index 205e671307c3..d6d582baa1ee 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 cxl_command_names[c->info.id].name; > > nitpick, but i'd prefer the error path out of line. > if (!c) > return NULL; > > return cxl_command_names[c->info.id].name; Got it, thanks! > > Otherwise > Reviewed-by: Jonathan Cameron <Jonathan.Cameron@huawei.com> >
diff --git a/drivers/cxl/core/mbox.c b/drivers/cxl/core/mbox.c index 205e671307c3..d6d582baa1ee 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 cxl_command_names[c->info.id].name; + + return NULL; +} + /** * cxl_mbox_send_cmd() - Send a mailbox command to a device. * @cxlds: The device data for the operation @@ -450,9 +461,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)