arch: Rename fbdev header and source files
authorThomas Zimmermann <tzimmermann@suse.de>
Fri, 29 Mar 2024 20:32:12 +0000 (21:32 +0100)
committerArnd Bergmann <arnd@arndb.de>
Fri, 3 May 2024 15:07:50 +0000 (17:07 +0200)
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 <tzimmermann@suse.de>
Reviewed-by: Sam Ravnborg <sam@ravnborg.org>
Cc: Vineet Gupta <vgupta@kernel.org>
Cc: Catalin Marinas <catalin.marinas@arm.com>
Cc: Will Deacon <will@kernel.org>
Cc: Huacai Chen <chenhuacai@kernel.org>
Cc: WANG Xuerui <kernel@xen0n.name>
Cc: Geert Uytterhoeven <geert@linux-m68k.org>
Cc: Thomas Bogendoerfer <tsbogend@alpha.franken.de>
Cc: "James E.J. Bottomley" <James.Bottomley@HansenPartnership.com>
Cc: Helge Deller <deller@gmx.de>
Cc: Michael Ellerman <mpe@ellerman.id.au>
Cc: Nicholas Piggin <npiggin@gmail.com>
Cc: Yoshinori Sato <ysato@users.sourceforge.jp>
Cc: Rich Felker <dalias@libc.org>
Cc: John Paul Adrian Glaubitz <glaubitz@physik.fu-berlin.de>
Cc: "David S. Miller" <davem@davemloft.net>
Cc: Andreas Larsson <andreas@gaisler.com>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Ingo Molnar <mingo@redhat.com>
Cc: Borislav Petkov <bp@alien8.de>
Cc: Dave Hansen <dave.hansen@linux.intel.com>
Cc: x86@kernel.org
Cc: "H. Peter Anvin" <hpa@zytor.com>
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
33 files changed:
arch/arc/include/asm/fb.h [deleted file]
arch/arm/include/asm/fb.h [deleted file]
arch/arm64/include/asm/fb.h [deleted file]
arch/loongarch/include/asm/fb.h [deleted file]
arch/loongarch/include/asm/video.h [new file with mode: 0644]
arch/m68k/include/asm/fb.h [deleted file]
arch/m68k/include/asm/video.h [new file with mode: 0644]
arch/mips/include/asm/fb.h [deleted file]
arch/mips/include/asm/video.h [new file with mode: 0644]
arch/parisc/include/asm/fb.h [deleted file]
arch/parisc/include/asm/video.h [new file with mode: 0644]
arch/parisc/video/Makefile
arch/parisc/video/fbdev.c [deleted file]
arch/parisc/video/video-sti.c [new file with mode: 0644]
arch/powerpc/include/asm/fb.h [deleted file]
arch/powerpc/include/asm/video.h [new file with mode: 0644]
arch/powerpc/kernel/pci-common.c
arch/sh/include/asm/fb.h [deleted file]
arch/sparc/include/asm/fb.h [deleted file]
arch/sparc/include/asm/video.h [new file with mode: 0644]
arch/sparc/video/Makefile
arch/sparc/video/fbdev.c [deleted file]
arch/sparc/video/video.c [new file with mode: 0644]
arch/um/include/asm/Kbuild
arch/x86/include/asm/fb.h [deleted file]
arch/x86/include/asm/video.h [new file with mode: 0644]
arch/x86/video/Makefile
arch/x86/video/fbdev.c [deleted file]
arch/x86/video/video.c [new file with mode: 0644]
include/asm-generic/Kbuild
include/asm-generic/fb.h [deleted file]
include/asm-generic/video.h [new file with mode: 0644]
include/linux/fb.h

