diff options
author | Mauro Carvalho Chehab <mchehab+huawei@kernel.org> | 2020-09-23 11:17:47 +0300 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab+huawei@kernel.org> | 2020-09-23 11:19:19 +0300 |
commit | 01cc2ec6ea044731e939e5e47f7e115b86f49465 (patch) | |
tree | 4f44814fae427ccd7c45b5b64612aebd9ebc2b7f | |
parent | 8e3d5d4baf0781974a224e284e837665c0d26f92 (diff) | |
download | linux-01cc2ec6ea044731e939e5e47f7e115b86f49465.tar.xz |
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>
7 files changed, 16 insertions, 20 deletions
diff --git a/drivers/staging/media/atomisp/pci/atomisp_compat_css20.c b/drivers/staging/media/atomisp/pci/atomisp_compat_css20.c index 85b39de7bc28..faa0935e536a 100644 --- a/drivers/staging/media/atomisp/pci/atomisp_compat_css20.c +++ b/drivers/staging/media/atomisp/pci/atomisp_compat_css20.c @@ -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; diff --git a/drivers/staging/media/atomisp/pci/hive_isp_css_include/print_support.h b/drivers/staging/media/atomisp/pci/hive_isp_css_include/print_support.h index 749f5c3725bd..540b405cc0f7 100644 --- a/drivers/staging/media/atomisp/pci/hive_isp_css_include/print_support.h +++ b/drivers/staging/media/atomisp/pci/hive_isp_css_include/print_support.h @@ -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; diff --git a/drivers/staging/media/atomisp/pci/ia_css_env.h b/drivers/staging/media/atomisp/pci/ia_css_env.h index 9808ff9e0492..6b38723b27cd 100644 --- a/drivers/staging/media/atomisp/pci/ia_css_env.h +++ b/drivers/staging/media/atomisp/pci/ia_css_env.h @@ -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.*/ }; diff --git a/drivers/staging/media/atomisp/pci/runtime/debug/interface/ia_css_debug.h b/drivers/staging/media/atomisp/pci/runtime/debug/interface/ia_css_debug.h index 0f9b7eb17647..5e6e7447ae00 100644 --- a/drivers/staging/media/atomisp/pci/runtime/debug/interface/ia_css_debug.h +++ b/drivers/staging/media/atomisp/pci/runtime/debug/interface/ia_css_debug.h @@ -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 diff --git a/drivers/staging/media/atomisp/pci/runtime/debug/src/ia_css_debug.c b/drivers/staging/media/atomisp/pci/runtime/debug/src/ia_css_debug.c index 4f637e7219a6..05ce0f73f5ae 100644 --- a/drivers/staging/media/atomisp/pci/runtime/debug/src/ia_css_debug.c +++ b/drivers/staging/media/atomisp/pci/runtime/debug/src/ia_css_debug.c @@ -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; diff --git a/drivers/staging/media/atomisp/pci/sh_css.c b/drivers/staging/media/atomisp/pci/sh_css.c index c50b5fba7b86..e8c5caf3dfe6 100644 --- a/drivers/staging/media/atomisp/pci/sh_css.c +++ b/drivers/staging/media/atomisp/pci/sh_css.c @@ -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 diff --git a/drivers/staging/media/atomisp/pci/sh_css_internal.h b/drivers/staging/media/atomisp/pci/sh_css_internal.h index 415353ceb7f6..3c669ec79b68 100644 --- a/drivers/staging/media/atomisp/pci/sh_css_internal.h +++ b/drivers/staging/media/atomisp/pci/sh_css_internal.h @@ -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); |