Commit 01cc2ec6 authored by Mauro Carvalho Chehab's avatar Mauro Carvalho Chehab

media: atomisp: cleanup __printf() atributes on printk messages

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: default avatarMauro Carvalho Chehab <mchehab+huawei@kernel.org>
parent 8e3d5d4b
...@@ -159,15 +159,14 @@ static void atomisp_css2_hw_load(hrt_address addr, void *to, uint32_t n) ...@@ -159,15 +159,14 @@ static void atomisp_css2_hw_load(hrt_address addr, void *to, uint32_t n)
spin_unlock_irqrestore(&mmio_lock, flags); spin_unlock_irqrestore(&mmio_lock, flags);
} }
static int __attribute__((format (printf, 1, 0))) static int __printf(1, 0) atomisp_css2_dbg_ftrace_print(const char *fmt,
atomisp_css2_dbg_ftrace_print(const char *fmt, va_list args) va_list args)
{ {
ftrace_vprintk(fmt, args); ftrace_vprintk(fmt, args);
return 0; return 0;
} }
static int __attribute__((format (printf, 1, 0))) static int __printf(1, 0) atomisp_vprintk(const char *fmt, va_list args)
atomisp_vprintk(const char *fmt, va_list args)
{ {
vprintk(fmt, args); vprintk(fmt, args);
return 0; return 0;
......
...@@ -20,8 +20,7 @@ ...@@ -20,8 +20,7 @@
extern int (*sh_css_printf)(const char *fmt, va_list args); extern int (*sh_css_printf)(const char *fmt, va_list args);
/* depends on host supplied print function in ia_css_init() */ /* depends on host supplied print function in ia_css_init() */
static inline __attribute__((format (printf, 1, 0))) static inline __printf(1, 2) void ia_css_print(const char *fmt, ...)
void ia_css_print(const char *fmt, ...)
{ {
va_list ap; va_list ap;
......
...@@ -75,9 +75,9 @@ struct ia_css_hw_access_env { ...@@ -75,9 +75,9 @@ struct ia_css_hw_access_env {
/* Environment with function pointers to print error and debug messages. /* Environment with function pointers to print error and debug messages.
*/ */
struct ia_css_print_env { 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. */ /** 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.*/ /** Print an error message.*/
}; };
......
...@@ -129,15 +129,16 @@ enum ia_css_debug_enable_param_dump { ...@@ -129,15 +129,16 @@ enum ia_css_debug_enable_param_dump {
* @param[in] fmt printf like format string * @param[in] fmt printf like format string
* @param[in] args arguments for the format string * @param[in] args arguments for the format string
*/ */
static inline void static inline void __printf(2, 0) ia_css_debug_vdtrace(unsigned int level,
ia_css_debug_vdtrace(unsigned int level, const char *fmt, va_list args) const char *fmt,
va_list args)
{ {
if (dbg_level >= level) if (dbg_level >= level)
sh_css_vprint(fmt, args); sh_css_vprint(fmt, args);
} }
__printf(2, 3) __printf(2, 3) void ia_css_debug_dtrace(unsigned int level,
void ia_css_debug_dtrace(unsigned int level, const char *fmt, ...); const char *fmt, ...);
/*! @brief Dump sp thread's stack contents /*! @brief Dump sp thread's stack contents
* SP thread's stack contents are set to 0xcafecafe. This function dumps the * SP thread's stack contents are set to 0xcafecafe. This function dumps the
......
...@@ -2454,8 +2454,7 @@ ia_css_debug_mode_enable_dma_channel(int dma_id, ...@@ -2454,8 +2454,7 @@ ia_css_debug_mode_enable_dma_channel(int dma_id,
return rc; return rc;
} }
static static void __printf(1, 2) dtrace_dot(const char *fmt, ...)
void dtrace_dot(const char *fmt, ...)
{ {
va_list ap; va_list ap;
......
...@@ -111,7 +111,7 @@ static int thread_alive; ...@@ -111,7 +111,7 @@ static int thread_alive;
struct sh_css my_css; 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 /* modes of work: stream_create and stream_destroy will update the save/restore data
only when in working mode, not suspend/resume only when in working mode, not suspend/resume
......
...@@ -907,10 +907,9 @@ struct host_sp_queues { ...@@ -907,10 +907,9 @@ struct host_sp_queues {
#define SIZE_OF_HOST_SP_QUEUES_STRUCT \ #define SIZE_OF_HOST_SP_QUEUES_STRUCT \
(SIZE_OF_QUEUES_ELEMS + SIZE_OF_QUEUES_DESC) (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 static inline void __printf(1, 2) sh_css_print(const char *fmt, ...)
sh_css_print(const char *fmt, ...)
{ {
va_list ap; va_list ap;
...@@ -921,8 +920,7 @@ sh_css_print(const char *fmt, ...) ...@@ -921,8 +920,7 @@ sh_css_print(const char *fmt, ...)
} }
} }
static inline void static inline void __printf(1, 0) sh_css_vprint(const char *fmt, va_list args)
sh_css_vprint(const char *fmt, va_list args)
{ {
if (sh_css_printf) if (sh_css_printf)
sh_css_printf(fmt, args); sh_css_printf(fmt, args);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment