From 2fd001cd36005846caa6456fff1008c6f5bae9d4 Mon Sep 17 00:00:00 2001 From: Thomas Zimmermann Date: Fri, 29 Mar 2024 21:32:12 +0100 Subject: arch: Rename fbdev header and source files The per-architecture fbdev code has no dependencies on fbdev and can be used for any video-related subsystem. Rename the files to 'video'. Use video-sti.c on parisc as the source file depends on CONFIG_STI_CORE. On arc, arm, arm64, sh, and um the asm header file is an empty wrapper around the file in asm-generic. Let Kbuild generate the file. The build system does this automatically. Only um needs to generate video.h explicitly, so that it overrides the host architecture's header. The latter would otherwise interfere with the build. Further update all includes statements, include guards, and Makefiles. Also update a few strings and comments to refer to video instead of fbdev. v3: - arc, arm, arm64, sh: generate asm header via build system (Sam, Helge, Arnd) - um: rename fb.h to video.h - fix typo in commit message (Sam) Signed-off-by: Thomas Zimmermann Reviewed-by: Sam Ravnborg Cc: Vineet Gupta Cc: Catalin Marinas Cc: Will Deacon Cc: Huacai Chen Cc: WANG Xuerui Cc: Geert Uytterhoeven Cc: Thomas Bogendoerfer Cc: "James E.J. Bottomley" Cc: Helge Deller Cc: Michael Ellerman Cc: Nicholas Piggin Cc: Yoshinori Sato Cc: Rich Felker Cc: John Paul Adrian Glaubitz Cc: "David S. Miller" Cc: Andreas Larsson Cc: Thomas Gleixner Cc: Ingo Molnar Cc: Borislav Petkov Cc: Dave Hansen Cc: x86@kernel.org Cc: "H. Peter Anvin" Signed-off-by: Arnd Bergmann --- arch/arc/include/asm/fb.h | 8 --- arch/arm/include/asm/fb.h | 6 -- arch/arm64/include/asm/fb.h | 10 --- arch/loongarch/include/asm/fb.h | 31 --------- arch/loongarch/include/asm/video.h | 31 +++++++++ arch/m68k/include/asm/fb.h | 32 --------- arch/m68k/include/asm/video.h | 32 +++++++++ arch/mips/include/asm/fb.h | 38 ----------- arch/mips/include/asm/video.h | 38 +++++++++++ arch/parisc/include/asm/fb.h | 16 ----- arch/parisc/include/asm/video.h | 16 +++++ arch/parisc/video/Makefile | 2 +- arch/parisc/video/fbdev.c | 27 -------- arch/parisc/video/video-sti.c | 27 ++++++++ arch/powerpc/include/asm/fb.h | 17 ----- arch/powerpc/include/asm/video.h | 17 +++++ arch/powerpc/kernel/pci-common.c | 2 +- arch/sh/include/asm/fb.h | 7 -- arch/sparc/include/asm/fb.h | 45 ------------ arch/sparc/include/asm/video.h | 45 ++++++++++++ arch/sparc/video/Makefile | 2 +- arch/sparc/video/fbdev.c | 25 ------- arch/sparc/video/video.c | 25 +++++++ arch/um/include/asm/Kbuild | 2 +- arch/x86/include/asm/fb.h | 21 ------ arch/x86/include/asm/video.h | 21 ++++++ arch/x86/video/Makefile | 2 +- arch/x86/video/fbdev.c | 40 ----------- arch/x86/video/video.c | 41 +++++++++++ include/asm-generic/Kbuild | 2 +- include/asm-generic/fb.h | 136 ------------------------------------- include/asm-generic/video.h | 136 +++++++++++++++++++++++++++++++++++++ include/linux/fb.h | 2 +- 33 files changed, 436 insertions(+), 466 deletions(-) delete mode 100644 arch/arc/include/asm/fb.h delete mode 100644 arch/arm/include/asm/fb.h delete mode 100644 arch/arm64/include/asm/fb.h delete mode 100644 arch/loongarch/include/asm/fb.h create mode 100644 arch/loongarch/include/asm/video.h delete mode 100644 arch/m68k/include/asm/fb.h create mode 100644 arch/m68k/include/asm/video.h delete mode 100644 arch/mips/include/asm/fb.h create mode 100644 arch/mips/include/asm/video.h delete mode 100644 arch/parisc/include/asm/fb.h create mode 100644 arch/parisc/include/asm/video.h delete mode 100644 arch/parisc/video/fbdev.c create mode 100644 arch/parisc/video/video-sti.c delete mode 100644 arch/powerpc/include/asm/fb.h create mode 100644 arch/powerpc/include/asm/video.h delete mode 100644 arch/sh/include/asm/fb.h delete mode 100644 arch/sparc/include/asm/fb.h create mode 100644 arch/sparc/include/asm/video.h delete mode 100644 arch/sparc/video/fbdev.c create mode 100644 arch/sparc/video/video.c delete mode 100644 arch/x86/include/asm/fb.h create mode 100644 arch/x86/include/asm/video.h delete mode 100644 arch/x86/video/fbdev.c create mode 100644 arch/x86/video/video.c delete mode 100644 include/asm-generic/fb.h create mode 100644 include/asm-generic/video.h diff --git a/arch/arc/include/asm/fb.h b/arch/arc/include/asm/fb.h deleted file mode 100644 index 9c2383d29cbb..000000000000 --- a/arch/arc/include/asm/fb.h +++ /dev/null @@ -1,8 +0,0 @@ -/* SPDX-License-Identifier: GPL-2.0 */ - -#ifndef _ASM_FB_H_ -#define _ASM_FB_H_ - -#include - -#endif /* _ASM_FB_H_ */ diff --git a/arch/arm/include/asm/fb.h b/arch/arm/include/asm/fb.h deleted file mode 100644 index ce20a43c3033..000000000000 --- a/arch/arm/include/asm/fb.h +++ /dev/null @@ -1,6 +0,0 @@ -#ifndef _ASM_FB_H_ -#define _ASM_FB_H_ - -#include - -#endif /* _ASM_FB_H_ */ diff --git a/arch/arm64/include/asm/fb.h b/arch/arm64/include/asm/fb.h deleted file mode 100644 index 1a495d8fb2ce..000000000000 --- a/arch/arm64/include/asm/fb.h +++ /dev/null @@ -1,10 +0,0 @@ -/* SPDX-License-Identifier: GPL-2.0-only */ -/* - * Copyright (C) 2012 ARM Ltd. - */ -#ifndef __ASM_FB_H_ -#define __ASM_FB_H_ - -#include - -#endif /* __ASM_FB_H_ */ diff --git a/arch/loongarch/include/asm/fb.h b/arch/loongarch/include/asm/fb.h deleted file mode 100644 index 0b218b10a9ec..000000000000 --- a/arch/loongarch/include/asm/fb.h +++ /dev/null @@ -1,31 +0,0 @@ -/* SPDX-License-Identifier: GPL-2.0 */ -/* - * Copyright (C) 2020-2022 Loongson Technology Corporation Limited - */ -#ifndef _ASM_FB_H_ -#define _ASM_FB_H_ - -#include -#include - -static inline void fb_memcpy_fromio(void *to, const volatile void __iomem *from, size_t n) -{ - memcpy(to, (void __force *)from, n); -} -#define fb_memcpy_fromio fb_memcpy_fromio - -static inline void fb_memcpy_toio(volatile void __iomem *to, const void *from, size_t n) -{ - memcpy((void __force *)to, from, n); -} -#define fb_memcpy_toio fb_memcpy_toio - -static inline void fb_memset_io(volatile void __iomem *addr, int c, size_t n) -{ - memset((void __force *)addr, c, n); -} -#define fb_memset fb_memset_io - -#include - -#endif /* _ASM_FB_H_ */ diff --git a/arch/loongarch/include/asm/video.h b/arch/loongarch/include/asm/video.h new file mode 100644 index 000000000000..9f76845f2d4f --- /dev/null +++ b/arch/loongarch/include/asm/video.h @@ -0,0 +1,31 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +/* + * Copyright (C) 2020-2022 Loongson Technology Corporation Limited + */ +#ifndef _ASM_VIDEO_H_ +#define _ASM_VIDEO_H_ + +#include +#include + +static inline void fb_memcpy_fromio(void *to, const volatile void __iomem *from, size_t n) +{ + memcpy(to, (void __force *)from, n); +} +#define fb_memcpy_fromio fb_memcpy_fromio + +static inline void fb_memcpy_toio(volatile void __iomem *to, const void *from, size_t n) +{ + memcpy((void __force *)to, from, n); +} +#define fb_memcpy_toio fb_memcpy_toio + +static inline void fb_memset_io(volatile void __iomem *addr, int c, size_t n) +{ + memset((void __force *)addr, c, n); +} +#define fb_memset fb_memset_io + +#include + +#endif /* _ASM_VIDEO_H_ */ diff --git a/arch/m68k/include/asm/fb.h b/arch/m68k/include/asm/fb.h deleted file mode 100644 index 9941b7434b69..000000000000 --- a/arch/m68k/include/asm/fb.h +++ /dev/null @@ -1,32 +0,0 @@ -/* SPDX-License-Identifier: GPL-2.0 */ -#ifndef _ASM_FB_H_ -#define _ASM_FB_H_ - -#include -#include - -static inline pgprot_t pgprot_framebuffer(pgprot_t prot, - unsigned long vm_start, unsigned long vm_end, - unsigned long offset) -{ -#ifdef CONFIG_MMU -#ifdef CONFIG_SUN3 - pgprot_val(prot) |= SUN3_PAGE_NOCACHE; -#else - if (CPU_IS_020_OR_030) - pgprot_val(prot) |= _PAGE_NOCACHE030; - if (CPU_IS_040_OR_060) { - pgprot_val(prot) &= _CACHEMASK040; - /* Use no-cache mode, serialized */ - pgprot_val(prot) |= _PAGE_NOCACHE_S; - } -#endif /* CONFIG_SUN3 */ -#endif /* CONFIG_MMU */ - - return prot; -} -#define pgprot_framebuffer pgprot_framebuffer - -#include - -#endif /* _ASM_FB_H_ */ diff --git a/arch/m68k/include/asm/video.h b/arch/m68k/include/asm/video.h new file mode 100644 index 000000000000..6cf2194c413d --- /dev/null +++ b/arch/m68k/include/asm/video.h @@ -0,0 +1,32 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +#ifndef _ASM_VIDEO_H_ +#define _ASM_VIDEO_H_ + +#include +#include + +static inline pgprot_t pgprot_framebuffer(pgprot_t prot, + unsigned long vm_start, unsigned long vm_end, + unsigned long offset) +{ +#ifdef CONFIG_MMU +#ifdef CONFIG_SUN3 + pgprot_val(prot) |= SUN3_PAGE_NOCACHE; +#else + if (CPU_IS_020_OR_030) + pgprot_val(prot) |= _PAGE_NOCACHE030; + if (CPU_IS_040_OR_060) { + pgprot_val(prot) &= _CACHEMASK040; + /* Use no-cache mode, serialized */ + pgprot_val(prot) |= _PAGE_NOCACHE_S; + } +#endif /* CONFIG_SUN3 */ +#endif /* CONFIG_MMU */ + + return prot; +} +#define pgprot_framebuffer pgprot_framebuffer + +#include + +#endif /* _ASM_VIDEO_H_ */ diff --git a/arch/mips/include/asm/fb.h b/arch/mips/include/asm/fb.h deleted file mode 100644 index d98d6681d64e..000000000000 --- a/arch/mips/include/asm/fb.h +++ /dev/null @@ -1,38 +0,0 @@ -#ifndef _ASM_FB_H_ -#define _ASM_FB_H_ - -#include - -static inline pgprot_t pgprot_framebuffer(pgprot_t prot, - unsigned long vm_start, unsigned long vm_end, - unsigned long offset) -{ - return pgprot_noncached(prot); -} -#define pgprot_framebuffer pgprot_framebuffer - -/* - * MIPS doesn't define __raw_ I/O macros, so the helpers - * in don't generate fb_readq() and - * fb_write(). We have to provide them here. - * - * TODO: Convert MIPS to generic I/O. The helpers below can - * then be removed. - */ -#ifdef CONFIG_64BIT -static inline u64 fb_readq(const volatile void __iomem *addr) -{ - return __raw_readq(addr); -} -#define fb_readq fb_readq - -static inline void fb_writeq(u64 b, volatile void __iomem *addr) -{ - __raw_writeq(b, addr); -} -#define fb_writeq fb_writeq -#endif - -#include - -#endif /* _ASM_FB_H_ */ diff --git a/arch/mips/include/asm/video.h b/arch/mips/include/asm/video.h new file mode 100644 index 000000000000..007c106d980f --- /dev/null +++ b/arch/mips/include/asm/video.h @@ -0,0 +1,38 @@ +#ifndef _ASM_VIDEO_H_ +#define _ASM_VIDEO_H_ + +#include + +static inline pgprot_t pgprot_framebuffer(pgprot_t prot, + unsigned long vm_start, unsigned long vm_end, + unsigned long offset) +{ + return pgprot_noncached(prot); +} +#define pgprot_framebuffer pgprot_framebuffer + +/* + * MIPS doesn't define __raw_ I/O macros, so the helpers + * in don't generate fb_readq() and + * fb_writeq(). We have to provide them here. + * + * TODO: Convert MIPS to generic I/O. The helpers below can + * then be removed. + */ +#ifdef CONFIG_64BIT +static inline u64 fb_readq(const volatile void __iomem *addr) +{ + return __raw_readq(addr); +} +#define fb_readq fb_readq + +static inline void fb_writeq(u64 b, volatile void __iomem *addr) +{ + __raw_writeq(b, addr); +} +#define fb_writeq fb_writeq +#endif + +#include + +#endif /* _ASM_VIDEO_H_ */ diff --git a/arch/parisc/include/asm/fb.h b/arch/parisc/include/asm/fb.h deleted file mode 100644 index ed2a195a3e76..000000000000 --- a/arch/parisc/include/asm/fb.h +++ /dev/null @@ -1,16 +0,0 @@ -/* SPDX-License-Identifier: GPL-2.0 */ -#ifndef _ASM_FB_H_ -#define _ASM_FB_H_ - -#include - -struct device; - -#if defined(CONFIG_STI_CORE) -bool video_is_primary_device(struct device *dev); -#define video_is_primary_device video_is_primary_device -#endif - -#include - -#endif /* _ASM_FB_H_ */ diff --git a/arch/parisc/include/asm/video.h b/arch/parisc/include/asm/video.h new file mode 100644 index 000000000000..c5dff3223194 --- /dev/null +++ b/arch/parisc/include/asm/video.h @@ -0,0 +1,16 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +#ifndef _ASM_VIDEO_H_ +#define _ASM_VIDEO_H_ + +#include + +struct device; + +#if defined(CONFIG_STI_CORE) +bool video_is_primary_device(struct device *dev); +#define video_is_primary_device video_is_primary_device +#endif + +#include + +#endif /* _ASM_VIDEO_H_ */ diff --git a/arch/parisc/video/Makefile b/arch/parisc/video/Makefile index 16a73cce4661..b5db5b42880f 100644 --- a/arch/parisc/video/Makefile +++ b/arch/parisc/video/Makefile @@ -1,3 +1,3 @@ # SPDX-License-Identifier: GPL-2.0-only -obj-$(CONFIG_STI_CORE) += fbdev.o +obj-$(CONFIG_STI_CORE) += video-sti.o diff --git a/arch/parisc/video/fbdev.c b/arch/parisc/video/fbdev.c deleted file mode 100644 index 540fa0c919d5..000000000000 --- a/arch/parisc/video/fbdev.c +++ /dev/null @@ -1,27 +0,0 @@ -// SPDX-License-Identifier: GPL-2.0-only -/* - * Copyright (C) 2000 Philipp Rumpf - * Copyright (C) 2001-2020 Helge Deller - * Copyright (C) 2001-2002 Thomas Bogendoerfer - */ - -#include - -#include