Re: [PATCH] fbdev/mb862xxfb: Fix defined but not used error

2024-03-15 Thread Helge Deller

On 2/29/24 12:50, Michael Ellerman wrote:

socrates_gc_mode is defined at the top-level but then only used inside
an #ifdef CONFIG_FB_MB862XX_LIME, leading to an error with some configs:

   drivers/video/fbdev/mb862xx/mb862xxfbdrv.c:36:31: error: ‘socrates_gc_mode’ 
defined but not used
  36 | static struct mb862xx_gc_mode socrates_gc_mode = {

Fix it by moving socrates_gc_mode inside that ifdef, immediately prior
to the only function where it's used.

Signed-off-by: Michael Ellerman 


applied.
Thanks!
Helge


---
  drivers/video/fbdev/mb862xx/mb862xxfbdrv.c | 18 +-
  1 file changed, 9 insertions(+), 9 deletions(-)

diff --git a/drivers/video/fbdev/mb862xx/mb862xxfbdrv.c 
b/drivers/video/fbdev/mb862xx/mb862xxfbdrv.c
index 7c402e9fd7a9..baec312d7b33 100644
--- a/drivers/video/fbdev/mb862xx/mb862xxfbdrv.c
+++ b/drivers/video/fbdev/mb862xx/mb862xxfbdrv.c
@@ -32,15 +32,6 @@
  #define CARMINE_MEM_SIZE  0x800
  #define DRV_NAME  "mb862xxfb"

-#if defined(CONFIG_SOCRATES)
-static struct mb862xx_gc_mode socrates_gc_mode = {
-   /* Mode for Prime View PM070WL4 TFT LCD Panel */
-   { "800x480", 45, 800, 480, 4, 86, 42, 33, 10, 128, 2, 0, 0, 0 },
-   /* 16 bits/pixel, 16MB, 133MHz, SDRAM memory mode value */
-   16, 0x100, GC_CCF_COT_133, 0x4157ba63
-};
-#endif
-
  /* Helpers */
  static inline int h_total(struct fb_var_screeninfo *var)
  {
@@ -666,6 +657,15 @@ static int mb862xx_gdc_init(struct mb862xxfb_par *par)
return 0;
  }

+#if defined(CONFIG_SOCRATES)
+static struct mb862xx_gc_mode socrates_gc_mode = {
+   /* Mode for Prime View PM070WL4 TFT LCD Panel */
+   { "800x480", 45, 800, 480, 4, 86, 42, 33, 10, 128, 2, 0, 0, 0 },
+   /* 16 bits/pixel, 16MB, 133MHz, SDRAM memory mode value */
+   16, 0x100, GC_CCF_COT_133, 0x4157ba63
+};
+#endif
+
  static int of_platform_mb862xx_probe(struct platform_device *ofdev)
  {
struct device_node *np = ofdev->dev.of_node;




[PATCH] fbdev/mb862xxfb: Fix defined but not used error

2024-02-29 Thread Michael Ellerman
socrates_gc_mode is defined at the top-level but then only used inside
an #ifdef CONFIG_FB_MB862XX_LIME, leading to an error with some configs:

  drivers/video/fbdev/mb862xx/mb862xxfbdrv.c:36:31: error: ‘socrates_gc_mode’ 
defined but not used
 36 | static struct mb862xx_gc_mode socrates_gc_mode = {

Fix it by moving socrates_gc_mode inside that ifdef, immediately prior
to the only function where it's used.

Signed-off-by: Michael Ellerman 
---
 drivers/video/fbdev/mb862xx/mb862xxfbdrv.c | 18 +-
 1 file changed, 9 insertions(+), 9 deletions(-)

diff --git a/drivers/video/fbdev/mb862xx/mb862xxfbdrv.c 
b/drivers/video/fbdev/mb862xx/mb862xxfbdrv.c
index 7c402e9fd7a9..baec312d7b33 100644
--- a/drivers/video/fbdev/mb862xx/mb862xxfbdrv.c
+++ b/drivers/video/fbdev/mb862xx/mb862xxfbdrv.c
@@ -32,15 +32,6 @@
 #define CARMINE_MEM_SIZE   0x800
 #define DRV_NAME   "mb862xxfb"
 
-#if defined(CONFIG_SOCRATES)
-static struct mb862xx_gc_mode socrates_gc_mode = {
-   /* Mode for Prime View PM070WL4 TFT LCD Panel */
-   { "800x480", 45, 800, 480, 4, 86, 42, 33, 10, 128, 2, 0, 0, 0 },
-   /* 16 bits/pixel, 16MB, 133MHz, SDRAM memory mode value */
-   16, 0x100, GC_CCF_COT_133, 0x4157ba63
-};
-#endif
-
 /* Helpers */
 static inline int h_total(struct fb_var_screeninfo *var)
 {
@@ -666,6 +657,15 @@ static int mb862xx_gdc_init(struct mb862xxfb_par *par)
return 0;
 }
 
+#if defined(CONFIG_SOCRATES)
+static struct mb862xx_gc_mode socrates_gc_mode = {
+   /* Mode for Prime View PM070WL4 TFT LCD Panel */
+   { "800x480", 45, 800, 480, 4, 86, 42, 33, 10, 128, 2, 0, 0, 0 },
+   /* 16 bits/pixel, 16MB, 133MHz, SDRAM memory mode value */
+   16, 0x100, GC_CCF_COT_133, 0x4157ba63
+};
+#endif
+
 static int of_platform_mb862xx_probe(struct platform_device *ofdev)
 {
struct device_node *np = ofdev->dev.of_node;
-- 
2.43.2