diff --git a/arch/arc/include/asm/fb.h b/arch/arc/include/asm/fb.h
deleted file mode 100644 (file)
index 9c2383d..0000000
+++ /dev/null
@@ -1,8 +0,0 @@
-/* SPDX-License-Identifier: GPL-2.0 */
-
-#ifndef _ASM_FB_H_
-#define _ASM_FB_H_
-
-#include <asm-generic/fb.h>
-
-#endif /* _ASM_FB_H_ */
diff --git a/arch/arm/include/asm/fb.h b/arch/arm/include/asm/fb.h
deleted file mode 100644 (file)
index ce20a43..0000000
+++ /dev/null
@@ -1,6 +0,0 @@
-#ifndef _ASM_FB_H_
-#define _ASM_FB_H_
-
-#include <asm-generic/fb.h>
-
-#endif /* _ASM_FB_H_ */
diff --git a/arch/arm64/include/asm/fb.h b/arch/arm64/include/asm/fb.h
deleted file mode 100644 (file)
index 1a495d8..0000000
+++ /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 <asm-generic/fb.h>
-
-#endif /* __ASM_FB_H_ */
diff --git a/arch/loongarch/include/asm/fb.h b/arch/loongarch/include/asm/fb.h
deleted file mode 100644 (file)
index 0b218b1..0000000
+++ /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 <linux/compiler.h>
-#include <linux/string.h>
-
-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 <asm-generic/fb.h>
-
-#endif /* _ASM_FB_H_ */
diff --git a/arch/loongarch/include/asm/video.h b/arch/loongarch/include/asm/video.h
new file mode 100644 (file)
index 0000000..9f76845
--- /dev/null
@@ -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 <linux/compiler.h>
+#include <linux/string.h>
+
+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 <asm-generic/video.h>
+
+#endif /* _ASM_VIDEO_H_ */
diff --git a/arch/m68k/include/asm/fb.h b/arch/m68k/include/asm/fb.h
deleted file mode 100644 (file)
index 9941b74..0000000
+++ /dev/null
@@ -1,32 +0,0 @@
-/* SPDX-License-Identifier: GPL-2.0 */
-#ifndef _ASM_FB_H_
-#define _ASM_FB_H_
-
-#include <asm/page.h>
-#include <asm/setup.h>
-
-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 <asm-generic/fb.h>
-
-#endif /* _ASM_FB_H_ */
diff --git a/arch/m68k/include/asm/video.h b/arch/m68k/include/asm/video.h
new file mode 100644 (file)
index 0000000..6cf2194
--- /dev/null
@@ -0,0 +1,32 @@
+/* SPDX-License-Identifier: GPL-2.0 */
+#ifndef _ASM_VIDEO_H_
+#define _ASM_VIDEO_H_
+
+#include <asm/page.h>
+#include <asm/setup.h>
+
+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 <asm-generic/video.h>
+
+#endif /* _ASM_VIDEO_H_ */
diff --git a/arch/mips/include/asm/fb.h b/arch/mips/include/asm/fb.h
deleted file mode 100644 (file)
index d98d668..0000000
+++ /dev/null
@@ -1,38 +0,0 @@
-#ifndef _ASM_FB_H_
-#define _ASM_FB_H_
-
-#include <asm/page.h>
-
-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 <asm-generic/fb.h> 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 <asm-generic/fb.h>
-
-#endif /* _ASM_FB_H_ */
diff --git a/arch/mips/include/asm/video.h b/arch/mips/include/asm/video.h
new file mode 100644 (file)
index 0000000..007c106
--- /dev/null
@@ -0,0 +1,38 @@
+#ifndef _ASM_VIDEO_H_
+#define _ASM_VIDEO_H_
+
+#include <asm/page.h>
+
+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 <asm-generic/video.h> 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 <asm-generic/video.h>
+
+#endif /* _ASM_VIDEO_H_ */
diff --git a/arch/parisc/include/asm/fb.h b/arch/parisc/include/asm/fb.h
deleted file mode 100644 (file)
index ed2a195..0000000
+++ /dev/null
@@ -1,16 +0,0 @@
-/* SPDX-License-Identifier: GPL-2.0 */
-#ifndef _ASM_FB_H_
-#define _ASM_FB_H_
-
-#include <linux/types.h>
-
-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 <asm-generic/fb.h>
-
-#endif /* _ASM_FB_H_ */
diff --git a/arch/parisc/include/asm/video.h b/arch/parisc/include/asm/video.h
new file mode 100644 (file)
index 0000000..c5dff32
--- /dev/null
@@ -0,0 +1,16 @@
+/* SPDX-License-Identifier: GPL-2.0 */
+#ifndef _ASM_VIDEO_H_
+#define _ASM_VIDEO_H_
+
+#include <linux/types.h>
+
+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 <asm-generic/video.h>
+
+#endif /* _ASM_VIDEO_H_ */
index 16a73cce466127b6f6c4f9c1bf1d1836c1575912..b5db5b42880f8c84c959e53ab82aefc49cc2017d 100644 (file)
@@ -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 (file)
index 540fa0c..0000000
+++ /dev/null
@@ -1,27 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0-only
-/*
- * Copyright (C) 2000 Philipp Rumpf <prumpf@tux.org>
- * Copyright (C) 2001-2020 Helge Deller <deller@gmx.de>
- * Copyright (C) 2001-2002 Thomas Bogendoerfer <tsbogend@alpha.franken.de>
- */
-
-#include <linux/module.h>
-
-#include <video/sticore.h>
-
-#include <asm/fb.h>
-
-bool video_is_primary_device(struct device *dev)
-{
-       struct sti_struct *sti;
-
-       sti = sti_get_rom(0);
-
-       /* if no built-in graphics card found, allow any fb driver as default */
-       if (!sti)
-               return true;
-
-       /* return true if it's the default built-in framebuffer driver */
-       return (sti->dev == dev);
-}
-EXPORT_SYMBOL(video_is_primary_device);
diff --git a/arch/parisc/video/video-sti.c b/arch/parisc/video/video-sti.c
new file mode 100644 (file)
index 0000000..564661e
--- /dev/null
@@ -0,0 +1,27 @@
+// SPDX-License-Identifier: GPL-2.0-only
+/*
+ * Copyright (C) 2000 Philipp Rumpf <prumpf@tux.org>
+ * Copyright (C) 2001-2020 Helge Deller <deller@gmx.de>
+ * Copyright (C) 2001-2002 Thomas Bogendoerfer <tsbogend@alpha.franken.de>
+ */
+
+#include <linux/module.h>
+
+#include <video/sticore.h>
+
+#include <asm/video.h>
+
+bool video_is_primary_device(struct device *dev)
+{
+       struct sti_struct *sti;
+
+       sti = sti_get_rom(0);
+
+       /* if no built-in graphics card found, allow any fb driver as default */
+       if (!sti)
+               return true;
+
+       /* return true if it's the default built-in framebuffer driver */
+       return (sti->dev == dev);
+}
+EXPORT_SYMBOL(video_is_primary_device);
diff --git a/arch/powerpc/include/asm/fb.h b/arch/powerpc/include/asm/fb.h
deleted file mode 100644 (file)
index c0c5d1d..0000000
+++ /dev/null
@@ -1,17 +0,0 @@
-/* SPDX-License-Identifier: GPL-2.0 */
-#ifndef _ASM_FB_H_
-#define _ASM_FB_H_
-
-#include <asm/page.h>
-
-static inline pgprot_t pgprot_framebuffer(pgprot_t prot,
-                                         unsigned long vm_start, unsigned long vm_end,
-                                         unsigned long offset)
-{
-       return __phys_mem_access_prot(PHYS_PFN(offset), vm_end - vm_start, prot);
-}
-#define pgprot_framebuffer pgprot_framebuffer
-
-#include <asm-generic/fb.h>
-
-#endif /* _ASM_FB_H_ */
diff --git a/arch/powerpc/include/asm/video.h b/arch/powerpc/include/asm/video.h
new file mode 100644 (file)
index 0000000..e177011
--- /dev/null
@@ -0,0 +1,17 @@
+/* SPDX-License-Identifier: GPL-2.0 */
+#ifndef _ASM_VIDEO_H_
+#define _ASM_VIDEO_H_
+
+#include <asm/page.h>
+
+static inline pgprot_t pgprot_framebuffer(pgprot_t prot,
+                                         unsigned long vm_start, unsigned long vm_end,
+                                         unsigned long offset)
+{
+       return __phys_mem_access_prot(PHYS_PFN(offset), vm_end - vm_start, prot);
+}
+#define pgprot_framebuffer pgprot_framebuffer
+
+#include <asm-generic/video.h>
+
+#endif /* _ASM_VIDEO_H_ */
index d95a48eff412ee0cf275c5aedee832fd7b8895ae..eac84d687b53f72974d0d6c7ac1fc336af125ffe 100644 (file)
@@ -517,7 +517,7 @@ int pci_iobar_pfn(struct pci_dev *pdev, int bar, struct vm_area_struct *vma)
 }
 
 /*
- * This one is used by /dev/mem and fbdev who have no clue about the
+ * This one is used by /dev/mem and video who have no clue about the
  * PCI device, it tries to find the PCI device first and calls the
  * above routine
  */
