Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

nvme: Move opcode string helper functions declarations

Move the declaration of all helper functions converting NVMe command
opcodes and status codes into strings from drivers/nvme/host/nvme.h
into include/linux/nvme.h, together with the commands definitions.
This allows NVMe target drivers to call these functions without having
to include a host header file.

Signed-off-by: Damien Le Moal <dlemoal@kernel.org>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Tested-by: Rick Wertenbroek <rick.wertenbroek@gmail.com>
Tested-by: Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org>
Signed-off-by: Keith Busch <kbusch@kernel.org>

authored by

Damien Le Moal and committed by
Keith Busch
30e77e0f 002bb027

+40 -39
-39
drivers/nvme/host/nvme.h
··· 1182 1182 return (ctrl->ctrl_config & NVME_CC_CSS_MASK) == NVME_CC_CSS_CSI; 1183 1183 } 1184 1184 1185 - #ifdef CONFIG_NVME_VERBOSE_ERRORS 1186 - const char *nvme_get_error_status_str(u16 status); 1187 - const char *nvme_get_opcode_str(u8 opcode); 1188 - const char *nvme_get_admin_opcode_str(u8 opcode); 1189 - const char *nvme_get_fabrics_opcode_str(u8 opcode); 1190 - #else /* CONFIG_NVME_VERBOSE_ERRORS */ 1191 - static inline const char *nvme_get_error_status_str(u16 status) 1192 - { 1193 - return "I/O Error"; 1194 - } 1195 - static inline const char *nvme_get_opcode_str(u8 opcode) 1196 - { 1197 - return "I/O Cmd"; 1198 - } 1199 - static inline const char *nvme_get_admin_opcode_str(u8 opcode) 1200 - { 1201 - return "Admin Cmd"; 1202 - } 1203 - 1204 - static inline const char *nvme_get_fabrics_opcode_str(u8 opcode) 1205 - { 1206 - return "Fabrics Cmd"; 1207 - } 1208 - #endif /* CONFIG_NVME_VERBOSE_ERRORS */ 1209 - 1210 - static inline const char *nvme_opcode_str(int qid, u8 opcode) 1211 - { 1212 - return qid ? nvme_get_opcode_str(opcode) : 1213 - nvme_get_admin_opcode_str(opcode); 1214 - } 1215 - 1216 - static inline const char *nvme_fabrics_opcode_str( 1217 - int qid, const struct nvme_command *cmd) 1218 - { 1219 - if (nvme_is_fabrics(cmd)) 1220 - return nvme_get_fabrics_opcode_str(cmd->fabrics.fctype); 1221 - 1222 - return nvme_opcode_str(qid, cmd->common.opcode); 1223 - } 1224 1185 #endif /* _NVME_H */
+40
include/linux/nvme.h
··· 1896 1896 return cmd->common.opcode == nvme_fabrics_command; 1897 1897 } 1898 1898 1899 + #ifdef CONFIG_NVME_VERBOSE_ERRORS 1900 + const char *nvme_get_error_status_str(u16 status); 1901 + const char *nvme_get_opcode_str(u8 opcode); 1902 + const char *nvme_get_admin_opcode_str(u8 opcode); 1903 + const char *nvme_get_fabrics_opcode_str(u8 opcode); 1904 + #else /* CONFIG_NVME_VERBOSE_ERRORS */ 1905 + static inline const char *nvme_get_error_status_str(u16 status) 1906 + { 1907 + return "I/O Error"; 1908 + } 1909 + static inline const char *nvme_get_opcode_str(u8 opcode) 1910 + { 1911 + return "I/O Cmd"; 1912 + } 1913 + static inline const char *nvme_get_admin_opcode_str(u8 opcode) 1914 + { 1915 + return "Admin Cmd"; 1916 + } 1917 + 1918 + static inline const char *nvme_get_fabrics_opcode_str(u8 opcode) 1919 + { 1920 + return "Fabrics Cmd"; 1921 + } 1922 + #endif /* CONFIG_NVME_VERBOSE_ERRORS */ 1923 + 1924 + static inline const char *nvme_opcode_str(int qid, u8 opcode) 1925 + { 1926 + return qid ? nvme_get_opcode_str(opcode) : 1927 + nvme_get_admin_opcode_str(opcode); 1928 + } 1929 + 1930 + static inline const char *nvme_fabrics_opcode_str( 1931 + int qid, const struct nvme_command *cmd) 1932 + { 1933 + if (nvme_is_fabrics(cmd)) 1934 + return nvme_get_fabrics_opcode_str(cmd->fabrics.fctype); 1935 + 1936 + return nvme_opcode_str(qid, cmd->common.opcode); 1937 + } 1938 + 1899 1939 struct nvme_error_slot { 1900 1940 __le64 error_count; 1901 1941 __le16 sqid;