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: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
This commit is contained in:
Mauro Carvalho Chehab 2020-09-23 10:17:47 +02:00
parent 8e3d5d4baf
commit 01cc2ec6ea
7 changed files with 16 additions and 20 deletions

View 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;

View 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;

View 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.*/
};

View 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

View 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;

View 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

View 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);