mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2026-05-22 22:35:40 -04:00
Rename the fbdev mmap helper fb_pgprotect() to pgprot_framebuffer(). The helper sets VMA page-access flags for framebuffers in device I/O memory. Also clean up the helper's parameters and return value. Instead of the VMA instance, pass the individial parameters separately: existing page-access flags, the VMAs start and end addresses and the offset in the underlying device memory rsp file. Return the new page-access flags. These changes align pgprot_framebuffer() with other pgprot_() functions. v4: * fix commit message (Christophe) v3: * rename fb_pgprotect() to pgprot_framebuffer() (Arnd) Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de> Reviewed-by: Arnd Bergmann <arnd@arndb.de> Acked-by: Geert Uytterhoeven <geert@linux-m68k.org> # m68k Reviewed-by: Javier Martinez Canillas <javierm@redhat.com> Link: https://patchwork.freedesktop.org/patch/msgid/20230922080636.26762-3-tzimmermann@suse.de
43 lines
1.0 KiB
C
43 lines
1.0 KiB
C
/* SPDX-License-Identifier: GPL-2.0 */
|
|
#ifndef _ASM_FB_H_
|
|
#define _ASM_FB_H_
|
|
|
|
#include <linux/compiler.h>
|
|
#include <linux/efi.h>
|
|
#include <linux/string.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)
|
|
{
|
|
if (efi_range_is_wc(vm_start, vm_end - vm_start))
|
|
return pgprot_writecombine(prot);
|
|
else
|
|
return pgprot_noncached(prot);
|
|
}
|
|
#define pgprot_framebuffer pgprot_framebuffer
|
|
|
|
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_ */
|