Re: [PATCH 22/22] drm: ensure drm headers are self-contained and pass kernel-doc

2024-03-07 Thread Jani Nikula
On Thu, 07 Mar 2024, Geert Uytterhoeven  wrote:
> Hi Jani,
>
> On Thu, Mar 7, 2024 at 9:44 AM Jani Nikula  wrote:
>> On Thu, 07 Mar 2024, kernel test robot  wrote:
>> > kernel test robot noticed the following build errors:
>>
>> So I'm trying to make include/drm/ttm/ttm_caching.h self-contained by
>> including  with [1], but it fails like below.
>>
>> Cc: Thomas and Geert, better ideas for the include there? Looks like
>> include/asm-generic/pgtable-nop4d.h isn't self-contained on m68k.
>
> I have sent a fix
>
> https://lore.kernel.org/r/ba359be013f379ff10f3afcea13e2f78dd9717be.1709804021.git.ge...@linux-m68k.org

Thanks! I've picked this up as part of my series, and will include it
with the other remaining patches when I post a v2, aiming to merge all
of them via drm-misc-next.

BR,
Jani.

>
> Gr{oetje,eeting}s,
>
> Geert

-- 
Jani Nikula, Intel


Re: [PATCH 22/22] drm: ensure drm headers are self-contained and pass kernel-doc

2024-03-07 Thread kernel test robot
Hi Jani,

kernel test robot noticed the following build warnings:

