2023-07-14 01:30:49

by Min-Hua Chen

[permalink] [raw]
Subject: [PATCH] fbdev: fbmem: mark registered_fb static

Mark registered_fb, num_registered_fb, fbcon_registered_fb, and
fbcon_num_registered_fb static to fix the following sparse
warnings:

drivers/video/fbdev/core/fbmem.c:51:16: sparse: warning: symbol 'registered_fb' was not declared. Should it be static?
drivers/video/fbdev/core/fbmem.c:52:5: sparse: warning: symbol 'num_registered_fb' was not declared. Should it be static?
drivers/video/fbdev/core/fbcon.c:105:16: sparse: warning: symbol 'fbcon_registered_fb' was not declared. Should it be static?
drivers/video/fbdev/core/fbcon.c:106:5: sparse: warning: symbol 'fbcon_num_registered_fb' was not declared. Should it be static?

No functional change intended.

Signed-off-by: Min-Hua Chen <[email protected]>
---
drivers/video/fbdev/core/fbcon.c | 4 ++--
drivers/video/fbdev/core/fbmem.c | 4 ++--
2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/video/fbdev/core/fbcon.c b/drivers/video/fbdev/core/fbcon.c
index c6c9d040bdec..4336c7d64ed0 100644
--- a/drivers/video/fbdev/core/fbcon.c
+++ b/drivers/video/fbdev/core/fbcon.c
@@ -102,8 +102,8 @@ enum {

static struct fbcon_display fb_display[MAX_NR_CONSOLES];

-struct fb_info *fbcon_registered_fb[FB_MAX];
-int fbcon_num_registered_fb;
+static struct fb_info *fbcon_registered_fb[FB_MAX];
+static int fbcon_num_registered_fb;

#define fbcon_for_each_registered_fb(i) \
for (i = 0; WARN_CONSOLE_UNLOCKED(), i < FB_MAX; i++) \
diff --git a/drivers/video/fbdev/core/fbmem.c b/drivers/video/fbdev/core/fbmem.c
index 329d16e49a90..18355655959a 100644
--- a/drivers/video/fbdev/core/fbmem.c
+++ b/drivers/video/fbdev/core/fbmem.c
@@ -48,8 +48,8 @@

static DEFINE_MUTEX(registration_lock);

-struct fb_info *registered_fb[FB_MAX] __read_mostly;
-int num_registered_fb __read_mostly;
+static struct fb_info *registered_fb[FB_MAX] __read_mostly;
+static int num_registered_fb __read_mostly;
#define for_each_registered_fb(i) \
for (i = 0; i < FB_MAX; i++) \
if (!registered_fb[i]) {} else
--
2.34.1



2023-07-31 14:27:35

by Helge Deller

[permalink] [raw]
Subject: Re: [PATCH] fbdev: fbmem: mark registered_fb static

On 7/14/23 02:37, Min-Hua Chen wrote:
> Mark registered_fb, num_registered_fb, fbcon_registered_fb, and
> fbcon_num_registered_fb static to fix the following sparse
> warnings:
>
> drivers/video/fbdev/core/fbmem.c:51:16: sparse: warning: symbol 'registered_fb' was not declared. Should it be static?
> drivers/video/fbdev/core/fbmem.c:52:5: sparse: warning: symbol 'num_registered_fb' was not declared. Should it be static?
> drivers/video/fbdev/core/fbcon.c:105:16: sparse: warning: symbol 'fbcon_registered_fb' was not declared. Should it be static?
> drivers/video/fbdev/core/fbcon.c:106:5: sparse: warning: symbol 'fbcon_num_registered_fb' was not declared. Should it be static?
>
> No functional change intended.

num_registered_fb is still used in:
drivers/staging/olpc_dcon/olpc_dcon.c: if (num_registered_fb < 1) {

Helge

2023-07-31 16:54:52

by Min-Hua Chen

[permalink] [raw]
Subject: Re: [PATCH] fbdev: fbmem: mark registered_fb static


Hi Helge,

>num_registered_fb is still used in:
>drivers/staging/olpc_dcon/olpc_dcon.c: if (num_registered_fb < 1) {
>
>Helge

Thanks, you're right, num_registered_fb is still being used.
I'll check this patch and submit v2.

thanks,
Min-Hua

2023-08-02 00:53:50

by Min-Hua Chen

[permalink] [raw]
Subject: Re: [PATCH] fbdev: fbmem: mark registered_fb static


>Hi Helge,
>
>>num_registered_fb is still used in:
>>drivers/staging/olpc_dcon/olpc_dcon.c: if (num_registered_fb < 1) {
>>
>>Helge
>
>Thanks, you're right, num_registered_fb is still being used.
>I'll check this patch and submit v2.

Update:

num_registered_fb and registered_fb are used by olpc_dcon.c, However,
olpc_dcon.c has been marked as broken [1].

I do not have the knowledge to remove the dependency of fbdev from olpc_dcon.c,
I'll leave num_registered_fb and registered_fb as-is.

[1] https://lore.kernel.org/all/[email protected]/

>thanks,
>Min-Hua
>