Commit 3eb3c33c authored by Linus Torvalds's avatar Linus Torvalds

Merge tag 'asm-generic-6.10' of git://git.kernel.org/pub/scm/linux/kernel/git/arnd/asm-generic

Pull asm-generic cleanups from Arnd Bergmann:
 "These are a few cross-architecture cleanup patches:

   - separate out fbdev support from the asm/video.h contents that may
     be used by either the old fbdev drivers or the newer drm display
     code (Thomas Zimmermann)

   - cleanups for the generic bitops code and asm-generic/bug.h
     (Thorsten Blum)

   - remove the orphaned include/asm-generic/page.h header that used to
     be included by long-removed mmu-less architectures (me)"

* tag 'asm-generic-6.10' of git://git.kernel.org/pub/scm/linux/kernel/git/arnd/asm-generic:
  arch: Fix name collision with ACPI's video.o
  bug: Improve comment
  asm-generic: remove unused asm-generic/page.h
  arch: Rename fbdev header and source files
  arch: Remove struct fb_info from video helpers
  arch: Select fbdev helpers with CONFIG_VIDEO
  bitops: Change function return types from long to int
parents 1b036162 34cda5ab
/* SPDX-License-Identifier: GPL-2.0 */
#ifndef _ASM_FB_H_
#define _ASM_FB_H_
#include <asm-generic/fb.h>
#endif /* _ASM_FB_H_ */
#ifndef _ASM_FB_H_
#define _ASM_FB_H_
#include <asm-generic/fb.h>
#endif /* _ASM_FB_H_ */
/* 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_ */
......@@ -2,8 +2,8 @@
/*
* Copyright (C) 2020-2022 Loongson Technology Corporation Limited
*/
#ifndef _ASM_FB_H_
#define _ASM_FB_H_
#ifndef _ASM_VIDEO_H_
#define _ASM_VIDEO_H_
#include <linux/compiler.h>
#include <linux/string.h>
......@@ -26,6 +26,6 @@ static inline void fb_memset_io(volatile void __iomem *addr, int c, size_t n)
}
#define fb_memset fb_memset_io
#include <asm-generic/fb.h>
#include <asm-generic/video.h>
#endif /* _ASM_FB_H_ */
#endif /* _ASM_VIDEO_H_ */
/* SPDX-License-Identifier: GPL-2.0 */
#ifndef _ASM_FB_H_
#define _ASM_FB_H_
#ifndef _ASM_VIDEO_H_
#define _ASM_VIDEO_H_
#include <asm/page.h>
#include <asm/setup.h>
......@@ -27,6 +27,6 @@ static inline pgprot_t pgprot_framebuffer(pgprot_t prot,
}
#define pgprot_framebuffer pgprot_framebuffer
#include <asm-generic/fb.h>
#include <asm-generic/video.h>
#endif /* _ASM_FB_H_ */
#endif /* _ASM_VIDEO_H_ */
#ifndef _ASM_FB_H_
#define _ASM_FB_H_
#ifndef _ASM_VIDEO_H_
#define _ASM_VIDEO_H_
#include <asm/page.h>
......@@ -13,8 +13,8 @@ static inline pgprot_t pgprot_framebuffer(pgprot_t prot,
/*
* 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.
* 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.
......@@ -33,6 +33,6 @@ static inline void fb_writeq(u64 b, volatile void __iomem *addr)
#define fb_writeq fb_writeq
#endif
#include <asm-generic/fb.h>
#include <asm-generic/video.h>
#endif /* _ASM_FB_H_ */
#endif /* _ASM_VIDEO_H_ */
......@@ -119,7 +119,7 @@ export LIBGCC
libs-y += arch/parisc/lib/ $(LIBGCC)
drivers-y += arch/parisc/video/
drivers-$(CONFIG_VIDEO) += arch/parisc/video/
boot := arch/parisc/boot
......
/* SPDX-License-Identifier: GPL-2.0 */
#ifndef _ASM_FB_H_
#define _ASM_FB_H_
struct fb_info;
#if defined(CONFIG_STI_CORE)
int fb_is_primary_device(struct fb_info *info);
#define fb_is_primary_device fb_is_primary_device
#endif
#include <asm-generic/fb.h>
#endif /* _ASM_FB_H_ */
/* 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_ */
# SPDX-License-Identifier: GPL-2.0-only
obj-$(CONFIG_STI_CORE) += fbdev.o
obj-$(CONFIG_STI_CORE) += video-sti.o
......@@ -5,12 +5,13 @@
* Copyright (C) 2001-2002 Thomas Bogendoerfer <tsbogend@alpha.franken.de>
*/
#include <linux/fb.h>
#include <linux/module.h>
#include <video/sticore.h>
int fb_is_primary_device(struct fb_info *info)
#include <asm/video.h>
bool video_is_primary_device(struct device *dev)
{
struct sti_struct *sti;
......@@ -21,6 +22,6 @@ int fb_is_primary_device(struct fb_info *info)
return true;
/* return true if it's the default built-in framebuffer driver */
return (sti->dev == info->device);
return (sti->dev == dev);
}
EXPORT_SYMBOL(fb_is_primary_device);
EXPORT_SYMBOL(video_is_primary_device);
/* SPDX-License-Identifier: GPL-2.0 */
#ifndef _ASM_FB_H_
#define _ASM_FB_H_
#ifndef _ASM_VIDEO_H_
#define _ASM_VIDEO_H_
#include <asm/page.h>
......@@ -12,6 +12,6 @@ static inline pgprot_t pgprot_framebuffer(pgprot_t prot,
}
#define pgprot_framebuffer pgprot_framebuffer
#include <asm-generic/fb.h>
#include <asm-generic/video.h>
#endif /* _ASM_FB_H_ */
#endif /* _ASM_VIDEO_H_ */
......@@ -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
*/
......
/* SPDX-License-Identifier: GPL-2.0 */
#ifndef _ASM_FB_H_
#define _ASM_FB_H_
#include <asm-generic/fb.h>
#endif /* _ASM_FB_H_ */
......@@ -59,8 +59,8 @@ endif
libs-y += arch/sparc/prom/
libs-y += arch/sparc/lib/
drivers-$(CONFIG_PM) += arch/sparc/power/
drivers-$(CONFIG_FB_CORE) += arch/sparc/video/
drivers-$(CONFIG_PM) += arch/sparc/power/
drivers-$(CONFIG_VIDEO) += arch/sparc/video/
boot := arch/sparc/boot
......
/* SPDX-License-Identifier: GPL-2.0 */
#ifndef _SPARC_FB_H_
#define _SPARC_FB_H_
#ifndef _SPARC_VIDEO_H_
#define _SPARC_VIDEO_H_
#include <linux/io.h>
#include <linux/types.h>
#include <asm/page.h>
struct fb_info;
struct device;
#ifdef CONFIG_SPARC32
static inline pgprot_t pgprot_framebuffer(pgprot_t prot,
......@@ -18,8 +19,8 @@ static inline pgprot_t pgprot_framebuffer(pgprot_t prot,
#define pgprot_framebuffer pgprot_framebuffer
#endif
int fb_is_primary_device(struct fb_info *info);
#define fb_is_primary_device fb_is_primary_device
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)
{
......@@ -39,6 +40,6 @@ static inline void fb_memset_io(volatile void __iomem *addr, int c, size_t n)
}
#define fb_memset fb_memset_io
#include <asm-generic/fb.h>
#include <asm-generic/video.h>
#endif /* _SPARC_FB_H_ */
#endif /* _SPARC_VIDEO_H_ */
# SPDX-License-Identifier: GPL-2.0-only
obj-$(CONFIG_FB_CORE) += fbdev.o
obj-y += video-common.o
// SPDX-License-Identifier: GPL-2.0
#include <linux/console.h>
#include <linux/fb.h>
#include <linux/device.h>
#include <linux/module.h>
#include <asm/prom.h>
#include <asm/video.h>
int fb_is_primary_device(struct fb_info *info)
bool video_is_primary_device(struct device *dev)
{
struct device *dev = info->device;
struct device_node *node;
struct device_node *node = dev->of_node;
if (console_set_on_cmdline)
return 0;
return false;
node = dev->of_node;
if (node && node == of_console_device)
return 1;
return true;
return 0;
return false;
}
EXPORT_SYMBOL(fb_is_primary_device);
EXPORT_SYMBOL(video_is_primary_device);
MODULE_DESCRIPTION("Sparc fbdev helpers");
MODULE_DESCRIPTION("Sparc video helpers");
MODULE_LICENSE("GPL");
......@@ -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
......@@ -258,7 +258,7 @@ drivers-$(CONFIG_PCI) += arch/x86/pci/
# suspend and hibernation support
drivers-$(CONFIG_PM) += arch/x86/power/
drivers-$(CONFIG_FB_CORE) += arch/x86/video/
drivers-$(CONFIG_VIDEO) += arch/x86/video/
####
# boot loader support. Several targets are kept for legacy purposes
......
/* SPDX-License-Identifier: GPL-2.0 */
#ifndef _ASM_X86_FB_H
#define _ASM_X86_FB_H
#ifndef _ASM_X86_VIDEO_H
#define _ASM_X86_VIDEO_H
#include <linux/types.h>
#include <asm/page.h>
struct fb_info;
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
int fb_is_primary_device(struct fb_info *info);
#define fb_is_primary_device fb_is_primary_device
bool video_is_primary_device(struct device *dev);
#define video_is_primary_device video_is_primary_device
#include <asm-generic/fb.h>
#include <asm-generic/video.h>
#endif /* _ASM_X86_FB_H */
#endif /* _ASM_X86_VIDEO_H */
# SPDX-License-Identifier: GPL-2.0-only
obj-$(CONFIG_FB_CORE) += fbdev.o
obj-y += video-common.o
......@@ -7,11 +7,11 @@
*
*/
#include <linux/fb.h>
#include <linux/module.h>
#include <linux/pci.h>
#include <linux/vgaarb.h>
#include <asm/fb.h>
#include <asm/video.h>
pgprot_t pgprot_framebuffer(pgprot_t prot,
unsigned long vm_start, unsigned long vm_end,
......@@ -25,20 +25,17 @@ pgprot_t pgprot_framebuffer(pgprot_t prot,
}
EXPORT_SYMBOL(pgprot_framebuffer);
int fb_is_primary_device(struct fb_info *info)
bool video_is_primary_device(struct device *dev)
{
struct device *device = info->device;
struct pci_dev *pci_dev;
struct pci_dev *pdev;
if (!device || !dev_is_pci(device))
return 0;
if (!dev_is_pci(dev))
return false;
pci_dev = to_pci_dev(device);
pdev = to_pci_dev(dev);
if (pci_dev == vga_default_device())
return 1;
return 0;
return (pdev == vga_default_device());
}
EXPORT_SYMBOL(fb_is_primary_device);
EXPORT_SYMBOL(video_is_primary_device);
MODULE_LICENSE("GPL");
......@@ -2907,7 +2907,7 @@ void fbcon_remap_all(struct fb_info *info)
static void fbcon_select_primary(struct fb_info *info)
{
if (!map_override && primary_device == -1 &&
fb_is_primary_device(info)) {
video_is_primary_device(info->device)) {
int i;
printk(KERN_INFO "fbcon: %s (fb%i) is primary device\n",
......
......@@ -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
......@@ -10,9 +10,9 @@
*
* Undefined if no bit exists, so code should check against 0 first.
*/
static __always_inline unsigned long generic___ffs(unsigned long word)
static __always_inline unsigned int generic___ffs(unsigned long word)
{
int num = 0;
unsigned int num = 0;
#if BITS_PER_LONG == 64
if ((word & 0xffffffff) == 0) {
......
......@@ -10,9 +10,9 @@
*
* Undefined if no set bit exists, so code should check against 0 first.
*/
static __always_inline unsigned long generic___fls(unsigned long word)
static __always_inline unsigned int generic___fls(unsigned long word)
{
int num = BITS_PER_LONG - 1;
unsigned int num = BITS_PER_LONG - 1;
#if BITS_PER_LONG == 64
if (!(word & (~0ul << 32))) {
......
......@@ -8,7 +8,7 @@
*
* Undefined if no bit exists, so code should check against 0 first.
*/
static __always_inline unsigned long __ffs(unsigned long word)
static __always_inline unsigned int __ffs(unsigned long word)
{
return __builtin_ctzl(word);
}
......
......@@ -8,7 +8,7 @@
*
* Undefined if no set bit exists, so code should check against 0 first.
*/
static __always_inline unsigned long __fls(unsigned long word)
static __always_inline unsigned int __fls(unsigned long word)
{
return (sizeof(word) * 8) - 1 - __builtin_clzl(word);
}
......
......@@ -72,7 +72,7 @@ struct bug_entry {
#endif
/*
* WARN(), WARN_ON(), WARN_ON_ONCE, and so on can be used to report
* WARN(), WARN_ON(), WARN_ON_ONCE(), and so on can be used to report
* significant kernel issues that need prompt attention if they should ever
* appear at runtime.
*
......
/* SPDX-License-Identifier: GPL-2.0 */
#ifndef __ASM_GENERIC_PAGE_H
#define __ASM_GENERIC_PAGE_H
/*
* Generic page.h implementation, for NOMMU architectures.
* This provides the dummy definitions for the memory management.
*/
#ifdef CONFIG_MMU
#error need to provide a real asm/page.h
#endif
/* PAGE_SHIFT determines the page size */
#define PAGE_SHIFT 12
#ifdef __ASSEMBLY__
#define PAGE_SIZE (1 << PAGE_SHIFT)
#else
#define PAGE_SIZE (1UL << PAGE_SHIFT)
#endif
#define PAGE_MASK (~(PAGE_SIZE-1))
#include <asm/setup.h>
#ifndef __ASSEMBLY__
#define clear_page(page) memset((page), 0, PAGE_SIZE)
#define copy_page(to,from) memcpy((to), (from), PAGE_SIZE)
#define clear_user_page(page, vaddr, pg) clear_page(page)
#define copy_user_page(to, from, vaddr, pg) copy_page(to, from)
/*
* These are used to make use of C type-checking..
*/
typedef struct {
unsigned long pte;
} pte_t;
typedef struct {
unsigned long pmd[16];
} pmd_t;
typedef struct {
unsigned long pgd;
} pgd_t;
typedef struct {
unsigned long pgprot;
} pgprot_t;
typedef struct page *pgtable_t;
#define pte_val(x) ((x).pte)
#define pmd_val(x) ((&x)->pmd[0])
#define pgd_val(x) ((x).pgd)
#define pgprot_val(x) ((x).pgprot)
#define __pte(x) ((pte_t) { (x) } )
#define __pmd(x) ((pmd_t) { (x) } )
#define __pgd(x) ((pgd_t) { (x) } )
#define __pgprot(x) ((pgprot_t) { (x) } )
extern unsigned long memory_start;
extern unsigned long memory_end;
#endif /* !__ASSEMBLY__ */
#define PAGE_OFFSET (0)
#ifndef ARCH_PFN_OFFSET
#define ARCH_PFN_OFFSET (PAGE_OFFSET >> PAGE_SHIFT)
#endif
#ifndef __ASSEMBLY__
#define __va(x) ((void *)((unsigned long) (x)))
#define __pa(x) ((unsigned long) (x))
static inline unsigned long virt_to_pfn(const void *kaddr)
{
return __pa(kaddr) >> PAGE_SHIFT;
}
#define virt_to_pfn virt_to_pfn
static inline void *pfn_to_virt(unsigned long pfn)
{
return __va(pfn) << PAGE_SHIFT;
}
#define pfn_to_virt pfn_to_virt
#define virt_to_page(addr) pfn_to_page(virt_to_pfn(addr))
#define page_to_virt(page) pfn_to_virt(page_to_pfn(page))
#ifndef page_to_phys
#define page_to_phys(page) ((dma_addr_t)page_to_pfn(page) << PAGE_SHIFT)
#endif
#define virt_addr_valid(kaddr) (((void *)(kaddr) >= (void *)PAGE_OFFSET) && \
((void *)(kaddr) < (void *)memory_end))
#endif /* __ASSEMBLY__ */
#include <asm-generic/memory_model.h>
#include <asm-generic/getorder.h>
#endif /* __ASM_GENERIC_PAGE_H */
/* SPDX-License-Identifier: GPL-2.0 */
#ifndef __ASM_GENERIC_FB_H_
#define __ASM_GENERIC_FB_H_
#ifndef __ASM_GENERIC_VIDEO_H_
#define __ASM_GENERIC_VIDEO_H_
/*
* Only include this header file from your architecture's <asm/fb.h>.
......@@ -10,8 +10,9 @@
#include <linux/io.h>
#include <linux/mm_types.h>
#include <linux/pgtable.h>
#include <linux/types.h>
struct fb_info;
struct device;
#ifndef pgprot_framebuffer
#define pgprot_framebuffer pgprot_framebuffer
......@@ -23,11 +24,11 @@ static inline pgprot_t pgprot_framebuffer(pgprot_t prot,
}
#endif
#ifndef fb_is_primary_device
#define fb_is_primary_device fb_is_primary_device
static inline int fb_is_primary_device(struct fb_info *info)
#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 0;
return false;
}
#endif
......@@ -132,4 +133,4 @@ static inline void fb_memset_io(volatile void __iomem *addr, int c, size_t n)
#define fb_memset fb_memset_io
#endif
#endif /* __ASM_GENERIC_FB_H_ */
#endif /* __ASM_GENERIC_VIDEO_H_ */
......@@ -203,7 +203,7 @@ static __always_inline __s64 sign_extend64(__u64 value, int index)
return (__s64)(value << shift) >> shift;
}
static inline unsigned fls_long(unsigned long l)
static inline unsigned int fls_long(unsigned long l)
{
if (sizeof(l) == 4)
return fls(l);
......@@ -239,7 +239,7 @@ static inline int get_count_order_long(unsigned long l)
* The result is not defined if no bits are set, so check that @word
* is non-zero before calling this.
*/
static inline unsigned long __ffs64(u64 word)
static inline unsigned int __ffs64(u64 word)
{
#if BITS_PER_LONG == 32
if (((u32)word) == 0UL)
......@@ -255,7 +255,7 @@ static inline unsigned long __ffs64(u64 word)
* @word: The word to search
* @n: Bit to find
*/
static inline unsigned long fns(unsigned long word, unsigned int n)
static inline unsigned int fns(unsigned long word, unsigned int n)
{
unsigned int bit;
......
......@@ -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;
......
......@@ -11,9 +11,9 @@
*
* Undefined if no bit exists, so code should check against 0 first.
*/
static __always_inline unsigned long __ffs(unsigned long word)
static __always_inline unsigned int __ffs(unsigned long word)
{
int num = 0;
unsigned int num = 0;
#if __BITS_PER_LONG == 64
if ((word & 0xffffffff) == 0) {
......
......@@ -10,9 +10,9 @@
*
* Undefined if no set bit exists, so code should check against 0 first.
*/
static __always_inline unsigned long generic___fls(unsigned long word)
static __always_inline unsigned int generic___fls(unsigned long word)
{
int num = BITS_PER_LONG - 1;
unsigned int num = BITS_PER_LONG - 1;
#if BITS_PER_LONG == 64
if (!(word & (~0ul << 32))) {
......
......@@ -72,7 +72,7 @@ static inline unsigned long hweight_long(unsigned long w)
return sizeof(w) == 4 ? hweight32(w) : hweight64(w);
}
static inline unsigned fls_long(unsigned long l)
static inline unsigned int fls_long(unsigned long l)
{
if (sizeof(l) == 4)
return fls(l);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment