From: Gleb C. <lna...@ya...> - 2025-05-19 17:47:22
|
Commit: 7cdf85e GitHub URL: https://github.com/SCST-project/scst/commit/7cdf85e66399705ad4f548fdfabb4bfb750bcf4c Author: Gleb Chesnokov Date: 2025-05-19T20:46:54+03:00 Log Message: ----------- scst_debug: Fix multiple checkpatch warnings This patch does not change any functionality. Modified Paths: -------------- scst/include/scst_debug.h | 23 +++-- scst/src/scst_debug.c | 68 +++++++-------- 2 files changed, 43 insertions(+), 48 deletions(-) =================================================================== diff --git a/scst/include/scst_debug.h b/scst/include/scst_debug.h index 0b1f348..2d8487e 100644 --- a/scst/include/scst_debug.h +++ b/scst/include/scst_debug.h @@ -106,7 +106,7 @@ #define TRACE_ALL 0xffffffff /* Flags 0xXXXXXXXXXX000000 are local for users */ -#define TRACE_MINOR_AND_MGMT_DBG (TRACE_MINOR|TRACE_MGMT_DEBUG) +#define TRACE_MINOR_AND_MGMT_DBG (TRACE_MINOR | TRACE_MGMT_DEBUG) /* * Note: in the next two printk() statements the KERN_CONT macro is only @@ -132,20 +132,19 @@ #endif int __printf(6, 7) -debug_print_with_prefix(unsigned long trace_flag, - const char *severity, const char *prefix, const char *func, int line, - const char *fmt, ...); +debug_print_with_prefix(unsigned long trace_flag, const char *severity, const char *prefix, + const char *func, int line, const char *fmt, ...); void debug_print_buffer(const void *data, int len); const char *debug_transport_id_to_initiator_name(const uint8_t *transport_id); #define TRACING_MINOR() (trace_flag & TRACE_MINOR) -#define TRACE(trace, format, args...) \ -do { \ - if (___unlikely(trace_flag & (trace))) { \ - debug_print_with_prefix(trace_flag, KERN_INFO, \ - __LOG_PREFIX, __func__, __LINE__, format, ## args); \ - } \ +#define TRACE(trace, format, args...) \ +do { \ + if (___unlikely(trace_flag & (trace))) { \ + debug_print_with_prefix(trace_flag, KERN_INFO, \ + __LOG_PREFIX, __func__, __LINE__, format, ## args); \ + } \ } while (0) #define TRACE_PR(format, args...) TRACE(TRACE_PRES, format, ## args) @@ -275,11 +274,11 @@ do { \ #define TRACE_DBG(format, args...) \ TRACE_DBG_FLAG(TRACE_DEBUG, format, ## args) #define TRACE_DBG_SPECIAL(format, args...) \ - TRACE_DBG_FLAG(TRACE_DEBUG|TRACE_SPECIAL, format, ## args) + TRACE_DBG_FLAG(TRACE_DEBUG | TRACE_SPECIAL, format, ## args) #define TRACE_MGMT_DBG(format, args...) \ TRACE_DBG_FLAG(TRACE_MGMT_DEBUG, format, ## args) #define TRACE_MGMT_DBG_SPECIAL(args...) \ - TRACE_DBG_FLAG(TRACE_MGMT_DEBUG|TRACE_SPECIAL, format, ## args) + TRACE_DBG_FLAG(TRACE_MGMT_DEBUG | TRACE_SPECIAL, format, ## args) #define TRACE_BLOCK(format, args...) \ TRACE_DBG_FLAG(TRACE_BLOCKING, format, ## args) diff --git a/scst/src/scst_debug.c b/scst/src/scst_debug.c index 5e67618..562fbb4 100644 --- a/scst/src/scst_debug.c +++ b/scst/src/scst_debug.c @@ -60,8 +60,8 @@ static inline int get_current_tid(void) * * Adds, if requested by trace_flag, debug prefix in the beginning */ -int debug_print_with_prefix(unsigned long trace_flag, const char *severity, - const char *prefix, const char *func, int line, const char *fmt, ...) +int debug_print_with_prefix(unsigned long trace_flag, const char *severity, const char *prefix, + const char *func, int line, const char *fmt, ...) { int i; unsigned long flags; @@ -75,7 +75,7 @@ int debug_print_with_prefix(unsigned long trace_flag, const char *severity, if (trace_flag & TRACE_PID) i += snprintf(&trace_buf[i], TRACE_BUF_SIZE - i, "[%d]: ", pid); - if (prefix != NULL) + if (prefix) i += snprintf(&trace_buf[i], TRACE_BUF_SIZE - i, "%s: ", prefix); if (trace_flag & TRACE_FUNCTION) @@ -103,10 +103,10 @@ EXPORT_SYMBOL(debug_print_with_prefix); void debug_print_buffer(const void *data, int len) { int z, z1, i; - const unsigned char *buf = (const unsigned char *) data; + const unsigned char *buf = (const unsigned char *)data; unsigned long flags; - if (buf == NULL) + if (!buf) return; spin_lock_irqsave(&trace_buf_lock, flags); @@ -119,8 +119,7 @@ void debug_print_buffer(const void *data, int len) " "); for (; (z1 < z) && (i < TRACE_BUF_SIZE - 1); z1++) { - if ((buf[z1] >= 0x20) && - (buf[z1] < 0x80)) + if (buf[z1] >= 0x20 && buf[z1] < 0x80) trace_buf[i++] = buf[z1]; else trace_buf[i++] = '.'; @@ -138,7 +137,7 @@ void debug_print_buffer(const void *data, int len) i += snprintf(&trace_buf[i], TRACE_BUF_SIZE - i, " "); for (; (z1 < z) && (i < TRACE_BUF_SIZE - 1); z1++) { - if ((buf[z1] > 0x20) && (buf[z1] < 0x80)) + if (buf[z1] > 0x20 && buf[z1] < 0x80) trace_buf[i++] = buf[z1]; else trace_buf[i++] = '.'; @@ -148,7 +147,6 @@ void debug_print_buffer(const void *data, int len) PRINT(KERN_INFO, "%s", trace_buf); spin_unlock_irqrestore(&trace_buf_lock, flags); - return; } EXPORT_SYMBOL(debug_print_buffer); @@ -175,7 +173,7 @@ const char *debug_transport_id_to_initiator_name(const uint8_t *transport_id) char *name_buf; unsigned long flags; - sBUG_ON(transport_id == NULL); /* better to catch it not under lock */ + sBUG_ON(!transport_id); /* better to catch it not under lock */ spin_lock_irqsave(&trace_buf_lock, flags); @@ -190,50 +188,48 @@ const char *debug_transport_id_to_initiator_name(const uint8_t *transport_id) switch (transport_id[0] & 0x0f) { case SCSI_TRANSPORTID_PROTOCOLID_ISCSI: - scnprintf(name_buf, SIZEOF_NAME_BUF, "%s", - &transport_id[4]); + scnprintf(name_buf, SIZEOF_NAME_BUF, "%s", &transport_id[4]); break; case SCSI_TRANSPORTID_PROTOCOLID_FCP2: scnprintf(name_buf, SIZEOF_NAME_BUF, - "%02x:%02x:%02x:%02x:%02x:%02x:%02x:%02x", - transport_id[8], transport_id[9], - transport_id[10], transport_id[11], - transport_id[12], transport_id[13], - transport_id[14], transport_id[15]); + "%02x:%02x:%02x:%02x:%02x:%02x:%02x:%02x", + transport_id[8], transport_id[9], + transport_id[10], transport_id[11], + transport_id[12], transport_id[13], + transport_id[14], transport_id[15]); break; case SCSI_TRANSPORTID_PROTOCOLID_SPI5: scnprintf(name_buf, SIZEOF_NAME_BUF, - "%x:%x", be16_to_cpu((__force __be16)transport_id[2]), - be16_to_cpu((__force __be16)transport_id[6])); + "%x:%x", be16_to_cpu((__force __be16)transport_id[2]), + be16_to_cpu((__force __be16)transport_id[6])); break; case SCSI_TRANSPORTID_PROTOCOLID_SRP: scnprintf(name_buf, SIZEOF_NAME_BUF, - "%02x:%02x:%02x:%02x:%02x:%02x:%02x:%02x" - ":%02x:%02x:%02x:%02x:%02x:%02x:%02x:%02x", - transport_id[8], transport_id[9], - transport_id[10], transport_id[11], - transport_id[12], transport_id[13], - transport_id[14], transport_id[15], - transport_id[16], transport_id[17], - transport_id[18], transport_id[19], - transport_id[20], transport_id[21], - transport_id[22], transport_id[23]); + "%02x:%02x:%02x:%02x:%02x:%02x:%02x:%02x:%02x:%02x:%02x:%02x:%02x:%02x:%02x:%02x", + transport_id[8], transport_id[9], + transport_id[10], transport_id[11], + transport_id[12], transport_id[13], + transport_id[14], transport_id[15], + transport_id[16], transport_id[17], + transport_id[18], transport_id[19], + transport_id[20], transport_id[21], + transport_id[22], transport_id[23]); break; case SCSI_TRANSPORTID_PROTOCOLID_SAS: scnprintf(name_buf, SIZEOF_NAME_BUF, - "%02x:%02x:%02x:%02x:%02x:%02x:%02x:%02x", - transport_id[4], transport_id[5], - transport_id[6], transport_id[7], - transport_id[8], transport_id[9], - transport_id[10], transport_id[11]); + "%02x:%02x:%02x:%02x:%02x:%02x:%02x:%02x", + transport_id[4], transport_id[5], + transport_id[6], transport_id[7], + transport_id[8], transport_id[9], + transport_id[10], transport_id[11]); break; case SCST_TRANSPORTID_PROTOCOLID_COPY_MGR: scnprintf(name_buf, SIZEOF_NAME_BUF, - "%s", &transport_id[2]); + "%s", &transport_id[2]); break; default: scnprintf(name_buf, SIZEOF_NAME_BUF, - "(Not known protocol ID %x)", transport_id[0] & 0x0f); + "(Not known protocol ID %x)", transport_id[0] & 0x0f); break; } |