[PATCH v4 6/8] Fix access to video_is_primary_device() when compiled without CONFIG_VIDEO

Mario Limonciello posted 8 patches 3 months, 2 weeks ago
There is a newer version of this series
[PATCH v4 6/8] Fix access to video_is_primary_device() when compiled without CONFIG_VIDEO
Posted by Mario Limonciello 3 months, 2 weeks ago
From: Mario Limonciello <mario.limonciello@amd.com>

When compiled without CONFIG_VIDEO the architecture specific
implementations of video_is_primary_device() include prototypes and
assume that video-common.c will be linked. Guard against this so that the
fallback inline implementation that returns false will be used when
compiled without CONFIG_VIDEO.

Reported-by: kernel test robot <lkp@intel.com>
Closes: https://lore.kernel.org/oe-kbuild-all/202506221312.49Fy1aNA-lkp@intel.com/
Signed-off-by: Mario Limonciello <mario.limonciello@amd.com>
---
v4:
 * new patch
---
 arch/parisc/include/asm/video.h | 2 +-
 arch/sparc/include/asm/video.h  | 2 ++
 arch/x86/include/asm/video.h    | 2 ++
 3 files changed, 5 insertions(+), 1 deletion(-)

diff --git a/arch/parisc/include/asm/video.h b/arch/parisc/include/asm/video.h
index c5dff3223194a..a9d50ebd6e769 100644
--- a/arch/parisc/include/asm/video.h
+++ b/arch/parisc/include/asm/video.h
@@ -6,7 +6,7 @@
 
 struct device;
 
-#if defined(CONFIG_STI_CORE)
+#if defined(CONFIG_STI_CORE) && defined(CONFIG_VIDEO)
 bool video_is_primary_device(struct device *dev);
 #define video_is_primary_device video_is_primary_device
 #endif
diff --git a/arch/sparc/include/asm/video.h b/arch/sparc/include/asm/video.h
index a6f48f52db584..773717b6d4914 100644
--- a/arch/sparc/include/asm/video.h
+++ b/arch/sparc/include/asm/video.h
@@ -19,8 +19,10 @@ static inline pgprot_t pgprot_framebuffer(pgprot_t prot,
 #define pgprot_framebuffer pgprot_framebuffer
 #endif
 
+#ifdef CONFIG_VIDEO
 bool video_is_primary_device(struct device *dev);
 #define video_is_primary_device video_is_primary_device
+#endif
 
 static inline void fb_memcpy_fromio(void *to, const volatile void __iomem *from, size_t n)
 {
diff --git a/arch/x86/include/asm/video.h b/arch/x86/include/asm/video.h
index 0950c9535fae9..08ec328203ef8 100644
--- a/arch/x86/include/asm/video.h
+++ b/arch/x86/include/asm/video.h
@@ -13,8 +13,10 @@ pgprot_t pgprot_framebuffer(pgprot_t prot,
 			    unsigned long offset);
 #define pgprot_framebuffer pgprot_framebuffer
 
+#ifdef CONFIG_VIDEO
 bool video_is_primary_device(struct device *dev);
 #define video_is_primary_device video_is_primary_device
+#endif
 
 #include <asm-generic/video.h>
 
-- 
2.43.0
Re: [PATCH v4 6/8] Fix access to video_is_primary_device() when compiled without CONFIG_VIDEO
Posted by Thomas Zimmermann 3 months, 2 weeks ago

Am 23.06.25 um 20:47 schrieb Mario Limonciello:
> From: Mario Limonciello <mario.limonciello@amd.com>
>
> When compiled without CONFIG_VIDEO the architecture specific
> implementations of video_is_primary_device() include prototypes and
> assume that video-common.c will be linked. Guard against this so that the
> fallback inline implementation that returns false will be used when
> compiled without CONFIG_VIDEO.
>
> Reported-by: kernel test robot <lkp@intel.com>
> Closes: https://lore.kernel.org/oe-kbuild-all/202506221312.49Fy1aNA-lkp@intel.com/
> Signed-off-by: Mario Limonciello <mario.limonciello@amd.com>

Acked-by: Thomas Zimmermann <tzimmermann@suse.de>

> ---
> v4:
>   * new patch
> ---
>   arch/parisc/include/asm/video.h | 2 +-
>   arch/sparc/include/asm/video.h  | 2 ++
>   arch/x86/include/asm/video.h    | 2 ++
>   3 files changed, 5 insertions(+), 1 deletion(-)
>
> diff --git a/arch/parisc/include/asm/video.h b/arch/parisc/include/asm/video.h
> index c5dff3223194a..a9d50ebd6e769 100644
> --- a/arch/parisc/include/asm/video.h
> +++ b/arch/parisc/include/asm/video.h
> @@ -6,7 +6,7 @@
>   
>   struct device;
>   
> -#if defined(CONFIG_STI_CORE)
> +#if defined(CONFIG_STI_CORE) && defined(CONFIG_VIDEO)
>   bool video_is_primary_device(struct device *dev);
>   #define video_is_primary_device video_is_primary_device
>   #endif
> diff --git a/arch/sparc/include/asm/video.h b/arch/sparc/include/asm/video.h
> index a6f48f52db584..773717b6d4914 100644
> --- a/arch/sparc/include/asm/video.h
> +++ b/arch/sparc/include/asm/video.h
> @@ -19,8 +19,10 @@ static inline pgprot_t pgprot_framebuffer(pgprot_t prot,
>   #define pgprot_framebuffer pgprot_framebuffer
>   #endif
>   
> +#ifdef CONFIG_VIDEO
>   bool video_is_primary_device(struct device *dev);
>   #define video_is_primary_device video_is_primary_device
> +#endif
>   
>   static inline void fb_memcpy_fromio(void *to, const volatile void __iomem *from, size_t n)
>   {
> diff --git a/arch/x86/include/asm/video.h b/arch/x86/include/asm/video.h
> index 0950c9535fae9..08ec328203ef8 100644
> --- a/arch/x86/include/asm/video.h
> +++ b/arch/x86/include/asm/video.h
> @@ -13,8 +13,10 @@ pgprot_t pgprot_framebuffer(pgprot_t prot,
>   			    unsigned long offset);
>   #define pgprot_framebuffer pgprot_framebuffer
>   
> +#ifdef CONFIG_VIDEO
>   bool video_is_primary_device(struct device *dev);
>   #define video_is_primary_device video_is_primary_device
> +#endif
>   
>   #include <asm-generic/video.h>
>   

-- 
--
Thomas Zimmermann
Graphics Driver Developer
SUSE Software Solutions Germany GmbH
Frankenstrasse 146, 90461 Nuernberg, Germany
GF: Ivo Totev, Andrew Myers, Andrew McDonald, Boudien Moerman
HRB 36809 (AG Nuernberg)