diff --git a/arch/sh/include/asm/fb.h b/arch/sh/include/asm/fb.h
deleted file mode 100644 (file)
index 19df13e..0000000
+++ /dev/null
@@ -1,7 +0,0 @@
-/* SPDX-License-Identifier: GPL-2.0 */
-#ifndef _ASM_FB_H_
-#define _ASM_FB_H_
-
-#include <asm-generic/fb.h>
-
-#endif /* _ASM_FB_H_ */
diff --git a/arch/sparc/include/asm/fb.h b/arch/sparc/include/asm/fb.h
deleted file mode 100644 (file)
index 07f0325..0000000
+++ /dev/null
@@ -1,45 +0,0 @@
-/* SPDX-License-Identifier: GPL-2.0 */
-#ifndef _SPARC_FB_H_
-#define _SPARC_FB_H_
-
-#include <linux/io.h>
-#include <linux/types.h>
-
-#include <asm/page.h>
-
-struct device;
-
-#ifdef CONFIG_SPARC32
-static inline pgprot_t pgprot_framebuffer(pgprot_t prot,
-                                         unsigned long vm_start, unsigned long vm_end,
-                                         unsigned long offset)
-{
-       return prot;
-}
-#define pgprot_framebuffer pgprot_framebuffer
-#endif
-
-bool video_is_primary_device(struct device *dev);
-#define video_is_primary_device video_is_primary_device
-
-static inline void fb_memcpy_fromio(void *to, const volatile void __iomem *from, size_t n)
-{
-       sbus_memcpy_fromio(to, 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)
-{
-       sbus_memcpy_toio(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)
-{
-       sbus_memset_io(addr, c, n);
-}
-#define fb_memset fb_memset_io
-
-#include <asm-generic/fb.h>
-
-#endif /* _SPARC_FB_H_ */
diff --git a/arch/sparc/include/asm/video.h b/arch/sparc/include/asm/video.h
new file mode 100644 (file)
index 0000000..a6f48f5
--- /dev/null
@@ -0,0 +1,45 @@
+/* SPDX-License-Identifier: GPL-2.0 */
+#ifndef _SPARC_VIDEO_H_
+#define _SPARC_VIDEO_H_
+
+#include <linux/io.h>
+#include <linux/types.h>
+
+#include <asm/page.h>
+
+struct device;
+
+#ifdef CONFIG_SPARC32
+static inline pgprot_t pgprot_framebuffer(pgprot_t prot,
+                                         unsigned long vm_start, unsigned long vm_end,
+                                         unsigned long offset)
+{
+       return prot;
+}
+#define pgprot_framebuffer pgprot_framebuffer
+#endif
+
+bool video_is_primary_device(struct device *dev);
+#define video_is_primary_device video_is_primary_device
+
+static inline void fb_memcpy_fromio(void *to, const volatile void __iomem *from, size_t n)
+{
+       sbus_memcpy_fromio(to, 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)
+{
+       sbus_memcpy_toio(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)
+{
+       sbus_memset_io(addr, c, n);
+}
+#define fb_memset fb_memset_io
+
+#include <asm-generic/video.h>
+
+#endif /* _SPARC_VIDEO_H_ */
index 9dd82880a027a6b43177eda7fc918032c4f7b104..fdf83a408d7509f94164414dceed2b6c8f698f6f 100644 (file)
@@ -1,3 +1,3 @@
 # SPDX-License-Identifier: GPL-2.0-only
 
-obj-y  += fbdev.o
+obj-y  += video.o
diff --git a/arch/sparc/video/fbdev.c b/arch/sparc/video/fbdev.c
deleted file mode 100644 (file)
index e46f049..0000000
+++ /dev/null
@@ -1,25 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0
-
-#include <linux/console.h>
-#include <linux/device.h>
-#include <linux/module.h>
-
-#include <asm/fb.h>
-#include <asm/prom.h>
-
-bool video_is_primary_device(struct device *dev)
-{
-       struct device_node *node = dev->of_node;
-
-       if (console_set_on_cmdline)
-               return false;
-
-       if (node && node == of_console_device)
-               return true;
-
-       return false;
-}
-EXPORT_SYMBOL(video_is_primary_device);
-
-MODULE_DESCRIPTION("Sparc fbdev helpers");
-MODULE_LICENSE("GPL");
diff --git a/arch/sparc/video/video.c b/arch/sparc/video/video.c
new file mode 100644 (file)
index 0000000..2414380
--- /dev/null
@@ -0,0 +1,25 @@
+// SPDX-License-Identifier: GPL-2.0
+
+#include <linux/console.h>
+#include <linux/device.h>
+#include <linux/module.h>
+
+#include <asm/prom.h>
+#include <asm/video.h>
+
+bool video_is_primary_device(struct device *dev)
+{
+       struct device_node *node = dev->of_node;
+
+       if (console_set_on_cmdline)
+               return false;
+
+       if (node && node == of_console_device)
+               return true;
+
+       return false;
+}
+EXPORT_SYMBOL(video_is_primary_device);
+
+MODULE_DESCRIPTION("Sparc video helpers");
+MODULE_LICENSE("GPL");
index b2d834a29f3a9021e12b357249d1cafdaa1fd2fb..6fe34779291a86f288cd1d23fc460740d7797619 100644 (file)
@@ -8,7 +8,6 @@ generic-y += dma-mapping.h
 generic-y += emergency-restart.h
 generic-y += exec.h
 generic-y += extable.h
-generic-y += fb.h
 generic-y += ftrace.h
 generic-y += hw_irq.h
 generic-y += irq_regs.h
@@ -28,3 +27,4 @@ generic-y += trace_clock.h
 generic-y += kprobes.h
 generic-y += mm_hooks.h
 generic-y += vga.h
+generic-y += video.h
diff --git a/arch/x86/include/asm/fb.h b/arch/x86/include/asm/fb.h
deleted file mode 100644 (file)
index 999db33..0000000
+++ /dev/null
@@ -1,21 +0,0 @@
-/* SPDX-License-Identifier: GPL-2.0 */
-#ifndef _ASM_X86_FB_H
-#define _ASM_X86_FB_H
-
-#include <linux/types.h>
-
-#include <asm/page.h>
-
-struct device;
-
-pgprot_t pgprot_framebuffer(pgprot_t prot,
-                           unsigned long vm_start, unsigned long vm_end,
-                           unsigned long offset);
-#define pgprot_framebuffer pgprot_framebuffer
-
-bool video_is_primary_device(struct device *dev);
-#define video_is_primary_device video_is_primary_device
-
-#include <asm-generic/fb.h>
-
-#endif /* _ASM_X86_FB_H */
diff --git a/arch/x86/include/asm/video.h b/arch/x86/include/asm/video.h
new file mode 100644 (file)
index 0000000..0950c95
--- /dev/null
@@ -0,0 +1,21 @@
+/* SPDX-License-Identifier: GPL-2.0 */
+#ifndef _ASM_X86_VIDEO_H
+#define _ASM_X86_VIDEO_H
+
+#include <linux/types.h>
+
+#include <asm/page.h>
+
+struct device;
+
+pgprot_t pgprot_framebuffer(pgprot_t prot,
+                           unsigned long vm_start, unsigned long vm_end,
+                           unsigned long offset);
+#define pgprot_framebuffer pgprot_framebuffer
+
+bool video_is_primary_device(struct device *dev);
+#define video_is_primary_device video_is_primary_device
+
+#include <asm-generic/video.h>
+
+#endif /* _ASM_X86_VIDEO_H */
index 9dd82880a027a6b43177eda7fc918032c4f7b104..fdf83a408d7509f94164414dceed2b6c8f698f6f 100644 (file)
@@ -1,3 +1,3 @@
 # SPDX-License-Identifier: GPL-2.0-only
 
-obj-y  += fbdev.o
+obj-y  += video.o
diff --git a/arch/x86/video/fbdev.c b/arch/x86/video/fbdev.c
deleted file mode 100644 (file)
index 4d87ce8..0000000
+++ /dev/null
@@ -1,40 +0,0 @@
-/*
- * Copyright (C) 2007 Antonino Daplas <adaplas@gmail.com>
- *
- * This file is subject to the terms and conditions of the GNU General Public
- * License.  See the file COPYING in the main directory of this archive
- * for more details.
- *
- */
-
-#include <linux/module.h>
-#include <linux/pci.h>
-#include <linux/vgaarb.h>
-#include <asm/fb.h>
-
-pgprot_t pgprot_framebuffer(pgprot_t prot,
-                           unsigned long vm_start, unsigned long vm_end,
-                           unsigned long offset)
-{
-       pgprot_val(prot) &= ~_PAGE_CACHE_MASK;
-       if (boot_cpu_data.x86 > 3)
-               pgprot_val(prot) |= cachemode2protval(_PAGE_CACHE_MODE_UC_MINUS);
-
-       return prot;
-}
-EXPORT_SYMBOL(pgprot_framebuffer);
-
-bool video_is_primary_device(struct device *dev)
-{
-       struct pci_dev *pdev;
-
-       if (!dev_is_pci(dev))
-               return false;
-
-       pdev = to_pci_dev(dev);
-
-       return (pdev == vga_default_device());
-}
-EXPORT_SYMBOL(video_is_primary_device);
-
-MODULE_LICENSE("GPL");
diff --git a/arch/x86/video/video.c b/arch/x86/video/video.c
new file mode 100644 (file)
index 0000000..81fc97a
--- /dev/null
@@ -0,0 +1,41 @@
+/*
+ * Copyright (C) 2007 Antonino Daplas <adaplas@gmail.com>
+ *
+ * This file is subject to the terms and conditions of the GNU General Public
+ * License.  See the file COPYING in the main directory of this archive
+ * for more details.
+ *
+ */
+
+#include <linux/module.h>
+#include <linux/pci.h>
+#include <linux/vgaarb.h>
+
+#include <asm/video.h>
+
+pgprot_t pgprot_framebuffer(pgprot_t prot,
+                           unsigned long vm_start, unsigned long vm_end,
+                           unsigned long offset)
+{
+       pgprot_val(prot) &= ~_PAGE_CACHE_MASK;
+       if (boot_cpu_data.x86 > 3)
+               pgprot_val(prot) |= cachemode2protval(_PAGE_CACHE_MODE_UC_MINUS);
+
+       return prot;
+}
+EXPORT_SYMBOL(pgprot_framebuffer);
+
+bool video_is_primary_device(struct device *dev)
+{
+       struct pci_dev *pdev;
+
+       if (!dev_is_pci(dev))
+               return false;
+
+       pdev = to_pci_dev(dev);
+
+       return (pdev == vga_default_device());
+}
+EXPORT_SYMBOL(video_is_primary_device);
+
+MODULE_LICENSE("GPL");
index d436bee4d129dd8f0369a5554f116aa3ff2c4a7f..b20fa25a7e8d8e21a960e589f780eb768e5c186e 100644 (file)
@@ -22,7 +22,6 @@ mandatory-y += dma-mapping.h
 mandatory-y += dma.h
 mandatory-y += emergency-restart.h
 mandatory-y += exec.h
-mandatory-y += fb.h
 mandatory-y += ftrace.h
 mandatory-y += futex.h
 mandatory-y += hardirq.h
@@ -62,5 +61,6 @@ mandatory-y += uaccess.h
 mandatory-y += unaligned.h
 mandatory-y += vermagic.h
 mandatory-y += vga.h
+mandatory-y += video.h
 mandatory-y += word-at-a-time.h
 mandatory-y += xor.h
diff --git a/include/asm-generic/fb.h b/include/asm-generic/fb.h
deleted file mode 100644 (file)
index 4788c1e..0000000
+++ /dev/null
@@ -1,136 +0,0 @@
-/* SPDX-License-Identifier: GPL-2.0 */
-
-#ifndef __ASM_GENERIC_FB_H_
-#define __ASM_GENERIC_FB_H_
-
-/*
- * Only include this header file from your architecture's <asm/fb.h>.
- */
-
-#include <linux/io.h>
-#include <linux/mm_types.h>
-#include <linux/pgtable.h>
-#include <linux/types.h>
-
-struct device;
-
-#ifndef pgprot_framebuffer
-#define pgprot_framebuffer pgprot_framebuffer
-static inline pgprot_t pgprot_framebuffer(pgprot_t prot,
-                                         unsigned long vm_start, unsigned long vm_end,
-                                         unsigned long offset)
-{
-       return pgprot_writecombine(prot);
-}
-#endif
-
-#ifndef video_is_primary_device
-#define video_is_primary_device video_is_primary_device
-static inline bool video_is_primary_device(struct device *dev)
-{
-       return false;
-}
-#endif
-
-/*
- * I/O helpers for the framebuffer. Prefer these functions over their
- * regular counterparts. The regular I/O functions provide in-order
- * access and swap bytes to/from little-endian ordering. Neither is
- * required for framebuffers. Instead, the helpers read and write
- * raw framebuffer data. Independent operations can be reordered for
- * improved performance.
- */
-
-#ifndef fb_readb
-static inline u8 fb_readb(const volatile void __iomem *addr)
-{
-       return __raw_readb(addr);
-}
-#define fb_readb fb_readb
-#endif
-
-#ifndef fb_readw
-static inline u16 fb_readw(const volatile void __iomem *addr)
-{
-       return __raw_readw(addr);
-}
-#define fb_readw fb_readw
-#endif
-
-#ifndef fb_readl
-static inline u32 fb_readl(const volatile void __iomem *addr)
-{
-       return __raw_readl(addr);
-}
-#define fb_readl fb_readl
-#endif
-
-#ifndef fb_readq
-#if defined(__raw_readq)
-static inline u64 fb_readq(const volatile void __iomem *addr)
-{
-       return __raw_readq(addr);
-}
-#define fb_readq fb_readq
-#endif
-#endif
-
-#ifndef fb_writeb
-static inline void fb_writeb(u8 b, volatile void __iomem *addr)
-{
-       __raw_writeb(b, addr);
-}
-#define fb_writeb fb_writeb
-#endif
-
-#ifndef fb_writew
-static inline void fb_writew(u16 b, volatile void __iomem *addr)
-{
-       __raw_writew(b, addr);
-}
-#define fb_writew fb_writew
-#endif
-
-#ifndef fb_writel
-static inline void fb_writel(u32 b, volatile void __iomem *addr)
-{
-       __raw_writel(b, addr);
-}
-#define fb_writel fb_writel
-#endif
-
-#ifndef fb_writeq
-#if defined(__raw_writeq)
-static inline void fb_writeq(u64 b, volatile void __iomem *addr)
-{
-       __raw_writeq(b, addr);
-}
-#define fb_writeq fb_writeq
-#endif
-#endif
-
-#ifndef fb_memcpy_fromio
-static inline void fb_memcpy_fromio(void *to, const volatile void __iomem *from, size_t n)
-{
-       memcpy_fromio(to, from, n);
-}
-#define fb_memcpy_fromio fb_memcpy_fromio
-#endif
-
-#ifndef fb_memcpy_toio
-static inline void fb_memcpy_toio(volatile void __iomem *to, const void *from, size_t n)
-{
-       memcpy_toio(to, from, n);
-}
-#define fb_memcpy_toio fb_memcpy_toio
-#endif
-
-#ifndef fb_memset
-static inline void fb_memset_io(volatile void __iomem *addr, int c, size_t n)
-{
-       memset_io(addr, c, n);
-}
-#define fb_memset fb_memset_io
-#endif
-
-#endif /* __ASM_GENERIC_FB_H_ */
diff --git a/include/asm-generic/video.h b/include/asm-generic/video.h
new file mode 100644 (file)
index 0000000..b1da230
--- /dev/null
@@ -0,0 +1,136 @@
+/* SPDX-License-Identifier: GPL-2.0 */
+
+#ifndef __ASM_GENERIC_VIDEO_H_
+#define __ASM_GENERIC_VIDEO_H_
+
+/*
+ * Only include this header file from your architecture's <asm/fb.h>.
+ */
+
+#include <linux/io.h>
+#include <linux/mm_types.h>
+#include <linux/pgtable.h>
+#include <linux/types.h>
+
+struct device;
+
+#ifndef pgprot_framebuffer
+#define pgprot_framebuffer pgprot_framebuffer
+static inline pgprot_t pgprot_framebuffer(pgprot_t prot,
+                                         unsigned long vm_start, unsigned long vm_end,
+                                         unsigned long offset)
+{
+       return pgprot_writecombine(prot);
+}
+#endif
+
+#ifndef video_is_primary_device
+#define video_is_primary_device video_is_primary_device
+static inline bool video_is_primary_device(struct device *dev)
+{
+       return false;
+}
+#endif
+
+/*
+ * I/O helpers for the framebuffer. Prefer these functions over their
+ * regular counterparts. The regular I/O functions provide in-order
+ * access and swap bytes to/from little-endian ordering. Neither is
+ * required for framebuffers. Instead, the helpers read and write
+ * raw framebuffer data. Independent operations can be reordered for
+ * improved performance.
+ */
+
+#ifndef fb_readb
+static inline u8 fb_readb(const volatile void __iomem *addr)
+{
+       return __raw_readb(addr);
+}
+#define fb_readb fb_readb
+#endif
+
+#ifndef fb_readw
+static inline u16 fb_readw(const volatile void __iomem *addr)
+{
+       return __raw_readw(addr);
+}
+#define fb_readw fb_readw
+#endif
+
+#ifndef fb_readl
+static inline u32 fb_readl(const volatile void __iomem *addr)
+{
+       return __raw_readl(addr);
+}
+#define fb_readl fb_readl
+#endif
+
+#ifndef fb_readq
+#if defined(__raw_readq)
+static inline u64 fb_readq(const volatile void __iomem *addr)
+{
+       return __raw_readq(addr);
+}
+#define fb_readq fb_readq
+#endif
+#endif
+
+#ifndef fb_writeb
+static inline void fb_writeb(u8 b, volatile void __iomem *addr)
+{
+       __raw_writeb(b, addr);
+}
+#define fb_writeb fb_writeb
+#endif
+
+#ifndef fb_writew
+static inline void fb_writew(u16 b, volatile void __iomem *addr)
+{
+       __raw_writew(b, addr);
+}
+#define fb_writew fb_writew
+#endif
+
+#ifndef fb_writel
+static inline void fb_writel(u32 b, volatile void __iomem *addr)
+{
+       __raw_writel(b, addr);
+}
+#define fb_writel fb_writel
+#endif
+
+#ifndef fb_writeq
+#if defined(__raw_writeq)
+static inline void fb_writeq(u64 b, volatile void __iomem *addr)
+{
+       __raw_writeq(b, addr);
+}
+#define fb_writeq fb_writeq
+#endif
+#endif
+
+#ifndef fb_memcpy_fromio
+static inline void fb_memcpy_fromio(void *to, const volatile void __iomem *from, size_t n)
+{
+       memcpy_fromio(to, from, n);
+}
+#define fb_memcpy_fromio fb_memcpy_fromio
+#endif
+
+#ifndef fb_memcpy_toio
+static inline void fb_memcpy_toio(volatile void __iomem *to, const void *from, size_t n)
+{
+       memcpy_toio(to, from, n);
+}
+#define fb_memcpy_toio fb_memcpy_toio
+#endif
+
+#ifndef fb_memset
+static inline void fb_memset_io(volatile void __iomem *addr, int c, size_t n)
+{
+       memset_io(addr, c, n);
+}
+#define fb_memset fb_memset_io
+#endif
+
+#endif /* __ASM_GENERIC_VIDEO_H_ */
index 0dd27364d56fe04e7a72bc3319ff4c8790cb2282..bd97240dd272795a48cd512014d0cebc5c8e2734 100644 (file)
@@ -12,7 +12,7 @@
 #include <linux/types.h>
 #include <linux/workqueue.h>
 
-#include <asm/fb.h>
+#include <asm/video.h>
 
 struct backlight_device;
 struct device;