mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] staging: sm750fb: mark g_fbmode as const
@ 2026-09-22 22:55 Iñaki Sobera Sotomayor
  2026-09-23  7:27 ` Ahmet Sezgin Duran
  0 siblings, 1 reply; 3+ messages in thread
From: Iñaki Sobera Sotomayor @ 2026-09-22 22:55 UTC (permalink / raw)
  To: sudipm.mukherjee, teddy.wang, gregkh
  Cc: linux-fbdev, linux-staging, linux-kernel, Iñaki Sobera Sotomayor

The g_fbmode array of pointers is only used during module initialization
to parse display options and is never modified. Marking both the pointers
and the array const allows the compiler to place it in .rodata, which
avoids accidental modifications and cleans up a checkpatch warning.

Signed-off-by: Iñaki Sobera Sotomayor <inakisobera8@gmail.com>
---
 drivers/staging/sm750fb/sm750.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/staging/sm750fb/sm750.c b/drivers/staging/sm750fb/sm750.c
index 8b93bfeb2..c3f391cdd 100644
--- a/drivers/staging/sm750fb/sm750.c
+++ b/drivers/staging/sm750fb/sm750.c
@@ -12,7 +12,7 @@
 static int g_hwcursor = 1;
 static int g_noaccel __ro_after_init;
 static int g_nomtrr __ro_after_init;
-static const char *g_fbmode[] = {NULL, NULL};
+static const char * const g_fbmode[] = {NULL, NULL};
 static const char *g_def_fbmode = "1024x768-32@60";
 static char *g_settings;
 static int g_dualview __ro_after_init;
-- 
2.55.0


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

* Re: [PATCH] staging: sm750fb: mark g_fbmode as const
  2026-09-22 22:55 [PATCH] staging: sm750fb: mark g_fbmode as const Iñaki Sobera Sotomayor
@ 2026-09-23  7:27 ` Ahmet Sezgin Duran
  2026-09-23 15:48   ` Iñaki Sobera Sotomayor
  0 siblings, 1 reply; 3+ messages in thread
From: Ahmet Sezgin Duran @ 2026-09-23  7:27 UTC (permalink / raw)
  To: Iñaki Sobera Sotomayor, sudipm.mukherjee, teddy.wang, gregkh
  Cc: linux-fbdev, linux-staging, linux-kernel

On 9/23/26 1:55 AM, Iñaki Sobera Sotomayor wrote:
> The g_fbmode array of pointers is only used during module initialization
> to parse display options and is never modified. Marking both the pointers
> and the array const allows the compiler to place it in .rodata, which
> avoids accidental modifications and cleans up a checkpatch warning.
> 
> Signed-off-by: Iñaki Sobera Sotomayor <inakisobera8@gmail.com>
> ---
>   drivers/staging/sm750fb/sm750.c | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/staging/sm750fb/sm750.c b/drivers/staging/sm750fb/sm750.c
> index 8b93bfeb2..c3f391cdd 100644
> --- a/drivers/staging/sm750fb/sm750.c
> +++ b/drivers/staging/sm750fb/sm750.c
> @@ -12,7 +12,7 @@
>   static int g_hwcursor = 1;
>   static int g_noaccel __ro_after_init;
>   static int g_nomtrr __ro_after_init;
> -static const char *g_fbmode[] = {NULL, NULL};
> +static const char * const g_fbmode[] = {NULL, NULL};
>   static const char *g_def_fbmode = "1024x768-32@60";
>   static char *g_settings;
>   static int g_dualview __ro_after_init;

Did you compile this patch? While SM750 module is enabled?

Regards,
Ahmet Sezgin Duran

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

* Re: [PATCH] staging: sm750fb: mark g_fbmode as const
  2026-09-23  7:27 ` Ahmet Sezgin Duran
@ 2026-09-23 15:48   ` Iñaki Sobera Sotomayor
  0 siblings, 0 replies; 3+ messages in thread
From: Iñaki Sobera Sotomayor @ 2026-09-23 15:48 UTC (permalink / raw)
  To: Ahmet Sezgin Duran
  Cc: sudipm.mukherjee, teddy.wang, gregkh, linux-fbdev, linux-staging,
	linux-kernel

Hi Ahmet,

Thank you for pointing this out. You are completely right.

I mistakenly missed that g_fbmode elements are assigned in sm750.c
(lines 762, 764, 872, 876) when handling display options, so making the
array itself const breaks compilation when CONFIG_FB_SM750 is enabled.

Please disregard this patch. Apologies for the noise.

Best regards,
Iñaki Sobera Sotomayor


El mié, 23 sept 2026 a las 1:27, Ahmet Sezgin Duran
(<ahmet@sezginduran.net>) escribió:
>
> On 9/23/26 1:55 AM, Iñaki Sobera Sotomayor wrote:
> > The g_fbmode array of pointers is only used during module initialization
> > to parse display options and is never modified. Marking both the pointers
> > and the array const allows the compiler to place it in .rodata, which
> > avoids accidental modifications and cleans up a checkpatch warning.
> >
> > Signed-off-by: Iñaki Sobera Sotomayor <inakisobera8@gmail.com>
> > ---
> >   drivers/staging/sm750fb/sm750.c | 2 +-
> >   1 file changed, 1 insertion(+), 1 deletion(-)
> >
> > diff --git a/drivers/staging/sm750fb/sm750.c b/drivers/staging/sm750fb/sm750.c
> > index 8b93bfeb2..c3f391cdd 100644
> > --- a/drivers/staging/sm750fb/sm750.c
> > +++ b/drivers/staging/sm750fb/sm750.c
> > @@ -12,7 +12,7 @@
> >   static int g_hwcursor = 1;
> >   static int g_noaccel __ro_after_init;
> >   static int g_nomtrr __ro_after_init;
> > -static const char *g_fbmode[] = {NULL, NULL};
> > +static const char * const g_fbmode[] = {NULL, NULL};
> >   static const char *g_def_fbmode = "1024x768-32@60";
> >   static char *g_settings;
> >   static int g_dualview __ro_after_init;
>
> Did you compile this patch? While SM750 module is enabled?
>
> Regards,
> Ahmet Sezgin Duran

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

end of thread, other threads:[~2026-09-23 15:48 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-09-22 22:55 [PATCH] staging: sm750fb: mark g_fbmode as const Iñaki Sobera Sotomayor
2026-09-23  7:27 ` Ahmet Sezgin Duran
2026-09-23 15:48   ` Iñaki Sobera Sotomayor

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®