[auto build test WARNING on drm-misc/drm-misc-next]
[cannot apply to drm/drm-next drm-intel/for-linux-next 
drm-intel/for-linux-next-fixes linus/master v6.8-rc7 next-20240307]
[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/Jani-Nikula/drm-crtc-make-drm_crtc_internal-h-self-contained/20240307-023603
base:   git://anongit.freedesktop.org/drm/drm-misc drm-misc-next
patch link:
https://lore.kernel.org/r/e22ab28836ee1689ea4781ed53fd2e4e4f84728e.1709749576.git.jani.nikula%40intel.com
patch subject: [PATCH 22/22] drm: ensure drm headers are self-contained and 
pass kernel-doc
config: hexagon-allmodconfig 
(https://download.01.org/0day-ci/archive/20240307/202403072259.eec2vf1x-...@intel.com/config)
compiler: clang version 19.0.0git (https://github.com/llvm/llvm-project 
325f51237252e6dab8e4e1ea1fa7acbb4faee1cd)
reproduce (this is a W=1 build): 
(https://download.01.org/0day-ci/archive/20240307/202403072259.eec2vf1x-...@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 
| Closes: 
https://lore.kernel.org/oe-kbuild-all/202403072259.eec2vf1x-...@intel.com/

All warnings (new ones prefixed by >>):

   In file included from :4:
>> include/drm/ttm/ttm_pool.h:89:52: warning: declaration of 'struct seq_file' 
>> will not be visible outside of this function [-Wvisibility]
  89 | int ttm_pool_debugfs(struct ttm_pool *pool, struct seq_file *m);
 |^
   1 warning generated.


vim +89 include/drm/ttm/ttm_pool.h

d099fc8f540add Christian König 2020-10-22  88  
d099fc8f540add Christian König 2020-10-22 @89  int ttm_pool_debugfs(struct 
ttm_pool *pool, struct seq_file *m);
d099fc8f540add Christian König 2020-10-22  90  

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


Re: [PATCH 22/22] drm: ensure drm headers are self-contained and pass kernel-doc

2024-03-07 Thread Geert Uytterhoeven
Hi Jani,

On Thu, Mar 7, 2024 at 9:44 AM Jani Nikula  wrote:
> On Thu, 07 Mar 2024, kernel test robot  wrote:
> > kernel test robot noticed the following build errors:
>
> So I'm trying to make include/drm/ttm/ttm_caching.h self-contained by
> including  with [1], but it fails like below.
>
> Cc: Thomas and Geert, better ideas for the include there? Looks like
> include/asm-generic/pgtable-nop4d.h isn't self-contained on m68k.

I have sent a fix

https://lore.kernel.org/r/ba359be013f379ff10f3afcea13e2f78dd9717be.1709804021.git.ge...@linux-m68k.org

Gr{oetje,eeting}s,

Geert

-- 
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- ge...@linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds


Re: [PATCH 22/22] drm: ensure drm headers are self-contained and pass kernel-doc

2024-03-07 Thread Jani Nikula
On Thu, 07 Mar 2024, kernel test robot  wrote:
> Hi Jani,
>
> kernel test robot noticed the following build errors:

So I'm trying to make include/drm/ttm/ttm_caching.h self-contained by
including  with [1], but it fails like below.

Cc: Thomas and Geert, better ideas for the include there? Looks like
include/asm-generic/pgtable-nop4d.h isn't self-contained on m68k.


BR,
Jani.


[1] 
https://lore.kernel.org/r/c35ce1a59d0796da32b32e4c8f59464de35f200a.1709749576.git.jani.nik...@intel.com



>
> [auto build test ERROR on drm-misc/drm-misc-next]
> [cannot apply to drm/drm-next drm-intel/for-linux-next 
> drm-intel/for-linux-next-fixes linus/master v6.8-rc7 next-20240306]
> [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/Jani-Nikula/drm-crtc-make-drm_crtc_internal-h-self-contained/20240307-023603
> base:   git://anongit.freedesktop.org/drm/drm-misc drm-misc-next
> patch link:
> https://lore.kernel.org/r/e22ab28836ee1689ea4781ed53fd2e4e4f84728e.1709749576.git.jani.nikula%40intel.com
> patch subject: [PATCH 22/22] drm: ensure drm headers are self-contained and 
> pass kernel-doc
> config: m68k-allmodconfig 
> (https://download.01.org/0day-ci/archive/20240307/202403071317.uow18zr3-...@intel.com/config)
> compiler: m68k-linux-gcc (GCC) 13.2.0
> reproduce (this is a W=1 build): 
> (https://download.01.org/0day-ci/archive/20240307/202403071317.uow18zr3-...@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 
> | Closes: 
> https://lore.kernel.org/oe-kbuild-all/202403071317.uow18zr3-...@intel.com/
>
> All error/warnings (new ones prefixed by >>):
>
>In file included from include/asm-generic/pgtable-nopud.h:7,
> from arch/m68k/include/asm/pgtable_mm.h:9,
> from arch/m68k/include/asm/pgtable.h:8,
> from include/linux/pgtable.h:6,
> from include/drm/ttm/ttm_caching.h:28,
> from :
>>> include/asm-generic/pgtable-nop4d.h:9:18: error: unknown type name 'pgd_t'
>9 | typedef struct { pgd_t pgd; } p4d_t;
>  |  ^
>include/asm-generic/pgtable-nop4d.h:21:28: error: unknown type name 
> 'pgd_t'; did you mean 'p4d_t'?
>   21 | static inline int pgd_none(pgd_t pgd)   { return 0; }
>  |^
>  |p4d_t
>include/asm-generic/pgtable-nop4d.h:22:27: error: unknown type name 
> 'pgd_t'; did you mean 'p4d_t'?
>   22 | static inline int pgd_bad(pgd_t pgd){ return 0; }
>  |   ^
>  |   p4d_t
>include/asm-generic/pgtable-nop4d.h:23:31: error: unknown type name 
> 'pgd_t'; did you mean 'p4d_t'?
>   23 | static inline int pgd_present(pgd_t pgd){ return 1; }
>  |   ^
>  |   p4d_t
>include/asm-generic/pgtable-nop4d.h:24:30: error: unknown type name 
> 'pgd_t'; did you mean 'p4d_t'?
>   24 | static inline void pgd_clear(pgd_t *pgd){ }
>  |  ^
>  |  p4d_t
>include/asm-generic/pgtable-nop4d.h:35:33: error: unknown type name 
> 'pgd_t'; did you mean 'p4d_t'?
>   35 | static inline p4d_t *p4d_offset(pgd_t *pgd, unsigned long address)
>  | ^
>  | p4d_t
>In file included from arch/m68k/include/asm/thread_info.h:6,
> from include/linux/thread_info.h:60,
> from include/asm-generic/preempt.h:5,
> from ./arch/m68k/include/generated/asm/preempt.h:1,
> from include/linux/preempt.h:79,
> from arch/m68k/include/asm/processor.h:11,
> from arch/m68k/include/asm/pgtable_mm.h:15:
>arch/m68k/include/asm/motorola_pgtable.h: In function 'pud_set':
>>> arch/m68k/include/asm/page.h:46:29: error: request for member 'pgd' in 
>>> something not a structure or union
>   46 | #define pgd_val(x)  ((x).pgd)
>  | ^
>include/asm-generic/pgtable-nop4d.h:40:50: note: in expansion of macro 
> 'pgd_val'
>   40 | #define p4d_val(x)   

Re: [PATCH 22/22] drm: ensure drm headers are self-contained and pass kernel-doc

2024-03-06 Thread kernel test robot
Hi Jani,

kernel test robot noticed the following build errors:

[auto build test ERROR on drm-misc/drm-misc-next]
[cannot apply to drm/drm-next drm-intel/for-linux-next 
drm-intel/for-linux-next-fixes linus/master v6.8-rc7 next-20240306]
[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/Jani-Nikula/drm-crtc-make-drm_crtc_internal-h-self-contained/20240307-023603
base:   git://anongit.freedesktop.org/drm/drm-misc drm-misc-next
patch link:
https://lore.kernel.org/r/e22ab28836ee1689ea4781ed53fd2e4e4f84728e.1709749576.git.jani.nikula%40intel.com
patch subject: [PATCH 22/22] drm: ensure drm headers are self-contained and 
pass kernel-doc
config: m68k-allmodconfig 
(https://download.01.org/0day-ci/archive/20240307/202403071317.uow18zr3-...@intel.com/config)
compiler: m68k-linux-gcc (GCC) 13.2.0
reproduce (this is a W=1 build): 
(https://download.01.org/0day-ci/archive/20240307/202403071317.uow18zr3-...@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 
| Closes: 
https://lore.kernel.org/oe-kbuild-all/202403071317.uow18zr3-...@intel.com/

All error/warnings (new ones prefixed by >>):

   In file included from include/asm-generic/pgtable-nopud.h:7,
from arch/m68k/include/asm/pgtable_mm.h:9,
from arch/m68k/include/asm/pgtable.h:8,
from include/linux/pgtable.h:6,
from include/drm/ttm/ttm_caching.h:28,
from :
>> include/asm-generic/pgtable-nop4d.h:9:18: error: unknown type name 'pgd_t'
   9 | typedef struct { pgd_t pgd; } p4d_t;
 |  ^
   include/asm-generic/pgtable-nop4d.h:21:28: error: unknown type name 'pgd_t'; 
did you mean 'p4d_t'?
  21 | static inline int pgd_none(pgd_t pgd)   { return 0; }
 |^
 |p4d_t
   include/asm-generic/pgtable-nop4d.h:22:27: error: unknown type name 'pgd_t'; 
did you mean 'p4d_t'?
  22 | static inline int pgd_bad(pgd_t pgd){ return 0; }
 |   ^
 |   p4d_t
   include/asm-generic/pgtable-nop4d.h:23:31: error: unknown type name 'pgd_t'; 
did you mean 'p4d_t'?
  23 | static inline int pgd_present(pgd_t pgd){ return 1; }
 |   ^
 |   p4d_t
   include/asm-generic/pgtable-nop4d.h:24:30: error: unknown type name 'pgd_t'; 
did you mean 'p4d_t'?
  24 | static inline void pgd_clear(pgd_t *pgd){ }
 |  ^
 |  p4d_t
   include/asm-generic/pgtable-nop4d.h:35:33: error: unknown type name 'pgd_t'; 
did you mean 'p4d_t'?
  35 | static inline p4d_t *p4d_offset(pgd_t *pgd, unsigned long address)
 | ^
 | p4d_t
   In file included from arch/m68k/include/asm/thread_info.h:6,
from include/linux/thread_info.h:60,
from include/asm-generic/preempt.h:5,
from ./arch/m68k/include/generated/asm/preempt.h:1,
from include/linux/preempt.h:79,
from arch/m68k/include/asm/processor.h:11,
from arch/m68k/include/asm/pgtable_mm.h:15:
   arch/m68k/include/asm/motorola_pgtable.h: In function 'pud_set':
>> arch/m68k/include/asm/page.h:46:29: error: request for member 'pgd' in 
>> something not a structure or union
  46 | #define pgd_val(x)  ((x).pgd)
 | ^
   include/asm-generic/pgtable-nop4d.h:40:50: note: in expansion of macro 
'pgd_val'
  40 | #define p4d_val(x)  (pgd_val((x).pgd))
 |  ^~~
   include/asm-generic/pgtable-nopud.h:48:50: note: in expansion of macro 
'p4d_val'
  48 | #define pud_val(x)  (p4d_val((x).p4d))
 |  ^~~
   arch/m68k/include/asm/motorola_pgtable.h:103:9: note: in expansion of macro 
'pud_val'
 103 | pud_val(*pudp) = _PAGE_TABLE | _PAGE_ACCESSED | __pa(pmdp);
 | ^~~
   include/linux/pgtable.h: In function 'pmd_offset':
>> arch/m68k/include/asm/page.h:46:29: error: request for member 'pgd' in 
>> something not a structure or union
  46 | #define pgd_val(x)  ((x).pgd)
 | ^
   include/asm-generic/pgtable-nop4d.h:40:50: note: in expansion of macro 
'p

Re: [PATCH 22/22] drm: ensure drm headers are self-contained and pass kernel-doc

2024-03-06 Thread kernel test robot
Hi Jani,

kernel test robot noticed the following build errors:

[auto build test ERROR on drm-misc/drm-misc-next]
[cannot apply to drm/drm-next drm-intel/for-linux-next 
drm-intel/for-linux-next-fixes linus/master v6.8-rc7 next-20240306]
[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/Jani-Nikula/drm-crtc-make-drm_crtc_internal-h-self-contained/20240307-023603
base:   git://anongit.freedesktop.org/drm/drm-misc drm-misc-next
patch link:
https://lore.kernel.org/r/e22ab28836ee1689ea4781ed53fd2e4e4f84728e.1709749576.git.jani.nikula%40intel.com
patch subject: [PATCH 22/22] drm: ensure drm headers are self-contained and 
pass kernel-doc
config: sh-allmodconfig 
(https://download.01.org/0day-ci/archive/20240307/202403071204.gjtmneoq-...@intel.com/config)
compiler: sh4-linux-gcc (GCC) 13.2.0
reproduce (this is a W=1 build): 
(https://download.01.org/0day-ci/archive/20240307/202403071204.gjtmneoq-...@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 
| Closes: 
https://lore.kernel.org/oe-kbuild-all/202403071204.gjtmneoq-...@intel.com/

All errors (new ones prefixed by >>):

   In file included from :
   drivers/gpu/drm/./drm_crtc_internal.h: In function 'drm_edid_load_firmware':
>> drivers/gpu/drm/./drm_crtc_internal.h:304:16: error: implicit declaration of 
>> function 'ERR_PTR' [-Werror=implicit-function-declaration]
 304 | return ERR_PTR(-ENOENT);
 |^~~
>> drivers/gpu/drm/./drm_crtc_internal.h:304:25: error: 'ENOENT' undeclared 
>> (first use in this function)
 304 | return ERR_PTR(-ENOENT);
 | ^~
   drivers/gpu/drm/./drm_crtc_internal.h:304:25: note: each undeclared 
identifier is reported only once for each function it appears in
   In file included from :
   drivers/gpu/drm/./drm_crtc_internal.h: At top level:
>> drivers/gpu/drm/./drm_crtc_internal.h:302:1: error: redefinition of 
>> 'drm_edid_load_firmware'
 302 | drm_edid_load_firmware(struct drm_connector *connector)
 | ^~
   drivers/gpu/drm/./drm_crtc_internal.h:302:1: note: previous definition of 
'drm_edid_load_firmware' with type 'const struct drm_edid *(struct 
drm_connector *)'
 302 | drm_edid_load_firmware(struct drm_connector *connector)
 | ^~
   drivers/gpu/drm/./drm_crtc_internal.h: In function 'drm_edid_load_firmware':
>> drivers/gpu/drm/./drm_crtc_internal.h:304:25: error: 'ENOENT' undeclared 
>> (first use in this function)
 304 | return ERR_PTR(-ENOENT);
 | ^~
   cc1: all warnings being treated as errors


vim +/ERR_PTR +304 drivers/gpu/drm/./drm_crtc_internal.h

5f2d0ed49036a0 Jani Nikula 2022-10-24  296  
5f2d0ed49036a0 Jani Nikula 2022-10-24  297  /* drm_edid_load.c */
5f2d0ed49036a0 Jani Nikula 2022-10-24  298  #ifdef CONFIG_DRM_LOAD_EDID_FIRMWARE
5f2d0ed49036a0 Jani Nikula 2022-10-24  299  const struct drm_edid 
*drm_edid_load_firmware(struct drm_connector *connector);
5f2d0ed49036a0 Jani Nikula 2022-10-24  300  #else
5f2d0ed49036a0 Jani Nikula 2022-10-24  301  static inline const struct drm_edid 
*
5f2d0ed49036a0 Jani Nikula 2022-10-24 @302  drm_edid_load_firmware(struct 
drm_connector *connector)
5f2d0ed49036a0 Jani Nikula 2022-10-24  303  {
5f2d0ed49036a0 Jani Nikula 2022-10-24 @304  return ERR_PTR(-ENOENT);

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


[PATCH 22/22] drm: ensure drm headers are self-contained and pass kernel-doc

2024-03-06 Thread Jani Nikula
Ensure drm headers build, are self-contained, have header guards, and
have no kernel-doc warnings, when CONFIG_DRM_HEADER_TEST=y.

The mechanism follows similar patters used in i915, xe, and usr/include.

To cover include/drm, we need to recurse there using the top level
Kbuild and the new include/Kbuild files.

Suggested-by: Daniel Vetter 
Cc: David Airlie 
Cc: Daniel Vetter 
Cc: Maarten Lankhorst 
Cc: Maxime Ripard 
Cc: Thomas Zimmermann 
Cc: Masahiro Yamada 
Signed-off-by: Jani Nikula 
---
 Kbuild   |  1 +
 drivers/gpu/drm/Kconfig  | 11 +++
 drivers/gpu/drm/Makefile | 18 ++
 include/Kbuild   |  1 +
 include/drm/Makefile | 18 ++
 5 files changed, 49 insertions(+)
 create mode 100644 include/Kbuild
 create mode 100644 include/drm/Makefile

diff --git a/Kbuild b/Kbuild
index 464b34a08f51..f327ca86990c 100644
--- a/Kbuild
+++ b/Kbuild
@@ -97,3 +97,4 @@ obj-$(CONFIG_SAMPLES) += samples/
 obj-$(CONFIG_NET)  += net/
 obj-y  += virt/
 obj-y  += $(ARCH_DRIVERS)
+obj-$(CONFIG_DRM_HEADER_TEST)  += include/
diff --git a/drivers/gpu/drm/Kconfig b/drivers/gpu/drm/Kconfig
index c08e18108c2a..dd17685ef6e7 100644
--- a/drivers/gpu/drm/Kconfig
+++ b/drivers/gpu/drm/Kconfig
@@ -429,3 +429,14 @@ config DRM_WERROR
  this config option is disabled by default.
 
  If in doubt, say N.
+
+config DRM_HEADER_TEST
+   bool "Ensure DRM headers are self-contained and pass kernel-doc"
+   depends on EXPERT
+   default n
+   help
+ Ensure the DRM subsystem headers both under drivers/gpu/drm and
+ include/drm compile, are self-contained, have header guards, and have
+ no kernel-doc warnings.
+
+ If in doubt, say N.
diff --git a/drivers/gpu/drm/Makefile b/drivers/gpu/drm/Makefile
index a73c04d2d7a3..6605d5686d01 100644
--- a/drivers/gpu/drm/Makefile
+++ b/drivers/gpu/drm/Makefile
@@ -218,3 +218,21 @@ obj-y  += solomon/
 obj-$(CONFIG_DRM_SPRD) += sprd/
 obj-$(CONFIG_DRM_LOONGSON) += loongson/
 obj-$(CONFIG_DRM_POWERVR) += imagination/
+
+# Ensure drm headers are self-contained and pass kernel-doc
+hdrtest-files := \
+   $(shell cd $(srctree)/$(src) && find . -maxdepth 1 -name 'drm_*.h') \
+   $(shell cd $(srctree)/$(src) && find display lib -name '*.h')
+
+always-$(CONFIG_DRM_HEADER_TEST) += \
+   $(patsubst %.h,%.hdrtest, $(hdrtest-files))
+
+# Include the header twice to detect missing include guard.
+quiet_cmd_hdrtest = HDRTEST $(patsubst %.hdrtest,%.h,$@)
+  cmd_hdrtest = \
+   $(CC) $(c_flags) -fsyntax-only -x c /dev/null -include $< 
-include $<; \
+   $(srctree)/scripts/kernel-doc -none $(if 
$(CONFIG_DRM_WERROR),-Werror) $<; \
+   touch $@
+
+$(obj)/%.hdrtest: $(src)/%.h FORCE
+   $(call if_changed_dep,hdrtest)
diff --git a/include/Kbuild b/include/Kbuild
new file mode 100644
index ..5e76a599e2dd
--- /dev/null
+++ b/include/Kbuild
@@ -0,0 +1 @@
+obj-$(CONFIG_DRM_HEADER_TEST)  += drm/
diff --git a/include/drm/Makefile b/include/drm/Makefile
new file mode 100644
index ..b9f391d7aadd
--- /dev/null
+++ b/include/drm/Makefile
@@ -0,0 +1,18 @@
+# SPDX-License-Identifier: GPL-2.0
+
+# Ensure drm headers are self-contained and pass kernel-doc
+hdrtest-files := \
+   $(shell cd $(srctree)/$(src) && find * -name '*.h' 2>/dev/null)
+
+always-$(CONFIG_DRM_HEADER_TEST) += \
+   $(patsubst %.h,%.hdrtest, $(hdrtest-files))
+
+# Include the header twice to detect missing include guard.
+quiet_cmd_hdrtest = HDRTEST $(patsubst %.hdrtest,%.h,$@)
+  cmd_hdrtest = \
+   $(CC) $(c_flags) -fsyntax-only -x c /dev/null -include $< 
-include $<; \
+   $(srctree)/scripts/kernel-doc -none $(if 
$(CONFIG_DRM_WERROR),-Werror) $<; \
+   touch $@
+
+$(obj)/%.hdrtest: $(src)/%.h FORCE
+   $(call if_changed_dep,hdrtest)
-- 
2.39.2