linux-fbdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] fbmem: Correct position of '__maybe_unused' in proc_fb_seq_ops
@ 2021-05-05 18:28 Nathan Chancellor
  2021-05-06  3:03 ` Guenter Roeck
  0 siblings, 1 reply; 2+ messages in thread
From: Nathan Chancellor @ 2021-05-05 18:28 UTC (permalink / raw)
  To: Daniel Vetter
  Cc: Guenter Roeck, Nick Desaulniers, dri-devel, linux-fbdev,
	linux-kernel, clang-built-linux, Nathan Chancellor,
	kernel test robot

Clang warns:

 drivers/video/fbdev/core/fbmem.c:736:21: warning: attribute
 declaration must precede definition [-Wignored-attributes]
 static const struct __maybe_unused seq_operations proc_fb_seq_ops = {
                     ^
 ./include/linux/compiler_attributes.h:273:56: note: expanded from macro
 '__maybe_unused'
 #define __maybe_unused                  __attribute__((__unused__))
                                                        ^
 ./include/linux/seq_file.h:31:8: note: previous definition is here
 struct seq_operations {
        ^
 1 warning generated.

The attribute should not split the type 'struct seq_operations'. Move it
before the struct keyword so that it works properly and there is no more
warning.

Fixes: b9d79e4ca4ff ("fbmem: Mark proc_fb_seq_ops as __maybe_unused")
Link: https://github.com/ClangBuiltLinux/linux/issues/1371
Reported-by: kernel test robot <lkp@intel.com>
Signed-off-by: Nathan Chancellor <nathan@kernel.org>
---
 drivers/video/fbdev/core/fbmem.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/video/fbdev/core/fbmem.c b/drivers/video/fbdev/core/fbmem.c
index 52c606c0f8a2..84c484f37b4a 100644
--- a/drivers/video/fbdev/core/fbmem.c
+++ b/drivers/video/fbdev/core/fbmem.c
@@ -733,7 +733,7 @@ static int fb_seq_show(struct seq_file *m, void *v)
 	return 0;
 }
 
-static const struct __maybe_unused seq_operations proc_fb_seq_ops = {
+static const __maybe_unused struct seq_operations proc_fb_seq_ops = {
 	.start	= fb_seq_start,
 	.next	= fb_seq_next,
 	.stop	= fb_seq_stop,

base-commit: b9d79e4ca4ff23543d6b33c736ba07c1f0a9dcb1
-- 
2.31.1.362.g311531c9de


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH] fbmem: Correct position of '__maybe_unused' in proc_fb_seq_ops
  2021-05-05 18:28 [PATCH] fbmem: Correct position of '__maybe_unused' in proc_fb_seq_ops Nathan Chancellor
@ 2021-05-06  3:03 ` Guenter Roeck
  0 siblings, 0 replies; 2+ messages in thread
From: Guenter Roeck @ 2021-05-06  3:03 UTC (permalink / raw)
  To: Nathan Chancellor
  Cc: Daniel Vetter, Nick Desaulniers, dri-devel, linux-fbdev,
	linux-kernel, clang-built-linux, kernel test robot

On Wed, May 05, 2021 at 11:28:08AM -0700, Nathan Chancellor wrote:
> Clang warns:
> 
>  drivers/video/fbdev/core/fbmem.c:736:21: warning: attribute
>  declaration must precede definition [-Wignored-attributes]
>  static const struct __maybe_unused seq_operations proc_fb_seq_ops = {
>                      ^
>  ./include/linux/compiler_attributes.h:273:56: note: expanded from macro
>  '__maybe_unused'
>  #define __maybe_unused                  __attribute__((__unused__))
>                                                         ^
>  ./include/linux/seq_file.h:31:8: note: previous definition is here
>  struct seq_operations {
>         ^
>  1 warning generated.
> 
> The attribute should not split the type 'struct seq_operations'. Move it
> before the struct keyword so that it works properly and there is no more
> warning.
> 

Oops, sorry.

Reviewed-by: Guenter Roeck <linux@roeck-us.net>

Guenter

> Fixes: b9d79e4ca4ff ("fbmem: Mark proc_fb_seq_ops as __maybe_unused")
> Link: https://github.com/ClangBuiltLinux/linux/issues/1371
> Reported-by: kernel test robot <lkp@intel.com>
> Signed-off-by: Nathan Chancellor <nathan@kernel.org>
> ---
>  drivers/video/fbdev/core/fbmem.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/video/fbdev/core/fbmem.c b/drivers/video/fbdev/core/fbmem.c
> index 52c606c0f8a2..84c484f37b4a 100644
> --- a/drivers/video/fbdev/core/fbmem.c
> +++ b/drivers/video/fbdev/core/fbmem.c
> @@ -733,7 +733,7 @@ static int fb_seq_show(struct seq_file *m, void *v)
>  	return 0;
>  }
>  
> -static const struct __maybe_unused seq_operations proc_fb_seq_ops = {
> +static const __maybe_unused struct seq_operations proc_fb_seq_ops = {
>  	.start	= fb_seq_start,
>  	.next	= fb_seq_next,
>  	.stop	= fb_seq_stop,
> 
> base-commit: b9d79e4ca4ff23543d6b33c736ba07c1f0a9dcb1
> -- 
> 2.31.1.362.g311531c9de
> 

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2021-05-06  3:03 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-05-05 18:28 [PATCH] fbmem: Correct position of '__maybe_unused' in proc_fb_seq_ops Nathan Chancellor
2021-05-06  3:03 ` Guenter Roeck

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).