media: atomisp: cleanup __printf() atributes on printk messages
authorMauro Carvalho Chehab <mchehab+huawei@kernel.org>
Wed, 23 Sep 2020 08:17:47 +0000 (10:17 +0200)
committerMauro Carvalho Chehab <mchehab+huawei@kernel.org>
Wed, 23 Sep 2020 08:19:19 +0000 (10:19 +0200)
There are still some warnings produced by -Wsuggest-attribute=format,
like this one:

drivers/staging/media/atomisp/pci/runtime/debug/src/ia_css_debug.c: In function ‘dtrace_dot’:
drivers/staging/media/atomisp/pci/runtime/debug/src/ia_css_debug.c:2466:2: warning: function ‘dtrace_dot’ might be a candidate for ‘gnu_printf’ format attribute [-Wsuggest-attribute=format]
 2466 |  ia_css_debug_vdtrace(IA_CSS_DEBUG_INFO, fmt, ap);
      |  ^~~~~~~~~~~~~~~~~~~~

Also, on some places, is is using __atribute, while on others it
is using the __printf() macro.

Uniform those to always use the __printf() macro, placing it
before the function, and fix the logic in order to cleanup
all such warnings.

Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
drivers/staging/media/atomisp/pci/atomisp_compat_css20.c
drivers/staging/media/atomisp/pci/hive_isp_css_include/print_support.h
drivers/staging/media/atomisp/pci/ia_css_env.h
drivers/staging/media/atomisp/pci/runtime/debug/interface/ia_css_debug.h
drivers/staging/media/atomisp/pci/runtime/debug/src/ia_css_debug.c
drivers/staging/media/atomisp/pci/sh_css.c
drivers/staging/media/atomisp/pci/sh_css_internal.h

index 85b39de..faa0935 100644 (file)
@@ -159,15 +159,14 @@ static void atomisp_css2_hw_load(hrt_address addr, void *to, uint32_t n)
        spin_unlock_irqrestore(&mmio_lock, flags);
 }
 
-static int  __attribute__((format (printf, 1, 0)))
-atomisp_css2_dbg_ftrace_print(const char *fmt, va_list args)
+static int  __printf(1, 0) atomisp_css2_dbg_ftrace_print(const char *fmt,
+                                                        va_list args)
 {
        ftrace_vprintk(fmt, args);
        return 0;
 }
 
-static int  __attribute__((format (printf, 1, 0)))
-atomisp_vprintk(const char *fmt, va_list args)
+static int  __printf(1, 0) atomisp_vprintk(const char *fmt, va_list args)
 {
        vprintk(fmt, args);
        return 0;
index 749f5c3..540b405 100644 (file)
@@ -20,8 +20,7 @@
 
 extern int (*sh_css_printf)(const char *fmt, va_list args);
 /* depends on host supplied print function in ia_css_init() */
-static inline  __attribute__((format (printf, 1, 0)))
-void ia_css_print(const char *fmt, ...)
+static inline  __printf(1, 2) void ia_css_print(const char *fmt, ...)
 {
        va_list ap;
 
index 9808ff9..6b38723 100644 (file)
@@ -75,9 +75,9 @@ struct ia_css_hw_access_env {
 /* Environment with function pointers to print error and debug messages.
  */
 struct ia_css_print_env {
-       int (*debug_print)(const char *fmt, va_list args) __attribute__((format (printf, 1, 0)));
+       int  __printf(1, 0) (*debug_print)(const char *fmt, va_list args);
        /** Print a debug message. */
-       int (*error_print)(const char *fmt, va_list args) __attribute__((format (printf, 1, 0)));
+       int  __printf(1, 0) (*error_print)(const char *fmt, va_list args);
        /** Print an error message.*/
 };
 
index 0f9b7eb..5e6e744 100644 (file)
@@ -129,15 +129,16 @@ enum ia_css_debug_enable_param_dump {
  * @param[in]  fmt             printf like format string
  * @param[in]  args            arguments for the format string
  */
-static inline void
-ia_css_debug_vdtrace(unsigned int level, const char *fmt, va_list args)
+static inline void __printf(2, 0) ia_css_debug_vdtrace(unsigned int level,
+                                                      const char *fmt,
+                                                      va_list args)
 {
        if (dbg_level >= level)
                sh_css_vprint(fmt, args);
 }
 
-__printf(2, 3)
-void ia_css_debug_dtrace(unsigned int level, const char *fmt, ...);
+__printf(2, 3) void ia_css_debug_dtrace(unsigned int level,
+                                       const char *fmt, ...);
 
 /*! @brief Dump sp thread's stack contents
  * SP thread's stack contents are set to 0xcafecafe. This function dumps the
index 4f637e7..05ce0f7 100644 (file)
@@ -2454,8 +2454,7 @@ ia_css_debug_mode_enable_dma_channel(int dma_id,
        return rc;
 }
 
-static
-void dtrace_dot(const char *fmt, ...)
+static void __printf(1, 2) dtrace_dot(const char *fmt, ...)
 {
        va_list ap;
 
index c50b5fb..e8c5caf 100644 (file)
@@ -111,7 +111,7 @@ static int thread_alive;
 
 struct sh_css my_css;
 
-int (*sh_css_printf)(const char *fmt, va_list args) = NULL;
+int  __printf(1, 0) (*sh_css_printf)(const char *fmt, va_list args) = NULL;
 
 /* modes of work: stream_create and stream_destroy will update the save/restore data
    only when in working mode, not suspend/resume
index 415353c..3c669ec 100644 (file)
@@ -907,10 +907,9 @@ struct host_sp_queues {
 #define SIZE_OF_HOST_SP_QUEUES_STRUCT          \
        (SIZE_OF_QUEUES_ELEMS + SIZE_OF_QUEUES_DESC)
 
-extern int (*sh_css_printf)(const char *fmt, va_list args);
+extern int  __printf(1, 0) (*sh_css_printf)(const char *fmt, va_list args);
 
-static inline void
-sh_css_print(const char *fmt, ...)
+static inline void  __printf(1, 2) sh_css_print(const char *fmt, ...)
 {
        va_list ap;
 
@@ -921,8 +920,7 @@ sh_css_print(const char *fmt, ...)
        }
 }
 
-static inline void
-sh_css_vprint(const char *fmt, va_list args)
+static inline void  __printf(1, 0) sh_css_vprint(const char *fmt, va_list args)
 {
        if (sh_css_printf)
                sh_css_printf(fmt, args);