From 4eec0b3048fcd74b504c2a6828a07f133a8ab508 Mon Sep 17 00:00:00 2001 From: Thomas Zimmermann Date: Mon, 17 Apr 2023 14:56:49 +0200 Subject: arch/sparc: Implement fb_is_primary_device() in source file Other architectures implment fb_is_primary_device() in a source file. Do the same on sparc. No functional changes, but allows to remove several include statement from . v2: * don't include in header file Signed-off-by: Thomas Zimmermann Cc: "David S. Miller" Acked-by: Arnd Bergmann Acked-by: Helge Deller Link: https://patchwork.freedesktop.org/patch/msgid/20230417125651.25126-18-tzimmermann@suse.de --- arch/sparc/Makefile | 1 + arch/sparc/include/asm/fb.h | 23 +++++------------------ arch/sparc/video/Makefile | 3 +++ arch/sparc/video/fbdev.c | 24 ++++++++++++++++++++++++ 4 files changed, 33 insertions(+), 18 deletions(-) create mode 100644 arch/sparc/video/Makefile create mode 100644 arch/sparc/video/fbdev.c (limited to 'arch/sparc') diff --git a/arch/sparc/Makefile b/arch/sparc/Makefile index a4ea5b05f288..95a9211e48e3 100644 --- a/arch/sparc/Makefile +++ b/arch/sparc/Makefile @@ -60,6 +60,7 @@ libs-y += arch/sparc/prom/ libs-y += arch/sparc/lib/ drivers-$(CONFIG_PM) += arch/sparc/power/ +drivers-$(CONFIG_FB) += arch/sparc/video/ boot := arch/sparc/boot diff --git a/arch/sparc/include/asm/fb.h b/arch/sparc/include/asm/fb.h index f699962e9ddf..28609f7a965c 100644 --- a/arch/sparc/include/asm/fb.h +++ b/arch/sparc/include/asm/fb.h @@ -1,11 +1,12 @@ /* SPDX-License-Identifier: GPL-2.0 */ #ifndef _SPARC_FB_H_ #define _SPARC_FB_H_ -#include -#include + #include + #include -#include + +struct fb_info; static inline void fb_pgprotect(struct file *file, struct vm_area_struct *vma, unsigned long off) @@ -15,20 +16,6 @@ static inline void fb_pgprotect(struct file *file, struct vm_area_struct *vma, #endif } -static inline int fb_is_primary_device(struct fb_info *info) -{ - struct device *dev = info->device; - struct device_node *node; - - if (console_set_on_cmdline) - return 0; - - node = dev->of_node; - if (node && - node == of_console_device) - return 1; - - return 0; -} +int fb_is_primary_device(struct fb_info *info); #endif /* _SPARC_FB_H_ */ diff --git a/arch/sparc/video/Makefile b/arch/sparc/video/Makefile new file mode 100644 index 000000000000..6baddbd58e4d --- /dev/null +++ b/arch/sparc/video/Makefile @@ -0,0 +1,3 @@ +# SPDX-License-Identifier: GPL-2.0-only + +obj-$(CONFIG_FB) += fbdev.o diff --git a/arch/sparc/video/fbdev.c b/arch/sparc/video/fbdev.c new file mode 100644 index 000000000000..dadd5799fbb3 --- /dev/null +++ b/arch/sparc/video/fbdev.c @@ -0,0 +1,24 @@ +// SPDX-License-Identifier: GPL-2.0 + +#include +#include +#include + +#include +#include + +int fb_is_primary_device(struct fb_info *info) +{ + struct device *dev = info->device; + struct device_node *node; + + if (console_set_on_cmdline) + return 0; + + node = dev->of_node; + if (node && node == of_console_device) + return 1; + + return 0; +} +EXPORT_SYMBOL(fb_is_primary_device); -- cgit v1.2.3 From db76f19a607d6cf4a9d5868d05675c355e99809c Mon Sep 17 00:00:00 2001 From: Thomas Zimmermann Date: Mon, 17 Apr 2023 14:56:50 +0200 Subject: arch/sparc: Implement with generic helpers Replace sparc64's fb_pgprotect() with the generic one from . On sparc, pgprot_writecombine() and pgprot_noncached() are the same; hence no functional changes v3: * use default implementation for fb_pgprotect() on sparc64 (Arnd) v2: * restore the original fb_pgprotect() Signed-off-by: Thomas Zimmermann Cc: "David S. Miller" Acked-by: Arnd Bergmann Acked-by: Helge Deller Link: https://patchwork.freedesktop.org/patch/msgid/20230417125651.25126-19-tzimmermann@suse.de --- arch/sparc/include/asm/fb.h | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) (limited to 'arch/sparc') diff --git a/arch/sparc/include/asm/fb.h b/arch/sparc/include/asm/fb.h index 28609f7a965c..689ee5c60054 100644 --- a/arch/sparc/include/asm/fb.h +++ b/arch/sparc/include/asm/fb.h @@ -2,20 +2,20 @@ #ifndef _SPARC_FB_H_ #define _SPARC_FB_H_ -#include - -#include - struct fb_info; +struct file; +struct vm_area_struct; +#ifdef CONFIG_SPARC32 static inline void fb_pgprotect(struct file *file, struct vm_area_struct *vma, unsigned long off) -{ -#ifdef CONFIG_SPARC64 - vma->vm_page_prot = pgprot_noncached(vma->vm_page_prot); +{ } +#define fb_pgprotect fb_pgprotect #endif -} int fb_is_primary_device(struct fb_info *info); +#define fb_is_primary_device fb_is_primary_device + +#include #endif /* _SPARC_FB_H_ */ -- cgit v1.2.3 From 8ff1541da3908b504cb53e5384d5deae2b9c6e1a Mon Sep 17 00:00:00 2001 From: Thomas Zimmermann Date: Fri, 12 May 2023 12:24:42 +0200 Subject: fbdev: Include instead of Replace include statements for with . Fixes the coding style: if a header is available in asm/ and linux/, it is preferable to include the header from linux/. This only affects a few source files, most of which already include . Suggested-by: Sam Ravnborg Signed-off-by: Thomas Zimmermann Reviewed-by: Arnd Bergmann Reviewed-by: Sui Jingfeng Reviewed-by: Sam Ravnborg Link: https://patchwork.freedesktop.org/patch/msgid/20230512102444.5438-6-tzimmermann@suse.de --- arch/parisc/video/fbdev.c | 3 +-- arch/sparc/video/fbdev.c | 1 - arch/x86/video/fbdev.c | 2 -- drivers/staging/sm750fb/sm750.c | 2 +- drivers/video/fbdev/core/fbcon.c | 1 - drivers/video/fbdev/core/fbmem.c | 2 -- include/linux/fb.h | 2 ++ 7 files changed, 4 insertions(+), 9 deletions(-) (limited to 'arch/sparc') diff --git a/arch/parisc/video/fbdev.c b/arch/parisc/video/fbdev.c index 4a0ae08fc75b..137561d98246 100644 --- a/arch/parisc/video/fbdev.c +++ b/arch/parisc/video/fbdev.c @@ -5,10 +5,9 @@ * Copyright (C) 2001-2002 Thomas Bogendoerfer */ +#include #include -#include - #include