[PATCH 0/7] fbdev: Clean up include dependencies in header

STALE958d

Revision v1 of 3 in this series.

12 messages, 3 authors, 2024-02-13 · open the first message on its own page

[PATCH 0/7] fbdev: Clean up include dependencies in header

From: Thomas Zimmermann <tzimmermann@suse.de>
Date: 2024-02-12 10:17:21

Remove unnecessary dependencies in the include statements of the
header file <linux/fb.h>. Several files throughout the kernel include
the fbdev header, so reducing dependencies positively affects other
subsystems as well. Also fix up nouveau, which needs backlight.h in
one of its source files.

Thomas Zimmermann (7):
  drm/nouveau: Include <linux/backlight.h>
  fbdev: Do not include <linux/backlight.h> in header
  fbdev: Do not include <linux/fs.h> in header
  fbdev: Do not include <linux/notifier.h> in header
  fbdev: Do not include <linux/slab.h> in header
  fbdev: Clean up forward declarations in header file
  fbdev: Clean up include statements in header file

 drivers/gpu/drm/nouveau/dispnv50/disp.c |  1 +
 include/linux/fb.h                      | 24 +++++++++++++-----------
 2 files changed, 14 insertions(+), 11 deletions(-)

-- 
2.43.0

[PATCH 1/7] drm/nouveau: Include <linux/backlight.h>

From: Thomas Zimmermann <tzimmermann@suse.de>
Date: 2024-02-12 10:17:28

Resolved the proxy include via <linux/fb.h>, which does not require the
backlight header.

Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
---
 drivers/gpu/drm/nouveau/dispnv50/disp.c | 1 +
 1 file changed, 1 insertion(+)
diff --git a/drivers/gpu/drm/nouveau/dispnv50/disp.c b/drivers/gpu/drm/nouveau/dispnv50/disp.c
index 8d37a694b7724..0c3d88ad0b0ea 100644
--- a/drivers/gpu/drm/nouveau/dispnv50/disp.c
+++ b/drivers/gpu/drm/nouveau/dispnv50/disp.c
@@ -28,6 +28,7 @@
 #include "wndw.h"
 #include "handles.h"
 
+#include <linux/backlight.h>
 #include <linux/dma-mapping.h>
 #include <linux/hdmi.h>
 #include <linux/component.h>
-- 
2.43.0

[PATCH 6/7] fbdev: Clean up forward declarations in header file

From: Thomas Zimmermann <tzimmermann@suse.de>
Date: 2024-02-12 10:17:31

Add forward declarations for struct i2c_adapter and struct module, and
sort the list alphabetically.

Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
---
 include/linux/fb.h | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)
diff --git a/include/linux/fb.h b/include/linux/fb.h
index 42155898374b1..8f70ca727a30d 100644
--- a/include/linux/fb.h
+++ b/include/linux/fb.h
@@ -15,15 +15,17 @@
 #include <asm/fb.h>
 
 struct backlight_device;
-struct vm_area_struct;
-struct fb_info;
 struct device;
+struct device_node;
+struct fb_info;
 struct file;
+struct i2c_adapter;
 struct inode;
+struct module;
 struct notifier_block;
 struct page;
 struct videomode;
-struct device_node;
+struct vm_area_struct;
 
 /* Definitions below are used in the parsed monitor specs */
 #define FB_DPMS_ACTIVE_OFF	1
-- 
2.43.0

[PATCH 4/7] fbdev: Do not include <linux/notifier.h> in header

From: Thomas Zimmermann <tzimmermann@suse.de>
Date: 2024-02-12 10:17:33

Forward declare struct notifier_block and remove the include
statement.

Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
---
 include/linux/fb.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/include/linux/fb.h b/include/linux/fb.h
index f269ba5202809..90f348f14a490 100644
--- a/include/linux/fb.h
+++ b/include/linux/fb.h
@@ -10,7 +10,6 @@
 
 #include <linux/init.h>
 #include <linux/workqueue.h>
-#include <linux/notifier.h>
 #include <linux/list.h>
 #include <linux/slab.h>
 
@@ -22,6 +21,7 @@ struct fb_info;
 struct device;
 struct file;
 struct inode;
+struct notifier_block;
 struct videomode;
 struct device_node;
 
-- 
2.43.0

[PATCH 3/7] fbdev: Do not include <linux/fs.h> in header

From: Thomas Zimmermann <tzimmermann@suse.de>
Date: 2024-02-12 10:17:34

Forward declare struct inode and remove the include statement.

Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
---
 include/linux/fb.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/include/linux/fb.h b/include/linux/fb.h
index 7380d959c5d53..f269ba5202809 100644
--- a/include/linux/fb.h
+++ b/include/linux/fb.h
@@ -8,7 +8,6 @@
 
 #define FBIO_CURSOR            _IOWR('F', 0x08, struct fb_cursor_user)
 
-#include <linux/fs.h>
 #include <linux/init.h>
 #include <linux/workqueue.h>
 #include <linux/notifier.h>
@@ -22,6 +21,7 @@ struct vm_area_struct;
 struct fb_info;
 struct device;
 struct file;
+struct inode;
 struct videomode;
 struct device_node;
 
-- 
2.43.0

