Skip to content

Commit 4b68219

Browse files
calebsanderkeithbusch
authored andcommitted
nvme: return string as char *, not unsigned char *
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 <[email protected]> Reviewed-by: Chaitanya Kulkarni <[email protected]> Reviewed-by: Christoph Hellwig <[email protected]> Reviewed-by: Sagi Grimberg <[email protected]> Signed-off-by: Keith Busch <[email protected]>
1 parent 0945b43 commit 4b68219

File tree

2 files changed

+13
-13
lines changed

2 files changed

+13
-13
lines changed

drivers/nvme/host/constants.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -171,31 +171,31 @@ static const char * const nvme_statuses[] = {
171171
[NVME_SC_HOST_ABORTED_CMD] = "Host Aborted Command",
172172
};
173173

174-
const unsigned char *nvme_get_error_status_str(u16 status)
174+
const char *nvme_get_error_status_str(u16 status)
175175
{
176176
status &= 0x7ff;
177177
if (status < ARRAY_SIZE(nvme_statuses) && nvme_statuses[status])
178178
return nvme_statuses[status & 0x7ff];
179179
return "Unknown";
180180
}
181181

182-
const unsigned char *nvme_get_opcode_str(u8 opcode)
182+
const char *nvme_get_opcode_str(u8 opcode)
183183
{
184184
if (opcode < ARRAY_SIZE(nvme_ops) && nvme_ops[opcode])
185185
return nvme_ops[opcode];
186186
return "Unknown";
187187
}
188188
EXPORT_SYMBOL_GPL(nvme_get_opcode_str);
189189

190-
const unsigned char *nvme_get_admin_opcode_str(u8 opcode)
190+
const char *nvme_get_admin_opcode_str(u8 opcode)
191191
{
192192
if (opcode < ARRAY_SIZE(nvme_admin_ops) && nvme_admin_ops[opcode])
193193
return nvme_admin_ops[opcode];
194194
return "Unknown";
195195
}
196196
EXPORT_SYMBOL_GPL(nvme_get_admin_opcode_str);
197197

198-
const unsigned char *nvme_get_fabrics_opcode_str(u8 opcode) {
198+
const char *nvme_get_fabrics_opcode_str(u8 opcode) {
199199
if (opcode < ARRAY_SIZE(nvme_fabrics_ops) && nvme_fabrics_ops[opcode])
200200
return nvme_fabrics_ops[opcode];
201201
return "Unknown";

drivers/nvme/host/nvme.h

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1140,31 +1140,31 @@ static inline bool nvme_multi_css(struct nvme_ctrl *ctrl)
11401140
}
11411141

11421142
#ifdef CONFIG_NVME_VERBOSE_ERRORS
1143-
const unsigned char *nvme_get_error_status_str(u16 status);
1144-
const unsigned char *nvme_get_opcode_str(u8 opcode);
1145-
const unsigned char *nvme_get_admin_opcode_str(u8 opcode);
1146-
const unsigned char *nvme_get_fabrics_opcode_str(u8 opcode);
1143+
const char *nvme_get_error_status_str(u16 status);
1144+
const char *nvme_get_opcode_str(u8 opcode);
1145+
const char *nvme_get_admin_opcode_str(u8 opcode);
1146+
const char *nvme_get_fabrics_opcode_str(u8 opcode);
11471147
#else /* CONFIG_NVME_VERBOSE_ERRORS */
1148-
static inline const unsigned char *nvme_get_error_status_str(u16 status)
1148+
static inline const char *nvme_get_error_status_str(u16 status)
11491149
{
11501150
return "I/O Error";
11511151
}
1152-
static inline const unsigned char *nvme_get_opcode_str(u8 opcode)
1152+
static inline const char *nvme_get_opcode_str(u8 opcode)
11531153
{
11541154
return "I/O Cmd";
11551155
}
1156-
static inline const unsigned char *nvme_get_admin_opcode_str(u8 opcode)
1156+
static inline const char *nvme_get_admin_opcode_str(u8 opcode)
11571157
{
11581158
return "Admin Cmd";
11591159
}
11601160

1161-
static inline const unsigned char *nvme_get_fabrics_opcode_str(u8 opcode)
1161+
static inline const char *nvme_get_fabrics_opcode_str(u8 opcode)
11621162
{
11631163
return "Fabrics Cmd";
11641164
}
11651165
#endif /* CONFIG_NVME_VERBOSE_ERRORS */
11661166

1167-
static inline const unsigned char *nvme_opcode_str(int qid, u8 opcode, u8 fctype)
1167+
static inline const char *nvme_opcode_str(int qid, u8 opcode, u8 fctype)
11681168
{
11691169
if (opcode == nvme_fabrics_command)
11701170
return nvme_get_fabrics_opcode_str(fctype);

0 commit comments

Comments
 (0)