From c205a67d28766ffaae3d02cdffc9c86d52ed6c2e Mon Sep 17 00:00:00 2001 From: Thomas Zimmermann Date: Fri, 22 Sep 2023 10:04:55 +0200 Subject: fbdev: Avoid file argument in fb_pgprotect() Only PowerPC's fb_pgprotect() needs the file argument, although the implementation in either phys_mem_access_prot() or pci_phys_mem_access_prot() does not use it. Pass NULL to the internal helper in preparation of further updates. A later patch will remove the file parameter from fb_pgprotect(). While at it, replace the shift operation with PHYS_PFN(). v5: * state function names in commit description (Javier) Suggested-by: Christophe Leroy Signed-off-by: Thomas Zimmermann Reviewed-by: Arnd Bergmann Reviewed-by: Javier Martinez Canillas Link: https://patchwork.freedesktop.org/patch/msgid/20230922080636.26762-2-tzimmermann@suse.de --- arch/powerpc/include/asm/fb.h | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'arch/powerpc/include/asm/fb.h') diff --git a/arch/powerpc/include/asm/fb.h b/arch/powerpc/include/asm/fb.h index 5f1a2e5f7654..61e3b8806db6 100644 --- a/arch/powerpc/include/asm/fb.h +++ b/arch/powerpc/include/asm/fb.h @@ -9,7 +9,12 @@ static inline void fb_pgprotect(struct file *file, struct vm_area_struct *vma, unsigned long off) { - vma->vm_page_prot = phys_mem_access_prot(file, off >> PAGE_SHIFT, + /* + * PowerPC's implementation of phys_mem_access_prot() does + * not use the file argument. Set it to NULL in preparation + * of later updates to the interface. + */ + vma->vm_page_prot = phys_mem_access_prot(NULL, PHYS_PFN(off), vma->vm_end - vma->vm_start, vma->vm_page_prot); } -- cgit v1.2.3 From 052ddf7b86d2d9443bce77ef5b5b1ef61a3b79fc Mon Sep 17 00:00:00 2001 From: Thomas Zimmermann Date: Fri, 22 Sep 2023 10:04:56 +0200 Subject: fbdev: Replace fb_pgprotect() with pgprot_framebuffer() 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 Reviewed-by: Arnd Bergmann Acked-by: Geert Uytterhoeven # m68k Reviewed-by: Javier Martinez Canillas Link: https://patchwork.freedesktop.org/patch/msgid/20230922080636.26762-3-tzimmermann@suse.de --- arch/powerpc/include/asm/fb.h | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) (limited to 'arch/powerpc/include/asm/fb.h') diff --git a/arch/powerpc/include/asm/fb.h b/arch/powerpc/include/asm/fb.h index 61e3b8806db6..3cecf14d51de 100644 --- a/arch/powerpc/include/asm/fb.h +++ b/arch/powerpc/include/asm/fb.h @@ -2,23 +2,20 @@ #ifndef _ASM_FB_H_ #define _ASM_FB_H_ -#include - #include -static inline void fb_pgprotect(struct file *file, struct vm_area_struct *vma, - unsigned long off) +static inline pgprot_t pgprot_framebuffer(pgprot_t prot, + unsigned long vm_start, unsigned long vm_end, + unsigned long offset) { /* * PowerPC's implementation of phys_mem_access_prot() does * not use the file argument. Set it to NULL in preparation * of later updates to the interface. */ - vma->vm_page_prot = phys_mem_access_prot(NULL, PHYS_PFN(off), - vma->vm_end - vma->vm_start, - vma->vm_page_prot); + return phys_mem_access_prot(NULL, PHYS_PFN(offset), vm_end - vm_start, prot); } -#define fb_pgprotect fb_pgprotect +#define pgprot_framebuffer pgprot_framebuffer #include -- cgit v1.2.3