[PATCH 5/7] fbdev: Do not include <linux/slab.h> in header

From: Thomas Zimmermann <tzimmermann@suse.de>
Date: 2024-02-12 10:17:35

Forward declare struct page and remove the include statement.

Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
---
 include/linux/fb.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/include/linux/fb.h b/include/linux/fb.h
index 90f348f14a490..42155898374b1 100644
--- a/include/linux/fb.h
+++ b/include/linux/fb.h
@@ -11,7 +11,6 @@
 #include <linux/init.h>
 #include <linux/workqueue.h>
 #include <linux/list.h>
-#include <linux/slab.h>
 
 #include <asm/fb.h>
 
@@ -22,6 +21,7 @@ struct device;
 struct file;
 struct inode;
 struct notifier_block;
+struct page;
 struct videomode;
 struct device_node;
 
-- 
2.43.0

[PATCH 7/7] fbdev: Clean up include statements in header file

From: Thomas Zimmermann <tzimmermann@suse.de>
Date: 2024-02-12 10:17:38

Include mutex.h, printk.h and types.h, remove several unnecessary
include statements, and sort the list alphabetically.

Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
---
 include/linux/fb.h | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/include/linux/fb.h b/include/linux/fb.h
index 8f70ca727a30d..708e6a177b1be 100644
--- a/include/linux/fb.h
+++ b/include/linux/fb.h
@@ -2,15 +2,15 @@
 #ifndef _LINUX_FB_H
 #define _LINUX_FB_H
 
-#include <linux/refcount.h>
-#include <linux/kgdb.h>
 #include <uapi/linux/fb.h>
 
 #define FBIO_CURSOR            _IOWR('F', 0x08, struct fb_cursor_user)
 
-#include <linux/init.h>
+#include <linux/mutex.h>
+#include <linux/printk.h>
+#include <linux/refcount.h>
+#include <linux/types.h>
 #include <linux/workqueue.h>
-#include <linux/list.h>
 
 #include <asm/fb.h>
 
-- 
2.43.0

[PATCH 2/7] fbdev: Do not include <linux/backlight.h> in header

From: Thomas Zimmermann <tzimmermann@suse.de>
Date: 2024-02-12 10:17:39

Forward declare struct backlight_device and remove the include
statement.

Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
---
 include/linux/fb.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/include/linux/fb.h b/include/linux/fb.h
index 2ce2f5c2fca9a..7380d959c5d53 100644
--- a/include/linux/fb.h
+++ b/include/linux/fb.h
@@ -13,11 +13,11 @@
 #include <linux/workqueue.h>
 #include <linux/notifier.h>
 #include <linux/list.h>
-#include <linux/backlight.h>
 #include <linux/slab.h>
 
 #include <asm/fb.h>
 
+struct backlight_device;
 struct vm_area_struct;
 struct fb_info;
 struct device;
-- 
2.43.0

Re: [PATCH 0/7] fbdev: Clean up include dependencies in header

From: Jani Nikula <jani.nikula@linux.intel.com>
Date: 2024-02-12 10:24:23

On Mon, 12 Feb 2024, Thomas Zimmermann [off-list ref] wrote:
Remove unnecessary dependencies in the include statements of the
header file <linux/fb.h>. Several files throughout the kernel include
the fbdev header, so reducing dependencies positively affects other
subsystems as well. Also fix up nouveau, which needs backlight.h in
one of its source files.
On the series,

Reviewed-by: Jani Nikula <redacted>
Thomas Zimmermann (7):
  drm/nouveau: Include <linux/backlight.h>
  fbdev: Do not include <linux/backlight.h> in header
  fbdev: Do not include <linux/fs.h> in header
  fbdev: Do not include <linux/notifier.h> in header
  fbdev: Do not include <linux/slab.h> in header
  fbdev: Clean up forward declarations in header file
  fbdev: Clean up include statements in header file

 drivers/gpu/drm/nouveau/dispnv50/disp.c |  1 +
 include/linux/fb.h                      | 24 +++++++++++++-----------
 2 files changed, 14 insertions(+), 11 deletions(-)
-- 
Jani Nikula, Intel

Re: [PATCH 2/7] fbdev: Do not include <linux/backlight.h> in header

From: kernel test robot <hidden>
Date: 2024-02-12 19:25:58

Hi Thomas,

kernel test robot noticed the following build warnings:

[auto build test WARNING on drm-misc/drm-misc-next]
[also build test WARNING on linus/master v6.8-rc4 next-20240212]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]

url:    https://github.com/intel-lab-lkp/linux/commits/Thomas-Zimmermann/drm-nouveau-Include-linux-backlight-h/20240212-181930
base:   git://anongit.freedesktop.org/drm/drm-misc drm-misc-next
patch link:    https://lore.kernel.org/r/20240212101712.23675-3-tzimmermann%40suse.de
patch subject: [PATCH 2/7] fbdev: Do not include <linux/backlight.h> in header
config: openrisc-allyesconfig (https://download.01.org/0day-ci/archive/20240213/202402130207.8ZFxCEYs-lkp@intel.com/config)
compiler: or1k-linux-gcc (GCC) 13.2.0
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20240213/202402130207.8ZFxCEYs-lkp@intel.com/reproduce)

