All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/5] nvme: return string as char *, not unsigned char *
@ 2024-01-31 16:43 Caleb Sander
  2024-01-31 16:43 ` [PATCH 2/5] nvme: remove redundant status mask Caleb Sander
                   ` (7 more replies)
  0 siblings, 8 replies; 17+ messages in thread
From: Caleb Sander @ 2024-01-31 16:43 UTC (permalink / raw)
  To: Keith Busch, Jens Axboe, Christoph Hellwig, Sagi Grimberg,
	James Smart, linux-nvme
  Cc: Caleb Sander

The functions in drivers/nvme/host/constants.c returning human-readable
status and opcode strings currently use type "const unsigned char *".
Typically string constants use type "const char *",
so remove "unsigned" from the return types.
This is a purely cosmetic change to clarify that the functions
return text strings instead of an array of bytes, for example.

Signed-off-by: Caleb Sander <csander@purestorage.com>
---
 drivers/nvme/host/constants.c |  8 ++++----
 drivers/nvme/host/nvme.h      | 18 +++++++++---------
 2 files changed, 13 insertions(+), 13 deletions(-)

diff --git a/drivers/nvme/host/constants.c b/drivers/nvme/host/constants.c
index 20f46c230885..8791283ec6ad 100644
--- a/drivers/nvme/host/constants.c
+++ b/drivers/nvme/host/constants.c
@@ -169,35 +169,35 @@ static const char * const nvme_statuses[] = {
 	[NVME_SC_CTRL_PATH_ERROR] = "Controller Pathing Error",
 	[NVME_SC_HOST_PATH_ERROR] = "Host Pathing Error",
 	[NVME_SC_HOST_ABORTED_CMD] = "Host Aborted Command",
 };
 
-const unsigned char *nvme_get_error_status_str(u16 status)
+const char *nvme_get_error_status_str(u16 status)
 {
 	status &= 0x7ff;
 	if (status < ARRAY_SIZE(nvme_statuses) && nvme_statuses[status])
 		return nvme_statuses[status & 0x7ff];
 	return "Unknown";
 }
 
-const unsigned char *nvme_get_opcode_str(u8 opcode)
+const char *nvme_get_opcode_str(u8 opcode)
 {
 	if (opcode < ARRAY_SIZE(nvme_ops) && nvme_ops[opcode])
 		return nvme_ops[opcode];
 	return "Unknown";
 }
 EXPORT_SYMBOL_GPL(nvme_get_opcode_str);
 
-const unsigned char *nvme_get_admin_opcode_str(u8 opcode)
+const char *nvme_get_admin_opcode_str(u8 opcode)
 {
 	if (opcode < ARRAY_SIZE(nvme_admin_ops) && nvme_admin_ops[opcode])
 		return nvme_admin_ops[opcode];
 	return "Unknown";
 }
 EXPORT_SYMBOL_GPL(nvme_get_admin_opcode_str);
 
-const unsigned char *nvme_get_fabrics_opcode_str(u8 opcode) {
+const char *nvme_get_fabrics_opcode_str(u8 opcode) {
 	if (opcode < ARRAY_SIZE(nvme_fabrics_ops) && nvme_fabrics_ops[opcode])
 		return nvme_fabrics_ops[opcode];
 	return "Unknown";
 }
 EXPORT_SYMBOL_GPL(nvme_get_fabrics_opcode_str);
diff --git a/drivers/nvme/host/nvme.h b/drivers/nvme/host/nvme.h
index 1700063bc24d..403df30fc3cc 100644
--- a/drivers/nvme/host/nvme.h
+++ b/drivers/nvme/host/nvme.h
@@ -1123,35 +1123,35 @@ static inline bool nvme_multi_css(struct nvme_ctrl *ctrl)
 {
 	return (ctrl->ctrl_config & NVME_CC_CSS_MASK) == NVME_CC_CSS_CSI;
 }
 
 #ifdef CONFIG_NVME_VERBOSE_ERRORS
-const unsigned char *nvme_get_error_status_str(u16 status);
-const unsigned char *nvme_get_opcode_str(u8 opcode);
-const unsigned char *nvme_get_admin_opcode_str(u8 opcode);
-const unsigned char *nvme_get_fabrics_opcode_str(u8 opcode);
+const char *nvme_get_error_status_str(u16 status);
+const char *nvme_get_opcode_str(u8 opcode);
+const char *nvme_get_admin_opcode_str(u8 opcode);
+const char *nvme_get_fabrics_opcode_str(u8 opcode);
 #else /* CONFIG_NVME_VERBOSE_ERRORS */
-static inline const unsigned char *nvme_get_error_status_str(u16 status)
+static inline const char *nvme_get_error_status_str(u16 status)
 {
 	return "I/O Error";
 }
-static inline const unsigned char *nvme_get_opcode_str(u8 opcode)
+static inline const char *nvme_get_opcode_str(u8 opcode)
 {
 	return "I/O Cmd";
 }
-static inline const unsigned char *nvme_get_admin_opcode_str(u8 opcode)
+static inline const char *nvme_get_admin_opcode_str(u8 opcode)
 {
 	return "Admin Cmd";
 }
 
-static inline const unsigned char *nvme_get_fabrics_opcode_str(u8 opcode)
+static inline const char *nvme_get_fabrics_opcode_str(u8 opcode)
 {
 	return "Fabrics Cmd";
 }
 #endif /* CONFIG_NVME_VERBOSE_ERRORS */
 
-static inline const unsigned char *nvme_opcode_str(int qid, u8 opcode, u8 fctype)
+static inline const char *nvme_opcode_str(int qid, u8 opcode, u8 fctype)
 {
 	if (opcode == nvme_fabrics_command)
 		return nvme_get_fabrics_opcode_str(fctype);
 	return qid ? nvme_get_opcode_str(opcode) :
 		nvme_get_admin_opcode_str(opcode);
-- 
2.25.1



^ permalink raw reply related	[flat|nested] 17+ messages in thread

end of thread, other threads:[~2024-02-01  0:29 UTC | newest]

Thread overview: 17+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-01-31 16:43 [PATCH 1/5] nvme: return string as char *, not unsigned char * Caleb Sander
2024-01-31 16:43 ` [PATCH 2/5] nvme: remove redundant status mask Caleb Sander
2024-01-31 17:33   ` Christoph Hellwig
2024-01-31 20:54   ` Sagi Grimberg
2024-01-31 16:43 ` [PATCH 3/5] nvme: take const cmd pointer in read-only helpers Caleb Sander
2024-01-31 17:33   ` Christoph Hellwig
2024-01-31 20:55   ` Sagi Grimberg
2024-01-31 16:43 ` [PATCH 4/5] nvme: split out fabrics version of nvme_opcode_str() Caleb Sander
2024-01-31 17:34   ` Christoph Hellwig
2024-01-31 20:56   ` Sagi Grimberg
2024-01-31 16:43 ` [PATCH 5/5] nvme-fc: log human-readable opcode on timeout Caleb Sander
2024-01-31 17:34   ` Christoph Hellwig
2024-01-31 20:57   ` Sagi Grimberg
2024-01-31 17:33 ` [PATCH 1/5] nvme: return string as char *, not unsigned char * Christoph Hellwig
2024-01-31 20:54 ` Sagi Grimberg
2024-01-31 23:05 ` Chaitanya Kulkarni
2024-02-01  0:29 ` Keith Busch

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.