diff mbox series

[4/9] staging: vc04_services: Shorten helper function name

Message ID 20231107095156.365492-5-umang.jain@ideasonboard.com (mailing list archive)
State New, archived
Headers show
Series staging: vc04_services: Smatch fixes and remove custom logging | expand

Commit Message

Umang Jain Nov. 7, 2023, 9:51 a.m. UTC
Shorten the helper log_category_str() to log_cat().
Going forwards, this will be used at multiple places with
dev_dbg().

No functiional changes intended in this patch.

Signed-off-by: Umang Jain <umang.jain@ideasonboard.com>
---
 .../vc04_services/interface/vchiq_arm/vchiq_core.h     | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

Comments

Kieran Bingham Nov. 7, 2023, 12:32 p.m. UTC | #1
Quoting Umang Jain (2023-11-07 09:51:51)
> Shorten the helper log_category_str() to log_cat().
> Going forwards, this will be used at multiple places with
> dev_dbg().
> 
> No functiional changes intended in this patch.

s/functiional/functional/

But if we're replacing this like this - maybe we don't need a log_cat -
would it make more sense to just make the VCHIQ_CORE VCHIQ_SUSPEND etc
just a #define "vchiq_core" ... and remove the indirection? Are they
used as enum's anywhere now still?

--
Kieran


> 
> Signed-off-by: Umang Jain <umang.jain@ideasonboard.com>
> ---
>  .../vc04_services/interface/vchiq_arm/vchiq_core.h     | 10 +++++-----
>  1 file changed, 5 insertions(+), 5 deletions(-)
> 
> diff --git a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_core.h b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_core.h
> index 161358db457c..cc7bb6ca832a 100644
> --- a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_core.h
> +++ b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_core.h
> @@ -39,7 +39,7 @@ enum vchiq_log_category {
>         VCHIQ_SUSPEND,
>  };
>  
> -static inline const char *log_category_str(enum vchiq_log_category c)
> +static inline const char *log_cat(enum vchiq_log_category c)
>  {
>         static const char * const strings[] = {
>                 "vchiq_arm",
> @@ -54,19 +54,19 @@ static inline const char *log_category_str(enum vchiq_log_category c)
>  
>  #ifndef vchiq_log_error
>  #define vchiq_log_error(dev, cat, fmt, ...) \
> -       do { dev_dbg(dev, "%s error: " fmt, log_category_str(cat), ##__VA_ARGS__); } while (0)
> +       do { dev_dbg(dev, "%s error: " fmt, log_cat(cat), ##__VA_ARGS__); } while (0)
>  #endif
>  #ifndef vchiq_log_warning
>  #define vchiq_log_warning(dev, cat, fmt, ...) \
> -       do { dev_dbg(dev, "%s warning: " fmt, log_category_str(cat), ##__VA_ARGS__); } while (0)
> +       do { dev_dbg(dev, "%s warning: " fmt, log_cat(cat), ##__VA_ARGS__); } while (0)
>  #endif
>  #ifndef vchiq_log_debug
>  #define vchiq_log_debug(dev, cat, fmt, ...) \
> -       do { dev_dbg(dev, "%s debug: " fmt, log_category_str(cat), ##__VA_ARGS__); } while (0)
> +       do { dev_dbg(dev, "%s debug: " fmt, log_cat(cat), ##__VA_ARGS__); } while (0)
>  #endif
>  #ifndef vchiq_log_trace
>  #define vchiq_log_trace(dev, cat, fmt, ...) \
> -       do { dev_dbg(dev, "%s trace: " fmt, log_category_str(cat), ##__VA_ARGS__); } while (0)
> +       do { dev_dbg(dev, "%s trace: " fmt, log_cat(cat), ##__VA_ARGS__); } while (0)
>  #endif
>  
>  #define VCHIQ_SLOT_MASK        (VCHIQ_SLOT_SIZE - 1)
> -- 
> 2.41.0
>
Greg KH Nov. 23, 2023, 1:11 p.m. UTC | #2
On Tue, Nov 07, 2023 at 04:51:51AM -0500, Umang Jain wrote:
> Shorten the helper log_category_str() to log_cat().
> Going forwards, this will be used at multiple places with
> dev_dbg().
> 
> No functiional changes intended in this patch.
> 
> Signed-off-by: Umang Jain <umang.jain@ideasonboard.com>
> ---
>  .../vc04_services/interface/vchiq_arm/vchiq_core.h     | 10 +++++-----
>  1 file changed, 5 insertions(+), 5 deletions(-)
> 
> diff --git a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_core.h b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_core.h
> index 161358db457c..cc7bb6ca832a 100644
> --- a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_core.h
> +++ b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_core.h
> @@ -39,7 +39,7 @@ enum vchiq_log_category {
>  	VCHIQ_SUSPEND,
>  };
>  
> -static inline const char *log_category_str(enum vchiq_log_category c)
> +static inline const char *log_cat(enum vchiq_log_category c)

This is a bad name for a subsystem-wide function name, why is this
needed at all?

thanks,

greg k-h
diff mbox series

Patch

diff --git a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_core.h b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_core.h
index 161358db457c..cc7bb6ca832a 100644
--- a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_core.h
+++ b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_core.h
@@ -39,7 +39,7 @@  enum vchiq_log_category {
 	VCHIQ_SUSPEND,
 };
 
-static inline const char *log_category_str(enum vchiq_log_category c)
+static inline const char *log_cat(enum vchiq_log_category c)
 {
 	static const char * const strings[] = {
 		"vchiq_arm",
@@ -54,19 +54,19 @@  static inline const char *log_category_str(enum vchiq_log_category c)
 
 #ifndef vchiq_log_error
 #define vchiq_log_error(dev, cat, fmt, ...) \
-	do { dev_dbg(dev, "%s error: " fmt, log_category_str(cat), ##__VA_ARGS__); } while (0)
+	do { dev_dbg(dev, "%s error: " fmt, log_cat(cat), ##__VA_ARGS__); } while (0)
 #endif
 #ifndef vchiq_log_warning
 #define vchiq_log_warning(dev, cat, fmt, ...) \
-	do { dev_dbg(dev, "%s warning: " fmt, log_category_str(cat), ##__VA_ARGS__); } while (0)
+	do { dev_dbg(dev, "%s warning: " fmt, log_cat(cat), ##__VA_ARGS__); } while (0)
 #endif
 #ifndef vchiq_log_debug
 #define vchiq_log_debug(dev, cat, fmt, ...) \
-	do { dev_dbg(dev, "%s debug: " fmt, log_category_str(cat), ##__VA_ARGS__); } while (0)
+	do { dev_dbg(dev, "%s debug: " fmt, log_cat(cat), ##__VA_ARGS__); } while (0)
 #endif
 #ifndef vchiq_log_trace
 #define vchiq_log_trace(dev, cat, fmt, ...) \
-	do { dev_dbg(dev, "%s trace: " fmt, log_category_str(cat), ##__VA_ARGS__); } while (0)
+	do { dev_dbg(dev, "%s trace: " fmt, log_cat(cat), ##__VA_ARGS__); } while (0)
 #endif
 
 #define VCHIQ_SLOT_MASK        (VCHIQ_SLOT_SIZE - 1)