If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot [off-list ref]
| Closes: https://lore.kernel.org/oe-kbuild-all/202402130207.8ZFxCEYs-lkp@intel.com/

All warnings (new ones prefixed by >>):

   drivers/staging/fbtft/fb_ssd1351.c: In function 'update_onboard_backlight':
   drivers/staging/fbtft/fb_ssd1351.c:192:33: error: implicit declaration of function 'bl_get_data'; did you mean 'acpi_get_data'? [-Werror=implicit-function-declaration]
     192 |         struct fbtft_par *par = bl_get_data(bd);
         |                                 ^~~~~~~~~~~
         |                                 acpi_get_data
quoted
drivers/staging/fbtft/fb_ssd1351.c:192:33: warning: initialization of 'struct fbtft_par *' from 'int' makes pointer from integer without a cast [-Wint-conversion]
   In file included from include/linux/device.h:15,
                    from include/linux/acpi.h:14,
                    from include/linux/spi/spi.h:9,
                    from drivers/staging/fbtft/fb_ssd1351.c:5:
   drivers/staging/fbtft/fb_ssd1351.c:197:35: error: invalid use of undefined type 'struct backlight_device'
     197 |                       __func__, bd->props.power, bd->props.fb_blank);
         |                                   ^~
   include/linux/dev_printk.h:110:37: note: in definition of macro 'dev_printk_index_wrap'
     110 |                 _p_func(dev, fmt, ##__VA_ARGS__);                       \
         |                                     ^~~~~~~~~~~
   drivers/staging/fbtft/fbtft.h:433:17: note: in expansion of macro 'dev_info'
     433 |                 dev_info((par)->info->device, format, ##arg);  \
         |                 ^~~~~~~~
   drivers/staging/fbtft/fb_ssd1351.c:195:9: note: in expansion of macro 'fbtft_par_dbg'
     195 |         fbtft_par_dbg(DEBUG_BACKLIGHT, par,
         |         ^~~~~~~~~~~~~
   drivers/staging/fbtft/fb_ssd1351.c:197:52: error: invalid use of undefined type 'struct backlight_device'
     197 |                       __func__, bd->props.power, bd->props.fb_blank);
         |                                                    ^~
   include/linux/dev_printk.h:110:37: note: in definition of macro 'dev_printk_index_wrap'
     110 |                 _p_func(dev, fmt, ##__VA_ARGS__);                       \
         |                                     ^~~~~~~~~~~
   drivers/staging/fbtft/fbtft.h:433:17: note: in expansion of macro 'dev_info'
     433 |                 dev_info((par)->info->device, format, ##arg);  \
         |                 ^~~~~~~~
   drivers/staging/fbtft/fb_ssd1351.c:195:9: note: in expansion of macro 'fbtft_par_dbg'
     195 |         fbtft_par_dbg(DEBUG_BACKLIGHT, par,
         |         ^~~~~~~~~~~~~
   drivers/staging/fbtft/fb_ssd1351.c:199:15: error: implicit declaration of function 'backlight_is_blank' [-Werror=implicit-function-declaration]
     199 |         on = !backlight_is_blank(bd);
         |               ^~~~~~~~~~~~~~~~~~
   drivers/staging/fbtft/fb_ssd1351.c: At top level:
   drivers/staging/fbtft/fb_ssd1351.c:206:21: error: variable 'bl_ops' has initializer but incomplete type
     206 | static const struct backlight_ops bl_ops = {
         |                     ^~~~~~~~~~~~~
   drivers/staging/fbtft/fb_ssd1351.c:207:10: error: 'const struct backlight_ops' has no member named 'update_status'
     207 |         .update_status = update_onboard_backlight,
         |          ^~~~~~~~~~~~~
quoted
drivers/staging/fbtft/fb_ssd1351.c:207:26: warning: excess elements in struct initializer
     207 |         .update_status = update_onboard_backlight,
         |                          ^~~~~~~~~~~~~~~~~~~~~~~~
   drivers/staging/fbtft/fb_ssd1351.c:207:26: note: (near initialization for 'bl_ops')
   drivers/staging/fbtft/fb_ssd1351.c: In function 'register_onboard_backlight':
   drivers/staging/fbtft/fb_ssd1351.c:213:16: error: variable 'bl_props' has initializer but incomplete type
     213 |         struct backlight_properties bl_props = { 0, };
         |                ^~~~~~~~~~~~~~~~~~~~
   drivers/staging/fbtft/fb_ssd1351.c:213:50: warning: excess elements in struct initializer
     213 |         struct backlight_properties bl_props = { 0, };
         |                                                  ^
   drivers/staging/fbtft/fb_ssd1351.c:213:50: note: (near initialization for 'bl_props')
   drivers/staging/fbtft/fb_ssd1351.c:213:37: error: storage size of 'bl_props' isn't known
     213 |         struct backlight_properties bl_props = { 0, };
         |                                     ^~~~~~~~
   drivers/staging/fbtft/fb_ssd1351.c:215:25: error: 'BACKLIGHT_RAW' undeclared (first use in this function); did you mean 'FB_BACKLIGHT_MAX'?
     215 |         bl_props.type = BACKLIGHT_RAW;
         |                         ^~~~~~~~~~~~~
         |                         FB_BACKLIGHT_MAX
   drivers/staging/fbtft/fb_ssd1351.c:215:25: note: each undeclared identifier is reported only once for each function it appears in
   drivers/staging/fbtft/fb_ssd1351.c:218:14: error: implicit declaration of function 'backlight_device_register'; did you mean 'root_device_register'? [-Werror=implicit-function-declaration]
     218 |         bd = backlight_device_register(dev_driver_string(par->info->device),
         |              ^~~~~~~~~~~~~~~~~~~~~~~~~
         |              root_device_register
quoted
drivers/staging/fbtft/fb_ssd1351.c:213:37: warning: unused variable 'bl_props' [-Wunused-variable]
     213 |         struct backlight_properties bl_props = { 0, };
         |                                     ^~~~~~~~
   drivers/staging/fbtft/fb_ssd1351.c: At top level:
   drivers/staging/fbtft/fb_ssd1351.c:206:35: error: storage size of 'bl_ops' isn't known
     206 | static const struct backlight_ops bl_ops = {
         |                                   ^~~~~~
   cc1: some warnings being treated as errors


vim +192 drivers/staging/fbtft/fb_ssd1351.c

883daf0a5c35c8 Thomas Petazzoni 2014-12-31  189  
883daf0a5c35c8 Thomas Petazzoni 2014-12-31  190  static int update_onboard_backlight(struct backlight_device *bd)
883daf0a5c35c8 Thomas Petazzoni 2014-12-31  191  {
883daf0a5c35c8 Thomas Petazzoni 2014-12-31 @192  	struct fbtft_par *par = bl_get_data(bd);
883daf0a5c35c8 Thomas Petazzoni 2014-12-31  193  	bool on;
883daf0a5c35c8 Thomas Petazzoni 2014-12-31  194  
883daf0a5c35c8 Thomas Petazzoni 2014-12-31  195  	fbtft_par_dbg(DEBUG_BACKLIGHT, par,
883daf0a5c35c8 Thomas Petazzoni 2014-12-31  196  		      "%s: power=%d, fb_blank=%d\n",
883daf0a5c35c8 Thomas Petazzoni 2014-12-31  197  		      __func__, bd->props.power, bd->props.fb_blank);
883daf0a5c35c8 Thomas Petazzoni 2014-12-31  198  
66d653c37228cb Stephen Kitt     2022-06-07  199  	on = !backlight_is_blank(bd);
883daf0a5c35c8 Thomas Petazzoni 2014-12-31  200  	/* Onboard backlight connected to GPIO0 on SSD1351, GPIO1 unused */
883daf0a5c35c8 Thomas Petazzoni 2014-12-31  201  	write_reg(par, 0xB5, on ? 0x03 : 0x02);
883daf0a5c35c8 Thomas Petazzoni 2014-12-31  202  
883daf0a5c35c8 Thomas Petazzoni 2014-12-31  203  	return 0;
883daf0a5c35c8 Thomas Petazzoni 2014-12-31  204  }
883daf0a5c35c8 Thomas Petazzoni 2014-12-31  205  
23801e3438f6ce Mike Rapoport    2015-09-03 @206  static const struct backlight_ops bl_ops = {
23801e3438f6ce Mike Rapoport    2015-09-03 @207  	.update_status = update_onboard_backlight,
23801e3438f6ce Mike Rapoport    2015-09-03  208  };
23801e3438f6ce Mike Rapoport    2015-09-03  209  
883daf0a5c35c8 Thomas Petazzoni 2014-12-31  210  static void register_onboard_backlight(struct fbtft_par *par)
883daf0a5c35c8 Thomas Petazzoni 2014-12-31  211  {
883daf0a5c35c8 Thomas Petazzoni 2014-12-31  212  	struct backlight_device *bd;
883daf0a5c35c8 Thomas Petazzoni 2014-12-31 @213  	struct backlight_properties bl_props = { 0, };
883daf0a5c35c8 Thomas Petazzoni 2014-12-31  214  
883daf0a5c35c8 Thomas Petazzoni 2014-12-31 @215  	bl_props.type = BACKLIGHT_RAW;
883daf0a5c35c8 Thomas Petazzoni 2014-12-31  216  	bl_props.power = FB_BLANK_POWERDOWN;
883daf0a5c35c8 Thomas Petazzoni 2014-12-31  217  
883daf0a5c35c8 Thomas Petazzoni 2014-12-31  218  	bd = backlight_device_register(dev_driver_string(par->info->device),
333c7b940526be Leonardo Brás    2018-08-07  219  				       par->info->device, par, &bl_ops,
333c7b940526be Leonardo Brás    2018-08-07  220  				       &bl_props);
883daf0a5c35c8 Thomas Petazzoni 2014-12-31  221  	if (IS_ERR(bd)) {
883daf0a5c35c8 Thomas Petazzoni 2014-12-31  222  		dev_err(par->info->device,
883daf0a5c35c8 Thomas Petazzoni 2014-12-31  223  			"cannot register backlight device (%ld)\n",
883daf0a5c35c8 Thomas Petazzoni 2014-12-31  224  			PTR_ERR(bd));
883daf0a5c35c8 Thomas Petazzoni 2014-12-31  225  		return;
883daf0a5c35c8 Thomas Petazzoni 2014-12-31  226  	}
883daf0a5c35c8 Thomas Petazzoni 2014-12-31  227  	par->info->bl_dev = bd;
883daf0a5c35c8 Thomas Petazzoni 2014-12-31  228  
883daf0a5c35c8 Thomas Petazzoni 2014-12-31  229  	if (!par->fbtftops.unregister_backlight)
883daf0a5c35c8 Thomas Petazzoni 2014-12-31  230  		par->fbtftops.unregister_backlight = fbtft_unregister_backlight;
883daf0a5c35c8 Thomas Petazzoni 2014-12-31  231  }
883daf0a5c35c8 Thomas Petazzoni 2014-12-31  232  

-- 
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki

Re: [PATCH 2/7] fbdev: Do not include <linux/backlight.h> in header

From: kernel test robot <hidden>
Date: 2024-02-12 19:57:02

Hi Thomas,

kernel test robot noticed the following build errors:

[auto build test ERROR on drm-misc/drm-misc-next]
[also build test ERROR on linus/master v6.8-rc4 next-20240212]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]

url:    https://github.com/intel-lab-lkp/linux/commits/Thomas-Zimmermann/drm-nouveau-Include-linux-backlight-h/20240212-181930
base:   git://anongit.freedesktop.org/drm/drm-misc drm-misc-next
patch link:    https://lore.kernel.org/r/20240212101712.23675-3-tzimmermann%40suse.de
patch subject: [PATCH 2/7] fbdev: Do not include <linux/backlight.h> in header
config: riscv-allmodconfig (https://download.01.org/0day-ci/archive/20240213/202402130346.2iGNwgDE-lkp@intel.com/config)
compiler: clang version 19.0.0git (https://github.com/llvm/llvm-project c08b90c50bcac9f3f563c79491c8dbcbe7c3b574)
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20240213/202402130346.2iGNwgDE-lkp@intel.com/reproduce)

If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot [off-list ref]
| Closes: https://lore.kernel.org/oe-kbuild-all/202402130346.2iGNwgDE-lkp@intel.com/

All errors (new ones prefixed by >>):
quoted
drivers/staging/fbtft/fb_ssd1351.c:192:26: error: call to undeclared function 'bl_get_data'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
     192 |         struct fbtft_par *par = bl_get_data(bd);
         |                                 ^
quoted
drivers/staging/fbtft/fb_ssd1351.c:192:20: error: incompatible integer to pointer conversion initializing 'struct fbtft_par *' with an expression of type 'int' [-Wint-conversion]
     192 |         struct fbtft_par *par = bl_get_data(bd);
         |                           ^     ~~~~~~~~~~~~~~~
quoted
drivers/staging/fbtft/fb_ssd1351.c:197:21: error: incomplete definition of type 'struct backlight_device'
     197 |                       __func__, bd->props.power, bd->props.fb_blank);
         |                                 ~~^
   drivers/staging/fbtft/fbtft.h:433:43: note: expanded from macro 'fbtft_par_dbg'
     433 |                 dev_info((par)->info->device, format, ##arg);  \
         |                                                         ^~~
   include/linux/dev_printk.h:150:67: note: expanded from macro 'dev_info'
     150 |         dev_printk_index_wrap(_dev_info, KERN_INFO, dev, dev_fmt(fmt), ##__VA_ARGS__)
         |                                                                          ^~~~~~~~~~~
   include/linux/dev_printk.h:110:23: note: expanded from macro 'dev_printk_index_wrap'
     110 |                 _p_func(dev, fmt, ##__VA_ARGS__);                       \
         |                                     ^~~~~~~~~~~
   include/linux/fb.h:20:8: note: forward declaration of 'struct backlight_device'
      20 | struct backlight_device;
         |        ^
   drivers/staging/fbtft/fb_ssd1351.c:197:38: error: incomplete definition of type 'struct backlight_device'
     197 |                       __func__, bd->props.power, bd->props.fb_blank);
         |                                                  ~~^
   drivers/staging/fbtft/fbtft.h:433:43: note: expanded from macro 'fbtft_par_dbg'
     433 |                 dev_info((par)->info->device, format, ##arg);  \
         |                                                         ^~~
   include/linux/dev_printk.h:150:67: note: expanded from macro 'dev_info'
     150 |         dev_printk_index_wrap(_dev_info, KERN_INFO, dev, dev_fmt(fmt), ##__VA_ARGS__)
         |                                                                          ^~~~~~~~~~~
   include/linux/dev_printk.h:110:23: note: expanded from macro 'dev_printk_index_wrap'
     110 |                 _p_func(dev, fmt, ##__VA_ARGS__);                       \
         |                                     ^~~~~~~~~~~
   include/linux/fb.h:20:8: note: forward declaration of 'struct backlight_device'
      20 | struct backlight_device;
         |        ^
quoted
drivers/staging/fbtft/fb_ssd1351.c:199:8: error: call to undeclared function 'backlight_is_blank'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
     199 |         on = !backlight_is_blank(bd);
         |               ^
quoted
drivers/staging/fbtft/fb_ssd1351.c:206:35: error: variable has incomplete type 'const struct backlight_ops'
     206 | static const struct backlight_ops bl_ops = {
         |                                   ^
   drivers/staging/fbtft/fb_ssd1351.c:206:21: note: forward declaration of 'struct backlight_ops'
     206 | static const struct backlight_ops bl_ops = {
         |                     ^
quoted
drivers/staging/fbtft/fb_ssd1351.c:213:30: error: variable has incomplete type 'struct backlight_properties'
     213 |         struct backlight_properties bl_props = { 0, };
         |                                     ^
   drivers/staging/fbtft/fb_ssd1351.c:213:9: note: forward declaration of 'struct backlight_properties'
     213 |         struct backlight_properties bl_props = { 0, };
         |                ^
quoted
drivers/staging/fbtft/fb_ssd1351.c:215:18: error: use of undeclared identifier 'BACKLIGHT_RAW'
     215 |         bl_props.type = BACKLIGHT_RAW;
         |                         ^
quoted
drivers/staging/fbtft/fb_ssd1351.c:218:7: error: call to undeclared function 'backlight_device_register'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
     218 |         bd = backlight_device_register(dev_driver_string(par->info->device),
         |              ^
   drivers/staging/fbtft/fb_ssd1351.c:218:7: note: did you mean '__root_device_register'?
   include/linux/device.h:1143:16: note: '__root_device_register' declared here
    1143 | struct device *__root_device_register(const char *name, struct module *owner);
         |                ^
   9 errors generated.


vim +197 drivers/staging/fbtft/fb_ssd1351.c

883daf0a5c35c8 Thomas Petazzoni 2014-12-31  189  
883daf0a5c35c8 Thomas Petazzoni 2014-12-31  190  static int update_onboard_backlight(struct backlight_device *bd)
883daf0a5c35c8 Thomas Petazzoni 2014-12-31  191  {
883daf0a5c35c8 Thomas Petazzoni 2014-12-31 @192  	struct fbtft_par *par = bl_get_data(bd);
883daf0a5c35c8 Thomas Petazzoni 2014-12-31  193  	bool on;
883daf0a5c35c8 Thomas Petazzoni 2014-12-31  194  
883daf0a5c35c8 Thomas Petazzoni 2014-12-31  195  	fbtft_par_dbg(DEBUG_BACKLIGHT, par,
883daf0a5c35c8 Thomas Petazzoni 2014-12-31  196  		      "%s: power=%d, fb_blank=%d\n",
883daf0a5c35c8 Thomas Petazzoni 2014-12-31 @197  		      __func__, bd->props.power, bd->props.fb_blank);
883daf0a5c35c8 Thomas Petazzoni 2014-12-31  198  
66d653c37228cb Stephen Kitt     2022-06-07 @199  	on = !backlight_is_blank(bd);
883daf0a5c35c8 Thomas Petazzoni 2014-12-31  200  	/* Onboard backlight connected to GPIO0 on SSD1351, GPIO1 unused */
883daf0a5c35c8 Thomas Petazzoni 2014-12-31  201  	write_reg(par, 0xB5, on ? 0x03 : 0x02);
883daf0a5c35c8 Thomas Petazzoni 2014-12-31  202  
883daf0a5c35c8 Thomas Petazzoni 2014-12-31  203  	return 0;
883daf0a5c35c8 Thomas Petazzoni 2014-12-31  204  }
883daf0a5c35c8 Thomas Petazzoni 2014-12-31  205  
23801e3438f6ce Mike Rapoport    2015-09-03 @206  static const struct backlight_ops bl_ops = {
23801e3438f6ce Mike Rapoport    2015-09-03  207  	.update_status = update_onboard_backlight,
23801e3438f6ce Mike Rapoport    2015-09-03  208  };
23801e3438f6ce Mike Rapoport    2015-09-03  209  
883daf0a5c35c8 Thomas Petazzoni 2014-12-31  210  static void register_onboard_backlight(struct fbtft_par *par)
883daf0a5c35c8 Thomas Petazzoni 2014-12-31  211  {
883daf0a5c35c8 Thomas Petazzoni 2014-12-31  212  	struct backlight_device *bd;
883daf0a5c35c8 Thomas Petazzoni 2014-12-31 @213  	struct backlight_properties bl_props = { 0, };
883daf0a5c35c8 Thomas Petazzoni 2014-12-31  214  
883daf0a5c35c8 Thomas Petazzoni 2014-12-31 @215  	bl_props.type = BACKLIGHT_RAW;
883daf0a5c35c8 Thomas Petazzoni 2014-12-31  216  	bl_props.power = FB_BLANK_POWERDOWN;
883daf0a5c35c8 Thomas Petazzoni 2014-12-31  217  
883daf0a5c35c8 Thomas Petazzoni 2014-12-31 @218  	bd = backlight_device_register(dev_driver_string(par->info->device),
333c7b940526be Leonardo Brás    2018-08-07  219  				       par->info->device, par, &bl_ops,
333c7b940526be Leonardo Brás    2018-08-07  220  				       &bl_props);
883daf0a5c35c8 Thomas Petazzoni 2014-12-31  221  	if (IS_ERR(bd)) {
883daf0a5c35c8 Thomas Petazzoni 2014-12-31  222  		dev_err(par->info->device,
883daf0a5c35c8 Thomas Petazzoni 2014-12-31  223  			"cannot register backlight device (%ld)\n",
883daf0a5c35c8 Thomas Petazzoni 2014-12-31  224  			PTR_ERR(bd));
883daf0a5c35c8 Thomas Petazzoni 2014-12-31  225  		return;
883daf0a5c35c8 Thomas Petazzoni 2014-12-31  226  	}
883daf0a5c35c8 Thomas Petazzoni 2014-12-31  227  	par->info->bl_dev = bd;
883daf0a5c35c8 Thomas Petazzoni 2014-12-31  228  
883daf0a5c35c8 Thomas Petazzoni 2014-12-31  229  	if (!par->fbtftops.unregister_backlight)
883daf0a5c35c8 Thomas Petazzoni 2014-12-31  230  		par->fbtftops.unregister_backlight = fbtft_unregister_backlight;
883daf0a5c35c8 Thomas Petazzoni 2014-12-31  231  }
883daf0a5c35c8 Thomas Petazzoni 2014-12-31  232  

-- 
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki

Re: [PATCH 2/7] fbdev: Do not include <linux/backlight.h> in header

From: kernel test robot <hidden>
Date: 2024-02-13 05:44:25

Hi Thomas,

kernel test robot noticed the following build warnings:

[auto build test WARNING on drm-misc/drm-misc-next]
[also build test WARNING on linus/master v6.8-rc4 next-20240212]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]

url:    https://github.com/intel-lab-lkp/linux/commits/Thomas-Zimmermann/drm-nouveau-Include-linux-backlight-h/20240212-181930
base:   git://anongit.freedesktop.org/drm/drm-misc drm-misc-next
patch link:    https://lore.kernel.org/r/20240212101712.23675-3-tzimmermann%40suse.de
patch subject: [PATCH 2/7] fbdev: Do not include <linux/backlight.h> in header
config: powerpc-ppc6xx_defconfig (https://download.01.org/0day-ci/archive/20240213/202402131349.eg8DJ3MB-lkp@intel.com/config)
compiler: powerpc-linux-gcc (GCC) 13.2.0
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20240213/202402131349.eg8DJ3MB-lkp@intel.com/reproduce)

If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot [off-list ref]
| Closes: https://lore.kernel.org/oe-kbuild-all/202402131349.eg8DJ3MB-lkp@intel.com/

All warnings (new ones prefixed by >>):

   drivers/macintosh/via-pmu-backlight.c: In function '__pmu_backlight_update_status':
   drivers/macintosh/via-pmu-backlight.c:74:21: error: implicit declaration of function 'backlight_get_brightness'; did you mean 'pmu_backlight_get_level_brightness'? [-Werror=implicit-function-declaration]
      74 |         int level = backlight_get_brightness(bd);
         |                     ^~~~~~~~~~~~~~~~~~~~~~~~
         |                     pmu_backlight_get_level_brightness
   drivers/macintosh/via-pmu-backlight.c: At top level:
   drivers/macintosh/via-pmu-backlight.c:108:21: error: variable 'pmu_backlight_data' has initializer but incomplete type
     108 | static const struct backlight_ops pmu_backlight_data = {
         |                     ^~~~~~~~~~~~~
   drivers/macintosh/via-pmu-backlight.c:109:10: error: 'const struct backlight_ops' has no member named 'update_status'
     109 |         .update_status  = pmu_backlight_update_status,
         |          ^~~~~~~~~~~~~
quoted
drivers/macintosh/via-pmu-backlight.c:109:27: warning: excess elements in struct initializer
     109 |         .update_status  = pmu_backlight_update_status,
         |                           ^~~~~~~~~~~~~~~~~~~~~~~~~~~
   drivers/macintosh/via-pmu-backlight.c:109:27: note: (near initialization for 'pmu_backlight_data')
   drivers/macintosh/via-pmu-backlight.c: In function 'pmu_backlight_init':
   drivers/macintosh/via-pmu-backlight.c:136:37: error: storage size of 'props' isn't known
     136 |         struct backlight_properties props;
         |                                     ^~~~~
   drivers/macintosh/via-pmu-backlight.c:154:34: error: invalid application of 'sizeof' to incomplete type 'struct backlight_properties'
     154 |         memset(&props, 0, sizeof(struct backlight_properties));
         |                                  ^~~~~~
   drivers/macintosh/via-pmu-backlight.c:155:22: error: 'BACKLIGHT_PLATFORM' undeclared (first use in this function)
     155 |         props.type = BACKLIGHT_PLATFORM;
         |                      ^~~~~~~~~~~~~~~~~~
   drivers/macintosh/via-pmu-backlight.c:155:22: note: each undeclared identifier is reported only once for each function it appears in
   drivers/macintosh/via-pmu-backlight.c:157:14: error: implicit declaration of function 'backlight_device_register'; did you mean 'root_device_register'? [-Werror=implicit-function-declaration]
     157 |         bd = backlight_device_register(name, NULL, NULL, &pmu_backlight_data,
         |              ^~~~~~~~~~~~~~~~~~~~~~~~~
         |              root_device_register
   drivers/macintosh/via-pmu-backlight.c:166:19: error: invalid use of undefined type 'struct backlight_device'
     166 |         level = bd->props.max_brightness;
         |                   ^~
   drivers/macintosh/via-pmu-backlight.c:176:35: error: invalid use of undefined type 'struct backlight_device'
     176 |                                 bd->props.max_brightness / 15);
         |                                   ^~
   drivers/macintosh/via-pmu-backlight.c:179:11: error: invalid use of undefined type 'struct backlight_device'
     179 |         bd->props.brightness = level;
         |           ^~
   drivers/macintosh/via-pmu-backlight.c:180:11: error: invalid use of undefined type 'struct backlight_device'
     180 |         bd->props.power = FB_BLANK_UNBLANK;
         |           ^~
   drivers/macintosh/via-pmu-backlight.c:181:9: error: implicit declaration of function 'backlight_update_status'; did you mean 'pmu_backlight_update_status'? [-Werror=implicit-function-declaration]
     181 |         backlight_update_status(bd);
         |         ^~~~~~~~~~~~~~~~~~~~~~~
         |         pmu_backlight_update_status
quoted
drivers/macintosh/via-pmu-backlight.c:136:37: warning: unused variable 'props' [-Wunused-variable]
     136 |         struct backlight_properties props;
         |                                     ^~~~~
   drivers/macintosh/via-pmu-backlight.c: At top level:
   drivers/macintosh/via-pmu-backlight.c:108:35: error: storage size of 'pmu_backlight_data' isn't known
     108 | static const struct backlight_ops pmu_backlight_data = {
         |                                   ^~~~~~~~~~~~~~~~~~
   drivers/macintosh/via-pmu-backlight.c:108:35: error: storage size of 'pmu_backlight_data' isn't known
   cc1: some warnings being treated as errors


vim +109 drivers/macintosh/via-pmu-backlight.c

0094f2cdcfb6f2 Benjamin Herrenschmidt 2007-12-20  106  
0094f2cdcfb6f2 Benjamin Herrenschmidt 2007-12-20  107  
acc2472ed33fc5 Lionel Debroux         2010-11-16  108  static const struct backlight_ops pmu_backlight_data = {
5474c120aafe78 Michael Hanselmann     2006-06-25 @109  	.update_status	= pmu_backlight_update_status,
599a52d1262939 Richard Purdie         2007-02-10  110  
5474c120aafe78 Michael Hanselmann     2006-06-25  111  };
5474c120aafe78 Michael Hanselmann     2006-06-25  112  
4b755999d6e0c1 Michael Hanselmann     2006-07-30  113  #ifdef CONFIG_PM
d565dd3b0824b6 Benjamin Herrenschmidt 2006-08-31  114  void pmu_backlight_set_sleep(int sleep)
4b755999d6e0c1 Michael Hanselmann     2006-07-30  115  {
4b755999d6e0c1 Michael Hanselmann     2006-07-30  116  	unsigned long flags;
4b755999d6e0c1 Michael Hanselmann     2006-07-30  117  
4b755999d6e0c1 Michael Hanselmann     2006-07-30  118  	spin_lock_irqsave(&pmu_backlight_lock, flags);
d565dd3b0824b6 Benjamin Herrenschmidt 2006-08-31  119  	sleeping = sleep;
fa19d63488bd10 Benjamin Herrenschmidt 2008-03-03  120  	if (pmac_backlight && uses_pmu_bl) {
0094f2cdcfb6f2 Benjamin Herrenschmidt 2007-12-20  121  		if (sleep) {
0094f2cdcfb6f2 Benjamin Herrenschmidt 2007-12-20  122  			struct adb_request req;
0094f2cdcfb6f2 Benjamin Herrenschmidt 2007-12-20  123  
0094f2cdcfb6f2 Benjamin Herrenschmidt 2007-12-20  124  			pmu_request(&req, NULL, 2, PMU_POWER_CTRL,
0094f2cdcfb6f2 Benjamin Herrenschmidt 2007-12-20  125  				    PMU_POW_BACKLIGHT | PMU_POW_OFF);
0094f2cdcfb6f2 Benjamin Herrenschmidt 2007-12-20  126  			pmu_wait_complete(&req);
0094f2cdcfb6f2 Benjamin Herrenschmidt 2007-12-20  127  		} else
0094f2cdcfb6f2 Benjamin Herrenschmidt 2007-12-20  128  			__pmu_backlight_update_status(pmac_backlight);
0094f2cdcfb6f2 Benjamin Herrenschmidt 2007-12-20  129  	}
4b755999d6e0c1 Michael Hanselmann     2006-07-30  130  	spin_unlock_irqrestore(&pmu_backlight_lock, flags);
4b755999d6e0c1 Michael Hanselmann     2006-07-30  131  }
d565dd3b0824b6 Benjamin Herrenschmidt 2006-08-31  132  #endif /* CONFIG_PM */
4b755999d6e0c1 Michael Hanselmann     2006-07-30  133  
00f7b29f6e9b8a Mathieu Malaterre      2017-12-26  134  void __init pmu_backlight_init(void)
5474c120aafe78 Michael Hanselmann     2006-06-25  135  {
a19a6ee6cad2b2 Matthew Garrett        2010-02-17 @136  	struct backlight_properties props;

-- 
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help