Re: [RESEND PATCH v2 6/9] drm/mgag200: Constify ioreadX() iomem argument (as in generic implementation)

2020-03-12 Thread Thomas Zimmermann
Hi Krzysztof,

I just received a resend email from 3 weeks ago :/

Do you want me to merge the mgag200 patch into drm-misc-next?

Best regards
Thomas

Am 19.02.20 um 18:50 schrieb Krzysztof Kozlowski:
> The ioreadX() helpers have inconsistent interface.  On some architectures
> void *__iomem address argument is a pointer to const, on some not.
> 
> Implementations of ioreadX() do not modify the memory under the address
> so they can be converted to a "const" version for const-safety and
> consistency among architectures.
> 
> Signed-off-by: Krzysztof Kozlowski 
> Reviewed-by: Thomas Zimmermann 
> 
> ---
> 
> Changes since v1:
> 1. Add Thomas' review.
> ---
>  drivers/gpu/drm/mgag200/mgag200_drv.h | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/gpu/drm/mgag200/mgag200_drv.h 
> b/drivers/gpu/drm/mgag200/mgag200_drv.h
> index aa32aad222c2..6512b3af4fb7 100644
> --- a/drivers/gpu/drm/mgag200/mgag200_drv.h
> +++ b/drivers/gpu/drm/mgag200/mgag200_drv.h
> @@ -34,9 +34,9 @@
>  
>  #define MGAG200FB_CONN_LIMIT 1
>  
> -#define RREG8(reg) ioread8(((void __iomem *)mdev->rmmio) + (reg))
> +#define RREG8(reg) ioread8(((const void __iomem *)mdev->rmmio) + (reg))
>  #define WREG8(reg, v) iowrite8(v, ((void __iomem *)mdev->rmmio) + (reg))
> -#define RREG32(reg) ioread32(((void __iomem *)mdev->rmmio) + (reg))
> +#define RREG32(reg) ioread32(((const void __iomem *)mdev->rmmio) + (reg))
>  #define WREG32(reg, v) iowrite32(v, ((void __iomem *)mdev->rmmio) + (reg))
>  
>  #define ATTR_INDEX 0x1fc0
> 

-- 
Thomas Zimmermann
Graphics Driver Developer
SUSE Software Solutions Germany GmbH
Maxfeldstr. 5, 90409 Nürnberg, Germany
(HRB 36809, AG Nürnberg)
Geschäftsführer: Felix Imendörffer



signature.asc
Description: OpenPGP digital signature


Re: [RESEND PATCH v2 6/9] drm/mgag200: Constify ioreadX() iomem argument (as in generic implementation)

2020-03-24 Thread Thomas Zimmermann
Hi

Am 14.03.20 um 11:59 schrieb Krzysztof Kozlowski:
> On Thu, Mar 12, 2020 at 11:49:05AM +0100, Thomas Zimmermann wrote:
>> Hi Krzysztof,
>>
>> I just received a resend email from 3 weeks ago :/
>>
>> Do you want me to merge the mgag200 patch into drm-misc-next?
> 
> Thanks but it depends on the first patch in the series so either it
> could go with your ack through other tree or I will send it later (once
> 1st patch gets to mainline).

Ok. You're welcome to send it through any tree that works best for you.
mgag200 sees only little change. I wouldn't expect major merge
conflicts, if any.

Best regards
Thomas

> 
> 
> Best regards,
> Krzysztof
> 

-- 
Thomas Zimmermann
Graphics Driver Developer
SUSE Software Solutions Germany GmbH
Maxfeldstr. 5, 90409 Nürnberg, Germany
(HRB 36809, AG Nürnberg)
Geschäftsführer: Felix Imendörffer



signature.asc
Description: OpenPGP digital signature


Re: [PATCH v2 6/9] drm/mgag200: Constify ioreadX() iomem argument (as in generic implementation)

2020-01-09 Thread Thomas Zimmermann
Hi

Am 08.01.20 um 21:05 schrieb Krzysztof Kozlowski:
> The ioreadX() helpers have inconsistent interface.  On some architectures
> void *__iomem address argument is a pointer to const, on some not.
> 
> Implementations of ioreadX() do not modify the memory under the address
> so they can be converted to a "const" version for const-safety and
> consistency among architectures.
> 
> Signed-off-by: Krzysztof Kozlowski 

Reviewed-by: Thomas Zimmermann 

> ---
>  drivers/gpu/drm/mgag200/mgag200_drv.h | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/gpu/drm/mgag200/mgag200_drv.h 
> b/drivers/gpu/drm/mgag200/mgag200_drv.h
> index aa32aad222c2..6512b3af4fb7 100644
> --- a/drivers/gpu/drm/mgag200/mgag200_drv.h
> +++ b/drivers/gpu/drm/mgag200/mgag200_drv.h
> @@ -34,9 +34,9 @@
>  
>  #define MGAG200FB_CONN_LIMIT 1
>  
> -#define RREG8(reg) ioread8(((void __iomem *)mdev->rmmio) + (reg))
> +#define RREG8(reg) ioread8(((const void __iomem *)mdev->rmmio) + (reg))
>  #define WREG8(reg, v) iowrite8(v, ((void __iomem *)mdev->rmmio) + (reg))
> -#define RREG32(reg) ioread32(((void __iomem *)mdev->rmmio) + (reg))
> +#define RREG32(reg) ioread32(((const void __iomem *)mdev->rmmio) + (reg))
>  #define WREG32(reg, v) iowrite32(v, ((void __iomem *)mdev->rmmio) + (reg))
>  
>  #define ATTR_INDEX 0x1fc0
> 

-- 
Thomas Zimmermann
Graphics Driver Developer
SUSE Software Solutions Germany GmbH
Maxfeldstr. 5, 90409 Nürnberg, Germany
(HRB 36809, AG Nürnberg)
Geschäftsführer: Felix Imendörffer



signature.asc
Description: OpenPGP digital signature


[PATCH v3 1/5] fbdev: Avoid file argument in fb_pgprotect()

2023-09-11 Thread Thomas Zimmermann
Only PowerPC's fb_pgprotect() needs the file argument, although
the implementation 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().

Suggested-by: Christophe Leroy 
Signed-off-by: Thomas Zimmermann 
---
 arch/powerpc/include/asm/fb.h | 7 ++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/arch/powerpc/include/asm/fb.h b/arch/powerpc/include/asm/fb.h
index 5f1a2e5f76548..61e3b8806db69 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);
 }
-- 
2.42.0



[PATCH v3 5/5] arch/powerpc: Call internal __phys_mem_access_prot() in fbdev code

2023-09-11 Thread Thomas Zimmermann
Call __phys_mem_access_prot() from the fbdev mmap helper
pgprot_framebuffer(). Allows to avoid the file argument of NULL.

Signed-off-by: Thomas Zimmermann 
---
 arch/powerpc/include/asm/fb.h | 7 +--
 1 file changed, 1 insertion(+), 6 deletions(-)

diff --git a/arch/powerpc/include/asm/fb.h b/arch/powerpc/include/asm/fb.h
index 3cecf14d51de8..c0c5d1df7ad1e 100644
--- a/arch/powerpc/include/asm/fb.h
+++ b/arch/powerpc/include/asm/fb.h
@@ -8,12 +8,7 @@ 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.
-*/
-   return phys_mem_access_prot(NULL, PHYS_PFN(offset), vm_end - vm_start, 
prot);
+   return __phys_mem_access_prot(PHYS_PFN(offset), vm_end - vm_start, 
prot);
 }
 #define pgprot_framebuffer pgprot_framebuffer
 
-- 
2.42.0



[PATCH v3 3/5] arch/powerpc: Remove trailing whitespaces

2023-09-11 Thread Thomas Zimmermann
Fix coding style. No functional changes.

Signed-off-by: Thomas Zimmermann 
---
 arch/powerpc/include/asm/machdep.h | 10 +-
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/arch/powerpc/include/asm/machdep.h 
b/arch/powerpc/include/asm/machdep.h
index 4f6e7d7ee3883..933465ed4c432 100644
--- a/arch/powerpc/include/asm/machdep.h
+++ b/arch/powerpc/include/asm/machdep.h
@@ -10,7 +10,7 @@
 #include 
 
 struct pt_regs;
-struct pci_bus;
+struct pci_bus;
 struct device_node;
 struct iommu_table;
 struct rtc_time;
@@ -78,8 +78,8 @@ struct machdep_calls {
unsigned char   (*nvram_read_val)(int addr);
void(*nvram_write_val)(int addr, unsigned char val);
ssize_t (*nvram_write)(char *buf, size_t count, loff_t *index);
-   ssize_t (*nvram_read)(char *buf, size_t count, loff_t *index);  
-   ssize_t (*nvram_size)(void);
+   ssize_t (*nvram_read)(char *buf, size_t count, loff_t *index);
+   ssize_t (*nvram_size)(void);
void(*nvram_sync)(void);
 
/* Exception handlers */
@@ -102,9 +102,9 @@ struct machdep_calls {
 */
long(*feature_call)(unsigned int feature, ...);
 
-   /* Get legacy PCI/IDE interrupt mapping */ 
+   /* Get legacy PCI/IDE interrupt mapping */
int (*pci_get_legacy_ide_irq)(struct pci_dev *dev, int 
channel);
-   
+
/* Get access protection for /dev/mem */
pgprot_t(*phys_mem_access_prot)(struct file *file,
unsigned long pfn,
-- 
2.42.0



[PATCH v3 0/5] ppc, fbdev: Clean up fbdev mmap helper

2023-09-11 Thread Thomas Zimmermann
Clean up and rename fb_pgprotect() to work without struct file. Then
refactor the implementation for PowerPC. This change has been discussed
at [1] in the context of refactoring fbdev's mmap code.

The first two patches update fbdev and replace fbdev's fb_pgprotect()
with pgprot_framebuffer() on all architectures. The new helper's stream-
lined interface enables more refactoring within fbdev's mmap
implementation.

Patches 3 to 5 adapt PowerPC's internal interfaces to provide
phys_mem_access_prot() that works without struct file. Neither the
architecture code or fbdev helpers need the parameter.

v3:
* rename fb_pgrotect() to pgprot_framebuffer() (Arnd)
v2:
* reorder patches to simplify merging (Michael)

[1] 
https://lore.kernel.org/linuxppc-dev/5501ba80-bdb0-6344-16b0-0466a950f...@suse.com/

Thomas Zimmermann (5):
  fbdev: Avoid file argument in fb_pgprotect()
  fbdev: Replace fb_pgprotect() with fb_pgprot_device()
  arch/powerpc: Remove trailing whitespaces
  arch/powerpc: Remove file parameter from phys_mem_access_prot code
  arch/powerpc: Call internal __phys_mem_access_prot() in fbdev code

 arch/ia64/include/asm/fb.h| 15 +++
 arch/m68k/include/asm/fb.h| 19 ++-
 arch/mips/include/asm/fb.h| 11 +--
 arch/powerpc/include/asm/book3s/pgtable.h | 10 --
 arch/powerpc/include/asm/fb.h | 13 +
 arch/powerpc/include/asm/machdep.h| 13 ++---
 arch/powerpc/include/asm/nohash/pgtable.h | 10 --
 arch/powerpc/include/asm/pci.h|  4 +---
 arch/powerpc/kernel/pci-common.c  |  3 +--
 arch/powerpc/mm/mem.c |  8 
 arch/sparc/include/asm/fb.h   | 15 +--
 arch/x86/include/asm/fb.h | 10 ++
 arch/x86/video/fbdev.c| 15 ---
 drivers/video/fbdev/core/fb_chrdev.c  |  3 ++-
 include/asm-generic/fb.h  | 12 ++--
 15 files changed, 86 insertions(+), 75 deletions(-)

-- 
2.42.0



[PATCH v3 4/5] arch/powerpc: Remove file parameter from phys_mem_access_prot code

2023-09-11 Thread Thomas Zimmermann
Remove 'file' parameter from struct machdep_calls.phys_mem_access_prot
and its implementation in pci_phys_mem_access_prot(). The file is not
used on PowerPC. By removing it, a later patch can simplify fbdev's
mmap code, which uses phys_mem_access_prot() on PowerPC.

Signed-off-by: Thomas Zimmermann 
---
 arch/powerpc/include/asm/book3s/pgtable.h | 10 --
 arch/powerpc/include/asm/machdep.h|  3 +--
 arch/powerpc/include/asm/nohash/pgtable.h | 10 --
 arch/powerpc/include/asm/pci.h|  4 +---
 arch/powerpc/kernel/pci-common.c  |  3 +--
 arch/powerpc/mm/mem.c |  8 
 6 files changed, 23 insertions(+), 15 deletions(-)

diff --git a/arch/powerpc/include/asm/book3s/pgtable.h 
b/arch/powerpc/include/asm/book3s/pgtable.h
index d18b748ea3ae0..84e36a5726417 100644
--- a/arch/powerpc/include/asm/book3s/pgtable.h
+++ b/arch/powerpc/include/asm/book3s/pgtable.h
@@ -20,9 +20,15 @@ extern void set_pte_at(struct mm_struct *mm, unsigned long 
addr, pte_t *ptep,
 extern int ptep_set_access_flags(struct vm_area_struct *vma, unsigned long 
address,
 pte_t *ptep, pte_t entry, int dirty);
 
+extern pgprot_t __phys_mem_access_prot(unsigned long pfn, unsigned long size,
+  pgprot_t vma_prot);
+
 struct file;
-extern pgprot_t phys_mem_access_prot(struct file *file, unsigned long pfn,
-unsigned long size, pgprot_t vma_prot);
+static inline pgprot_t phys_mem_access_prot(struct file *file, unsigned long 
pfn,
+   unsigned long size, pgprot_t 
vma_prot)
+{
+   return __phys_mem_access_prot(pfn, size, vma_prot);
+}
 #define __HAVE_PHYS_MEM_ACCESS_PROT
 
 void __update_mmu_cache(struct vm_area_struct *vma, unsigned long address, 
pte_t *ptep);
diff --git a/arch/powerpc/include/asm/machdep.h 
b/arch/powerpc/include/asm/machdep.h
index 933465ed4c432..d31a5ec1550d4 100644
--- a/arch/powerpc/include/asm/machdep.h
+++ b/arch/powerpc/include/asm/machdep.h
@@ -106,8 +106,7 @@ struct machdep_calls {
int (*pci_get_legacy_ide_irq)(struct pci_dev *dev, int 
channel);
 
/* Get access protection for /dev/mem */
-   pgprot_t(*phys_mem_access_prot)(struct file *file,
-   unsigned long pfn,
+   pgprot_t(*phys_mem_access_prot)(unsigned long pfn,
unsigned long size,
pgprot_t vma_prot);
 
diff --git a/arch/powerpc/include/asm/nohash/pgtable.h 
b/arch/powerpc/include/asm/nohash/pgtable.h
index a6cb6f922..90366b0b3ad9a 100644
--- a/arch/powerpc/include/asm/nohash/pgtable.h
+++ b/arch/powerpc/include/asm/nohash/pgtable.h
@@ -246,9 +246,15 @@ extern int ptep_set_access_flags(struct vm_area_struct 
*vma, unsigned long addre
 
 #define pgprot_writecombine pgprot_noncached_wc
 
+extern pgprot_t __phys_mem_access_prot(unsigned long pfn, unsigned long size,
+  pgprot_t vma_prot);
+
 struct file;
-extern pgprot_t phys_mem_access_prot(struct file *file, unsigned long pfn,
-unsigned long size, pgprot_t vma_prot);
+static inline pgprot_t phys_mem_access_prot(struct file *file, unsigned long 
pfn,
+   unsigned long size, pgprot_t 
vma_prot)
+{
+   return __phys_mem_access_prot(pfn, size, vma_prot);
+}
 #define __HAVE_PHYS_MEM_ACCESS_PROT
 
 #ifdef CONFIG_HUGETLB_PAGE
diff --git a/arch/powerpc/include/asm/pci.h b/arch/powerpc/include/asm/pci.h
index 289f1ec85bc54..34ed4d51c546b 100644
--- a/arch/powerpc/include/asm/pci.h
+++ b/arch/powerpc/include/asm/pci.h
@@ -104,9 +104,7 @@ extern void of_scan_pci_bridge(struct pci_dev *dev);
 extern void of_scan_bus(struct device_node *node, struct pci_bus *bus);
 extern void of_rescan_bus(struct device_node *node, struct pci_bus *bus);
 
-struct file;
-extern pgprot_tpci_phys_mem_access_prot(struct file *file,
-unsigned long pfn,
+extern pgprot_tpci_phys_mem_access_prot(unsigned long pfn,
 unsigned long size,
 pgprot_t prot);
 
diff --git a/arch/powerpc/kernel/pci-common.c b/arch/powerpc/kernel/pci-common.c
index e88d7c9feeec3..73f12a17e572e 100644
--- a/arch/powerpc/kernel/pci-common.c
+++ b/arch/powerpc/kernel/pci-common.c
@@ -521,8 +521,7 @@ int pci_iobar_pfn(struct pci_dev *pdev, int bar, struct 
vm_area_struct *vma)
  * PCI device, it tries to find the PCI device first and calls the
  * above routine
  */
-pgprot_t pci_phys_mem_access_prot(struct file *file,
- unsigned long pfn,
+pgprot_t pci_phys_mem_access_prot(unsigned long pfn,
  unsigned long size,
  pgprot_

[PATCH v3 2/5] fbdev: Replace fb_pgprotect() with fb_pgprot_device()

2023-09-11 Thread Thomas Zimmermann
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.

v3:
* rename fb_pgprotect() to pgprot_framebuffer() (Arnd)

Signed-off-by: Thomas Zimmermann 
---
 arch/ia64/include/asm/fb.h   | 15 +++
 arch/m68k/include/asm/fb.h   | 19 ++-
 arch/mips/include/asm/fb.h   | 11 +--
 arch/powerpc/include/asm/fb.h| 13 +
 arch/sparc/include/asm/fb.h  | 15 +--
 arch/x86/include/asm/fb.h| 10 ++
 arch/x86/video/fbdev.c   | 15 ---
 drivers/video/fbdev/core/fb_chrdev.c |  3 ++-
 include/asm-generic/fb.h | 12 ++--
 9 files changed, 58 insertions(+), 55 deletions(-)

diff --git a/arch/ia64/include/asm/fb.h b/arch/ia64/include/asm/fb.h
index 1717b26fd423f..7fce0d5423590 100644
--- a/arch/ia64/include/asm/fb.h
+++ b/arch/ia64/include/asm/fb.h
@@ -8,17 +8,16 @@
 
 #include 
 
-struct file;
-
-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)
 {
-   if (efi_range_is_wc(vma->vm_start, vma->vm_end - vma->vm_start))
-   vma->vm_page_prot = pgprot_writecombine(vma->vm_page_prot);
+   if (efi_range_is_wc(vm_start, vm_end - vm_start))
+   return pgprot_writecombine(prot);
else
-   vma->vm_page_prot = pgprot_noncached(vma->vm_page_prot);
+   return pgprot_noncached(prot);
 }
-#define fb_pgprotect fb_pgprotect
+#define pgprot_framebuffer pgprot_framebuffer
 
 static inline void fb_memcpy_fromio(void *to, const volatile void __iomem 
*from, size_t n)
 {
diff --git a/arch/m68k/include/asm/fb.h b/arch/m68k/include/asm/fb.h
index 24273fc7ad917..9941b7434b696 100644
--- a/arch/m68k/include/asm/fb.h
+++ b/arch/m68k/include/asm/fb.h
@@ -5,26 +5,27 @@
 #include 
 #include 
 
-struct file;
-
-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)
 {
 #ifdef CONFIG_MMU
 #ifdef CONFIG_SUN3
-   pgprot_val(vma->vm_page_prot) |= SUN3_PAGE_NOCACHE;
+   pgprot_val(prot) |= SUN3_PAGE_NOCACHE;
 #else
if (CPU_IS_020_OR_030)
-   pgprot_val(vma->vm_page_prot) |= _PAGE_NOCACHE030;
+   pgprot_val(prot) |= _PAGE_NOCACHE030;
if (CPU_IS_040_OR_060) {
-   pgprot_val(vma->vm_page_prot) &= _CACHEMASK040;
+   pgprot_val(prot) &= _CACHEMASK040;
/* Use no-cache mode, serialized */
-   pgprot_val(vma->vm_page_prot) |= _PAGE_NOCACHE_S;
+   pgprot_val(prot) |= _PAGE_NOCACHE_S;
}
 #endif /* CONFIG_SUN3 */
 #endif /* CONFIG_MMU */
+
+   return prot;
 }
-#define fb_pgprotect fb_pgprotect
+#define pgprot_framebuffer pgprot_framebuffer
 
 #include 
 
diff --git a/arch/mips/include/asm/fb.h b/arch/mips/include/asm/fb.h
index 18b7226403bad..d98d6681d64ec 100644
--- a/arch/mips/include/asm/fb.h
+++ b/arch/mips/include/asm/fb.h
@@ -3,14 +3,13 @@
 
 #include 
 
-struct file;
-
-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)
 {
-   vma->vm_page_prot = pgprot_noncached(vma->vm_page_prot);
+   return pgprot_noncached(prot);
 }
-#define fb_pgprotect fb_pgprotect
+#define pgprot_framebuffer pgprot_framebuffer
 
 /*
  * MIPS doesn't define __raw_ I/O macros, so the helpers
diff --git a/arch/powerpc/include/asm/fb.h b/arch/powerpc/include/asm/fb.h
index 61e3b8806db69..3cecf14d51de8 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)

Re: [PATCH v3 2/5] fbdev: Replace fb_pgprotect() with fb_pgprot_device()

2023-09-11 Thread Thomas Zimmermann



Am 11.09.23 um 16:19 schrieb Christophe Leroy:


Le 11/09/2023 à 15:08, Thomas Zimmermann a écrit :

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.

v3:
* rename fb_pgprotect() to pgprot_framebuffer() (Arnd)


Then maybe the Subject: needs to be changed as well.


Arghh. Sorry.





Signed-off-by: Thomas Zimmermann 
---
   arch/ia64/include/asm/fb.h   | 15 +++
   arch/m68k/include/asm/fb.h   | 19 ++-
   arch/mips/include/asm/fb.h   | 11 +--
   arch/powerpc/include/asm/fb.h| 13 +
   arch/sparc/include/asm/fb.h  | 15 +--
   arch/x86/include/asm/fb.h| 10 ++
   arch/x86/video/fbdev.c   | 15 ---
   drivers/video/fbdev/core/fb_chrdev.c |  3 ++-
   include/asm-generic/fb.h | 12 ++--
   9 files changed, 58 insertions(+), 55 deletions(-)

diff --git a/arch/ia64/include/asm/fb.h b/arch/ia64/include/asm/fb.h
index 1717b26fd423f..7fce0d5423590 100644
--- a/arch/ia64/include/asm/fb.h
+++ b/arch/ia64/include/asm/fb.h
@@ -8,17 +8,16 @@
   
   #include 
   
-struct file;

-
-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)
   {
-   if (efi_range_is_wc(vma->vm_start, vma->vm_end - vma->vm_start))
-   vma->vm_page_prot = pgprot_writecombine(vma->vm_page_prot);
+   if (efi_range_is_wc(vm_start, vm_end - vm_start))
+   return pgprot_writecombine(prot);
else
-   vma->vm_page_prot = pgprot_noncached(vma->vm_page_prot);
+   return pgprot_noncached(prot);
   }
-#define fb_pgprotect fb_pgprotect
+#define pgprot_framebuffer pgprot_framebuffer
   
   static inline void fb_memcpy_fromio(void *to, const volatile void __iomem *from, size_t n)

   {
diff --git a/arch/m68k/include/asm/fb.h b/arch/m68k/include/asm/fb.h
index 24273fc7ad917..9941b7434b696 100644
--- a/arch/m68k/include/asm/fb.h
+++ b/arch/m68k/include/asm/fb.h
@@ -5,26 +5,27 @@
   #include 
   #include 
   
-struct file;

-
-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)
   {
   #ifdef CONFIG_MMU
   #ifdef CONFIG_SUN3
-   pgprot_val(vma->vm_page_prot) |= SUN3_PAGE_NOCACHE;
+   pgprot_val(prot) |= SUN3_PAGE_NOCACHE;
   #else
if (CPU_IS_020_OR_030)
-   pgprot_val(vma->vm_page_prot) |= _PAGE_NOCACHE030;
+   pgprot_val(prot) |= _PAGE_NOCACHE030;
if (CPU_IS_040_OR_060) {
-   pgprot_val(vma->vm_page_prot) &= _CACHEMASK040;
+   pgprot_val(prot) &= _CACHEMASK040;
/* Use no-cache mode, serialized */
-   pgprot_val(vma->vm_page_prot) |= _PAGE_NOCACHE_S;
+   pgprot_val(prot) |= _PAGE_NOCACHE_S;
}
   #endif /* CONFIG_SUN3 */
   #endif /* CONFIG_MMU */
+
+   return prot;
   }
-#define fb_pgprotect fb_pgprotect
+#define pgprot_framebuffer pgprot_framebuffer
   
   #include 
   
diff --git a/arch/mips/include/asm/fb.h b/arch/mips/include/asm/fb.h

index 18b7226403bad..d98d6681d64ec 100644
--- a/arch/mips/include/asm/fb.h
+++ b/arch/mips/include/asm/fb.h
@@ -3,14 +3,13 @@
   
   #include 
   
-struct file;

-
-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)
   {
-   vma->vm_page_prot = pgprot_noncached(vma->vm_page_prot);
+   return pgprot_noncached(prot);
   }
-#define fb_pgprotect fb_pgprotect
+#define pgprot_framebuffer pgprot_framebuffer
   
   /*

* MIPS doesn't define __raw_ I/O macros, so the helpers
diff --git a/arch/powerpc/include/asm/fb.h b/arch/powerpc/include/asm/fb.h
index 61e3b8806db69..3cecf14d51de8 100644
--- a/arch/powerpc/include/as

[PATCH v4 3/5] arch/powerpc: Remove trailing whitespaces

2023-09-12 Thread Thomas Zimmermann
Fix coding style. No functional changes.

Signed-off-by: Thomas Zimmermann 
---
 arch/powerpc/include/asm/machdep.h | 10 +-
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/arch/powerpc/include/asm/machdep.h 
b/arch/powerpc/include/asm/machdep.h
index 4f6e7d7ee3883..933465ed4c432 100644
--- a/arch/powerpc/include/asm/machdep.h
+++ b/arch/powerpc/include/asm/machdep.h
@@ -10,7 +10,7 @@
 #include 
 
 struct pt_regs;
-struct pci_bus;
+struct pci_bus;
 struct device_node;
 struct iommu_table;
 struct rtc_time;
@@ -78,8 +78,8 @@ struct machdep_calls {
unsigned char   (*nvram_read_val)(int addr);
void(*nvram_write_val)(int addr, unsigned char val);
ssize_t (*nvram_write)(char *buf, size_t count, loff_t *index);
-   ssize_t (*nvram_read)(char *buf, size_t count, loff_t *index);  
-   ssize_t (*nvram_size)(void);
+   ssize_t (*nvram_read)(char *buf, size_t count, loff_t *index);
+   ssize_t (*nvram_size)(void);
void(*nvram_sync)(void);
 
/* Exception handlers */
@@ -102,9 +102,9 @@ struct machdep_calls {
 */
long(*feature_call)(unsigned int feature, ...);
 
-   /* Get legacy PCI/IDE interrupt mapping */ 
+   /* Get legacy PCI/IDE interrupt mapping */
int (*pci_get_legacy_ide_irq)(struct pci_dev *dev, int 
channel);
-   
+
/* Get access protection for /dev/mem */
pgprot_t(*phys_mem_access_prot)(struct file *file,
unsigned long pfn,
-- 
2.42.0



[PATCH v4 2/5] fbdev: Replace fb_pgprotect() with pgprot_framebuffer()

2023-09-12 Thread Thomas Zimmermann
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 
---
 arch/ia64/include/asm/fb.h   | 15 +++
 arch/m68k/include/asm/fb.h   | 19 ++-
 arch/mips/include/asm/fb.h   | 11 +--
 arch/powerpc/include/asm/fb.h| 13 +
 arch/sparc/include/asm/fb.h  | 15 +--
 arch/x86/include/asm/fb.h| 10 ++
 arch/x86/video/fbdev.c   | 15 ---
 drivers/video/fbdev/core/fb_chrdev.c |  3 ++-
 include/asm-generic/fb.h | 12 ++--
 9 files changed, 58 insertions(+), 55 deletions(-)

diff --git a/arch/ia64/include/asm/fb.h b/arch/ia64/include/asm/fb.h
index 1717b26fd423f..7fce0d5423590 100644
--- a/arch/ia64/include/asm/fb.h
+++ b/arch/ia64/include/asm/fb.h
@@ -8,17 +8,16 @@
 
 #include 
 
-struct file;
-
-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)
 {
-   if (efi_range_is_wc(vma->vm_start, vma->vm_end - vma->vm_start))
-   vma->vm_page_prot = pgprot_writecombine(vma->vm_page_prot);
+   if (efi_range_is_wc(vm_start, vm_end - vm_start))
+   return pgprot_writecombine(prot);
else
-   vma->vm_page_prot = pgprot_noncached(vma->vm_page_prot);
+   return pgprot_noncached(prot);
 }
-#define fb_pgprotect fb_pgprotect
+#define pgprot_framebuffer pgprot_framebuffer
 
 static inline void fb_memcpy_fromio(void *to, const volatile void __iomem 
*from, size_t n)
 {
diff --git a/arch/m68k/include/asm/fb.h b/arch/m68k/include/asm/fb.h
index 24273fc7ad917..9941b7434b696 100644
--- a/arch/m68k/include/asm/fb.h
+++ b/arch/m68k/include/asm/fb.h
@@ -5,26 +5,27 @@
 #include 
 #include 
 
-struct file;
-
-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)
 {
 #ifdef CONFIG_MMU
 #ifdef CONFIG_SUN3
-   pgprot_val(vma->vm_page_prot) |= SUN3_PAGE_NOCACHE;
+   pgprot_val(prot) |= SUN3_PAGE_NOCACHE;
 #else
if (CPU_IS_020_OR_030)
-   pgprot_val(vma->vm_page_prot) |= _PAGE_NOCACHE030;
+   pgprot_val(prot) |= _PAGE_NOCACHE030;
if (CPU_IS_040_OR_060) {
-   pgprot_val(vma->vm_page_prot) &= _CACHEMASK040;
+   pgprot_val(prot) &= _CACHEMASK040;
/* Use no-cache mode, serialized */
-   pgprot_val(vma->vm_page_prot) |= _PAGE_NOCACHE_S;
+   pgprot_val(prot) |= _PAGE_NOCACHE_S;
}
 #endif /* CONFIG_SUN3 */
 #endif /* CONFIG_MMU */
+
+   return prot;
 }
-#define fb_pgprotect fb_pgprotect
+#define pgprot_framebuffer pgprot_framebuffer
 
 #include 
 
diff --git a/arch/mips/include/asm/fb.h b/arch/mips/include/asm/fb.h
index 18b7226403bad..d98d6681d64ec 100644
--- a/arch/mips/include/asm/fb.h
+++ b/arch/mips/include/asm/fb.h
@@ -3,14 +3,13 @@
 
 #include 
 
-struct file;
-
-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)
 {
-   vma->vm_page_prot = pgprot_noncached(vma->vm_page_prot);
+   return pgprot_noncached(prot);
 }
-#define fb_pgprotect fb_pgprotect
+#define pgprot_framebuffer pgprot_framebuffer
 
 /*
  * MIPS doesn't define __raw_ I/O macros, so the helpers
diff --git a/arch/powerpc/include/asm/fb.h b/arch/powerpc/include/asm/fb.h
index 61e3b8806db69..3cecf14d51de8 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,
-   

[PATCH v4 1/5] fbdev: Avoid file argument in fb_pgprotect()

2023-09-12 Thread Thomas Zimmermann
Only PowerPC's fb_pgprotect() needs the file argument, although
the implementation 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().

Suggested-by: Christophe Leroy 
Signed-off-by: Thomas Zimmermann 
---
 arch/powerpc/include/asm/fb.h | 7 ++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/arch/powerpc/include/asm/fb.h b/arch/powerpc/include/asm/fb.h
index 5f1a2e5f76548..61e3b8806db69 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);
 }
-- 
2.42.0



[PATCH v4 0/5] ppc, fbdev: Clean up fbdev mmap helper

2023-09-12 Thread Thomas Zimmermann
Clean up and rename fb_pgprotect() to work without struct file. Then
refactor the implementation for PowerPC. This change has been discussed
at [1] in the context of refactoring fbdev's mmap code.

The first two patches update fbdev and replace fbdev's fb_pgprotect()
with pgprot_framebuffer() on all architectures. The new helper's stream-
lined interface enables more refactoring within fbdev's mmap
implementation.

Patches 3 to 5 adapt PowerPC's internal interfaces to provide
phys_mem_access_prot() that works without struct file. Neither the
architecture code or fbdev helpers need the parameter.

v4:
* fix commit message (Christophe)
v3:
* rename fb_pgrotect() to pgprot_framebuffer() (Arnd)
v2:
* reorder patches to simplify merging (Michael)

[1] 
https://lore.kernel.org/linuxppc-dev/5501ba80-bdb0-6344-16b0-0466a950f...@suse.com/

Thomas Zimmermann (5):
  fbdev: Avoid file argument in fb_pgprotect()
  fbdev: Replace fb_pgprotect() with pgprot_framebuffer()
  arch/powerpc: Remove trailing whitespaces
  arch/powerpc: Remove file parameter from phys_mem_access_prot code
  arch/powerpc: Call internal __phys_mem_access_prot() in fbdev code

 arch/ia64/include/asm/fb.h| 15 +++
 arch/m68k/include/asm/fb.h| 19 ++-
 arch/mips/include/asm/fb.h| 11 +--
 arch/powerpc/include/asm/book3s/pgtable.h | 10 --
 arch/powerpc/include/asm/fb.h | 13 +
 arch/powerpc/include/asm/machdep.h| 13 ++---
 arch/powerpc/include/asm/nohash/pgtable.h | 10 --
 arch/powerpc/include/asm/pci.h|  4 +---
 arch/powerpc/kernel/pci-common.c  |  3 +--
 arch/powerpc/mm/mem.c |  8 
 arch/sparc/include/asm/fb.h   | 15 +--
 arch/x86/include/asm/fb.h | 10 ++
 arch/x86/video/fbdev.c| 15 ---
 drivers/video/fbdev/core/fb_chrdev.c  |  3 ++-
 include/asm-generic/fb.h  | 12 ++--
 15 files changed, 86 insertions(+), 75 deletions(-)

-- 
2.42.0



[PATCH v4 5/5] arch/powerpc: Call internal __phys_mem_access_prot() in fbdev code

2023-09-12 Thread Thomas Zimmermann
Call __phys_mem_access_prot() from the fbdev mmap helper
pgprot_framebuffer(). Allows to avoid the file argument of NULL.

Signed-off-by: Thomas Zimmermann 
---
 arch/powerpc/include/asm/fb.h | 7 +--
 1 file changed, 1 insertion(+), 6 deletions(-)

diff --git a/arch/powerpc/include/asm/fb.h b/arch/powerpc/include/asm/fb.h
index 3cecf14d51de8..c0c5d1df7ad1e 100644
--- a/arch/powerpc/include/asm/fb.h
+++ b/arch/powerpc/include/asm/fb.h
@@ -8,12 +8,7 @@ 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.
-*/
-   return phys_mem_access_prot(NULL, PHYS_PFN(offset), vm_end - vm_start, 
prot);
+   return __phys_mem_access_prot(PHYS_PFN(offset), vm_end - vm_start, 
prot);
 }
 #define pgprot_framebuffer pgprot_framebuffer
 
-- 
2.42.0



[PATCH v4 4/5] arch/powerpc: Remove file parameter from phys_mem_access_prot code

2023-09-12 Thread Thomas Zimmermann
Remove 'file' parameter from struct machdep_calls.phys_mem_access_prot
and its implementation in pci_phys_mem_access_prot(). The file is not
used on PowerPC. By removing it, a later patch can simplify fbdev's
mmap code, which uses phys_mem_access_prot() on PowerPC.

Signed-off-by: Thomas Zimmermann 
---
 arch/powerpc/include/asm/book3s/pgtable.h | 10 --
 arch/powerpc/include/asm/machdep.h|  3 +--
 arch/powerpc/include/asm/nohash/pgtable.h | 10 --
 arch/powerpc/include/asm/pci.h|  4 +---
 arch/powerpc/kernel/pci-common.c  |  3 +--
 arch/powerpc/mm/mem.c |  8 
 6 files changed, 23 insertions(+), 15 deletions(-)

diff --git a/arch/powerpc/include/asm/book3s/pgtable.h 
b/arch/powerpc/include/asm/book3s/pgtable.h
index d18b748ea3ae0..84e36a5726417 100644
--- a/arch/powerpc/include/asm/book3s/pgtable.h
+++ b/arch/powerpc/include/asm/book3s/pgtable.h
@@ -20,9 +20,15 @@ extern void set_pte_at(struct mm_struct *mm, unsigned long 
addr, pte_t *ptep,
 extern int ptep_set_access_flags(struct vm_area_struct *vma, unsigned long 
address,
 pte_t *ptep, pte_t entry, int dirty);
 
+extern pgprot_t __phys_mem_access_prot(unsigned long pfn, unsigned long size,
+  pgprot_t vma_prot);
+
 struct file;
-extern pgprot_t phys_mem_access_prot(struct file *file, unsigned long pfn,
-unsigned long size, pgprot_t vma_prot);
+static inline pgprot_t phys_mem_access_prot(struct file *file, unsigned long 
pfn,
+   unsigned long size, pgprot_t 
vma_prot)
+{
+   return __phys_mem_access_prot(pfn, size, vma_prot);
+}
 #define __HAVE_PHYS_MEM_ACCESS_PROT
 
 void __update_mmu_cache(struct vm_area_struct *vma, unsigned long address, 
pte_t *ptep);
diff --git a/arch/powerpc/include/asm/machdep.h 
b/arch/powerpc/include/asm/machdep.h
index 933465ed4c432..d31a5ec1550d4 100644
--- a/arch/powerpc/include/asm/machdep.h
+++ b/arch/powerpc/include/asm/machdep.h
@@ -106,8 +106,7 @@ struct machdep_calls {
int (*pci_get_legacy_ide_irq)(struct pci_dev *dev, int 
channel);
 
/* Get access protection for /dev/mem */
-   pgprot_t(*phys_mem_access_prot)(struct file *file,
-   unsigned long pfn,
+   pgprot_t(*phys_mem_access_prot)(unsigned long pfn,
unsigned long size,
pgprot_t vma_prot);
 
diff --git a/arch/powerpc/include/asm/nohash/pgtable.h 
b/arch/powerpc/include/asm/nohash/pgtable.h
index a6cb6f922..90366b0b3ad9a 100644
--- a/arch/powerpc/include/asm/nohash/pgtable.h
+++ b/arch/powerpc/include/asm/nohash/pgtable.h
@@ -246,9 +246,15 @@ extern int ptep_set_access_flags(struct vm_area_struct 
*vma, unsigned long addre
 
 #define pgprot_writecombine pgprot_noncached_wc
 
+extern pgprot_t __phys_mem_access_prot(unsigned long pfn, unsigned long size,
+  pgprot_t vma_prot);
+
 struct file;
-extern pgprot_t phys_mem_access_prot(struct file *file, unsigned long pfn,
-unsigned long size, pgprot_t vma_prot);
+static inline pgprot_t phys_mem_access_prot(struct file *file, unsigned long 
pfn,
+   unsigned long size, pgprot_t 
vma_prot)
+{
+   return __phys_mem_access_prot(pfn, size, vma_prot);
+}
 #define __HAVE_PHYS_MEM_ACCESS_PROT
 
 #ifdef CONFIG_HUGETLB_PAGE
diff --git a/arch/powerpc/include/asm/pci.h b/arch/powerpc/include/asm/pci.h
index 289f1ec85bc54..34ed4d51c546b 100644
--- a/arch/powerpc/include/asm/pci.h
+++ b/arch/powerpc/include/asm/pci.h
@@ -104,9 +104,7 @@ extern void of_scan_pci_bridge(struct pci_dev *dev);
 extern void of_scan_bus(struct device_node *node, struct pci_bus *bus);
 extern void of_rescan_bus(struct device_node *node, struct pci_bus *bus);
 
-struct file;
-extern pgprot_tpci_phys_mem_access_prot(struct file *file,
-unsigned long pfn,
+extern pgprot_tpci_phys_mem_access_prot(unsigned long pfn,
 unsigned long size,
 pgprot_t prot);
 
diff --git a/arch/powerpc/kernel/pci-common.c b/arch/powerpc/kernel/pci-common.c
index e88d7c9feeec3..73f12a17e572e 100644
--- a/arch/powerpc/kernel/pci-common.c
+++ b/arch/powerpc/kernel/pci-common.c
@@ -521,8 +521,7 @@ int pci_iobar_pfn(struct pci_dev *pdev, int bar, struct 
vm_area_struct *vma)
  * PCI device, it tries to find the PCI device first and calls the
  * above routine
  */
-pgprot_t pci_phys_mem_access_prot(struct file *file,
- unsigned long pfn,
+pgprot_t pci_phys_mem_access_prot(unsigned long pfn,
  unsigned long size,
  pgprot_

Re: [PATCH v4 0/5] ppc, fbdev: Clean up fbdev mmap helper

2023-09-18 Thread Thomas Zimmermann

Ping for a review.

I'd like to get at least the first two patches into the DRM git tree. 
The PPC patches could later be merged through another tree.


Best regards
Thomas

Am 12.09.23 um 15:48 schrieb Thomas Zimmermann:

Clean up and rename fb_pgprotect() to work without struct file. Then
refactor the implementation for PowerPC. This change has been discussed
at [1] in the context of refactoring fbdev's mmap code.

The first two patches update fbdev and replace fbdev's fb_pgprotect()
with pgprot_framebuffer() on all architectures. The new helper's stream-
lined interface enables more refactoring within fbdev's mmap
implementation.

Patches 3 to 5 adapt PowerPC's internal interfaces to provide
phys_mem_access_prot() that works without struct file. Neither the
architecture code or fbdev helpers need the parameter.

v4:
* fix commit message (Christophe)
v3:
* rename fb_pgrotect() to pgprot_framebuffer() (Arnd)
v2:
* reorder patches to simplify merging (Michael)

[1] 
https://lore.kernel.org/linuxppc-dev/5501ba80-bdb0-6344-16b0-0466a950f...@suse.com/

Thomas Zimmermann (5):
   fbdev: Avoid file argument in fb_pgprotect()
   fbdev: Replace fb_pgprotect() with pgprot_framebuffer()
   arch/powerpc: Remove trailing whitespaces
   arch/powerpc: Remove file parameter from phys_mem_access_prot code
   arch/powerpc: Call internal __phys_mem_access_prot() in fbdev code

  arch/ia64/include/asm/fb.h| 15 +++
  arch/m68k/include/asm/fb.h| 19 ++-
  arch/mips/include/asm/fb.h| 11 +--
  arch/powerpc/include/asm/book3s/pgtable.h | 10 --
  arch/powerpc/include/asm/fb.h | 13 +
  arch/powerpc/include/asm/machdep.h| 13 ++---
  arch/powerpc/include/asm/nohash/pgtable.h | 10 --
  arch/powerpc/include/asm/pci.h|  4 +---
  arch/powerpc/kernel/pci-common.c  |  3 +--
  arch/powerpc/mm/mem.c |  8 
  arch/sparc/include/asm/fb.h   | 15 +--
  arch/x86/include/asm/fb.h | 10 ++
  arch/x86/video/fbdev.c| 15 ---
  drivers/video/fbdev/core/fb_chrdev.c  |  3 ++-
  include/asm-generic/fb.h  | 12 ++--
  15 files changed, 86 insertions(+), 75 deletions(-)



--
Thomas Zimmermann
Graphics Driver Developer
SUSE Software Solutions Germany GmbH
Frankenstrasse 146, 90461 Nuernberg, Germany
GF: Ivo Totev, Andrew Myers, Andrew McDonald, Boudien Moerman
HRB 36809 (AG Nuernberg)


OpenPGP_signature.asc
Description: OpenPGP digital signature


Re: [PATCH v4 1/5] fbdev: Avoid file argument in fb_pgprotect()

2023-09-22 Thread Thomas Zimmermann

Hi Javier

Am 20.09.23 um 10:01 schrieb Javier Martinez Canillas:

Thomas Zimmermann  writes:

Hello Thomas,


Only PowerPC's fb_pgprotect() needs the file argument, although
the implementation does not use it. Pass NULL to the internal


Can you please mention the function that's the implementation for


Sure


PowerPC ? If I'm looking at the code correctly, that function is
phys_mem_access_prot() defined in the arch/powerpc/mm/mem.c file:

pgprot_t phys_mem_access_prot(struct file *file, unsigned long pfn,
  unsigned long size, pgprot_t vma_prot)
{
if (ppc_md.phys_mem_access_prot)
return ppc_md.phys_mem_access_prot(file, pfn, size, vma_prot);

if (!page_is_ram(pfn))
vma_prot = pgprot_noncached(vma_prot);

return vma_prot;
}

and if set, ppc_md.phys_mem_access_prot is pci_phys_mem_access_prot()
that is defined in the arch/powerpc/kernel/pci-common.c source file:

https://elixir.bootlin.com/linux/v6.6-rc2/source/arch/powerpc/kernel/pci-common.c#L524


Yes, that's correct. The only value for that function pointer appears to 
be pci_phys_mem_access_prot()




That function indeed doesn't use the file argument. So your patch looks
correct to me.

Reviewed-by: Javier Martinez Canillas 


Thanks

Best regards
Thomas





--
Thomas Zimmermann
Graphics Driver Developer
SUSE Software Solutions Germany GmbH
Frankenstrasse 146, 90461 Nuernberg, Germany
GF: Ivo Totev, Andrew Myers, Andrew McDonald, Boudien Moerman
HRB 36809 (AG Nuernberg)


OpenPGP_signature.asc
Description: OpenPGP digital signature


[PATCH v5 1/5] fbdev: Avoid file argument in fb_pgprotect()

2023-09-22 Thread Thomas Zimmermann
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 
---
 arch/powerpc/include/asm/fb.h | 7 ++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/arch/powerpc/include/asm/fb.h b/arch/powerpc/include/asm/fb.h
index 5f1a2e5f76548..61e3b8806db69 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);
 }
-- 
2.42.0



[PATCH v5 2/5] fbdev: Replace fb_pgprotect() with pgprot_framebuffer()

2023-09-22 Thread Thomas Zimmermann
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
---
 arch/ia64/include/asm/fb.h   | 15 +++
 arch/m68k/include/asm/fb.h   | 19 ++-
 arch/mips/include/asm/fb.h   | 11 +--
 arch/powerpc/include/asm/fb.h| 13 +
 arch/sparc/include/asm/fb.h  | 15 +--
 arch/x86/include/asm/fb.h| 10 ++
 arch/x86/video/fbdev.c   | 15 ---
 drivers/video/fbdev/core/fb_chrdev.c |  3 ++-
 include/asm-generic/fb.h | 12 ++--
 9 files changed, 58 insertions(+), 55 deletions(-)

diff --git a/arch/ia64/include/asm/fb.h b/arch/ia64/include/asm/fb.h
index 1717b26fd423f..7fce0d5423590 100644
--- a/arch/ia64/include/asm/fb.h
+++ b/arch/ia64/include/asm/fb.h
@@ -8,17 +8,16 @@
 
 #include 
 
-struct file;
-
-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)
 {
-   if (efi_range_is_wc(vma->vm_start, vma->vm_end - vma->vm_start))
-   vma->vm_page_prot = pgprot_writecombine(vma->vm_page_prot);
+   if (efi_range_is_wc(vm_start, vm_end - vm_start))
+   return pgprot_writecombine(prot);
else
-   vma->vm_page_prot = pgprot_noncached(vma->vm_page_prot);
+   return pgprot_noncached(prot);
 }
-#define fb_pgprotect fb_pgprotect
+#define pgprot_framebuffer pgprot_framebuffer
 
 static inline void fb_memcpy_fromio(void *to, const volatile void __iomem 
*from, size_t n)
 {
diff --git a/arch/m68k/include/asm/fb.h b/arch/m68k/include/asm/fb.h
index 24273fc7ad917..9941b7434b696 100644
--- a/arch/m68k/include/asm/fb.h
+++ b/arch/m68k/include/asm/fb.h
@@ -5,26 +5,27 @@
 #include 
 #include 
 
-struct file;
-
-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)
 {
 #ifdef CONFIG_MMU
 #ifdef CONFIG_SUN3
-   pgprot_val(vma->vm_page_prot) |= SUN3_PAGE_NOCACHE;
+   pgprot_val(prot) |= SUN3_PAGE_NOCACHE;
 #else
if (CPU_IS_020_OR_030)
-   pgprot_val(vma->vm_page_prot) |= _PAGE_NOCACHE030;
+   pgprot_val(prot) |= _PAGE_NOCACHE030;
if (CPU_IS_040_OR_060) {
-   pgprot_val(vma->vm_page_prot) &= _CACHEMASK040;
+   pgprot_val(prot) &= _CACHEMASK040;
/* Use no-cache mode, serialized */
-   pgprot_val(vma->vm_page_prot) |= _PAGE_NOCACHE_S;
+   pgprot_val(prot) |= _PAGE_NOCACHE_S;
}
 #endif /* CONFIG_SUN3 */
 #endif /* CONFIG_MMU */
+
+   return prot;
 }
-#define fb_pgprotect fb_pgprotect
+#define pgprot_framebuffer pgprot_framebuffer
 
 #include 
 
diff --git a/arch/mips/include/asm/fb.h b/arch/mips/include/asm/fb.h
index 18b7226403bad..d98d6681d64ec 100644
--- a/arch/mips/include/asm/fb.h
+++ b/arch/mips/include/asm/fb.h
@@ -3,14 +3,13 @@
 
 #include 
 
-struct file;
-
-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)
 {
-   vma->vm_page_prot = pgprot_noncached(vma->vm_page_prot);
+   return pgprot_noncached(prot);
 }
-#define fb_pgprotect fb_pgprotect
+#define pgprot_framebuffer pgprot_framebuffer
 
 /*
  * MIPS doesn't define __raw_ I/O macros, so the helpers
diff --git a/arch/powerpc/include/asm/fb.h b/arch/powerpc/include/asm/fb.h
index 61e3b8806db69..3cecf14d51de8 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 f

[PATCH v5 3/5] arch/powerpc: Remove trailing whitespaces

2023-09-22 Thread Thomas Zimmermann
Fix coding style. No functional changes.

Signed-off-by: Thomas Zimmermann 
Reviewed-by: Arnd Bergmann 
Reviewed-by: Philippe Mathieu-Daudé 
---
 arch/powerpc/include/asm/machdep.h | 10 +-
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/arch/powerpc/include/asm/machdep.h 
b/arch/powerpc/include/asm/machdep.h
index 4f6e7d7ee3883..933465ed4c432 100644
--- a/arch/powerpc/include/asm/machdep.h
+++ b/arch/powerpc/include/asm/machdep.h
@@ -10,7 +10,7 @@
 #include 
 
 struct pt_regs;
-struct pci_bus;
+struct pci_bus;
 struct device_node;
 struct iommu_table;
 struct rtc_time;
@@ -78,8 +78,8 @@ struct machdep_calls {
unsigned char   (*nvram_read_val)(int addr);
void(*nvram_write_val)(int addr, unsigned char val);
ssize_t (*nvram_write)(char *buf, size_t count, loff_t *index);
-   ssize_t (*nvram_read)(char *buf, size_t count, loff_t *index);  
-   ssize_t (*nvram_size)(void);
+   ssize_t (*nvram_read)(char *buf, size_t count, loff_t *index);
+   ssize_t (*nvram_size)(void);
void(*nvram_sync)(void);
 
/* Exception handlers */
@@ -102,9 +102,9 @@ struct machdep_calls {
 */
long(*feature_call)(unsigned int feature, ...);
 
-   /* Get legacy PCI/IDE interrupt mapping */ 
+   /* Get legacy PCI/IDE interrupt mapping */
int (*pci_get_legacy_ide_irq)(struct pci_dev *dev, int 
channel);
-   
+
/* Get access protection for /dev/mem */
pgprot_t(*phys_mem_access_prot)(struct file *file,
unsigned long pfn,
-- 
2.42.0



[PATCH v5 0/5] ppc, fbdev: Clean up fbdev mmap helper

2023-09-22 Thread Thomas Zimmermann
Clean up and rename fb_pgprotect() to work without struct file. Then
refactor the implementation for PowerPC. This change has been discussed
at [1] in the context of refactoring fbdev's mmap code.

The first two patches update fbdev and replace fbdev's fb_pgprotect()
with pgprot_framebuffer() on all architectures. The new helper's stream-
lined interface enables more refactoring within fbdev's mmap
implementation.

Patches 3 to 5 adapt PowerPC's internal interfaces to provide
phys_mem_access_prot() that works without struct file. Neither the
architecture code or fbdev helpers need the parameter.

v5:
* improve commit descriptions (Javier)
* add missing tags (Geert)
v4:
* fix commit message (Christophe)
v3:
* rename fb_pgrotect() to pgprot_framebuffer() (Arnd)
v2:
* reorder patches to simplify merging (Michael)

[1] 
https://lore.kernel.org/linuxppc-dev/5501ba80-bdb0-6344-16b0-0466a950f...@suse.com/

Thomas Zimmermann (5):
  fbdev: Avoid file argument in fb_pgprotect()
  fbdev: Replace fb_pgprotect() with pgprot_framebuffer()
  arch/powerpc: Remove trailing whitespaces
  arch/powerpc: Remove file parameter from phys_mem_access_prot code
  arch/powerpc: Call internal __phys_mem_access_prot() in fbdev code

 arch/ia64/include/asm/fb.h| 15 +++
 arch/m68k/include/asm/fb.h| 19 ++-
 arch/mips/include/asm/fb.h| 11 +--
 arch/powerpc/include/asm/book3s/pgtable.h | 10 --
 arch/powerpc/include/asm/fb.h | 13 +
 arch/powerpc/include/asm/machdep.h| 13 ++---
 arch/powerpc/include/asm/nohash/pgtable.h | 10 --
 arch/powerpc/include/asm/pci.h|  4 +---
 arch/powerpc/kernel/pci-common.c  |  3 +--
 arch/powerpc/mm/mem.c |  8 
 arch/sparc/include/asm/fb.h   | 15 +--
 arch/x86/include/asm/fb.h | 10 ++
 arch/x86/video/fbdev.c| 15 ---
 drivers/video/fbdev/core/fb_chrdev.c  |  3 ++-
 include/asm-generic/fb.h  | 12 ++--
 15 files changed, 86 insertions(+), 75 deletions(-)


base-commit: f8d21cb17a99b75862196036bb4bb93ee9637b74
-- 
2.42.0



[PATCH v5 5/5] arch/powerpc: Call internal __phys_mem_access_prot() in fbdev code

2023-09-22 Thread Thomas Zimmermann
Call __phys_mem_access_prot() from the fbdev mmap helper
pgprot_framebuffer(). Allows to avoid the file argument of NULL.

Signed-off-by: Thomas Zimmermann 
Reviewed-by: Arnd Bergmann 
---
 arch/powerpc/include/asm/fb.h | 7 +--
 1 file changed, 1 insertion(+), 6 deletions(-)

diff --git a/arch/powerpc/include/asm/fb.h b/arch/powerpc/include/asm/fb.h
index 3cecf14d51de8..c0c5d1df7ad1e 100644
--- a/arch/powerpc/include/asm/fb.h
+++ b/arch/powerpc/include/asm/fb.h
@@ -8,12 +8,7 @@ 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.
-*/
-   return phys_mem_access_prot(NULL, PHYS_PFN(offset), vm_end - vm_start, 
prot);
+   return __phys_mem_access_prot(PHYS_PFN(offset), vm_end - vm_start, 
prot);
 }
 #define pgprot_framebuffer pgprot_framebuffer
 
-- 
2.42.0



[PATCH v5 4/5] arch/powerpc: Remove file parameter from phys_mem_access_prot code

2023-09-22 Thread Thomas Zimmermann
Remove 'file' parameter from struct machdep_calls.phys_mem_access_prot
and its implementation in pci_phys_mem_access_prot(). The file is not
used on PowerPC. By removing it, a later patch can simplify fbdev's
mmap code, which uses phys_mem_access_prot() on PowerPC.

Signed-off-by: Thomas Zimmermann 
Reviewed-by: Arnd Bergmann 
---
 arch/powerpc/include/asm/book3s/pgtable.h | 10 --
 arch/powerpc/include/asm/machdep.h|  3 +--
 arch/powerpc/include/asm/nohash/pgtable.h | 10 --
 arch/powerpc/include/asm/pci.h|  4 +---
 arch/powerpc/kernel/pci-common.c  |  3 +--
 arch/powerpc/mm/mem.c |  8 
 6 files changed, 23 insertions(+), 15 deletions(-)

diff --git a/arch/powerpc/include/asm/book3s/pgtable.h 
b/arch/powerpc/include/asm/book3s/pgtable.h
index d18b748ea3ae0..84e36a5726417 100644
--- a/arch/powerpc/include/asm/book3s/pgtable.h
+++ b/arch/powerpc/include/asm/book3s/pgtable.h
@@ -20,9 +20,15 @@ extern void set_pte_at(struct mm_struct *mm, unsigned long 
addr, pte_t *ptep,
 extern int ptep_set_access_flags(struct vm_area_struct *vma, unsigned long 
address,
 pte_t *ptep, pte_t entry, int dirty);
 
+extern pgprot_t __phys_mem_access_prot(unsigned long pfn, unsigned long size,
+  pgprot_t vma_prot);
+
 struct file;
-extern pgprot_t phys_mem_access_prot(struct file *file, unsigned long pfn,
-unsigned long size, pgprot_t vma_prot);
+static inline pgprot_t phys_mem_access_prot(struct file *file, unsigned long 
pfn,
+   unsigned long size, pgprot_t 
vma_prot)
+{
+   return __phys_mem_access_prot(pfn, size, vma_prot);
+}
 #define __HAVE_PHYS_MEM_ACCESS_PROT
 
 void __update_mmu_cache(struct vm_area_struct *vma, unsigned long address, 
pte_t *ptep);
diff --git a/arch/powerpc/include/asm/machdep.h 
b/arch/powerpc/include/asm/machdep.h
index 933465ed4c432..d31a5ec1550d4 100644
--- a/arch/powerpc/include/asm/machdep.h
+++ b/arch/powerpc/include/asm/machdep.h
@@ -106,8 +106,7 @@ struct machdep_calls {
int (*pci_get_legacy_ide_irq)(struct pci_dev *dev, int 
channel);
 
/* Get access protection for /dev/mem */
-   pgprot_t(*phys_mem_access_prot)(struct file *file,
-   unsigned long pfn,
+   pgprot_t(*phys_mem_access_prot)(unsigned long pfn,
unsigned long size,
pgprot_t vma_prot);
 
diff --git a/arch/powerpc/include/asm/nohash/pgtable.h 
b/arch/powerpc/include/asm/nohash/pgtable.h
index a6cb6f922..90366b0b3ad9a 100644
--- a/arch/powerpc/include/asm/nohash/pgtable.h
+++ b/arch/powerpc/include/asm/nohash/pgtable.h
@@ -246,9 +246,15 @@ extern int ptep_set_access_flags(struct vm_area_struct 
*vma, unsigned long addre
 
 #define pgprot_writecombine pgprot_noncached_wc
 
+extern pgprot_t __phys_mem_access_prot(unsigned long pfn, unsigned long size,
+  pgprot_t vma_prot);
+
 struct file;
-extern pgprot_t phys_mem_access_prot(struct file *file, unsigned long pfn,
-unsigned long size, pgprot_t vma_prot);
+static inline pgprot_t phys_mem_access_prot(struct file *file, unsigned long 
pfn,
+   unsigned long size, pgprot_t 
vma_prot)
+{
+   return __phys_mem_access_prot(pfn, size, vma_prot);
+}
 #define __HAVE_PHYS_MEM_ACCESS_PROT
 
 #ifdef CONFIG_HUGETLB_PAGE
diff --git a/arch/powerpc/include/asm/pci.h b/arch/powerpc/include/asm/pci.h
index 289f1ec85bc54..34ed4d51c546b 100644
--- a/arch/powerpc/include/asm/pci.h
+++ b/arch/powerpc/include/asm/pci.h
@@ -104,9 +104,7 @@ extern void of_scan_pci_bridge(struct pci_dev *dev);
 extern void of_scan_bus(struct device_node *node, struct pci_bus *bus);
 extern void of_rescan_bus(struct device_node *node, struct pci_bus *bus);
 
-struct file;
-extern pgprot_tpci_phys_mem_access_prot(struct file *file,
-unsigned long pfn,
+extern pgprot_tpci_phys_mem_access_prot(unsigned long pfn,
 unsigned long size,
 pgprot_t prot);
 
diff --git a/arch/powerpc/kernel/pci-common.c b/arch/powerpc/kernel/pci-common.c
index e88d7c9feeec3..73f12a17e572e 100644
--- a/arch/powerpc/kernel/pci-common.c
+++ b/arch/powerpc/kernel/pci-common.c
@@ -521,8 +521,7 @@ int pci_iobar_pfn(struct pci_dev *pdev, int bar, struct 
vm_area_struct *vma)
  * PCI device, it tries to find the PCI device first and calls the
  * above routine
  */
-pgprot_t pci_phys_mem_access_prot(struct file *file,
- unsigned long pfn,
+pgprot_t pci_phys_mem_access_prot(unsigned long pfn,
  uns

Re: [PATCH v5 0/5] ppc, fbdev: Clean up fbdev mmap helper

2023-09-25 Thread Thomas Zimmermann
FYI, I intent to merge patches 1 and 2 of this patchset into 
drm-misc-next. The updates for PowerPC can be merged through PPC trees 
later. Let me know if this does not work for you.


Best regards
Thomas

Am 22.09.23 um 10:04 schrieb Thomas Zimmermann:

Clean up and rename fb_pgprotect() to work without struct file. Then
refactor the implementation for PowerPC. This change has been discussed
at [1] in the context of refactoring fbdev's mmap code.

The first two patches update fbdev and replace fbdev's fb_pgprotect()
with pgprot_framebuffer() on all architectures. The new helper's stream-
lined interface enables more refactoring within fbdev's mmap
implementation.

Patches 3 to 5 adapt PowerPC's internal interfaces to provide
phys_mem_access_prot() that works without struct file. Neither the
architecture code or fbdev helpers need the parameter.

v5:
* improve commit descriptions (Javier)
* add missing tags (Geert)
v4:
* fix commit message (Christophe)
v3:
* rename fb_pgrotect() to pgprot_framebuffer() (Arnd)
v2:
* reorder patches to simplify merging (Michael)

[1] 
https://lore.kernel.org/linuxppc-dev/5501ba80-bdb0-6344-16b0-0466a950f...@suse.com/

Thomas Zimmermann (5):
   fbdev: Avoid file argument in fb_pgprotect()
   fbdev: Replace fb_pgprotect() with pgprot_framebuffer()
   arch/powerpc: Remove trailing whitespaces
   arch/powerpc: Remove file parameter from phys_mem_access_prot code
   arch/powerpc: Call internal __phys_mem_access_prot() in fbdev code

  arch/ia64/include/asm/fb.h| 15 +++
  arch/m68k/include/asm/fb.h| 19 ++-
  arch/mips/include/asm/fb.h| 11 +--
  arch/powerpc/include/asm/book3s/pgtable.h | 10 --
  arch/powerpc/include/asm/fb.h | 13 +
  arch/powerpc/include/asm/machdep.h| 13 ++---
  arch/powerpc/include/asm/nohash/pgtable.h | 10 --
  arch/powerpc/include/asm/pci.h|  4 +---
  arch/powerpc/kernel/pci-common.c  |  3 +--
  arch/powerpc/mm/mem.c |  8 
  arch/sparc/include/asm/fb.h   | 15 +--
  arch/x86/include/asm/fb.h | 10 ++
  arch/x86/video/fbdev.c| 15 ---
  drivers/video/fbdev/core/fb_chrdev.c  |  3 ++-
  include/asm-generic/fb.h  | 12 ++--
  15 files changed, 86 insertions(+), 75 deletions(-)


base-commit: f8d21cb17a99b75862196036bb4bb93ee9637b74


--
Thomas Zimmermann
Graphics Driver Developer
SUSE Software Solutions Germany GmbH
Frankenstrasse 146, 90461 Nuernberg, Germany
GF: Ivo Totev, Andrew Myers, Andrew McDonald, Boudien Moerman
HRB 36809 (AG Nuernberg)


OpenPGP_signature.asc
Description: OpenPGP digital signature


Re: (subset) [PATCH v5 0/5] ppc, fbdev: Clean up fbdev mmap helper

2023-11-13 Thread Thomas Zimmermann



Am 13.11.23 um 03:45 schrieb Michael Ellerman:

On Fri, 22 Sep 2023 10:04:54 +0200, Thomas Zimmermann wrote:

Clean up and rename fb_pgprotect() to work without struct file. Then
refactor the implementation for PowerPC. This change has been discussed
at [1] in the context of refactoring fbdev's mmap code.

The first two patches update fbdev and replace fbdev's fb_pgprotect()
with pgprot_framebuffer() on all architectures. The new helper's stream-
lined interface enables more refactoring within fbdev's mmap
implementation.

[...]


Patches 3-5 applied to powerpc/fixes.

[3/5] arch/powerpc: Remove trailing whitespaces
   https://git.kernel.org/powerpc/c/322948c3198cf80e7c10d953ddad24ebd85757cd
[4/5] arch/powerpc: Remove file parameter from phys_mem_access_prot code
   https://git.kernel.org/powerpc/c/1f92a844c35e483c00bab8a7b7d39c555ee799d8
[5/5] arch/powerpc: Call internal __phys_mem_access_prot() in fbdev code
   https://git.kernel.org/powerpc/c/deebe5f607d7f72f83c41163191ad0c1c4356385


Great, thanks a lot!



cheers


--
Thomas Zimmermann
Graphics Driver Developer
SUSE Software Solutions Germany GmbH
Frankenstrasse 146, 90461 Nuernberg, Germany
GF: Ivo Totev, Andrew Myers, Andrew McDonald, Boudien Moerman
HRB 36809 (AG Nuernberg)


OpenPGP_signature.asc
Description: OpenPGP digital signature


[PATCH 19/32] fbdev/ps3fb: Initialize fb_ops with fbdev macros

2023-11-15 Thread Thomas Zimmermann
Initialize the instance of struct fb_ops with fbdev initializer
macros for framebuffers in virtual address space. Set the read/write,
draw and mmap callbacks to the correct implementation and avoid
implicit defaults. Also select the necessary helpers in Kconfig.

Fbdev drivers sometimes rely on the callbacks being NULL for a
default I/O-memory-based implementation to be invoked; hence
requiring the I/O helpers to be built in any case. Setting all
callbacks in all drivers explicitly will allow to make the I/O
helpers optional. This benefits systems that do not use these
functions.

Signed-off-by: Thomas Zimmermann 
Cc: Michael Ellerman 
Cc: Nicholas Piggin 
Cc: Christophe Leroy 
Cc: linuxppc-dev@lists.ozlabs.org
---
 drivers/video/fbdev/Kconfig | 5 +
 drivers/video/fbdev/ps3fb.c | 7 ++-
 2 files changed, 3 insertions(+), 9 deletions(-)

diff --git a/drivers/video/fbdev/Kconfig b/drivers/video/fbdev/Kconfig
index 2445cbca85579..812b3a9a49507 100644
--- a/drivers/video/fbdev/Kconfig
+++ b/drivers/video/fbdev/Kconfig
@@ -1715,10 +1715,7 @@ config FB_IBM_GXT4500
 config FB_PS3
tristate "PS3 GPU framebuffer driver"
depends on FB && PS3_PS3AV
-   select FB_SYS_FILLRECT
-   select FB_SYS_COPYAREA
-   select FB_SYS_IMAGEBLIT
-   select FB_SYS_FOPS
+   select FB_SYSMEM_HELPERS
help
  Include support for the virtual frame buffer in the PS3 platform.
 
diff --git a/drivers/video/fbdev/ps3fb.c b/drivers/video/fbdev/ps3fb.c
index de81ad3a5d1ed..de8d78bf070a0 100644
--- a/drivers/video/fbdev/ps3fb.c
+++ b/drivers/video/fbdev/ps3fb.c
@@ -939,15 +939,12 @@ static const struct fb_ops ps3fb_ops = {
.owner  = THIS_MODULE,
.fb_open= ps3fb_open,
.fb_release = ps3fb_release,
-   .fb_read= fb_sys_read,
-   .fb_write   = fb_sys_write,
+   __FB_DEFAULT_SYSMEM_OPS_RDWR,
.fb_check_var   = ps3fb_check_var,
.fb_set_par = ps3fb_set_par,
.fb_setcolreg   = ps3fb_setcolreg,
.fb_pan_display = ps3fb_pan_display,
-   .fb_fillrect= sys_fillrect,
-   .fb_copyarea= sys_copyarea,
-   .fb_imageblit   = sys_imageblit,
+   __FB_DEFAULT_SYSMEM_OPS_DRAW,
.fb_mmap= ps3fb_mmap,
.fb_blank   = ps3fb_blank,
.fb_ioctl   = ps3fb_ioctl,
-- 
2.42.0



[PATCH 18/32] fbdev/ps3fb: Set FBINFO_VIRTFB flag

2023-11-15 Thread Thomas Zimmermann
The ps3fb driver operates on system memory. Mark the framebuffer
accordingly. Helpers operating on the framebuffer memory will test
for the presence of this flag.

Signed-off-by: Thomas Zimmermann 
Cc: Michael Ellerman 
Cc: Nicholas Piggin 
Cc: Christophe Leroy 
Cc: linuxppc-dev@lists.ozlabs.org
---
 drivers/video/fbdev/ps3fb.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/video/fbdev/ps3fb.c b/drivers/video/fbdev/ps3fb.c
index 64d291d6b1532..de81ad3a5d1ed 100644
--- a/drivers/video/fbdev/ps3fb.c
+++ b/drivers/video/fbdev/ps3fb.c
@@ -1145,7 +1145,7 @@ static int ps3fb_probe(struct ps3_system_bus_device *dev)
info->fix.smem_len = ps3fb_videomemory.size - GPU_FB_START;
 
info->pseudo_palette = par->pseudo_palette;
-   info->flags = FBINFO_READS_FAST |
+   info->flags = FBINFO_VIRTFB | FBINFO_READS_FAST |
  FBINFO_HWACCEL_XPAN | FBINFO_HWACCEL_YPAN;
 
retval = fb_alloc_cmap(&info->cmap, 256, 0);
-- 
2.42.0



[PATCH 10/12] fbdev/core: Use fb_is_primary_device() in fb_firmware_edid()

2023-06-29 Thread Thomas Zimmermann
Detect the primary VGA device with fb_is_primary_device() in the
implementation of fb_firmware_edid(). Remove the existing code.

Adapt the function to receive an instance of struct fb_info and
update all callers.

Signed-off-by: Thomas Zimmermann 
Cc: Daniel Vetter 
Cc: Helge Deller 
Cc: Antonino Daplas 
Cc: Maik Broemme 
Cc: Randy Dunlap 
---
 drivers/video/fbdev/core/fbmon.c  | 25 +++
 drivers/video/fbdev/i810/i810-i2c.c   |  2 +-
 drivers/video/fbdev/intelfb/intelfbdrv.c  |  2 +-
 drivers/video/fbdev/nvidia/nv_i2c.c   |  2 +-
 drivers/video/fbdev/savage/savagefb-i2c.c |  2 +-
 include/linux/fb.h|  2 +-
 6 files changed, 12 insertions(+), 23 deletions(-)

diff --git a/drivers/video/fbdev/core/fbmon.c b/drivers/video/fbdev/core/fbmon.c
index 79e5bfbdd34c2..35be4431f649a 100644
--- a/drivers/video/fbdev/core/fbmon.c
+++ b/drivers/video/fbdev/core/fbmon.c
@@ -28,7 +28,6 @@
  */
 #include 
 #include 
-#include 
 #include 
 #include 
 #include 
@@ -1482,31 +1481,21 @@ int fb_validate_mode(const struct fb_var_screeninfo 
*var, struct fb_info *info)
 }
 
 #if defined(CONFIG_FIRMWARE_EDID) && defined(CONFIG_X86)
-
-/*
- * We need to ensure that the EDID block is only returned for
- * the primary graphics adapter.
- */
-
-const unsigned char *fb_firmware_edid(struct device *device)
+const unsigned char *fb_firmware_edid(struct fb_info *info)
 {
-   struct pci_dev *dev = NULL;
-   struct resource *res = NULL;
unsigned char *edid = NULL;
 
-   if (device)
-   dev = to_pci_dev(device);
-
-   if (dev)
-   res = &dev->resource[PCI_ROM_RESOURCE];
-
-   if (res && res->flags & IORESOURCE_ROM_SHADOW)
+   /*
+* We need to ensure that the EDID block is only
+* returned for the primary graphics adapter.
+*/
+   if (fb_is_primary_device(info))
edid = edid_info.dummy;
 
return edid;
 }
 #else
-const unsigned char *fb_firmware_edid(struct device *device)
+const unsigned char *fb_firmware_edid(struct fb_info *info)
 {
return NULL;
 }
diff --git a/drivers/video/fbdev/i810/i810-i2c.c 
b/drivers/video/fbdev/i810/i810-i2c.c
index 7db17d0d8a8cf..b605e96620c1f 100644
--- a/drivers/video/fbdev/i810/i810-i2c.c
+++ b/drivers/video/fbdev/i810/i810-i2c.c
@@ -161,7 +161,7 @@ int i810_probe_i2c_connector(struct fb_info *info, u8 
**out_edid, int conn)
if (conn < par->ddc_num) {
edid = fb_ddc_read(&par->chan[conn].adapter);
} else {
-   const u8 *e = fb_firmware_edid(info->device);
+   const u8 *e = fb_firmware_edid(info);
 
if (e != NULL) {
DPRINTK("i810-i2c: Getting EDID from BIOS\n");
diff --git a/drivers/video/fbdev/intelfb/intelfbdrv.c 
b/drivers/video/fbdev/intelfb/intelfbdrv.c
index a81095b2b1ea5..4633a75e3a613 100644
--- a/drivers/video/fbdev/intelfb/intelfbdrv.c
+++ b/drivers/video/fbdev/intelfb/intelfbdrv.c
@@ -1024,7 +1024,7 @@ static int intelfb_init_var(struct intelfb_info *dinfo)
   sizeof(struct fb_var_screeninfo));
msrc = 5;
} else {
-   const u8 *edid_s = fb_firmware_edid(&dinfo->pdev->dev);
+   const u8 *edid_s = fb_firmware_edid(dinfo->info);
u8 *edid_d = NULL;
 
if (edid_s) {
diff --git a/drivers/video/fbdev/nvidia/nv_i2c.c 
b/drivers/video/fbdev/nvidia/nv_i2c.c
index 0b48965a6420c..632e7d622ebfa 100644
--- a/drivers/video/fbdev/nvidia/nv_i2c.c
+++ b/drivers/video/fbdev/nvidia/nv_i2c.c
@@ -159,7 +159,7 @@ int nvidia_probe_i2c_connector(struct fb_info *info, int 
conn, u8 **out_edid)
 
if (!edid && conn == 1) {
/* try to get from firmware */
-   const u8 *e = fb_firmware_edid(info->device);
+   const u8 *e = fb_firmware_edid(info);
 
if (e != NULL)
edid = kmemdup(e, EDID_LENGTH, GFP_KERNEL);
diff --git a/drivers/video/fbdev/savage/savagefb-i2c.c 
b/drivers/video/fbdev/savage/savagefb-i2c.c
index 80fa87e2ae2ff..cf9c376f76526 100644
--- a/drivers/video/fbdev/savage/savagefb-i2c.c
+++ b/drivers/video/fbdev/savage/savagefb-i2c.c
@@ -227,7 +227,7 @@ int savagefb_probe_i2c_connector(struct fb_info *info, u8 
**out_edid)
 
if (!edid) {
/* try to get from firmware */
-   const u8 *e = fb_firmware_edid(info->device);
+   const u8 *e = fb_firmware_edid(info);
 
if (e)
edid = kmemdup(e, EDID_LENGTH, GFP_KERNEL);
diff --git a/include/linux/fb.h b/include/linux/fb.h
index 1d5c13f34b098..5ffd2223326bf 100644
--- a/include/linux/fb.h
+++ b/include/linux/fb.h
@@ -761,7 +761,7 @@ extern int fb_get_mode(int flags, u32 val, struct 
fb_var_screeninfo *var,
 extern int fb_validate_mode(const struct fb_var_screeninfo

[PATCH 07/12] arch/x86: Declare edid_info in

2023-06-29 Thread Thomas Zimmermann
The global variable edid_info contains the firmware's EDID information
as an extension to the regular screen_info on x86. Therefore move it to
.

Add the Kconfig token ARCH_HAS_EDID_INFO to guard against access on
architectures that don't provide edid_info. Select it on x86.

Signed-off-by: Thomas Zimmermann 
Cc: Thomas Gleixner 
Cc: Ingo Molnar 
Cc: Borislav Petkov 
Cc: Dave Hansen 
Cc: x...@kernel.org
Cc: "H. Peter Anvin" 
Cc: Helge Deller 
Cc: Arnd Bergmann 
Cc: Kees Cook 
Cc: "Paul E. McKenney" 
Cc: Peter Zijlstra 
Cc: Andrew Morton 
Cc: Frederic Weisbecker 
Cc: Nicholas Piggin 
Cc: Ard Biesheuvel 
Cc: Sami Tolvanen 
Cc: Juerg Haefliger 
---
 arch/Kconfig  | 6 ++
 arch/x86/Kconfig  | 1 +
 drivers/video/Kconfig | 3 ---
 include/asm-generic/screen_info.h | 6 ++
 include/video/edid.h  | 3 ---
 5 files changed, 13 insertions(+), 6 deletions(-)

diff --git a/arch/Kconfig b/arch/Kconfig
index 2f58293fd7bcb..ee9866e4df2b0 100644
--- a/arch/Kconfig
+++ b/arch/Kconfig
@@ -1466,6 +1466,12 @@ config ARCH_HAS_NONLEAF_PMD_YOUNG
  address translations. Page table walkers that clear the accessed bit
  may use this capability to reduce their search space.
 
+config ARCH_HAS_EDID_INFO
+   bool
+   help
+ Selected by architectures that provide a global instance of
+ edid_info.
+
 config ARCH_HAS_SCREEN_INFO
bool
help
diff --git a/arch/x86/Kconfig b/arch/x86/Kconfig
index d7c2bf4ee403d..ee81855116be7 100644
--- a/arch/x86/Kconfig
+++ b/arch/x86/Kconfig
@@ -76,6 +76,7 @@ config X86
select ARCH_HAS_DEBUG_VM_PGTABLEif !X86_PAE
select ARCH_HAS_DEVMEM_IS_ALLOWED
select ARCH_HAS_EARLY_DEBUG if KGDB
+   select ARCH_HAS_EDID_INFO
select ARCH_HAS_ELF_RANDOMIZE
select ARCH_HAS_FAST_MULTIPLIER
select ARCH_HAS_FORTIFY_SOURCE
diff --git a/drivers/video/Kconfig b/drivers/video/Kconfig
index d4a72bea56be0..8b2b9ac37c3df 100644
--- a/drivers/video/Kconfig
+++ b/drivers/video/Kconfig
@@ -21,9 +21,6 @@ config STI_CORE
 config VIDEO_CMDLINE
bool
 
-config ARCH_HAS_SCREEN_INFO
-   bool
-
 config VIDEO_NOMODESET
bool
default n
diff --git a/include/asm-generic/screen_info.h 
b/include/asm-generic/screen_info.h
index 6fd0e50fabfcd..5efc99c296b40 100644
--- a/include/asm-generic/screen_info.h
+++ b/include/asm-generic/screen_info.h
@@ -5,6 +5,12 @@
 
 #include 
 
+#include 
+
+#if defined(CONFIG_ARCH_HAS_EDID_INFO)
+extern struct edid_info edid_info;
+#endif
+
 #if defined(CONFIG_ARCH_HAS_SCREEN_INFO)
 extern struct screen_info screen_info;
 #endif
diff --git a/include/video/edid.h b/include/video/edid.h
index f614371e9116a..52aabb7060321 100644
--- a/include/video/edid.h
+++ b/include/video/edid.h
@@ -4,7 +4,4 @@
 
 #include 
 
-#ifdef CONFIG_X86
-extern struct edid_info edid_info;
-#endif
 #endif /* __linux_video_edid_h__ */
-- 
2.41.0



[PATCH 02/12] fbdev/sm712fb: Do not include

2023-06-29 Thread Thomas Zimmermann
Sm712fb's dependency on  is artificial in that
it only uses struct screen_info for its internals. Replace the use of
struct screen_info with a custom data structure and remove the include
of .

Signed-off-by: Thomas Zimmermann 
Cc: Sudip Mukherjee 
Cc: Teddy Wang 
Cc: Helge Deller 
---
 drivers/video/fbdev/sm712fb.c | 9 +++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/drivers/video/fbdev/sm712fb.c b/drivers/video/fbdev/sm712fb.c
index b7ad3c644e138..f929091da4e77 100644
--- a/drivers/video/fbdev/sm712fb.c
+++ b/drivers/video/fbdev/sm712fb.c
@@ -27,12 +27,17 @@
 #include 
 #include 
 #include 
-#include 
 
 #include 
 
 #include "sm712.h"
 
+struct smtcfb_screen_info {
+   u16 lfb_width;
+   u16 lfb_height;
+   u16 lfb_depth;
+};
+
 /*
  * Private structure
  */
@@ -829,7 +834,7 @@ static const struct modeinit vgamode[] = {
},
 };
 
-static struct screen_info smtc_scr_info;
+static struct smtcfb_screen_info smtc_scr_info;
 
 static char *mode_option;
 
-- 
2.41.0



[PATCH 08/12] drivers/firmware: Remove trailing whitespaces

2023-06-29 Thread Thomas Zimmermann
Fix coding style. No functional changes.

Signed-off-by: Thomas Zimmermann 
---
 drivers/firmware/Kconfig | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/firmware/Kconfig b/drivers/firmware/Kconfig
index b59e3041fd627..0432737bbb8b4 100644
--- a/drivers/firmware/Kconfig
+++ b/drivers/firmware/Kconfig
@@ -99,7 +99,7 @@ config EFI_PCDP
  You must also enable the appropriate drivers (serial, VGA, etc.)
 
  See DIG64_HCDPv20_042804.pdf available from
- <http://www.dig64.org/specifications/> 
+ <http://www.dig64.org/specifications/>
 
 config DMIID
 bool "Export DMI identification via sysfs to userspace"
-- 
2.41.0



[PATCH 12/12] fbdev/core: Define empty fb_firmware_edid() in

2023-06-29 Thread Thomas Zimmermann
Move the empty declaration of fb_firmware_edid() to .
Follow common style and avoid the overhead of exporting the symbol.
No functional changes.

Signed-off-by: Thomas Zimmermann 
Cc: Daniel Vetter 
Cc: Helge Deller 
Cc: Randy Dunlap 
---
 drivers/video/fbdev/core/fbmon.c |  7 +--
 include/linux/fb.h   | 10 +-
 2 files changed, 10 insertions(+), 7 deletions(-)

diff --git a/drivers/video/fbdev/core/fbmon.c b/drivers/video/fbdev/core/fbmon.c
index 9ae063021e431..d45bd8a18c2f2 100644
--- a/drivers/video/fbdev/core/fbmon.c
+++ b/drivers/video/fbdev/core/fbmon.c
@@ -1496,13 +1496,8 @@ const unsigned char *fb_firmware_edid(struct fb_info 
*info)
 
return edid;
 }
-#else
-const unsigned char *fb_firmware_edid(struct fb_info *info)
-{
-   return NULL;
-}
-#endif
 EXPORT_SYMBOL(fb_firmware_edid);
+#endif
 
 EXPORT_SYMBOL(fb_parse_edid);
 EXPORT_SYMBOL(fb_edid_to_monspecs);
diff --git a/include/linux/fb.h b/include/linux/fb.h
index 5ffd2223326bf..e949532ffc109 100644
--- a/include/linux/fb.h
+++ b/include/linux/fb.h
@@ -761,7 +761,6 @@ extern int fb_get_mode(int flags, u32 val, struct 
fb_var_screeninfo *var,
 extern int fb_validate_mode(const struct fb_var_screeninfo *var,
struct fb_info *info);
 extern int fb_parse_edid(unsigned char *edid, struct fb_var_screeninfo *var);
-extern const unsigned char *fb_firmware_edid(struct fb_info *info);
 extern void fb_edid_to_monspecs(unsigned char *edid,
struct fb_monspecs *specs);
 extern void fb_destroy_modedb(struct fb_videomode *modedb);
@@ -774,6 +773,15 @@ extern int of_get_fb_videomode(struct device_node *np,
 extern int fb_videomode_from_videomode(const struct videomode *vm,
   struct fb_videomode *fbmode);
 
+#if defined(CONFIG_FIRMWARE_EDID)
+const unsigned char *fb_firmware_edid(struct fb_info *info);
+#else
+static inline const unsigned char *fb_firmware_edid(struct fb_info *info)
+{
+   return NULL;
+}
+#endif
+
 /* drivers/video/modedb.c */
 #define VESA_MODEDB_SIZE 43
 #define DMT_SIZE 0x50
-- 
2.41.0



[PATCH 09/12] drivers: Add dependencies on CONFIG_ARCH_HAS_SCREEN_INFO

2023-06-29 Thread Thomas Zimmermann
Various files within drivers/ depend on the declaration of the
screen_info variable. Add this information to Kconfig.

In the case of the dummy console, the dependency exists only
on ARM. Ignore it on !ARM platforms.

Signed-off-by: Thomas Zimmermann 
Cc: Ard Biesheuvel 
Cc: Maarten Lankhorst 
Cc: Maxime Ripard 
Cc: David Airlie 
Cc: Daniel Vetter 
Cc: "K. Y. Srinivasan" 
Cc: Haiyang Zhang 
Cc: Wei Liu 
Cc: Dexuan Cui 
Cc: Greg Kroah-Hartman 
Cc: Helge Deller 
Cc: Arnd Bergmann 
Cc: Javier Martinez Canillas 
Cc: Randy Dunlap 
Cc: Andy Shevchenko 
---
 drivers/firmware/Kconfig  | 1 +
 drivers/firmware/efi/Kconfig  | 1 +
 drivers/gpu/drm/Kconfig   | 1 +
 drivers/hv/Kconfig| 1 +
 drivers/video/console/Kconfig | 2 ++
 drivers/video/fbdev/Kconfig   | 4 
 6 files changed, 10 insertions(+)

diff --git a/drivers/firmware/Kconfig b/drivers/firmware/Kconfig
index 0432737bbb8b4..65bbf7422f1db 100644
--- a/drivers/firmware/Kconfig
+++ b/drivers/firmware/Kconfig
@@ -228,6 +228,7 @@ config QCOM_SCM_DOWNLOAD_MODE_DEFAULT
 
 config SYSFB
bool
+   depends on ARCH_HAS_SCREEN_INFO
select BOOT_VESA_SUPPORT
 
 config SYSFB_SIMPLEFB
diff --git a/drivers/firmware/efi/Kconfig b/drivers/firmware/efi/Kconfig
index 043ca31c114eb..963d305421e50 100644
--- a/drivers/firmware/efi/Kconfig
+++ b/drivers/firmware/efi/Kconfig
@@ -225,6 +225,7 @@ config EFI_DISABLE_PCI_DMA
 config EFI_EARLYCON
def_bool y
depends on SERIAL_EARLYCON && !ARM && !IA64
+   depends on ARCH_HAS_SCREEN_INFO
select FONT_SUPPORT
select ARCH_USE_MEMREMAP_PROT
 
diff --git a/drivers/gpu/drm/Kconfig b/drivers/gpu/drm/Kconfig
index afb3b2f5f4253..63dfc3391d2ff 100644
--- a/drivers/gpu/drm/Kconfig
+++ b/drivers/gpu/drm/Kconfig
@@ -366,6 +366,7 @@ source "drivers/gpu/drm/sprd/Kconfig"
 config DRM_HYPERV
tristate "DRM Support for Hyper-V synthetic video device"
depends on DRM && PCI && MMU && HYPERV
+   depends on ARCH_HAS_SCREEN_INFO
select DRM_KMS_HELPER
select DRM_GEM_SHMEM_HELPER
help
diff --git a/drivers/hv/Kconfig b/drivers/hv/Kconfig
index 00242107d62e0..3730c9b42a9bd 100644
--- a/drivers/hv/Kconfig
+++ b/drivers/hv/Kconfig
@@ -6,6 +6,7 @@ config HYPERV
tristate "Microsoft Hyper-V client drivers"
depends on (X86 && X86_LOCAL_APIC && HYPERVISOR_GUEST) \
|| (ACPI && ARM64 && !CPU_BIG_ENDIAN)
+   depends on ARCH_HAS_SCREEN_INFO
select PARAVIRT
select X86_HV_CALLBACK_VECTOR if X86
select OF_EARLY_FLATTREE if OF
diff --git a/drivers/video/console/Kconfig b/drivers/video/console/Kconfig
index a2a88d42edf0c..b39e2ae039783 100644
--- a/drivers/video/console/Kconfig
+++ b/drivers/video/console/Kconfig
@@ -10,6 +10,7 @@ config VGA_CONSOLE
depends on !4xx && !PPC_8xx && !SPARC && !M68K && !PARISC &&  !SUPERH 
&& \
(!ARM || ARCH_FOOTBRIDGE || ARCH_INTEGRATOR || ARCH_NETWINDER) 
&& \
!ARM64 && !ARC && !MICROBLAZE && !OPENRISC && !S390 && !UML
+   depends on ARCH_HAS_SCREEN_INFO
select APERTURE_HELPERS if (DRM || FB || VFIO_PCI_CORE)
default y
help
@@ -48,6 +49,7 @@ config SGI_NEWPORT_CONSOLE
 
 config DUMMY_CONSOLE
bool
+   depends on ARCH_HAS_SCREEN_INFO || !ARM
default y
 
 config DUMMY_CONSOLE_COLUMNS
diff --git a/drivers/video/fbdev/Kconfig b/drivers/video/fbdev/Kconfig
index cecf15418632d..e11d85e802bc7 100644
--- a/drivers/video/fbdev/Kconfig
+++ b/drivers/video/fbdev/Kconfig
@@ -655,6 +655,7 @@ config FB_UVESA
 config FB_VESA
bool "VESA VGA graphics support"
depends on (FB = y) && X86
+   depends on ARCH_HAS_SCREEN_INFO
select APERTURE_HELPERS
select FB_CFB_FILLRECT
select FB_CFB_COPYAREA
@@ -669,6 +670,7 @@ config FB_VESA
 config FB_EFI
bool "EFI-based Framebuffer Support"
depends on (FB = y) && !IA64 && EFI
+   depends on ARCH_HAS_SCREEN_INFO
select APERTURE_HELPERS
select DRM_PANEL_ORIENTATION_QUIRKS
select FB_CFB_FILLRECT
@@ -1089,6 +1091,7 @@ config FB_CARILLO_RANCH
 config FB_INTEL
tristate "Intel 830M/845G/852GM/855GM/865G/915G/945G/945GM/965G/965GM 
support"
depends on FB && PCI && X86 && AGP_INTEL && EXPERT
+   depends on ARCH_HAS_SCREEN_INFO
select FB_MODE_HELPERS
select FB_CFB_FILLRECT
select FB_CFB_COPYAREA
@@ -2185,6 +2188,7 @@ config FB_BROADSHEET
 config FB_HYPERV
tristate "Microsoft Hyper-V Synthetic Video support"
depends on FB && HYPERV
+   depends on ARCH_HAS_SCREEN_INFO
select FB_CFB_FILLRECT
select FB_CFB_COPYAREA
select FB_CFB_IMAGEBLIT
-- 
2.41.0



[PATCH 04/12] staging/sm750fb: Do not include

2023-06-29 Thread Thomas Zimmermann
The sm750fb driver does not need anything from .
Remove the include statements.

Signed-off-by: Thomas Zimmermann 
Cc: Sudip Mukherjee 
Cc: Teddy Wang 
---
 drivers/staging/sm750fb/sm750.c| 1 -
 drivers/staging/sm750fb/sm750_accel.c  | 1 -
 drivers/staging/sm750fb/sm750_cursor.c | 1 -
 drivers/staging/sm750fb/sm750_hw.c | 1 -
 4 files changed, 4 deletions(-)

diff --git a/drivers/staging/sm750fb/sm750.c b/drivers/staging/sm750fb/sm750.c
index 55e302a27847d..c260f73cf570a 100644
--- a/drivers/staging/sm750fb/sm750.c
+++ b/drivers/staging/sm750fb/sm750.c
@@ -14,7 +14,6 @@
 #include 
 #include 
 #include 
-#include 
 #include 
 
 #include "sm750.h"
diff --git a/drivers/staging/sm750fb/sm750_accel.c 
b/drivers/staging/sm750fb/sm750_accel.c
index 24b9077a634a6..44b9e3fe3a41d 100644
--- a/drivers/staging/sm750fb/sm750_accel.c
+++ b/drivers/staging/sm750fb/sm750_accel.c
@@ -14,7 +14,6 @@
 #include 
 #include 
 #include 
-#include 
 
 #include "sm750.h"
 #include "sm750_accel.h"
diff --git a/drivers/staging/sm750fb/sm750_cursor.c 
b/drivers/staging/sm750fb/sm750_cursor.c
index 43e6f52c2551f..eea4d1bd36ce7 100644
--- a/drivers/staging/sm750fb/sm750_cursor.c
+++ b/drivers/staging/sm750fb/sm750_cursor.c
@@ -14,7 +14,6 @@
 #include 
 #include 
 #include 
-#include 
 
 #include "sm750.h"
 #include "sm750_cursor.h"
diff --git a/drivers/staging/sm750fb/sm750_hw.c 
b/drivers/staging/sm750fb/sm750_hw.c
index 55cb00e8b0d1c..71247eaf26eef 100644
--- a/drivers/staging/sm750fb/sm750_hw.c
+++ b/drivers/staging/sm750fb/sm750_hw.c
@@ -17,7 +17,6 @@
 #include 
 #endif
 #include 
-#include 
 #include 
 
 #include "sm750.h"
-- 
2.41.0



[PATCH 03/12] sysfb: Do not include from sysfb header

2023-06-29 Thread Thomas Zimmermann
The header file  does not need anything from
. Declare struct screen_info and remove
the include statements.

Signed-off-by: Thomas Zimmermann 
Cc: Ard Biesheuvel 
Cc: Hans de Goede 
Cc: Javier Martinez Canillas 
---
 include/linux/sysfb.h | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/include/linux/sysfb.h b/include/linux/sysfb.h
index c1ef5fc60a3cb..19cb803dd5ecd 100644
--- a/include/linux/sysfb.h
+++ b/include/linux/sysfb.h
@@ -9,7 +9,8 @@
 
 #include 
 #include 
-#include 
+
+struct screen_info;
 
 enum {
M_I17,  /* 17-Inch iMac */
-- 
2.41.0



[PATCH 11/12] fbdev/core: Protect edid_info with CONFIG_ARCH_HAS_EDID_INFO

2023-06-29 Thread Thomas Zimmermann
Guard usage of edid_info with CONFIG_ARCH_HAS_EDID_INFO instead
of CONFIG_X86. No functional changes.

Signed-off-by: Thomas Zimmermann 
Cc: Daniel Vetter 
Cc: Helge Deller 
Cc: Randy Dunlap 
---
 drivers/video/fbdev/core/fbmon.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/video/fbdev/core/fbmon.c b/drivers/video/fbdev/core/fbmon.c
index 35be4431f649a..9ae063021e431 100644
--- a/drivers/video/fbdev/core/fbmon.c
+++ b/drivers/video/fbdev/core/fbmon.c
@@ -1480,17 +1480,19 @@ int fb_validate_mode(const struct fb_var_screeninfo 
*var, struct fb_info *info)
-EINVAL : 0;
 }
 
-#if defined(CONFIG_FIRMWARE_EDID) && defined(CONFIG_X86)
+#if defined(CONFIG_FIRMWARE_EDID)
 const unsigned char *fb_firmware_edid(struct fb_info *info)
 {
unsigned char *edid = NULL;
 
+#if defined(CONFIG_ARCH_HAS_EDID_INFO)
/*
 * We need to ensure that the EDID block is only
 * returned for the primary graphics adapter.
 */
if (fb_is_primary_device(info))
edid = edid_info.dummy;
+#endif
 
return edid;
 }
-- 
2.41.0



[PATCH 00/12] arch,fbdev: Move screen_info into arch/

2023-06-29 Thread Thomas Zimmermann
The variables screen_info and edid_info provide information about
the system's screen, and possibly EDID data of the connected display.
Both are defined and set by architecture code. But both variables are
declared in non-arch header files. Dependencies are at bease loosely
tracked. To resolve this, move the global state screen_info and its
companion edid_info into arch/. Only declare them on architectures
that define them. List dependencies on the variables in the Kconfig
files. Also clean up the callers.

Patch 1 to 4 resolve a number of unnecessary include statements of
. The header should only be included in source
files that access struct screen_info.

Patches 5 to 7 move the declaration of screen_info and edid_info to
. Architectures that provide either set
a Kconfig token to enable them.

Patches 8 to 9 make users of screen_info depend on the architecture's
feature.

Finally, patches 10 to 12 rework fbdev's handling of firmware EDID
data to make use of existing helpers and the refactored edid_info.

Tested on x86-64. Built for a variety of platforms.

Future directions: with the patchset in place, it will become possible
to provide screen_info and edid_info only if there are users. Some
architectures do this by testing for CONFIG_VT, CONFIG_DUMMY_CONSOLE,
etc. A more uniform approach would be nice. We should also attempt
to minimize access to the global screen_info as much as possible. To
do so, some drivers, such as efifb and vesafb, would require an update.
The firmware's EDID data could possibly made available outside of fbdev.
For example, the simpledrm and ofdrm drivers could provide such data
to userspace compositors.

Thomas Zimmermann (12):
  efi: Do not include  from EFI header
  fbdev/sm712fb: Do not include 
  sysfb: Do not include  from sysfb header
  staging/sm750fb: Do not include 
  arch: Remove trailing whitespaces
  arch: Declare screen_info in 
  arch/x86: Declare edid_info in 
  drivers/firmware: Remove trailing whitespaces
  drivers: Add dependencies on CONFIG_ARCH_HAS_SCREEN_INFO
  fbdev/core: Use fb_is_primary_device() in fb_firmware_edid()
  fbdev/core: Protect edid_info with CONFIG_ARCH_HAS_EDID_INFO
  fbdev/core: Define empty fb_firmware_edid() in 

 arch/Kconfig  | 12 +++
 arch/alpha/Kconfig|  1 +
 arch/arm/Kconfig  |  1 +
 arch/arm/kernel/efi.c |  2 ++
 arch/arm64/Kconfig|  1 +
 arch/arm64/kernel/efi.c   |  1 +
 arch/csky/Kconfig |  1 +
 arch/hexagon/Kconfig  |  1 +
 arch/ia64/Kconfig |  5 +--
 arch/loongarch/Kconfig|  1 +
 arch/mips/Kconfig |  1 +
 arch/nios2/Kconfig|  1 +
 arch/powerpc/Kconfig  |  1 +
 arch/riscv/Kconfig|  1 +
 arch/sh/Kconfig   |  7 ++--
 arch/sparc/Kconfig|  1 +
 arch/x86/Kconfig  |  2 ++
 arch/xtensa/Kconfig   |  1 +
 drivers/firmware/Kconfig  |  3 +-
 drivers/firmware/efi/Kconfig  |  1 +
 drivers/firmware/efi/libstub/efi-stub-entry.c |  2 ++
 drivers/firmware/efi/libstub/screen_info.c|  2 ++
 drivers/gpu/drm/Kconfig   |  1 +
 drivers/hv/Kconfig|  1 +
 drivers/staging/sm750fb/sm750.c   |  1 -
 drivers/staging/sm750fb/sm750_accel.c |  1 -
 drivers/staging/sm750fb/sm750_cursor.c|  1 -
 drivers/staging/sm750fb/sm750_hw.c|  1 -
 drivers/video/console/Kconfig |  2 ++
 drivers/video/fbdev/Kconfig   |  4 +++
 drivers/video/fbdev/core/fbmon.c  | 34 ++-
 drivers/video/fbdev/i810/i810-i2c.c   |  2 +-
 drivers/video/fbdev/intelfb/intelfbdrv.c  |  2 +-
 drivers/video/fbdev/nvidia/nv_i2c.c   |  2 +-
 drivers/video/fbdev/savage/savagefb-i2c.c |  2 +-
 drivers/video/fbdev/sm712fb.c |  9 +++--
 include/asm-generic/Kbuild|  1 +
 include/asm-generic/screen_info.h | 18 ++
 include/linux/efi.h   |  3 +-
 include/linux/fb.h| 10 +-
 include/linux/screen_info.h   |  2 +-
 include/linux/sysfb.h |  3 +-
 include/video/edid.h  |  3 --
 43 files changed, 105 insertions(+), 47 deletions(-)
 create mode 100644 include/asm-generic/screen_info.h


base-commit: d2f0af8472494398a42153684b790b723a79f143
-- 
2.41.0



[PATCH 05/12] arch: Remove trailing whitespaces

2023-06-29 Thread Thomas Zimmermann
Fix coding style. No functional changes.

Signed-off-by: Thomas Zimmermann 
Cc: Yoshinori Sato 
Cc: Rich Felker 
Cc: John Paul Adrian Glaubitz 
Cc: Andrew Morton 
Cc: Geert Uytterhoeven 
Cc: Arnd Bergmann 
Cc: "Kirill A. Shutemov" 
Cc: Anshuman Khandual 
Cc: Niklas Schnelle 
Cc: Zi Yan 
Cc: "Mike Rapoport (IBM)" 
Cc: Peter Zijlstra 
---
 arch/ia64/Kconfig | 4 ++--
 arch/sh/Kconfig   | 6 +++---
 2 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/arch/ia64/Kconfig b/arch/ia64/Kconfig
index 21fa63ce5ffc0..e79f15e32a451 100644
--- a/arch/ia64/Kconfig
+++ b/arch/ia64/Kconfig
@@ -260,7 +260,7 @@ config PERMIT_BSP_REMOVE
default n
help
Say Y here if your platform SAL will support removal of BSP with 
HOTPLUG_CPU
-   support. 
+   support.
 
 config FORCE_CPEI_RETARGET
bool "Force assumption that CPEI can be re-targeted"
@@ -335,7 +335,7 @@ config IA64_PALINFO
 config IA64_MC_ERR_INJECT
tristate "MC error injection support"
help
- Adds support for MC error injection. If enabled, the kernel 
+ Adds support for MC error injection. If enabled, the kernel
  will provide a sysfs interface for user applications to
  call MC error injection PAL procedures to inject various errors.
  This is a useful tool for MCA testing.
diff --git a/arch/sh/Kconfig b/arch/sh/Kconfig
index 9652d367fc377..04b9550cf0070 100644
--- a/arch/sh/Kconfig
+++ b/arch/sh/Kconfig
@@ -234,7 +234,7 @@ config CPU_SUBTYPE_SH7201
select CPU_SH2A
select CPU_HAS_FPU
select SYS_SUPPORTS_SH_MTU2
- 
+
 config CPU_SUBTYPE_SH7203
bool "Support SH7203 processor"
select CPU_SH2A
@@ -496,7 +496,7 @@ config CPU_SUBTYPE_SH7366
 endchoice
 
 source "arch/sh/mm/Kconfig"
- 
+
 source "arch/sh/Kconfig.cpu"
 
 source "arch/sh/boards/Kconfig"
@@ -647,7 +647,7 @@ config GUSA
  This is the default implementation for both UP and non-ll/sc
  CPUs, and is used by the libc, amongst others.
 
- For additional information, design information can be found 
+ For additional information, design information can be found
  in <http://lc.linux.or.jp/lc2002/papers/niibe0919p.pdf>.
 
  This should only be disabled for special cases where alternate
-- 
2.41.0



[PATCH 01/12] efi: Do not include from EFI header

2023-06-29 Thread Thomas Zimmermann
The header file  does not need anything from
. Declare struct screen_info and remove
the include statements. Update a number of source files that
require struct screen_info's definition.

Signed-off-by: Thomas Zimmermann 
Cc: Ard Biesheuvel 
Cc: Russell King 
Cc: Catalin Marinas 
Cc: Will Deacon 
---
 arch/arm/kernel/efi.c | 2 ++
 arch/arm64/kernel/efi.c   | 1 +
 drivers/firmware/efi/libstub/efi-stub-entry.c | 2 ++
 drivers/firmware/efi/libstub/screen_info.c| 2 ++
 include/linux/efi.h   | 3 ++-
 5 files changed, 9 insertions(+), 1 deletion(-)

diff --git a/arch/arm/kernel/efi.c b/arch/arm/kernel/efi.c
index e2b9d2618c672..e94655ef16bb3 100644
--- a/arch/arm/kernel/efi.c
+++ b/arch/arm/kernel/efi.c
@@ -5,6 +5,8 @@
 
 #include 
 #include 
+#include 
+
 #include 
 #include 
 #include 
diff --git a/arch/arm64/kernel/efi.c b/arch/arm64/kernel/efi.c
index baab8dd3ead3c..3afbe503b066f 100644
--- a/arch/arm64/kernel/efi.c
+++ b/arch/arm64/kernel/efi.c
@@ -9,6 +9,7 @@
 
 #include 
 #include 
+#include 
 
 #include 
 #include 
diff --git a/drivers/firmware/efi/libstub/efi-stub-entry.c 
b/drivers/firmware/efi/libstub/efi-stub-entry.c
index cc4dcaea67fa6..2f1902e5d4075 100644
--- a/drivers/firmware/efi/libstub/efi-stub-entry.c
+++ b/drivers/firmware/efi/libstub/efi-stub-entry.c
@@ -1,6 +1,8 @@
 // SPDX-License-Identifier: GPL-2.0-only
 
 #include 
+#include 
+
 #include 
 
 #include "efistub.h"
diff --git a/drivers/firmware/efi/libstub/screen_info.c 
b/drivers/firmware/efi/libstub/screen_info.c
index 4be1c4d1f922b..a51ec201ca3cb 100644
--- a/drivers/firmware/efi/libstub/screen_info.c
+++ b/drivers/firmware/efi/libstub/screen_info.c
@@ -1,6 +1,8 @@
 // SPDX-License-Identifier: GPL-2.0
 
 #include 
+#include 
+
 #include 
 
 #include "efistub.h"
diff --git a/include/linux/efi.h b/include/linux/efi.h
index 571d1a6e1b744..360895a5572c0 100644
--- a/include/linux/efi.h
+++ b/include/linux/efi.h
@@ -24,10 +24,11 @@
 #include 
 #include 
 #include 
-#include 
 
 #include 
 
+struct screen_info;
+
 #define EFI_SUCCESS0
 #define EFI_LOAD_ERROR ( 1 | (1UL << (BITS_PER_LONG-1)))
 #define EFI_INVALID_PARAMETER  ( 2 | (1UL << (BITS_PER_LONG-1)))
-- 
2.41.0



Re: [PATCH 07/12] arch/x86: Declare edid_info in

2023-06-29 Thread Thomas Zimmermann

Hi

Am 29.06.23 um 14:35 schrieb Arnd Bergmann:

On Thu, Jun 29, 2023, at 13:45, Thomas Zimmermann wrote:

The global variable edid_info contains the firmware's EDID information
as an extension to the regular screen_info on x86. Therefore move it to
.

Add the Kconfig token ARCH_HAS_EDID_INFO to guard against access on
architectures that don't provide edid_info. Select it on x86.


I'm not sure we need another symbol in addition to
CONFIG_FIRMWARE_EDID. Since all the code behind that
existing symbol is also x86 specific, would it be enough
to just add either 'depends on X86' or 'depends on X86 ||
COMPILE_TEST' there?


FIRMWARE_EDID is a user-selectable feature, while ARCH_HAS_EDID_INFO 
announces an architecture feature. They do different things.


Right now, ARCH_HAS_EDID_INFO only works on the old BIOS-based VESA 
systems. In the future, I want to add support for EDID data from EFI and 
OF as well. It would be stored in edid_info. I assume that the new 
symbol will become useful then.


Before this patchset, I originally wanted to make use of edid_info in 
the simpledrm graphics driver. But I found that the rsp code could use 
some work first. Maybe the patchset are already tailored towards the 
future changes.


Best regards
Thomas



   Arnd


--
Thomas Zimmermann
Graphics Driver Developer
SUSE Software Solutions Germany GmbH
Frankenstrasse 146, 90461 Nuernberg, Germany
GF: Ivo Totev, Andrew Myers, Andrew McDonald, Boudien Moerman
HRB 36809 (AG Nuernberg)


OpenPGP_signature
Description: OpenPGP digital signature


[PATCH 06/12] arch: Declare screen_info in

2023-06-29 Thread Thomas Zimmermann
The variable screen_info does not exist on all architectures. Declare
it in . All architectures that do declare it
will provide it via .

Add the Kconfig token ARCH_HAS_SCREEN_INFO to guard against access on
architectures that don't provide screen_info.

Signed-off-by: Thomas Zimmermann 
Cc: Richard Henderson 
Cc: Ivan Kokshaysky 
Cc: Matt Turner 
Cc: Russell King 
Cc: Catalin Marinas 
Cc: Will Deacon 
Cc: Guo Ren 
Cc: Brian Cain 
Cc: Huacai Chen 
Cc: WANG Xuerui 
Cc: Thomas Bogendoerfer 
Cc: Dinh Nguyen 
Cc: Michael Ellerman 
Cc: Nicholas Piggin 
Cc: Christophe Leroy 
Cc: Paul Walmsley 
Cc: Palmer Dabbelt 
Cc: Albert Ou 
Cc: Yoshinori Sato 
Cc: Rich Felker 
Cc: John Paul Adrian Glaubitz 
Cc: "David S. Miller" 
Cc: Thomas Gleixner 
Cc: Ingo Molnar 
Cc: Borislav Petkov 
Cc: Dave Hansen 
Cc: x...@kernel.org
Cc: "H. Peter Anvin" 
Cc: Chris Zankel 
Cc: Max Filippov 
Cc: Helge Deller 
Cc: Arnd Bergmann 
Cc: Kees Cook 
Cc: "Paul E. McKenney" 
Cc: Peter Zijlstra 
Cc: Frederic Weisbecker 
Cc: Andrew Morton 
Cc: Ard Biesheuvel 
Cc: Sami Tolvanen 
Cc: Juerg Haefliger 
Cc: Geert Uytterhoeven 
Cc: Anshuman Khandual 
Cc: Niklas Schnelle 
Cc: "Russell King (Oracle)" 
Cc: Linus Walleij 
Cc: Sebastian Reichel 
Cc: "Mike Rapoport (IBM)" 
Cc: "Kirill A. Shutemov" 
Cc: Zi Yan 
---
 arch/Kconfig  |  6 ++
 arch/alpha/Kconfig|  1 +
 arch/arm/Kconfig  |  1 +
 arch/arm64/Kconfig|  1 +
 arch/csky/Kconfig |  1 +
 arch/hexagon/Kconfig  |  1 +
 arch/ia64/Kconfig |  1 +
 arch/loongarch/Kconfig|  1 +
 arch/mips/Kconfig |  1 +
 arch/nios2/Kconfig|  1 +
 arch/powerpc/Kconfig  |  1 +
 arch/riscv/Kconfig|  1 +
 arch/sh/Kconfig   |  1 +
 arch/sparc/Kconfig|  1 +
 arch/x86/Kconfig  |  1 +
 arch/xtensa/Kconfig   |  1 +
 drivers/video/Kconfig |  3 +++
 include/asm-generic/Kbuild|  1 +
 include/asm-generic/screen_info.h | 12 
 include/linux/screen_info.h   |  2 +-
 20 files changed, 38 insertions(+), 1 deletion(-)
 create mode 100644 include/asm-generic/screen_info.h

diff --git a/arch/Kconfig b/arch/Kconfig
index 205fd23e0cada..2f58293fd7bcb 100644
--- a/arch/Kconfig
+++ b/arch/Kconfig
@@ -1466,6 +1466,12 @@ config ARCH_HAS_NONLEAF_PMD_YOUNG
  address translations. Page table walkers that clear the accessed bit
  may use this capability to reduce their search space.
 
+config ARCH_HAS_SCREEN_INFO
+   bool
+   help
+ Selected by architectures that provide a global instance of
+ screen_info.
+
 source "kernel/gcov/Kconfig"
 
 source "scripts/gcc-plugins/Kconfig"
diff --git a/arch/alpha/Kconfig b/arch/alpha/Kconfig
index a5c2b1aa46b02..d749011d88b14 100644
--- a/arch/alpha/Kconfig
+++ b/arch/alpha/Kconfig
@@ -4,6 +4,7 @@ config ALPHA
default y
select ARCH_32BIT_USTAT_F_TINODE
select ARCH_HAS_CURRENT_STACK_POINTER
+   select ARCH_HAS_SCREEN_INFO
select ARCH_MIGHT_HAVE_PC_PARPORT
select ARCH_MIGHT_HAVE_PC_SERIO
select ARCH_NO_PREEMPT
diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig
index 0fb4b218f6658..a9d01ee67a90e 100644
--- a/arch/arm/Kconfig
+++ b/arch/arm/Kconfig
@@ -15,6 +15,7 @@ config ARM
select ARCH_HAS_MEMBARRIER_SYNC_CORE
select ARCH_HAS_NON_OVERLAPPING_ADDRESS_SPACE
select ARCH_HAS_PTE_SPECIAL if ARM_LPAE
+   select ARCH_HAS_SCREEN_INFO
select ARCH_HAS_SETUP_DMA_OPS
select ARCH_HAS_SET_MEMORY
select ARCH_STACKWALK
diff --git a/arch/arm64/Kconfig b/arch/arm64/Kconfig
index 343e1e1cae10a..21addc4715bb3 100644
--- a/arch/arm64/Kconfig
+++ b/arch/arm64/Kconfig
@@ -36,6 +36,7 @@ config ARM64
select ARCH_HAS_NON_OVERLAPPING_ADDRESS_SPACE
select ARCH_HAS_PTE_DEVMAP
select ARCH_HAS_PTE_SPECIAL
+   select ARCH_HAS_SCREEN_INFO
select ARCH_HAS_SETUP_DMA_OPS
select ARCH_HAS_SET_DIRECT_MAP
select ARCH_HAS_SET_MEMORY
diff --git a/arch/csky/Kconfig b/arch/csky/Kconfig
index 4df1f8c9d170b..28444e581fc1f 100644
--- a/arch/csky/Kconfig
+++ b/arch/csky/Kconfig
@@ -10,6 +10,7 @@ config CSKY
select ARCH_USE_QUEUED_RWLOCKS
select ARCH_USE_QUEUED_SPINLOCKS
select ARCH_HAS_CURRENT_STACK_POINTER
+   select ARCH_HAS_SCREEN_INFO
select ARCH_INLINE_READ_LOCK if !PREEMPTION
select ARCH_INLINE_READ_LOCK_BH if !PREEMPTION
select ARCH_INLINE_READ_LOCK_IRQ if !PREEMPTION
diff --git a/arch/hexagon/Kconfig b/arch/hexagon/Kconfig
index 54eadf2651786..cc683c0a43d34 100644
--- a/arch/hexagon/Kconfig
+++ b/arch/hexagon/Kconfig
@@ -5,6 +5,7 @@ comment "Linux Kernel Configuration for Hexagon"
 config HEXAGON
def_bool y
select ARCH_32BIT_OFF_T

Re: [PATCH 06/12] arch: Declare screen_info in

2023-06-29 Thread Thomas Zimmermann

Hi

Am 29.06.23 um 15:03 schrieb Arnd Bergmann:

On Thu, Jun 29, 2023, at 13:45, Thomas Zimmermann wrote:


diff --git a/include/asm-generic/screen_info.h
b/include/asm-generic/screen_info.h
new file mode 100644
index 0..6fd0e50fabfcd
--- /dev/null
+++ b/include/asm-generic/screen_info.h
@@ -0,0 +1,12 @@
+/* SPDX-License-Identifier: GPL-2.0 */
+
+#ifndef _ASM_GENERIC_SCREEN_INFO_H
+#define _ASM_GENERIC_SCREEN_INFO_H
+
+#include 
+
+#if defined(CONFIG_ARCH_HAS_SCREEN_INFO)
+extern struct screen_info screen_info;
+#endif
+
+#endif /* _ASM_GENERIC_SCREEN_INFO_H */
diff --git a/include/linux/screen_info.h b/include/linux/screen_info.h
index eab7081392d50..c764b9a51c24b 100644
--- a/include/linux/screen_info.h
+++ b/include/linux/screen_info.h
@@ -4,6 +4,6 @@

  #include 

-extern struct screen_info screen_info;
+#include 



What is the purpose of adding a file in asm-generic? If all
architectures use the same generic file, I'd just leave the
declaration in include/linux/. I wouldn't bother adding the


That appears a bit 'un-clean' for something that is defined in 
architecture? But OK, I would not object.



#ifdef either, but I can see how that helps turn a link
error into an earlier compile error.


Yes, that's intentional. If there's a Kconfig token anyway, we can also 
fail early during the build.


Best regards
Thomas



   Arnd


--
Thomas Zimmermann
Graphics Driver Developer
SUSE Software Solutions Germany GmbH
Frankenstrasse 146, 90461 Nuernberg, Germany
GF: Ivo Totev, Andrew Myers, Andrew McDonald, Boudien Moerman
HRB 36809 (AG Nuernberg)


OpenPGP_signature
Description: OpenPGP digital signature


Re: [PATCH 00/12] arch,fbdev: Move screen_info into arch/

2023-06-29 Thread Thomas Zimmermann

Hi

Am 29.06.23 um 15:31 schrieb Arnd Bergmann:

On Thu, Jun 29, 2023, at 13:45, Thomas Zimmermann wrote:

The variables screen_info and edid_info provide information about
the system's screen, and possibly EDID data of the connected display.
Both are defined and set by architecture code. But both variables are
declared in non-arch header files. Dependencies are at bease loosely
tracked. To resolve this, move the global state screen_info and its
companion edid_info into arch/. Only declare them on architectures
that define them. List dependencies on the variables in the Kconfig
files. Also clean up the callers.

Patch 1 to 4 resolve a number of unnecessary include statements of
. The header should only be included in source
files that access struct screen_info.

Patches 5 to 7 move the declaration of screen_info and edid_info to
. Architectures that provide either set
a Kconfig token to enable them.

Patches 8 to 9 make users of screen_info depend on the architecture's
feature.

Finally, patches 10 to 12 rework fbdev's handling of firmware EDID
data to make use of existing helpers and the refactored edid_info.

Tested on x86-64. Built for a variety of platforms.


This all looks like a nice cleanup!


I guess that patches 1 to 4 are uncontroversial and could be landed 
quickly. Patches 10 to 12 are probably as well.





Future directions: with the patchset in place, it will become possible
to provide screen_info and edid_info only if there are users. Some
architectures do this by testing for CONFIG_VT, CONFIG_DUMMY_CONSOLE,
etc. A more uniform approach would be nice. We should also attempt
to minimize access to the global screen_info as much as possible. To
do so, some drivers, such as efifb and vesafb, would require an update.
The firmware's EDID data could possibly made available outside of fbdev.
For example, the simpledrm and ofdrm drivers could provide such data
to userspace compositors.


I suspect that most architectures that provide a screen_info only
have this in order to compile the framebuffer drivers, and provide
hardcoded data that does not even reflect any real hardware.


That's quite possible. Only x86's bootparam and EFI code sets 
screen_info from external data. The rest is hardcoded. A number of 
architectures protect screen_info with CONFIG_VT, CONFIG_DUMMY_CONSOLE, 
etc. In a later patchset, I wanted to change this such that these users 
of screen_info would enable the feature via select in their Kconfig.


Do you know the reason for this branch in dummycon:

https://elixir.bootlin.com/linux/v6.4/source/drivers/video/console/dummycon.c#L21

What is special about arm that dummycon uses the screeninfo?



We can probably reduce the number of architectures that do this
a lot, especially if we get EFI out of the picture.


Can you elaborate?

Best regards
Thomas



   Arnd


--
Thomas Zimmermann
Graphics Driver Developer
SUSE Software Solutions Germany GmbH
Frankenstrasse 146, 90461 Nuernberg, Germany
GF: Ivo Totev, Andrew Myers, Andrew McDonald, Boudien Moerman
HRB 36809 (AG Nuernberg)


OpenPGP_signature
Description: OpenPGP digital signature


Re: [PATCH 07/12] arch/x86: Declare edid_info in

2023-06-30 Thread Thomas Zimmermann

Hi

Am 29.06.23 um 15:21 schrieb Arnd Bergmann:

On Thu, Jun 29, 2023, at 15:01, Thomas Zimmermann wrote:

Am 29.06.23 um 14:35 schrieb Arnd Bergmann:

On Thu, Jun 29, 2023, at 13:45, Thomas Zimmermann wrote:

The global variable edid_info contains the firmware's EDID information
as an extension to the regular screen_info on x86. Therefore move it to
.

Add the Kconfig token ARCH_HAS_EDID_INFO to guard against access on
architectures that don't provide edid_info. Select it on x86.


I'm not sure we need another symbol in addition to
CONFIG_FIRMWARE_EDID. Since all the code behind that
existing symbol is also x86 specific, would it be enough
to just add either 'depends on X86' or 'depends on X86 ||
COMPILE_TEST' there?


FIRMWARE_EDID is a user-selectable feature, while ARCH_HAS_EDID_INFO
announces an architecture feature. They do different things.


I still have trouble seeing the difference.


The idea here is that ARCH_HAS_ signals the architecture's support for 
the feature.  Drivers set 'depends on' in their Kconfig.


Another Kconfig token, VIDEO_SCREEN_INFO or FIRMWARE_EDID, would then 
actually enable the feature.  Drivers select VIDEO_SCREEN_INFO or 
FIRMWARE_EDID and the architectures contains code like


#ifdef VIDEO_SCREEN_INFO
struct screen_info screen_info = {
/* set values here */
}
#endif

This allows us to disable code that requires screen_info/edid_info, but 
also disable screen_info/edid_info unless such code has been enabled in 
the kernel config.


Some architectures currently mimic this by guarding screen_info with 
ifdef CONFIG_VT or similar. I'd like to make this more flexible. The 
cost of a few more internal Kconfig tokens seems negligible.





Right now, ARCH_HAS_EDID_INFO only works on the old BIOS-based VESA
systems. In the future, I want to add support for EDID data from EFI and
OF as well. It would be stored in edid_info. I assume that the new
symbol will become useful then.


I don't see why an OF based system would have the same limitation
as legacy BIOS with supporting only a single monitor, if we need
to have a generic representation of EDID data in DT, that would
probably be in a per device property anyway.


Sorry that was my mistake. OF has nothing to do with this.



I suppose you could use FIRMWARE_EDID on EFI or OF systems without
the need for a global edid_info structure, but that would not
share any code with the current fb_firmware_edid() function.


The current code is build on top of screen_info and edid_info. I'd 
preferably not replace that, if possible.


Best regards
Thomas



  Arnd


--
Thomas Zimmermann
Graphics Driver Developer
SUSE Software Solutions Germany GmbH
Frankenstrasse 146, 90461 Nuernberg, Germany
GF: Ivo Totev, Andrew Myers, Andrew McDonald, Boudien Moerman
HRB 36809 (AG Nuernberg)


OpenPGP_signature
Description: OpenPGP digital signature


Re: [01/12] efi: Do not include from EFI header

2023-07-05 Thread Thomas Zimmermann

Hi

Am 05.07.23 um 03:40 schrieb Sui Jingfeng:

Hi, Thomas


I love your patch, LoongArch also have UEFI GOP support,

Maybe the arch/loongarch/kernel/efi.c don't include the '#include 
' explicitly.


Oh, thank you for testing. I try to build arch/ changes on all of the 
affected platforms, but I cannot build for all of them. I have no means 
of building for loongarch ATM.


I'll update the patch according to your feedback.

Best regards
Thomas




```

diff --git a/arch/loongarch/kernel/efi.c b/arch/loongarch/kernel/efi.c
index 3d448fef3af4..04f4d217aefb 100644
--- a/arch/loongarch/kernel/efi.c
+++ b/arch/loongarch/kernel/efi.c
@@ -19,6 +19,7 @@
  #include 
  #include 
  #include 
+#include 

  #include 
  #include 
```


On 2023/6/29 19:45, Thomas Zimmermann wrote:

The header file  does not need anything from
. Declare struct screen_info and remove
the include statements. Update a number of source files that
require struct screen_info's definition.

Signed-off-by: Thomas Zimmermann 
Cc: Ard Biesheuvel 
Cc: Russell King 
Cc: Catalin Marinas 
Cc: Will Deacon 
Reviewed-by: Javier Martinez Canillas 


With the above issue solved, please take my R-B if you would like.


Reviewed-by: Sui Jingfeng 


---
  arch/arm/kernel/efi.c | 2 ++
  arch/arm64/kernel/efi.c   | 1 +
  drivers/firmware/efi/libstub/efi-stub-entry.c | 2 ++
  drivers/firmware/efi/libstub/screen_info.c    | 2 ++
  include/linux/efi.h   | 3 ++-
  5 files changed, 9 insertions(+), 1 deletion(-)

diff --git a/arch/arm/kernel/efi.c b/arch/arm/kernel/efi.c
index e2b9d2618c672..e94655ef16bb3 100644
--- a/arch/arm/kernel/efi.c
+++ b/arch/arm/kernel/efi.c
@@ -5,6 +5,8 @@
  #include 
  #include 
+#include 
+
  #include 
  #include 
  #include 
diff --git a/arch/arm64/kernel/efi.c b/arch/arm64/kernel/efi.c
index baab8dd3ead3c..3afbe503b066f 100644
--- a/arch/arm64/kernel/efi.c
+++ b/arch/arm64/kernel/efi.c
@@ -9,6 +9,7 @@
  #include 
  #include 
+#include 
  #include 
  #include 
diff --git a/drivers/firmware/efi/libstub/efi-stub-entry.c 
b/drivers/firmware/efi/libstub/efi-stub-entry.c

index cc4dcaea67fa6..2f1902e5d4075 100644
--- a/drivers/firmware/efi/libstub/efi-stub-entry.c
+++ b/drivers/firmware/efi/libstub/efi-stub-entry.c
@@ -1,6 +1,8 @@
  // SPDX-License-Identifier: GPL-2.0-only
  #include 
+#include 
+
  #include 
  #include "efistub.h"
diff --git a/drivers/firmware/efi/libstub/screen_info.c 
b/drivers/firmware/efi/libstub/screen_info.c

index 4be1c4d1f922b..a51ec201ca3cb 100644
--- a/drivers/firmware/efi/libstub/screen_info.c
+++ b/drivers/firmware/efi/libstub/screen_info.c
@@ -1,6 +1,8 @@
  // SPDX-License-Identifier: GPL-2.0
  #include 
+#include 
+
  #include 
  #include "efistub.h"
diff --git a/include/linux/efi.h b/include/linux/efi.h
index 571d1a6e1b744..360895a5572c0 100644
--- a/include/linux/efi.h
+++ b/include/linux/efi.h
@@ -24,10 +24,11 @@
  #include 
  #include 
  #include 
-#include 
  #include 
+struct screen_info;
+
  #define EFI_SUCCESS    0
  #define EFI_LOAD_ERROR    ( 1 | (1UL << (BITS_PER_LONG-1)))
  #define EFI_INVALID_PARAMETER    ( 2 | (1UL << (BITS_PER_LONG-1)))




--
Thomas Zimmermann
Graphics Driver Developer
SUSE Software Solutions Germany GmbH
Frankenstrasse 146, 90461 Nuernberg, Germany
GF: Ivo Totev, Andrew Myers, Andrew McDonald, Boudien Moerman
HRB 36809 (AG Nuernberg)


OpenPGP_signature
Description: OpenPGP digital signature


Re: [PATCH 07/12] arch/x86: Declare edid_info in

2023-07-05 Thread Thomas Zimmermann

Hi Arnd

Am 30.06.23 um 13:53 schrieb Arnd Bergmann:

On Fri, Jun 30, 2023, at 09:46, Thomas Zimmermann wrote:

Am 29.06.23 um 15:21 schrieb Arnd Bergmann:

On Thu, Jun 29, 2023, at 15:01, Thomas Zimmermann wrote:

Am 29.06.23 um 14:35 schrieb Arnd Bergmann:

On Thu, Jun 29, 2023, at 13:45, Thomas Zimmermann wrote:




FIRMWARE_EDID is a user-selectable feature, while ARCH_HAS_EDID_INFO
announces an architecture feature. They do different things.


I still have trouble seeing the difference.


The idea here is that ARCH_HAS_ signals the architecture's support for
the feature.  Drivers set 'depends on' in their Kconfig.

Another Kconfig token, VIDEO_SCREEN_INFO or FIRMWARE_EDID, would then
actually enable the feature.  Drivers select VIDEO_SCREEN_INFO or
FIRMWARE_EDID and the architectures contains code like


Fair enough. In that case, I guess FIRMWARE_EDID will just depend on
ARCH_HAS_EDID_INFO, or possibly "depends on FIRMWARE_EDID || EFI"
after it starts calling into an EFI specific function, right?


#ifdef VIDEO_SCREEN_INFO
struct screen_info screen_info = {
/* set values here */
}
#endif

This allows us to disable code that requires screen_info/edid_info, but
also disable screen_info/edid_info unless such code has been enabled in
the kernel config.

Some architectures currently mimic this by guarding screen_info with
ifdef CONFIG_VT or similar. I'd like to make this more flexible. The
cost of a few more internal Kconfig tokens seems negligible.


I definitely get it for the screen_info, which needs the complexity.
For ARCHARCH_HAS_EDID_INFO I would hope that it's never selected by
anything other than x86, so I would still go with just a dependency
on x86 for simplicity, but I don't mind having the extra symbol if that
keeps it more consistent with how the screen_info is handled.


Well, I'd like to add edid_info to platforms with EFI. What would be 
arm/arm64 and loongarch, I guess. See below for the future plans.





I suppose you could use FIRMWARE_EDID on EFI or OF systems without
the need for a global edid_info structure, but that would not
share any code with the current fb_firmware_edid() function.


The current code is build on top of screen_info and edid_info. I'd
preferably not replace that, if possible.


One way I could imagine this looking in the end would be
something like

struct screen_info *fb_screen_info(struct device *dev)
{
   struct screen_info *si = NULL;

   if (IS_ENABLED(CONFIG_EFI))
 si = efi_get_screen_info(dev);

   if (IS_ENABLED(CONFIG_ARCH_HAS_SCREEN_INFO) && !si)
 si = screen_info;

   return si;
}

corresponding to fb_firmware_edid(). With this, any driver
that wants to access screen_info would call this function
instead of using the global pointer, plus either NULL pointer
check or a CONFIG_ARCH_HAS_SCREEN_INFO dependency.

This way we could completely eliminate the global screen_info
on arm64, riscv, and loongarch but still use the efi and
hyperv framebuffer/drm drivers.


If possible, I'd like to remove global screen_info and edid_info 
entirely from fbdev and the various consoles.


We currently use screen_info to set up the generic framebuffer device in 
drivers/firmware/sysfb.c. I'd like to use edid_info here as well, so 
that the generic graphics drivers can get EDID information.


For the few fbdev drivers and consoles that require the global 
screen_info/edid_info, I'd rather provide lookup functions in sysfb 
(e.g., sysfb_get_screen_info(), sysfb_get_edid_info()). The global 
screen_info/edid_info state would then become an internal artifact of 
the sysfb code.


Hopefully that explains some of the decisions made in this patchset.

Best regards
Thomas



 Arnd


--
Thomas Zimmermann
Graphics Driver Developer
SUSE Software Solutions Germany GmbH
Frankenstrasse 146, 90461 Nuernberg, Germany
GF: Ivo Totev, Andrew Myers, Andrew McDonald, Boudien Moerman
HRB 36809 (AG Nuernberg)


OpenPGP_signature
Description: OpenPGP digital signature


Re: [06/12] arch: Declare screen_info in

2023-07-05 Thread Thomas Zimmermann

Hi

Am 05.07.23 um 03:21 schrieb Sui Jingfeng:

Hi, Thomas


I love your patch, yet after applied your patch, the linux kernel fail 
to compile on my LoongArch machine.


screen_info is missing. I think this should be solved with your update 
to patch 1.


Best regards
Thomas




```

   CC  arch/loongarch/kernel/efi.o
arch/loongarch/kernel/efi.c: In function ‘init_screen_info’:
arch/loongarch/kernel/efi.c:77:54: error: invalid application of 
‘sizeof’ to incomplete type ‘struct screen_info’

    77 | si = early_memremap(screen_info_table, sizeof(*si));
   |  ^
arch/loongarch/kernel/efi.c:82:9: error: ‘screen_info’ undeclared (first 
use in this function)

    82 | screen_info = *si;
   | ^~~
arch/loongarch/kernel/efi.c:82:9: note: each undeclared identifier is 
reported only once for each function it appears in
arch/loongarch/kernel/efi.c:82:23: error: invalid use of undefined type 
‘struct screen_info’

    82 | screen_info = *si;
   |   ^
arch/loongarch/kernel/efi.c:83:29: error: invalid application of 
‘sizeof’ to incomplete type ‘struct screen_info’

    83 | memset(si, 0, sizeof(*si));
   | ^
arch/loongarch/kernel/efi.c:84:34: error: invalid application of 
‘sizeof’ to incomplete type ‘struct screen_info’

    84 | early_memunmap(si, sizeof(*si));
   |  ^
make[3]: *** [scripts/Makefile.build:252: arch/loongarch/kernel/efi.o] 
Error 1

make[3]: *** Waiting for unfinished jobs
make[2]: *** [scripts/Makefile.build:494: arch/loongarch/kernel] Error 2
make[1]: *** [scripts/Makefile.build:494: arch/loongarch] Error 2
make[1]: *** Waiting for unfinished jobs
make: *** [Makefile:2026: .] Error 2

```

On 2023/6/29 19:45, Thomas Zimmermann wrote:

The variable screen_info does not exist on all architectures. Declare
it in . All architectures that do declare it
will provide it via .

Add the Kconfig token ARCH_HAS_SCREEN_INFO to guard against access on
architectures that don't provide screen_info.

Signed-off-by: Thomas Zimmermann 
Cc: Richard Henderson 
Cc: Ivan Kokshaysky 
Cc: Matt Turner 
Cc: Russell King 
Cc: Catalin Marinas 
Cc: Will Deacon 
Cc: Guo Ren 
Cc: Brian Cain 
Cc: Huacai Chen 
Cc: WANG Xuerui 
Cc: Thomas Bogendoerfer 
Cc: Dinh Nguyen 
Cc: Michael Ellerman 
Cc: Nicholas Piggin 
Cc: Christophe Leroy 
Cc: Paul Walmsley 
Cc: Palmer Dabbelt 
Cc: Albert Ou 
Cc: Yoshinori Sato 
Cc: Rich Felker 
Cc: John Paul Adrian Glaubitz 
Cc: "David S. Miller" 
Cc: Thomas Gleixner 
Cc: Ingo Molnar 
Cc: Borislav Petkov 
Cc: Dave Hansen 
Cc: x...@kernel.org
Cc: "H. Peter Anvin" 
Cc: Chris Zankel 
Cc: Max Filippov 
Cc: Helge Deller 
Cc: Arnd Bergmann 
Cc: Kees Cook 
Cc: "Paul E. McKenney" 
Cc: Peter Zijlstra 
Cc: Frederic Weisbecker 
Cc: Andrew Morton 
Cc: Ard Biesheuvel 
Cc: Sami Tolvanen 
Cc: Juerg Haefliger 
Cc: Geert Uytterhoeven 
Cc: Anshuman Khandual 
Cc: Niklas Schnelle 
Cc: "Russell King (Oracle)" 
Cc: Linus Walleij 
Cc: Sebastian Reichel 
Cc: "Mike Rapoport (IBM)" 
Cc: "Kirill A. Shutemov" 
Cc: Zi Yan 
Acked-by: WANG Xuerui  # loongarch
---
  arch/Kconfig  |  6 ++
  arch/alpha/Kconfig    |  1 +
  arch/arm/Kconfig  |  1 +
  arch/arm64/Kconfig    |  1 +
  arch/csky/Kconfig |  1 +
  arch/hexagon/Kconfig  |  1 +
  arch/ia64/Kconfig |  1 +
  arch/loongarch/Kconfig    |  1 +
  arch/mips/Kconfig |  1 +
  arch/nios2/Kconfig    |  1 +
  arch/powerpc/Kconfig  |  1 +
  arch/riscv/Kconfig    |  1 +
  arch/sh/Kconfig   |  1 +
  arch/sparc/Kconfig    |  1 +
  arch/x86/Kconfig  |  1 +
  arch/xtensa/Kconfig   |  1 +
  drivers/video/Kconfig |  3 +++
  include/asm-generic/Kbuild    |  1 +
  include/asm-generic/screen_info.h | 12 
  include/linux/screen_info.h   |  2 +-
  20 files changed, 38 insertions(+), 1 deletion(-)
  create mode 100644 include/asm-generic/screen_info.h

diff --git a/arch/Kconfig b/arch/Kconfig
index 205fd23e0cada..2f58293fd7bcb 100644
--- a/arch/Kconfig
+++ b/arch/Kconfig
@@ -1466,6 +1466,12 @@ config ARCH_HAS_NONLEAF_PMD_YOUNG
    address translations. Page table walkers that clear the 
accessed bit

    may use this capability to reduce their search space.
+config ARCH_HAS_SCREEN_INFO
+    bool
+    help
+  Selected by architectures that provide a global instance of
+  screen_info.
+
  source "kernel/gcov/Kconfig"
  source "scripts/gcc-plugins/Kconfig"
diff --git a/arch/alpha/Kconfig b/arch/alpha/Kconfig
index a5c2b1aa46b02..d749011d88b14 100644
--- a/arch/alpha/Kconfig
+++ b/arch/alpha/Kconfig
@@ -4,6 +4,7 @@ config ALPHA
  default

[PATCH 07/17] vfio-mdev: Remove flag FBINFO_DEFAULT from fbdev sample driver

2023-07-10 Thread Thomas Zimmermann
The flag FBINFO_DEFAULT is 0 and has no effect, as struct fbinfo.flags
has been allocated to zero by framebuffer_alloc(). So do not set it.

Flags should signal differences from the default values. After cleaning
up all occurences of FBINFO_DEFAULT, the token can be removed.

Signed-off-by: Thomas Zimmermann 
Cc: Kirti Wankhede 
---
 samples/vfio-mdev/mdpy-fb.c | 1 -
 1 file changed, 1 deletion(-)

diff --git a/samples/vfio-mdev/mdpy-fb.c b/samples/vfio-mdev/mdpy-fb.c
index 3c8001b9e407..cda477b28685 100644
--- a/samples/vfio-mdev/mdpy-fb.c
+++ b/samples/vfio-mdev/mdpy-fb.c
@@ -162,7 +162,6 @@ static int mdpy_fb_probe(struct pci_dev *pdev,
}
 
info->fbops = &mdpy_fb_ops;
-   info->flags = FBINFO_DEFAULT;
info->pseudo_palette = par->palette;
 
ret = register_framebuffer(info);
-- 
2.41.0



[PATCH 06/17] fbdev/fsl-diu-fb: Remove flag FBINFO_DEFAULT

2023-07-10 Thread Thomas Zimmermann
The flag FBINFO_DEFAULT is 0 and has no effect, as struct fbinfo.flags
has been allocated to zero by dmam_alloc_coherent(__GFP_ZERO). So do not
set it.

Flags should signal differences from the default values. After cleaning
up all occurences of FBINFO_DEFAULT, the token can be removed.

Signed-off-by: Thomas Zimmermann 
Cc: Timur Tabi 
Cc: Helge Deller 
---
 drivers/video/fbdev/fsl-diu-fb.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/video/fbdev/fsl-diu-fb.c b/drivers/video/fbdev/fsl-diu-fb.c
index 785eb8a06943..c62b48f27ba9 100644
--- a/drivers/video/fbdev/fsl-diu-fb.c
+++ b/drivers/video/fbdev/fsl-diu-fb.c
@@ -1476,7 +1476,7 @@ static int install_fb(struct fb_info *info)
 
info->var.activate = FB_ACTIVATE_NOW;
info->fbops = &fsl_diu_ops;
-   info->flags = FBINFO_DEFAULT | FBINFO_VIRTFB | FBINFO_PARTIAL_PAN_OK |
+   info->flags = FBINFO_VIRTFB | FBINFO_PARTIAL_PAN_OK |
FBINFO_READS_FAST;
info->pseudo_palette = mfbi->pseudo_palette;
 
-- 
2.41.0



[PATCH 00/17] fbdev: Remove FBINFO_DEFAULT and FBINFO_FLAG_DEFAULT flags

2023-07-10 Thread Thomas Zimmermann
Remove the unused flags FBINFO_DEFAULT and FBINFO_FLAG_DEFAULT from
fbdev and drivers, as briefly discussed at [1]. Both flags were maybe
useful when fbdev had special handling for driver modules. With
commit 376b3ff54c9a ("fbdev: Nuke FBINFO_MODULE"), they are both 0
and have no further effect.

Patches 1 to 7 remove FBINFO_DEFAULT from drivers. Patches 2 to 5
split this by the way the fb_info struct is being allocated. All flags
are cleared to zero during the allocation.

Patches 8 to 16 do the same for FBINFO_FLAG_DEFAULT. Patch 8 fixes
an actual bug in how arch/sh uses the tokne for struct fb_videomode,
which is unrelated.

Patch 17 removes both flag constants from 

[1] 
https://lore.kernel.org/dri-devel/877crer8fm@minerva.mail-host-address-is-not-set/

Thomas Zimmermann (17):
  drm: Remove flag FBINFO_DEFAULT from fbdev emulation
  fbdev: Remove flag FBINFO_DEFAULT from fbdev drivers
  fbdev: Remove flag FBINFO_DEFAULT from fbdev drivers
  fbdev: Remove flag FBINFO_DEFAULT from fbdev drivers
  fbdev: Remove flag FBINFO_DEFAULT from fbdev drivers
  fbdev/fsl-diu-fb: Remove flag FBINFO_DEFAULT
  vfio-mdev: Remove flag FBINFO_DEFAULT from fbdev sample driver
  arch/sh: Do not assign FBINFO_FLAG_DEFAULT to fb_videomode.flag
  auxdisplay: Remove flag FBINFO_FLAG_DEFAULT from fbdev drivers
  hid/picolcd: Remove flag FBINFO_FLAG_DEFAULT from fbdev driver
  media: Remove flag FBINFO_FLAG_DEFAULT from fbdev drivers
  staging: Remove flag FBINFO_FLAG_DEFAULT from fbdev drivers
  fbdev: Remove flag FBINFO_FLAG_DEFAULT from fbdev drivers
  fbdev: Remove flag FBINFO_FLAG_DEFAULT from fbdev drivers
  fbdev/atafb: Remove flag FBINFO_FLAG_DEFAULT
  fbdev/pxafb: Remove flag FBINFO_FLAG_DEFAULT
  fbdev: Remove FBINFO_DEFAULT and FBINFO_FLAG_DEFAULT

 arch/sh/boards/mach-sh7763rdp/setup.c  | 1 -
 drivers/auxdisplay/cfag12864bfb.c  | 1 -
 drivers/auxdisplay/ht16k33.c   | 1 -
 drivers/gpu/drm/drm_fbdev_dma.c| 1 -
 drivers/gpu/drm/drm_fbdev_generic.c| 1 -
 drivers/gpu/drm/gma500/fbdev.c | 2 +-
 drivers/gpu/drm/radeon/radeon_fbdev.c  | 2 +-
 drivers/hid/hid-picolcd_fb.c   | 1 -
 drivers/media/pci/ivtv/ivtvfb.c| 1 -
 drivers/media/test-drivers/vivid/vivid-osd.c   | 1 -
 drivers/staging/fbtft/fbtft-core.c | 2 +-
 drivers/staging/sm750fb/sm750.c| 1 -
 drivers/video/fbdev/68328fb.c  | 2 +-
 drivers/video/fbdev/acornfb.c  | 2 +-
 drivers/video/fbdev/amba-clcd.c| 1 -
 drivers/video/fbdev/amifb.c| 5 ++---
 drivers/video/fbdev/arcfb.c| 1 -
 drivers/video/fbdev/asiliantfb.c   | 1 -
 drivers/video/fbdev/atafb.c| 1 -
 drivers/video/fbdev/atmel_lcdfb.c  | 2 +-
 drivers/video/fbdev/aty/aty128fb.c | 1 -
 drivers/video/fbdev/aty/atyfb_base.c   | 3 +--
 drivers/video/fbdev/aty/radeon_base.c  | 3 +--
 drivers/video/fbdev/broadsheetfb.c | 2 +-
 drivers/video/fbdev/bw2.c  | 1 -
 drivers/video/fbdev/carminefb.c| 1 -
 drivers/video/fbdev/cg14.c | 2 +-
 drivers/video/fbdev/cg3.c  | 1 -
 drivers/video/fbdev/cg6.c  | 2 +-
 drivers/video/fbdev/chipsfb.c  | 1 -
 drivers/video/fbdev/cirrusfb.c | 3 +--
 drivers/video/fbdev/clps711x-fb.c  | 1 -
 drivers/video/fbdev/cobalt_lcdfb.c | 1 -
 drivers/video/fbdev/controlfb.c| 2 +-
 drivers/video/fbdev/cyber2000fb.c  | 2 +-
 drivers/video/fbdev/da8xx-fb.c | 1 -
 drivers/video/fbdev/efifb.c| 1 -
 drivers/video/fbdev/ep93xx-fb.c| 1 -
 drivers/video/fbdev/ffb.c  | 3 +--
 drivers/video/fbdev/fm2fb.c| 1 -
 drivers/video/fbdev/fsl-diu-fb.c   | 2 +-
 drivers/video/fbdev/g364fb.c   | 2 +-
 drivers/video/fbdev/gbefb.c| 1 -
 drivers/video/fbdev/geode/gx1fb_core.c | 1 -
 drivers/video/fbdev/geode/gxfb_core.c  | 1 -
 drivers/video/fbdev/geode/lxfb_core.c  | 1 -
 drivers/video/fbdev/goldfishfb.c   | 1 -
 drivers/video/fbdev/grvga.c| 2 +-
 drivers/video/fbdev/gxt4500.c  | 3 +--
 drivers/video/fbdev/hecubafb.c | 2 +-
 drivers/video/fbdev/hgafb.c| 2 +-
 drivers/video/fbdev/hitfb.c| 2 +-
 drivers/video/fbdev/hpfb.c | 1 -
 drivers/video/fbdev/hyperv_fb.c| 2 --
 drivers/video/fbdev/i740fb.c   | 2 +-
 drivers/video/fbdev/i810/i810_main.c   | 4 ++--
 drivers/video/fbdev/imsttfb.c  | 3 +--
 drivers/video/fbdev/imxfb.c| 3 +--
 drivers/video/fbdev/intelfb/intelfbdrv.c

[PATCH 04/17] fbdev: Remove flag FBINFO_DEFAULT from fbdev drivers

2023-07-10 Thread Thomas Zimmermann
The flag FBINFO_DEFAULT is 0 and has no effect, as struct fbinfo.flags
has been allocated to zero by devm_kzalloc(). So do not set it.

Flags should signal differences from the default values. After cleaning
up all occurences of FBINFO_DEFAULT, the token can be removed.

Signed-off-by: Thomas Zimmermann 
Cc: Helge Deller 
---
 drivers/video/fbdev/pxafb.c| 1 -
 drivers/video/fbdev/sa1100fb.c | 1 -
 drivers/video/fbdev/wm8505fb.c | 3 +--
 drivers/video/fbdev/xilinxfb.c | 1 -
 4 files changed, 1 insertion(+), 5 deletions(-)

diff --git a/drivers/video/fbdev/pxafb.c b/drivers/video/fbdev/pxafb.c
index 2a8b1dea3a67..c8c4677d06b4 100644
--- a/drivers/video/fbdev/pxafb.c
+++ b/drivers/video/fbdev/pxafb.c
@@ -1826,7 +1826,6 @@ static struct pxafb_info *pxafb_init_fbinfo(struct device 
*dev,
fbi->fb.var.vmode   = FB_VMODE_NONINTERLACED;
 
fbi->fb.fbops   = &pxafb_ops;
-   fbi->fb.flags   = FBINFO_DEFAULT;
fbi->fb.node= -1;
 
addr = fbi;
diff --git a/drivers/video/fbdev/sa1100fb.c b/drivers/video/fbdev/sa1100fb.c
index a2408bf00ca0..3d76ce111488 100644
--- a/drivers/video/fbdev/sa1100fb.c
+++ b/drivers/video/fbdev/sa1100fb.c
@@ -1089,7 +1089,6 @@ static struct sa1100fb_info *sa1100fb_init_fbinfo(struct 
device *dev)
fbi->fb.var.vmode   = FB_VMODE_NONINTERLACED;
 
fbi->fb.fbops   = &sa1100fb_ops;
-   fbi->fb.flags   = FBINFO_DEFAULT;
fbi->fb.monspecs= monspecs;
fbi->fb.pseudo_palette  = fbi->pseudo_palette;
 
diff --git a/drivers/video/fbdev/wm8505fb.c b/drivers/video/fbdev/wm8505fb.c
index 10a8b1250103..5833147aa43d 100644
--- a/drivers/video/fbdev/wm8505fb.c
+++ b/drivers/video/fbdev/wm8505fb.c
@@ -285,8 +285,7 @@ static int wm8505fb_probe(struct platform_device *pdev)
fbi->fb.fix.accel   = FB_ACCEL_NONE;
 
fbi->fb.fbops   = &wm8505fb_ops;
-   fbi->fb.flags   = FBINFO_DEFAULT
-   | FBINFO_HWACCEL_COPYAREA
+   fbi->fb.flags   = FBINFO_HWACCEL_COPYAREA
| FBINFO_HWACCEL_FILLRECT
| FBINFO_HWACCEL_XPAN
| FBINFO_HWACCEL_YPAN
diff --git a/drivers/video/fbdev/xilinxfb.c b/drivers/video/fbdev/xilinxfb.c
index 2aa3a528277f..768a281a8d2c 100644
--- a/drivers/video/fbdev/xilinxfb.c
+++ b/drivers/video/fbdev/xilinxfb.c
@@ -324,7 +324,6 @@ static int xilinxfb_assign(struct platform_device *pdev,
drvdata->info.fix.line_length = pdata->xvirt * BYTES_PER_PIXEL;
 
drvdata->info.pseudo_palette = drvdata->pseudo_palette;
-   drvdata->info.flags = FBINFO_DEFAULT;
drvdata->info.var = xilinx_fb_var;
drvdata->info.var.height = pdata->screen_height_mm;
drvdata->info.var.width = pdata->screen_width_mm;
-- 
2.41.0



[PATCH 12/17] staging: Remove flag FBINFO_FLAG_DEFAULT from fbdev drivers

2023-07-10 Thread Thomas Zimmermann
The flag FBINFO_FLAG_DEFAULT is 0 and has no effect, as struct
fbinfo.flags has been allocated to zero by framebuffer_alloc(). So do
not set it.

Flags should signal differences from the default values. After cleaning
up all occurences of FBINFO_FLAG_DEFAULT, the token can be removed.

Signed-off-by: Thomas Zimmermann 
Cc: Greg Kroah-Hartman 
Cc: Sudip Mukherjee 
Cc: Teddy Wang 
---
 drivers/staging/fbtft/fbtft-core.c | 2 +-
 drivers/staging/sm750fb/sm750.c| 1 -
 2 files changed, 1 insertion(+), 2 deletions(-)

diff --git a/drivers/staging/fbtft/fbtft-core.c 
b/drivers/staging/fbtft/fbtft-core.c
index 3a4abf3bae40..eac1d570f437 100644
--- a/drivers/staging/fbtft/fbtft-core.c
+++ b/drivers/staging/fbtft/fbtft-core.c
@@ -684,7 +684,7 @@ struct fb_info *fbtft_framebuffer_alloc(struct 
fbtft_display *display,
info->var.transp.offset =  0;
info->var.transp.length =  0;
 
-   info->flags =  FBINFO_FLAG_DEFAULT | FBINFO_VIRTFB;
+   info->flags =  FBINFO_VIRTFB;
 
par = info->par;
par->info = info;
diff --git a/drivers/staging/sm750fb/sm750.c b/drivers/staging/sm750fb/sm750.c
index c260f73cf570..79bcd5bd4938 100644
--- a/drivers/staging/sm750fb/sm750.c
+++ b/drivers/staging/sm750fb/sm750.c
@@ -807,7 +807,6 @@ static int lynxfb_set_fbinfo(struct fb_info *info, int 
index)
info->screen_base = crtc->v_screen;
pr_debug("screen_base vaddr = %p\n", info->screen_base);
info->screen_size = line_length * var->yres_virtual;
-   info->flags = FBINFO_FLAG_DEFAULT | 0;
 
/* set info->fix */
fix->type = FB_TYPE_PACKED_PIXELS;
-- 
2.41.0



[PATCH 01/17] drm: Remove flag FBINFO_DEFAULT from fbdev emulation

2023-07-10 Thread Thomas Zimmermann
The flag FBINFO_DEFAULT is 0 and has no effect, as struct fbinfo.flags
has been allocated to zero by framebuffer_alloc(). So do not set it.

Flags should signal differences from the default values. After cleaning
up all occurences of FBINFO_DEFAULT, the token can be removed.

Signed-off-by: Thomas Zimmermann 
Cc: Patrik Jakobsson 
Cc: Alex Deucher 
Cc: "Christian König" 
Cc: "Pan, Xinhui" 
---
 drivers/gpu/drm/drm_fbdev_dma.c   | 1 -
 drivers/gpu/drm/drm_fbdev_generic.c   | 1 -
 drivers/gpu/drm/gma500/fbdev.c| 2 +-
 drivers/gpu/drm/radeon/radeon_fbdev.c | 2 +-
 4 files changed, 2 insertions(+), 4 deletions(-)

diff --git a/drivers/gpu/drm/drm_fbdev_dma.c b/drivers/gpu/drm/drm_fbdev_dma.c
index 8217f1ddc007..bc5fdb1da6a3 100644
--- a/drivers/gpu/drm/drm_fbdev_dma.c
+++ b/drivers/gpu/drm/drm_fbdev_dma.c
@@ -123,7 +123,6 @@ static int drm_fbdev_dma_helper_fb_probe(struct 
drm_fb_helper *fb_helper,
drm_fb_helper_fill_info(info, fb_helper, sizes);
 
info->fbops = &drm_fbdev_dma_fb_ops;
-   info->flags = FBINFO_DEFAULT;
 
/* screen */
info->flags |= FBINFO_VIRTFB; /* system memory */
diff --git a/drivers/gpu/drm/drm_fbdev_generic.c 
b/drivers/gpu/drm/drm_fbdev_generic.c
index 98ae703848a0..8a5600b33e10 100644
--- a/drivers/gpu/drm/drm_fbdev_generic.c
+++ b/drivers/gpu/drm/drm_fbdev_generic.c
@@ -109,7 +109,6 @@ static int drm_fbdev_generic_helper_fb_probe(struct 
drm_fb_helper *fb_helper,
drm_fb_helper_fill_info(info, fb_helper, sizes);
 
info->fbops = &drm_fbdev_generic_fb_ops;
-   info->flags = FBINFO_DEFAULT;
 
/* screen */
info->flags |= FBINFO_VIRTFB | FBINFO_READS_FAST;
diff --git a/drivers/gpu/drm/gma500/fbdev.c b/drivers/gpu/drm/gma500/fbdev.c
index 955cbe9f05a7..b09a3ef770d4 100644
--- a/drivers/gpu/drm/gma500/fbdev.c
+++ b/drivers/gpu/drm/gma500/fbdev.c
@@ -215,7 +215,7 @@ static int psb_fbdev_fb_probe(struct drm_fb_helper 
*fb_helper,
}
 
info->fbops = &psb_fbdev_fb_ops;
-   info->flags = FBINFO_DEFAULT;
+
/* Accessed stolen memory directly */
info->screen_base = dev_priv->vram_addr + backing->offset;
info->screen_size = size;
diff --git a/drivers/gpu/drm/radeon/radeon_fbdev.c 
b/drivers/gpu/drm/radeon/radeon_fbdev.c
index ab9c1abbac97..c632ca03032b 100644
--- a/drivers/gpu/drm/radeon/radeon_fbdev.c
+++ b/drivers/gpu/drm/radeon/radeon_fbdev.c
@@ -253,7 +253,7 @@ static int radeon_fbdev_fb_helper_fb_probe(struct 
drm_fb_helper *fb_helper,
}
 
info->fbops = &radeon_fbdev_fb_ops;
-   info->flags = FBINFO_DEFAULT;
+
/* radeon resume is fragile and needs a vt switch to help it along */
info->skip_vt_switch = false;
 
-- 
2.41.0



[PATCH 02/17] fbdev: Remove flag FBINFO_DEFAULT from fbdev drivers

2023-07-10 Thread Thomas Zimmermann
The flag FBINFO_DEFAULT is 0 and has no effect, as struct fbinfo.flags
has been allocated to zero by a static declaration. So do not set it.

Flags should signal differences from the default values. After cleaning
up all occurences of FBINFO_DEFAULT, the token can be removed.

Signed-off-by: Thomas Zimmermann 
Cc: Helge Deller 
---
 drivers/video/fbdev/68328fb.c  | 2 +-
 drivers/video/fbdev/acornfb.c  | 2 +-
 drivers/video/fbdev/g364fb.c   | 2 +-
 drivers/video/fbdev/hpfb.c | 1 -
 drivers/video/fbdev/macfb.c| 1 -
 drivers/video/fbdev/maxinefb.c | 1 -
 6 files changed, 3 insertions(+), 6 deletions(-)

diff --git a/drivers/video/fbdev/68328fb.c b/drivers/video/fbdev/68328fb.c
index 07d6e8dc686b..956dd2399cc0 100644
--- a/drivers/video/fbdev/68328fb.c
+++ b/drivers/video/fbdev/68328fb.c
@@ -448,7 +448,7 @@ static int __init mc68x328fb_init(void)
fb_info.var.red.offset = fb_info.var.green.offset = 
fb_info.var.blue.offset = 0;
}
fb_info.pseudo_palette = &mc68x328fb_pseudo_palette;
-   fb_info.flags = FBINFO_DEFAULT | FBINFO_HWACCEL_YPAN;
+   fb_info.flags = FBINFO_HWACCEL_YPAN;
 
if (fb_alloc_cmap(&fb_info.cmap, 256, 0))
return -ENOMEM;
diff --git a/drivers/video/fbdev/acornfb.c b/drivers/video/fbdev/acornfb.c
index 1b72edc01cfb..8fec21dfca09 100644
--- a/drivers/video/fbdev/acornfb.c
+++ b/drivers/video/fbdev/acornfb.c
@@ -694,7 +694,7 @@ static void acornfb_init_fbinfo(void)
first = 0;
 
fb_info.fbops   = &acornfb_ops;
-   fb_info.flags   = FBINFO_DEFAULT | FBINFO_HWACCEL_YPAN;
+   fb_info.flags   = FBINFO_HWACCEL_YPAN;
fb_info.pseudo_palette  = current_par.pseudo_palette;
 
strcpy(fb_info.fix.id, "Acorn");
diff --git a/drivers/video/fbdev/g364fb.c b/drivers/video/fbdev/g364fb.c
index c5b7673ddc6c..0825cbde116e 100644
--- a/drivers/video/fbdev/g364fb.c
+++ b/drivers/video/fbdev/g364fb.c
@@ -219,7 +219,7 @@ int __init g364fb_init(void)
fb_info.screen_base = (char *) G364_MEM_BASE;   /* virtual kernel 
address */
fb_info.var = fb_var;
fb_info.fix = fb_fix;
-   fb_info.flags = FBINFO_DEFAULT | FBINFO_HWACCEL_YPAN;
+   fb_info.flags = FBINFO_HWACCEL_YPAN;
 
fb_alloc_cmap(&fb_info.cmap, 255, 0);
 
diff --git a/drivers/video/fbdev/hpfb.c b/drivers/video/fbdev/hpfb.c
index 77fbff47b1a8..406c1383cbda 100644
--- a/drivers/video/fbdev/hpfb.c
+++ b/drivers/video/fbdev/hpfb.c
@@ -287,7 +287,6 @@ static int hpfb_init_one(unsigned long phys_base, unsigned 
long virt_base)
else
strcat(fb_info.fix.id, "Catseye");
fb_info.fbops = &hpfb_ops;
-   fb_info.flags = FBINFO_DEFAULT;
fb_info.var   = hpfb_defined;
fb_info.screen_base = (char *)fb_start;
 
diff --git a/drivers/video/fbdev/macfb.c b/drivers/video/fbdev/macfb.c
index 44ff860a3f37..5ca208d992cc 100644
--- a/drivers/video/fbdev/macfb.c
+++ b/drivers/video/fbdev/macfb.c
@@ -876,7 +876,6 @@ static int __init macfb_init(void)
fb_info.var = macfb_defined;
fb_info.fix = macfb_fix;
fb_info.pseudo_palette  = pseudo_palette;
-   fb_info.flags   = FBINFO_DEFAULT;
 
err = fb_alloc_cmap(&fb_info.cmap, video_cmap_len, 0);
if (err)
diff --git a/drivers/video/fbdev/maxinefb.c b/drivers/video/fbdev/maxinefb.c
index 4e6b05232ae2..0ac1873b2acb 100644
--- a/drivers/video/fbdev/maxinefb.c
+++ b/drivers/video/fbdev/maxinefb.c
@@ -155,7 +155,6 @@ int __init maxinefb_init(void)
fb_info.screen_base = (char *)maxinefb_fix.smem_start;
fb_info.var = maxinefb_defined;
fb_info.fix = maxinefb_fix;
-   fb_info.flags = FBINFO_DEFAULT;
 
fb_alloc_cmap(&fb_info.cmap, 256, 0);
 
-- 
2.41.0



[PATCH 08/17] arch/sh: Do not assign FBINFO_FLAG_DEFAULT to fb_videomode.flag

2023-07-10 Thread Thomas Zimmermann
FBINFO_FLAG_DEFAULT is a flag for a framebuffer in struct fb_info.
Flags for videomodes are prefixed with FB_MODE_. FBINFO_FLAG_DEFAULT
is 0 and the static declaration already clears the memory area of
sh7763fb_videomode. So remove the assignment.

Signed-off-by: Thomas Zimmermann 
Cc: Yoshinori Sato 
Cc: Rich Felker 
Cc: John Paul Adrian Glaubitz 
---
 arch/sh/boards/mach-sh7763rdp/setup.c | 1 -
 1 file changed, 1 deletion(-)

diff --git a/arch/sh/boards/mach-sh7763rdp/setup.c 
b/arch/sh/boards/mach-sh7763rdp/setup.c
index 97e715e4e9b3..345f2b76c85a 100644
--- a/arch/sh/boards/mach-sh7763rdp/setup.c
+++ b/arch/sh/boards/mach-sh7763rdp/setup.c
@@ -119,7 +119,6 @@ static struct fb_videomode sh7763fb_videomode = {
.vsync_len = 1,
.sync = 0,
.vmode = FB_VMODE_NONINTERLACED,
-   .flag = FBINFO_FLAG_DEFAULT,
 };
 
 static struct sh7760fb_platdata sh7763fb_def_pdata = {
-- 
2.41.0



[PATCH 11/17] media: Remove flag FBINFO_FLAG_DEFAULT from fbdev drivers

2023-07-10 Thread Thomas Zimmermann
The flag FBINFO_FLAG_DEFAULT is 0 and has no effect, as struct
fbinfo.flags has been allocated to zero by kzalloc(). So do not
set it.

Flags should signal differences from the default values. After cleaning
up all occurences of FBINFO_FLAG_DEFAULT, the token can be removed.

Signed-off-by: Thomas Zimmermann 
Cc: Andy Walls 
Cc: Mauro Carvalho Chehab 
Cc: Hans Verkuil 
---
 drivers/media/pci/ivtv/ivtvfb.c  | 1 -
 drivers/media/test-drivers/vivid/vivid-osd.c | 1 -
 2 files changed, 2 deletions(-)

diff --git a/drivers/media/pci/ivtv/ivtvfb.c b/drivers/media/pci/ivtv/ivtvfb.c
index 0aeb9daaee4c..23c8c094e791 100644
--- a/drivers/media/pci/ivtv/ivtvfb.c
+++ b/drivers/media/pci/ivtv/ivtvfb.c
@@ -1048,7 +1048,6 @@ static int ivtvfb_init_vidmode(struct ivtv *itv)
/* Generate valid fb_info */
 
oi->ivtvfb_info.node = -1;
-   oi->ivtvfb_info.flags = FBINFO_FLAG_DEFAULT;
oi->ivtvfb_info.par = itv;
oi->ivtvfb_info.var = oi->ivtvfb_defined;
oi->ivtvfb_info.fix = oi->ivtvfb_fix;
diff --git a/drivers/media/test-drivers/vivid/vivid-osd.c 
b/drivers/media/test-drivers/vivid/vivid-osd.c
index ec25edc679b3..051f1805a16d 100644
--- a/drivers/media/test-drivers/vivid/vivid-osd.c
+++ b/drivers/media/test-drivers/vivid/vivid-osd.c
@@ -310,7 +310,6 @@ static int vivid_fb_init_vidmode(struct vivid_dev *dev)
/* Generate valid fb_info */
 
dev->fb_info.node = -1;
-   dev->fb_info.flags = FBINFO_FLAG_DEFAULT;
dev->fb_info.par = dev;
dev->fb_info.var = dev->fb_defined;
dev->fb_info.fix = dev->fb_fix;
-- 
2.41.0



[PATCH 03/17] fbdev: Remove flag FBINFO_DEFAULT from fbdev drivers

2023-07-10 Thread Thomas Zimmermann
The flag FBINFO_DEFAULT is 0 and has no effect, as struct fbinfo.flags
has been allocated to zero by kzalloc(). So do not set it.

Flags should signal differences from the default values. After cleaning
up all occurences of FBINFO_DEFAULT, the token can be removed.

Signed-off-by: Thomas Zimmermann 
Cc: Helge Deller 
Cc: Russell King 
---
 drivers/video/fbdev/controlfb.c   | 2 +-
 drivers/video/fbdev/cyber2000fb.c | 2 +-
 drivers/video/fbdev/valkyriefb.c  | 1 -
 drivers/video/fbdev/vermilion/vermilion.c | 2 +-
 drivers/video/fbdev/vt8500lcdfb.c | 3 +--
 5 files changed, 4 insertions(+), 6 deletions(-)

diff --git a/drivers/video/fbdev/controlfb.c b/drivers/video/fbdev/controlfb.c
index 82eeb139c4eb..717134c141ff 100644
--- a/drivers/video/fbdev/controlfb.c
+++ b/drivers/video/fbdev/controlfb.c
@@ -775,7 +775,7 @@ static void __init control_init_info(struct fb_info *info, 
struct fb_info_contro
info->par = &p->par;
info->fbops = &controlfb_ops;
info->pseudo_palette = p->pseudo_palette;
-info->flags = FBINFO_DEFAULT | FBINFO_HWACCEL_YPAN;
+   info->flags = FBINFO_HWACCEL_YPAN;
info->screen_base = p->frame_buffer + CTRLFB_OFF;
 
fb_alloc_cmap(&info->cmap, 256, 0);
diff --git a/drivers/video/fbdev/cyber2000fb.c 
b/drivers/video/fbdev/cyber2000fb.c
index 38c0a6866d76..98ea56a9abf1 100644
--- a/drivers/video/fbdev/cyber2000fb.c
+++ b/drivers/video/fbdev/cyber2000fb.c
@@ -1459,7 +1459,7 @@ static struct cfb_info *cyberpro_alloc_fb_info(unsigned 
int id, char *name)
cfb->fb.var.accel_flags = FB_ACCELF_TEXT;
 
cfb->fb.fbops   = &cyber2000fb_ops;
-   cfb->fb.flags   = FBINFO_DEFAULT | FBINFO_HWACCEL_YPAN;
+   cfb->fb.flags   = FBINFO_HWACCEL_YPAN;
cfb->fb.pseudo_palette  = cfb->pseudo_palette;
 
spin_lock_init(&cfb->reg_b0_lock);
diff --git a/drivers/video/fbdev/valkyriefb.c b/drivers/video/fbdev/valkyriefb.c
index b166b7cfe0e5..fd4488777032 100644
--- a/drivers/video/fbdev/valkyriefb.c
+++ b/drivers/video/fbdev/valkyriefb.c
@@ -535,7 +535,6 @@ static int __init valkyrie_init_info(struct fb_info *info,
 {
info->fbops = &valkyriefb_ops;
info->screen_base = p->frame_buffer + 0x1000;
-   info->flags = FBINFO_DEFAULT;
info->pseudo_palette = p->pseudo_palette;
info->par = &p->par;
return fb_alloc_cmap(&info->cmap, 256, 0);
diff --git a/drivers/video/fbdev/vermilion/vermilion.c 
b/drivers/video/fbdev/vermilion/vermilion.c
index 32e74e02a02f..71584c775efd 100644
--- a/drivers/video/fbdev/vermilion/vermilion.c
+++ b/drivers/video/fbdev/vermilion/vermilion.c
@@ -477,7 +477,7 @@ static int vml_pci_probe(struct pci_dev *dev, const struct 
pci_device_id *id)
}
 
info = &vinfo->info;
-   info->flags = FBINFO_DEFAULT | FBINFO_PARTIAL_PAN_OK;
+   info->flags = FBINFO_PARTIAL_PAN_OK;
 
err = vmlfb_enable_mmio(par);
if (err)
diff --git a/drivers/video/fbdev/vt8500lcdfb.c 
b/drivers/video/fbdev/vt8500lcdfb.c
index 31d4e85b220c..42d39a9d5130 100644
--- a/drivers/video/fbdev/vt8500lcdfb.c
+++ b/drivers/video/fbdev/vt8500lcdfb.c
@@ -300,8 +300,7 @@ static int vt8500lcd_probe(struct platform_device *pdev)
fbi->fb.var.vmode   = FB_VMODE_NONINTERLACED;
 
fbi->fb.fbops   = &vt8500lcd_ops;
-   fbi->fb.flags   = FBINFO_DEFAULT
-   | FBINFO_HWACCEL_COPYAREA
+   fbi->fb.flags   = FBINFO_HWACCEL_COPYAREA
| FBINFO_HWACCEL_FILLRECT
| FBINFO_HWACCEL_YPAN
| FBINFO_VIRTFB
-- 
2.41.0



[PATCH 15/17] fbdev/atafb: Remove flag FBINFO_FLAG_DEFAULT

2023-07-10 Thread Thomas Zimmermann
The flag FBINFO_FLAG_DEFAULT is 0 and has no effect, as struct
fbinfo.flags has been allocated to zero by a static declaration. So do
not set it.

Flags should signal differences from the default values. After cleaning
up all occurences of FBINFO_FLAG_DEFAULT, the token can be removed.

Signed-off-by: Thomas Zimmermann 
Cc: Helge Deller 
---
 drivers/video/fbdev/atafb.c | 1 -
 1 file changed, 1 deletion(-)

diff --git a/drivers/video/fbdev/atafb.c b/drivers/video/fbdev/atafb.c
index 2bc4089865e6..c4a420b791b9 100644
--- a/drivers/video/fbdev/atafb.c
+++ b/drivers/video/fbdev/atafb.c
@@ -3112,7 +3112,6 @@ static int __init atafb_probe(struct platform_device 
*pdev)
 #ifdef ATAFB_FALCON
fb_info.pseudo_palette = current_par.hw.falcon.pseudo_palette;
 #endif
-   fb_info.flags = FBINFO_FLAG_DEFAULT;
 
if (!fb_find_mode(&fb_info.var, &fb_info, mode_option, atafb_modedb,
  NUM_TOTAL_MODES, &atafb_modedb[defmode],
-- 
2.41.0



[PATCH 10/17] hid/picolcd: Remove flag FBINFO_FLAG_DEFAULT from fbdev driver

2023-07-10 Thread Thomas Zimmermann
The flag FBINFO_FLAG_DEFAULT is 0 and has no effect, as struct
fbinfo.flags has been allocated to zero by framebuffer_alloc(). So do
not set it.

Flags should signal differences from the default values. After cleaning
up all occurences of FBINFO_FLAG_DEFAULT, the token can be removed.

Signed-off-by: Thomas Zimmermann 
Cc: "Bruno Prémont" 
Cc: Jiri Kosina 
Cc: Benjamin Tissoires 
---
 drivers/hid/hid-picolcd_fb.c | 1 -
 1 file changed, 1 deletion(-)

diff --git a/drivers/hid/hid-picolcd_fb.c b/drivers/hid/hid-picolcd_fb.c
index dabcd054dad9..d726aaafb146 100644
--- a/drivers/hid/hid-picolcd_fb.c
+++ b/drivers/hid/hid-picolcd_fb.c
@@ -527,7 +527,6 @@ int picolcd_init_framebuffer(struct picolcd_data *data)
info->var = picolcdfb_var;
info->fix = picolcdfb_fix;
info->fix.smem_len   = PICOLCDFB_SIZE*8;
-   info->flags = FBINFO_FLAG_DEFAULT;
 
fbdata = info->par;
spin_lock_init(&fbdata->lock);
-- 
2.41.0



[PATCH 14/17] fbdev: Remove flag FBINFO_FLAG_DEFAULT from fbdev drivers

2023-07-10 Thread Thomas Zimmermann
The flag FBINFO_FLAG_DEFAULT is 0 and has no effect, as struct
fbinfo.flags has been allocated to zero by framebuffer_alloc(). So
do not set it.

Flags should signal differences from the default values. After cleaning
up all occurences of FBINFO_FLAG_DEFAULT, the token can be removed.

Signed-off-by: Thomas Zimmermann 
Cc: Jaya Kumar 
Cc: Helge Deller 
Cc: Peter Jones 
Cc: Sascha Hauer 
Cc: Pengutronix Kernel Team 
Cc: Shawn Guo 
Cc: Fabio Estevam 
Cc: NXP Linux Team 
Cc: Maik Broemme 
Cc: Jingoo Han 
Cc: Sudip Mukherjee 
Cc: Teddy Wang 
Cc: Michal Januszewski 
---
 drivers/video/fbdev/arcfb.c| 1 -
 drivers/video/fbdev/aty/aty128fb.c | 1 -
 drivers/video/fbdev/broadsheetfb.c | 2 +-
 drivers/video/fbdev/da8xx-fb.c | 1 -
 drivers/video/fbdev/efifb.c| 1 -
 drivers/video/fbdev/goldfishfb.c   | 1 -
 drivers/video/fbdev/gxt4500.c  | 3 +--
 drivers/video/fbdev/hecubafb.c | 2 +-
 drivers/video/fbdev/imxfb.c| 3 +--
 drivers/video/fbdev/intelfb/intelfbdrv.c   | 1 -
 drivers/video/fbdev/metronomefb.c  | 2 +-
 drivers/video/fbdev/mx3fb.c| 1 -
 drivers/video/fbdev/omap/omapfb_main.c | 1 -
 drivers/video/fbdev/omap2/omapfb/omapfb-main.c | 1 -
 drivers/video/fbdev/s3c-fb.c   | 1 -
 drivers/video/fbdev/sh_mobile_lcdcfb.c | 2 --
 drivers/video/fbdev/sis/sis_main.c | 2 --
 drivers/video/fbdev/sm501fb.c  | 2 +-
 drivers/video/fbdev/sm712fb.c  | 1 -
 drivers/video/fbdev/uvesafb.c  | 3 +--
 drivers/video/fbdev/vesafb.c   | 2 +-
 drivers/video/fbdev/vfb.c  | 1 -
 drivers/video/fbdev/vga16fb.c  | 2 +-
 drivers/video/fbdev/xen-fbfront.c  | 2 +-
 24 files changed, 10 insertions(+), 29 deletions(-)

diff --git a/drivers/video/fbdev/arcfb.c b/drivers/video/fbdev/arcfb.c
index 9aaea3be8281..cff11cb04a55 100644
--- a/drivers/video/fbdev/arcfb.c
+++ b/drivers/video/fbdev/arcfb.c
@@ -546,7 +546,6 @@ static int arcfb_probe(struct platform_device *dev)
par->c2io_addr = c2io_addr;
par->cslut[0] = 0x00;
par->cslut[1] = 0x06;
-   info->flags = FBINFO_FLAG_DEFAULT;
spin_lock_init(&par->lock);
if (irq) {
par->irq = irq;
diff --git a/drivers/video/fbdev/aty/aty128fb.c 
b/drivers/video/fbdev/aty/aty128fb.c
index 2d9320a52e51..b44fc78ccd4f 100644
--- a/drivers/video/fbdev/aty/aty128fb.c
+++ b/drivers/video/fbdev/aty/aty128fb.c
@@ -1927,7 +1927,6 @@ static int aty128_init(struct pci_dev *pdev, const struct 
pci_device_id *ent)
 
/* fill in info */
info->fbops = &aty128fb_ops;
-   info->flags = FBINFO_FLAG_DEFAULT;
 
par->lcd_on = default_lcd_on;
par->crt_on = default_crt_on;
diff --git a/drivers/video/fbdev/broadsheetfb.c 
b/drivers/video/fbdev/broadsheetfb.c
index cb725a91b6bb..e51e14c29c55 100644
--- a/drivers/video/fbdev/broadsheetfb.c
+++ b/drivers/video/fbdev/broadsheetfb.c
@@ -1069,7 +1069,7 @@ static int broadsheetfb_probe(struct platform_device *dev)
 
mutex_init(&par->io_lock);
 
-   info->flags = FBINFO_FLAG_DEFAULT | FBINFO_VIRTFB;
+   info->flags = FBINFO_VIRTFB;
 
info->fbdefio = &broadsheetfb_defio;
fb_deferred_io_init(info);
diff --git a/drivers/video/fbdev/da8xx-fb.c b/drivers/video/fbdev/da8xx-fb.c
index 60cd1286370f..988dedcf6be8 100644
--- a/drivers/video/fbdev/da8xx-fb.c
+++ b/drivers/video/fbdev/da8xx-fb.c
@@ -1463,7 +1463,6 @@ static int fb_probe(struct platform_device *device)
da8xx_fb_var.bits_per_pixel = lcd_cfg->bpp;
 
/* Initialize fbinfo */
-   da8xx_fb_info->flags = FBINFO_FLAG_DEFAULT;
da8xx_fb_info->fix = da8xx_fb_fix;
da8xx_fb_info->var = da8xx_fb_var;
da8xx_fb_info->fbops = &da8xx_fb_ops;
diff --git a/drivers/video/fbdev/efifb.c b/drivers/video/fbdev/efifb.c
index 3d7be69ab593..3391c8e84210 100644
--- a/drivers/video/fbdev/efifb.c
+++ b/drivers/video/fbdev/efifb.c
@@ -555,7 +555,6 @@ static int efifb_probe(struct platform_device *dev)
info->fbops = &efifb_ops;
info->var = efifb_defined;
info->fix = efifb_fix;
-   info->flags = FBINFO_FLAG_DEFAULT;
 
orientation = drm_get_panel_orientation_quirk(efifb_defined.xres,
  efifb_defined.yres);
diff --git a/drivers/video/fbdev/goldfishfb.c b/drivers/video/fbdev/goldfishfb.c
index 6fa2108fd912..ef2528c3faa9 100644
--- a/drivers/video/fbdev/goldfishfb.c
+++ b/drivers/video/fbdev/goldfishfb.c
@@ -212,7 +212,6 @@ static int goldfish_fb_probe(struct platform_device *pdev)
height = readl(fb->reg_base + FB_GET_HEIGHT);
 
fb->fb.fbops= &goldfish_fb_ops;
- 

[PATCH 16/17] fbdev/pxafb: Remove flag FBINFO_FLAG_DEFAULT

2023-07-10 Thread Thomas Zimmermann
The flag FBINFO_FLAG_DEFAULT is 0 and has no effect, as struct
fbinfo.flags has been allocated to zero by devm_kzalloc(). So do not
set it.

Flags should signal differences from the default values. After cleaning
up all occurences of FBINFO_FLAG_DEFAULT, the token can be removed.

Signed-off-by: Thomas Zimmermann 
Cc: Helge Deller 
---
 drivers/video/fbdev/pxafb.c | 1 -
 1 file changed, 1 deletion(-)

diff --git a/drivers/video/fbdev/pxafb.c b/drivers/video/fbdev/pxafb.c
index c8c4677d06b4..beffb0602a2c 100644
--- a/drivers/video/fbdev/pxafb.c
+++ b/drivers/video/fbdev/pxafb.c
@@ -888,7 +888,6 @@ static void init_pxafb_overlay(struct pxafb_info *fbi, 
struct pxafb_layer *ofb,
ofb->fb.var.vmode   = FB_VMODE_NONINTERLACED;
 
ofb->fb.fbops   = &overlay_fb_ops;
-   ofb->fb.flags   = FBINFO_FLAG_DEFAULT;
ofb->fb.node= -1;
ofb->fb.pseudo_palette  = NULL;
 
-- 
2.41.0



[PATCH 13/17] fbdev: Remove flag FBINFO_FLAG_DEFAULT from fbdev drivers

2023-07-10 Thread Thomas Zimmermann
The flag FBINFO_FLAG_DEFAULT is 0 and has no effect, as struct
fbinfo.flags has been allocated to zero by kzalloc(). So do not
set it.

Flags should signal differences from the default values. After cleaning
up all occurences of FBINFO_FLAG_DEFAULT, the token can be removed.

Signed-off-by: Thomas Zimmermann 
Cc: Helge Deller 
---
 drivers/video/fbdev/amba-clcd.c | 1 -
 drivers/video/fbdev/matrox/matroxfb_crtc2.c | 5 ++---
 2 files changed, 2 insertions(+), 4 deletions(-)

diff --git a/drivers/video/fbdev/amba-clcd.c b/drivers/video/fbdev/amba-clcd.c
index e45338227be6..24d89e6fb780 100644
--- a/drivers/video/fbdev/amba-clcd.c
+++ b/drivers/video/fbdev/amba-clcd.c
@@ -461,7 +461,6 @@ static int clcdfb_register(struct clcd_fb *fb)
}
 
fb->fb.fbops= &clcdfb_ops;
-   fb->fb.flags= FBINFO_FLAG_DEFAULT;
fb->fb.pseudo_palette   = fb->cmap;
 
strncpy(fb->fb.fix.id, clcd_name, sizeof(fb->fb.fix.id));
diff --git a/drivers/video/fbdev/matrox/matroxfb_crtc2.c 
b/drivers/video/fbdev/matrox/matroxfb_crtc2.c
index 7655afa3fd50..372197c124de 100644
--- a/drivers/video/fbdev/matrox/matroxfb_crtc2.c
+++ b/drivers/video/fbdev/matrox/matroxfb_crtc2.c
@@ -603,9 +603,8 @@ static int matroxfb_dh_regit(const struct matrox_fb_info 
*minfo,
void* oldcrtc2;
 
m2info->fbcon.fbops = &matroxfb_dh_ops;
-   m2info->fbcon.flags = FBINFO_FLAG_DEFAULT;
-   m2info->fbcon.flags |= FBINFO_HWACCEL_XPAN |
-  FBINFO_HWACCEL_YPAN;
+   m2info->fbcon.flags = FBINFO_HWACCEL_XPAN |
+ FBINFO_HWACCEL_YPAN;
m2info->fbcon.pseudo_palette = m2info->cmap;
fb_alloc_cmap(&m2info->fbcon.cmap, 256, 1);
 
-- 
2.41.0



[PATCH 09/17] auxdisplay: Remove flag FBINFO_FLAG_DEFAULT from fbdev drivers

2023-07-10 Thread Thomas Zimmermann
The flag FBINFO_FLAG_DEFAULT is 0 and has no effect, as struct
fbinfo.flags has been allocated to zero by framebuffer_alloc(). So do
not set it.

Flags should signal differences from the default values. After cleaning
up all occurences of FBINFO_FLAG_DEFAULT, the token can be removed.

Signed-off-by: Thomas Zimmermann 
Cc: Miguel Ojeda 
Cc: Robin van der Gracht 
---
 drivers/auxdisplay/cfag12864bfb.c | 1 -
 drivers/auxdisplay/ht16k33.c  | 1 -
 2 files changed, 2 deletions(-)

diff --git a/drivers/auxdisplay/cfag12864bfb.c 
b/drivers/auxdisplay/cfag12864bfb.c
index c2cab7e2b126..729845bcc803 100644
--- a/drivers/auxdisplay/cfag12864bfb.c
+++ b/drivers/auxdisplay/cfag12864bfb.c
@@ -79,7 +79,6 @@ static int cfag12864bfb_probe(struct platform_device *device)
info->var = cfag12864bfb_var;
info->pseudo_palette = NULL;
info->par = NULL;
-   info->flags = FBINFO_FLAG_DEFAULT;
 
if (register_framebuffer(info) < 0)
goto fballoced;
diff --git a/drivers/auxdisplay/ht16k33.c b/drivers/auxdisplay/ht16k33.c
index edaf92b7ea77..df3f37651e45 100644
--- a/drivers/auxdisplay/ht16k33.c
+++ b/drivers/auxdisplay/ht16k33.c
@@ -646,7 +646,6 @@ static int ht16k33_fbdev_probe(struct device *dev, struct 
ht16k33_priv *priv,
fbdev->info->var = ht16k33_fb_var;
fbdev->info->bl_dev = bl;
fbdev->info->pseudo_palette = NULL;
-   fbdev->info->flags = FBINFO_FLAG_DEFAULT;
fbdev->info->par = priv;
 
err = register_framebuffer(fbdev->info);
-- 
2.41.0



[PATCH 17/17] fbdev: Remove FBINFO_DEFAULT and FBINFO_FLAG_DEFAULT

2023-07-10 Thread Thomas Zimmermann
Remove the unused flags FBINFO_DEFAULT and FBINFO_FLAG_DEFAULT. No
functional changes.

Signed-off-by: Thomas Zimmermann 
Cc: Helge Deller 
---
 include/linux/fb.h | 3 ---
 1 file changed, 3 deletions(-)

diff --git a/include/linux/fb.h b/include/linux/fb.h
index 1d5c13f34b09..43458f582f35 100644
--- a/include/linux/fb.h
+++ b/include/linux/fb.h
@@ -383,7 +383,6 @@ struct fb_tile_ops {
 #endif /* CONFIG_FB_TILEBLITTING */
 
 /* FBINFO_* = fb_info.flags bit flags */
-#define FBINFO_DEFAULT 0
 #define FBINFO_HWACCEL_DISABLED0x0002
/* When FBINFO_HWACCEL_DISABLED is set:
 *  Hardware acceleration is turned off.  Software implementations
@@ -504,8 +503,6 @@ struct fb_info {
bool skip_vt_switch; /* no VT switch on suspend/resume required */
 };
 
-#define FBINFO_FLAG_DEFAULTFBINFO_DEFAULT
-
 /* This will go away
  * fbset currently hacks in FB_ACCELF_TEXT into var.accel_flags
  * when it wants to turn the acceleration engine on.  This is
-- 
2.41.0



[PATCH 05/17] fbdev: Remove flag FBINFO_DEFAULT from fbdev drivers

2023-07-10 Thread Thomas Zimmermann
The flag FBINFO_DEFAULT is 0 and has no effect, as struct fbinfo.flags
has been allocated to zero by framebuffer_alloc(). So do not set it.

Flags should signal differences from the default values. After cleaning
up all occurences of FBINFO_DEFAULT, the token can be removed.

Signed-off-by: Thomas Zimmermann 
Cc: Helge Deller 
Cc: Nicolas Ferre 
Cc: Benjamin Herrenschmidt 
Cc: Ferenc Bakonyi 
Cc: "K. Y. Srinivasan" 
Cc: Haiyang Zhang 
Cc: Wei Liu 
Cc: Dexuan Cui 
Cc: Antonino Daplas 
Cc: Maik Broemme 
Cc: Michael Ellerman 
Cc: Nicholas Piggin 
Cc: Christophe Leroy 
Cc: Kristoffer Ericson 
Cc: Hans de Goede 
Cc: Steve Glendinning 
Cc: Bernie Thompson 
Cc: Florian Tobias Schandinat 
---
 drivers/video/fbdev/amifb.c  | 5 ++---
 drivers/video/fbdev/asiliantfb.c | 1 -
 drivers/video/fbdev/atmel_lcdfb.c| 2 +-
 drivers/video/fbdev/aty/atyfb_base.c | 3 +--
 drivers/video/fbdev/aty/radeon_base.c| 3 +--
 drivers/video/fbdev/bw2.c| 1 -
 drivers/video/fbdev/carminefb.c  | 1 -
 drivers/video/fbdev/cg14.c   | 2 +-
 drivers/video/fbdev/cg3.c| 1 -
 drivers/video/fbdev/cg6.c| 2 +-
 drivers/video/fbdev/chipsfb.c| 1 -
 drivers/video/fbdev/cirrusfb.c   | 3 +--
 drivers/video/fbdev/clps711x-fb.c| 1 -
 drivers/video/fbdev/cobalt_lcdfb.c   | 1 -
 drivers/video/fbdev/ep93xx-fb.c  | 1 -
 drivers/video/fbdev/ffb.c| 3 +--
 drivers/video/fbdev/fm2fb.c  | 1 -
 drivers/video/fbdev/gbefb.c  | 1 -
 drivers/video/fbdev/geode/gx1fb_core.c   | 1 -
 drivers/video/fbdev/geode/gxfb_core.c| 1 -
 drivers/video/fbdev/geode/lxfb_core.c| 1 -
 drivers/video/fbdev/grvga.c  | 2 +-
 drivers/video/fbdev/hgafb.c  | 2 +-
 drivers/video/fbdev/hitfb.c  | 2 +-
 drivers/video/fbdev/hyperv_fb.c  | 2 --
 drivers/video/fbdev/i740fb.c | 2 +-
 drivers/video/fbdev/i810/i810_main.c | 4 ++--
 drivers/video/fbdev/imsttfb.c| 3 +--
 drivers/video/fbdev/intelfb/intelfbdrv.c | 4 ++--
 drivers/video/fbdev/kyro/fbdev.c | 1 -
 drivers/video/fbdev/leo.c| 1 -
 drivers/video/fbdev/mb862xx/mb862xxfbdrv.c   | 2 +-
 drivers/video/fbdev/mmp/fb/mmpfb.c   | 2 +-
 drivers/video/fbdev/neofb.c  | 2 +-
 drivers/video/fbdev/nvidia/nvidia.c  | 4 ++--
 drivers/video/fbdev/offb.c   | 2 +-
 drivers/video/fbdev/p9100.c  | 1 -
 drivers/video/fbdev/platinumfb.c | 1 -
 drivers/video/fbdev/pm2fb.c  | 3 +--
 drivers/video/fbdev/pm3fb.c  | 3 +--
 drivers/video/fbdev/pmag-aa-fb.c | 1 -
 drivers/video/fbdev/pmag-ba-fb.c | 1 -
 drivers/video/fbdev/pmagb-b-fb.c | 1 -
 drivers/video/fbdev/ps3fb.c  | 2 +-
 drivers/video/fbdev/pvr2fb.c | 2 +-
 drivers/video/fbdev/pxa168fb.c   | 2 +-
 drivers/video/fbdev/q40fb.c  | 1 -
 drivers/video/fbdev/riva/fbdev.c | 3 +--
 drivers/video/fbdev/s1d13xxxfb.c | 4 ++--
 drivers/video/fbdev/savage/savagefb_driver.c | 3 +--
 drivers/video/fbdev/simplefb.c   | 1 -
 drivers/video/fbdev/sis/sis_main.c   | 3 +--
 drivers/video/fbdev/skeletonfb.c | 2 +-
 drivers/video/fbdev/smscufx.c| 2 +-
 drivers/video/fbdev/sstfb.c  | 1 -
 drivers/video/fbdev/sunxvr1000.c | 1 -
 drivers/video/fbdev/sunxvr2500.c | 1 -
 drivers/video/fbdev/sunxvr500.c  | 1 -
 drivers/video/fbdev/tcx.c| 1 -
 drivers/video/fbdev/tdfxfb.c | 2 +-
 drivers/video/fbdev/tgafb.c  | 2 +-
 drivers/video/fbdev/tridentfb.c  | 2 +-
 drivers/video/fbdev/udlfb.c  | 2 +-
 drivers/video/fbdev/via/viafbdev.c   | 2 +-
 64 files changed, 41 insertions(+), 81 deletions(-)

diff --git a/drivers/video/fbdev/amifb.c b/drivers/video/fbdev/amifb.c
index d88265dbebf4..cea782283b9c 100644
--- a/drivers/video/fbdev/amifb.c
+++ b/drivers/video/fbdev/amifb.c
@@ -2427,7 +2427,7 @@ static int amifb_set_par(struct fb_info *info)
info->fix.ywrapstep = 1;
info->fix.xpanstep = 0;
info->fix.ypanstep = 0;
-   info->flags = FBINFO_DEFAULT | FBINFO_HWACCEL_YWRAP |
+   info->flags = FBINFO_HWACCEL_YWRAP |
FBINFO_READS_FAST; /* override SCROLL_REDRAW */
} else {
info->fix.ywrapstep = 0;
@@ -2436,7 +2436,7 @@ static int amifb_set_par(struct fb_info *info)
else
info->fix.xpanstep = 16 << maxfmode;
info->fix.ypanstep = 1;
-   

Re: [PATCH 08/17] arch/sh: Do not assign FBINFO_FLAG_DEFAULT to fb_videomode.flag

2023-07-10 Thread Thomas Zimmermann

Hi

Am 10.07.23 um 15:42 schrieb John Paul Adrian Glaubitz:

Hi Thomas!

On Mon, 2023-07-10 at 14:50 +0200, Thomas Zimmermann wrote:

FBINFO_FLAG_DEFAULT is a flag for a framebuffer in struct fb_info.
Flags for videomodes are prefixed with FB_MODE_. FBINFO_FLAG_DEFAULT
is 0 and the static declaration already clears the memory area of
sh7763fb_videomode. So remove the assignment.

Signed-off-by: Thomas Zimmermann 
Cc: Yoshinori Sato 
Cc: Rich Felker 
Cc: John Paul Adrian Glaubitz 
---
  arch/sh/boards/mach-sh7763rdp/setup.c | 1 -
  1 file changed, 1 deletion(-)

diff --git a/arch/sh/boards/mach-sh7763rdp/setup.c 
b/arch/sh/boards/mach-sh7763rdp/setup.c
index 97e715e4e9b3..345f2b76c85a 100644
--- a/arch/sh/boards/mach-sh7763rdp/setup.c
+++ b/arch/sh/boards/mach-sh7763rdp/setup.c
@@ -119,7 +119,6 @@ static struct fb_videomode sh7763fb_videomode = {
.vsync_len = 1,
.sync = 0,
.vmode = FB_VMODE_NONINTERLACED,
-   .flag = FBINFO_FLAG_DEFAULT,
  };
  
  static struct sh7760fb_platdata sh7763fb_def_pdata = {


I would argue that the current code is more readable that your proposed change.

I agree that it's a no-op, but code is not just about functionality but also
readability, isn't it?


I won't argue with that, but the flag itself is wrong. 
FBINFO_FLAG_DEFAULT is/was for struct fb_info.flags. You have struct 
fb_videomode.flag. The valid flags for this field are at [1]. If 
anything, the field could be initialized to FB_MODE_IS_UNKNOWN, which 
has the same value.


[1] https://elixir.bootlin.com/linux/latest/source/include/linux/fb.h#L681



Also, I prefer "sh:" as the architecture prefix, not "arch/sh:".


Ok.

Best regards
Thomas


Thanks,
Adrian



--
Thomas Zimmermann
Graphics Driver Developer
SUSE Software Solutions Germany GmbH
Frankenstrasse 146, 90461 Nuernberg, Germany
GF: Ivo Totev, Andrew Myers, Andrew McDonald, Boudien Moerman
HRB 36809 (AG Nuernberg)


OpenPGP_signature
Description: OpenPGP digital signature


Re: [PATCH 08/17] arch/sh: Do not assign FBINFO_FLAG_DEFAULT to fb_videomode.flag

2023-07-10 Thread Thomas Zimmermann

Hi

Am 10.07.23 um 15:59 schrieb John Paul Adrian Glaubitz:

Hi Thomas!

On Mon, 2023-07-10 at 15:52 +0200, Thomas Zimmermann wrote:

I would argue that the current code is more readable that your proposed change.

I agree that it's a no-op, but code is not just about functionality but also
readability, isn't it?


I won't argue with that, but the flag itself is wrong.
FBINFO_FLAG_DEFAULT is/was for struct fb_info.flags. You have struct
fb_videomode.flag. The valid flags for this field are at [1]. If
anything, the field could be initialized to FB_MODE_IS_UNKNOWN, which
has the same value.

[1] https://elixir.bootlin.com/linux/latest/source/include/linux/fb.h#L681


FB_MODE_IS_UNKNOWN sounds very reasonable to me. Would you agree using that 
instead?


Sure, I'll update the patch accordingly.

Best regards
Thomas





Also, I prefer "sh:" as the architecture prefix, not "arch/sh:".


Ok.


Thanks.

Adrian



--
Thomas Zimmermann
Graphics Driver Developer
SUSE Software Solutions Germany GmbH
Frankenstrasse 146, 90461 Nuernberg, Germany
GF: Ivo Totev, Andrew Myers, Andrew McDonald, Boudien Moerman
HRB 36809 (AG Nuernberg)


OpenPGP_signature
Description: OpenPGP digital signature


Re: [PATCH 09/17] auxdisplay: Remove flag FBINFO_FLAG_DEFAULT from fbdev drivers

2023-07-10 Thread Thomas Zimmermann

Hi

Am 10.07.23 um 16:24 schrieb Miguel Ojeda:

On Mon, Jul 10, 2023 at 3:01 PM Thomas Zimmermann  wrote:


The flag FBINFO_FLAG_DEFAULT is 0 and has no effect, as struct
fbinfo.flags has been allocated to zero by framebuffer_alloc(). So do
not set it.


`framebuffer_alloc()` does indeed use `kzalloc()`, but the docs do not
mention the zeroing. Should that guarantee be documented?


I'll append a patch to the series that documents this.




Flags should signal differences from the default values. After cleaning
up all occurences of FBINFO_FLAG_DEFAULT, the token can be removed.


occurences -> occurrences

can -> will maybe? Since the intention of the patch series is to
remove it (them) altogether).


Sure.

Best regards
Thomas



Thanks!

Cheers,
Miguel


--
Thomas Zimmermann
Graphics Driver Developer
SUSE Software Solutions Germany GmbH
Frankenstrasse 146, 90461 Nuernberg, Germany
GF: Ivo Totev, Andrew Myers, Andrew McDonald, Boudien Moerman
HRB 36809 (AG Nuernberg)


OpenPGP_signature
Description: OpenPGP digital signature


Re: [PATCH 09/17] auxdisplay: Remove flag FBINFO_FLAG_DEFAULT from fbdev drivers

2023-07-10 Thread Thomas Zimmermann

Hi

Am 10.07.23 um 18:25 schrieb Miguel Ojeda:

On Mon, Jul 10, 2023 at 5:22 PM Thomas Zimmermann  wrote:


I'll append a patch to the series that documents this.

Sure.


Thanks!

If you are planning to take it into some other tree:

Acked-by: Miguel Ojeda 


Thanks.



Otherwise, I can take it into the `auxdisplay` tree.


I'd like to take the patchset into drm-misc. It's part of a larger 
cleanup of the fbdev modules and its interfaces.


Best regards
Thomas



Cheers,
Miguel


--
Thomas Zimmermann
Graphics Driver Developer
SUSE Software Solutions Germany GmbH
Frankenstrasse 146, 90461 Nuernberg, Germany
GF: Ivo Totev, Andrew Myers, Andrew McDonald, Boudien Moerman
HRB 36809 (AG Nuernberg)


OpenPGP_signature
Description: OpenPGP digital signature


Re: [PATCH 00/17] fbdev: Remove FBINFO_DEFAULT and FBINFO_FLAG_DEFAULT flags

2023-07-10 Thread Thomas Zimmermann

Hi Sam

Am 10.07.23 um 19:19 schrieb Sam Ravnborg:

Hi Thomas,

On Mon, Jul 10, 2023 at 02:50:04PM +0200, Thomas Zimmermann wrote:

Remove the unused flags FBINFO_DEFAULT and FBINFO_FLAG_DEFAULT from
fbdev and drivers, as briefly discussed at [1]. Both flags were maybe
useful when fbdev had special handling for driver modules. With
commit 376b3ff54c9a ("fbdev: Nuke FBINFO_MODULE"), they are both 0
and have no further effect.

Patches 1 to 7 remove FBINFO_DEFAULT from drivers. Patches 2 to 5
split this by the way the fb_info struct is being allocated. All flags
are cleared to zero during the allocation.

Patches 8 to 16 do the same for FBINFO_FLAG_DEFAULT. Patch 8 fixes
an actual bug in how arch/sh uses the tokne for struct fb_videomode,
which is unrelated.

Patch 17 removes both flag constants from 


We have a few more flags that are unused - should they be nuked too?
FBINFO_HWACCEL_FILLRECT
FBINFO_HWACCEL_ROTATE
FBINFO_HWACCEL_XPAN


It seems those are there for completeness. Nothing sets _ROTATE, the 
others are simply never checked. According to the comments, some are 
required, some are optional. I don't know what that means.


IIRC there were complains about performance when Daniel tried to remove 
fbcon acceleration, so not all _HWACCEL_ flags are unneeded.


Leaving them in for reference/completeness might be an option; or not. I 
have no strong feelings about those flags.




Unused as in no references from fbdev/core/*

I would rather see one series nuke all unused FBINFO flags in one go.
Assuming my quick grep are right and the above can be dropped.


I would not want to extend this series. I'm removing _DEFAULT as it's 
absolutely pointless and confusing.


Best regards
Thomas



Sam


--
Thomas Zimmermann
Graphics Driver Developer
SUSE Software Solutions Germany GmbH
Frankenstrasse 146, 90461 Nuernberg, Germany
GF: Ivo Totev, Andrew Myers, Andrew McDonald, Boudien Moerman
HRB 36809 (AG Nuernberg)


OpenPGP_signature
Description: OpenPGP digital signature


Re: [PATCH 00/17] fbdev: Remove FBINFO_DEFAULT and FBINFO_FLAG_DEFAULT flags

2023-07-11 Thread Thomas Zimmermann



Am 11.07.23 um 16:47 schrieb Sam Ravnborg:

Hi Thomas,

On Tue, Jul 11, 2023 at 08:24:40AM +0200, Thomas Zimmermann wrote:

Hi Sam

Am 10.07.23 um 19:19 schrieb Sam Ravnborg:

Hi Thomas,

On Mon, Jul 10, 2023 at 02:50:04PM +0200, Thomas Zimmermann wrote:

Remove the unused flags FBINFO_DEFAULT and FBINFO_FLAG_DEFAULT from
fbdev and drivers, as briefly discussed at [1]. Both flags were maybe
useful when fbdev had special handling for driver modules. With
commit 376b3ff54c9a ("fbdev: Nuke FBINFO_MODULE"), they are both 0
and have no further effect.

Patches 1 to 7 remove FBINFO_DEFAULT from drivers. Patches 2 to 5
split this by the way the fb_info struct is being allocated. All flags
are cleared to zero during the allocation.

Patches 8 to 16 do the same for FBINFO_FLAG_DEFAULT. Patch 8 fixes
an actual bug in how arch/sh uses the tokne for struct fb_videomode,
which is unrelated.

Patch 17 removes both flag constants from 


We have a few more flags that are unused - should they be nuked too?
FBINFO_HWACCEL_FILLRECT
FBINFO_HWACCEL_ROTATE
FBINFO_HWACCEL_XPAN


It seems those are there for completeness. Nothing sets _ROTATE, the others
are simply never checked. According to the comments, some are required, some
are optional. I don't know what that means.

IIRC there were complains about performance when Daniel tried to remove
fbcon acceleration, so not all _HWACCEL_ flags are unneeded.

Leaving them in for reference/completeness might be an option; or not. I
have no strong feelings about those flags.



Unused as in no references from fbdev/core/*

I would rather see one series nuke all unused FBINFO flags in one go.
Assuming my quick grep are right and the above can be dropped.


I would not want to extend this series. I'm removing _DEFAULT as it's
absolutely pointless and confusing.


OK, makes sense and thanks for the explanation.

The series is:
Acked-by: Sam Ravnborg 


Thanks a lot.





--
Thomas Zimmermann
Graphics Driver Developer
SUSE Software Solutions Germany GmbH
Frankenstrasse 146, 90461 Nuernberg, Germany
GF: Ivo Totev, Andrew Myers, Andrew McDonald, Boudien Moerman
HRB 36809 (AG Nuernberg)


OpenPGP_signature
Description: OpenPGP digital signature


[PATCH v2 02/18] fbdev: Remove flag FBINFO_DEFAULT from fbdev drivers

2023-07-13 Thread Thomas Zimmermann
The flag FBINFO_DEFAULT is 0 and has no effect, as struct fbinfo.flags
has been allocated to zero by a static declaration. So do not set it.

Flags should signal differences from the default values. After cleaning
up all occurrences of FBINFO_DEFAULT, the token will be removed.

v2:
* fix commit message (Miguel)

Signed-off-by: Thomas Zimmermann 
Acked-by: Sam Ravnborg 
Cc: Helge Deller 
---
 drivers/video/fbdev/68328fb.c  | 2 +-
 drivers/video/fbdev/acornfb.c  | 2 +-
 drivers/video/fbdev/g364fb.c   | 2 +-
 drivers/video/fbdev/hpfb.c | 1 -
 drivers/video/fbdev/macfb.c| 1 -
 drivers/video/fbdev/maxinefb.c | 1 -
 6 files changed, 3 insertions(+), 6 deletions(-)

diff --git a/drivers/video/fbdev/68328fb.c b/drivers/video/fbdev/68328fb.c
index 07d6e8dc686b..956dd2399cc0 100644
--- a/drivers/video/fbdev/68328fb.c
+++ b/drivers/video/fbdev/68328fb.c
@@ -448,7 +448,7 @@ static int __init mc68x328fb_init(void)
fb_info.var.red.offset = fb_info.var.green.offset = 
fb_info.var.blue.offset = 0;
}
fb_info.pseudo_palette = &mc68x328fb_pseudo_palette;
-   fb_info.flags = FBINFO_DEFAULT | FBINFO_HWACCEL_YPAN;
+   fb_info.flags = FBINFO_HWACCEL_YPAN;
 
if (fb_alloc_cmap(&fb_info.cmap, 256, 0))
return -ENOMEM;
diff --git a/drivers/video/fbdev/acornfb.c b/drivers/video/fbdev/acornfb.c
index 1b72edc01cfb..8fec21dfca09 100644
--- a/drivers/video/fbdev/acornfb.c
+++ b/drivers/video/fbdev/acornfb.c
@@ -694,7 +694,7 @@ static void acornfb_init_fbinfo(void)
first = 0;
 
fb_info.fbops   = &acornfb_ops;
-   fb_info.flags   = FBINFO_DEFAULT | FBINFO_HWACCEL_YPAN;
+   fb_info.flags   = FBINFO_HWACCEL_YPAN;
fb_info.pseudo_palette  = current_par.pseudo_palette;
 
strcpy(fb_info.fix.id, "Acorn");
diff --git a/drivers/video/fbdev/g364fb.c b/drivers/video/fbdev/g364fb.c
index c5b7673ddc6c..0825cbde116e 100644
--- a/drivers/video/fbdev/g364fb.c
+++ b/drivers/video/fbdev/g364fb.c
@@ -219,7 +219,7 @@ int __init g364fb_init(void)
fb_info.screen_base = (char *) G364_MEM_BASE;   /* virtual kernel 
address */
fb_info.var = fb_var;
fb_info.fix = fb_fix;
-   fb_info.flags = FBINFO_DEFAULT | FBINFO_HWACCEL_YPAN;
+   fb_info.flags = FBINFO_HWACCEL_YPAN;
 
fb_alloc_cmap(&fb_info.cmap, 255, 0);
 
diff --git a/drivers/video/fbdev/hpfb.c b/drivers/video/fbdev/hpfb.c
index 77fbff47b1a8..406c1383cbda 100644
--- a/drivers/video/fbdev/hpfb.c
+++ b/drivers/video/fbdev/hpfb.c
@@ -287,7 +287,6 @@ static int hpfb_init_one(unsigned long phys_base, unsigned 
long virt_base)
else
strcat(fb_info.fix.id, "Catseye");
fb_info.fbops = &hpfb_ops;
-   fb_info.flags = FBINFO_DEFAULT;
fb_info.var   = hpfb_defined;
fb_info.screen_base = (char *)fb_start;
 
diff --git a/drivers/video/fbdev/macfb.c b/drivers/video/fbdev/macfb.c
index 44ff860a3f37..5ca208d992cc 100644
--- a/drivers/video/fbdev/macfb.c
+++ b/drivers/video/fbdev/macfb.c
@@ -876,7 +876,6 @@ static int __init macfb_init(void)
fb_info.var = macfb_defined;
fb_info.fix = macfb_fix;
fb_info.pseudo_palette  = pseudo_palette;
-   fb_info.flags   = FBINFO_DEFAULT;
 
err = fb_alloc_cmap(&fb_info.cmap, video_cmap_len, 0);
if (err)
diff --git a/drivers/video/fbdev/maxinefb.c b/drivers/video/fbdev/maxinefb.c
index 4e6b05232ae2..0ac1873b2acb 100644
--- a/drivers/video/fbdev/maxinefb.c
+++ b/drivers/video/fbdev/maxinefb.c
@@ -155,7 +155,6 @@ int __init maxinefb_init(void)
fb_info.screen_base = (char *)maxinefb_fix.smem_start;
fb_info.var = maxinefb_defined;
fb_info.fix = maxinefb_fix;
-   fb_info.flags = FBINFO_DEFAULT;
 
fb_alloc_cmap(&fb_info.cmap, 256, 0);
 
-- 
2.41.0



[PATCH v2 00/18] fbdev: Remove FBINFO_DEFAULT and FBINFO_FLAG_DEFAULT flags

2023-07-13 Thread Thomas Zimmermann
Remove the unused flags FBINFO_DEFAULT and FBINFO_FLAG_DEFAULT from
fbdev and drivers, as briefly discussed at [1]. Both flags were maybe
useful when fbdev had special handling for driver modules. With
commit 376b3ff54c9a ("fbdev: Nuke FBINFO_MODULE"), they are both 0
and have no further effect.

Patches 1 to 7 remove FBINFO_DEFAULT from drivers. Patches 2 to 5
split this by the way the fb_info struct is being allocated. All flags
are cleared to zero during the allocation.

Patches 8 to 16 do the same for FBINFO_FLAG_DEFAULT. Patch 8 fixes
an actual bug in how arch/sh uses the tokne for struct fb_videomode,
which is unrelated.

Patch 17 removes both flag constants from  and patch 18
documents the zero'ed memory returned by framebuffer_alloc().

v2:
* sh: use FB_MODE_IS_UNKNOWN (Adrian)
* fix commit messages (Miguel)
* document framebuffer_alloc()'s zero'ed memory (Miguel)

[1] 
https://lore.kernel.org/dri-devel/877crer8fm@minerva.mail-host-address-is-not-set/

Thomas Zimmermann (18):
  drm: Remove flag FBINFO_DEFAULT from fbdev emulation
  fbdev: Remove flag FBINFO_DEFAULT from fbdev drivers
  fbdev: Remove flag FBINFO_DEFAULT from fbdev drivers
  fbdev: Remove flag FBINFO_DEFAULT from fbdev drivers
  fbdev: Remove flag FBINFO_DEFAULT from fbdev drivers
  fbdev/fsl-diu-fb: Remove flag FBINFO_DEFAULT
  vfio-mdev: Remove flag FBINFO_DEFAULT from fbdev sample driver
  sh: Assign FB_MODE_IS_UNKNOWN to struct fb_videomode.flag
  auxdisplay: Remove flag FBINFO_FLAG_DEFAULT from fbdev drivers
  hid/picolcd: Remove flag FBINFO_FLAG_DEFAULT from fbdev driver
  media: Remove flag FBINFO_FLAG_DEFAULT from fbdev drivers
  staging: Remove flag FBINFO_FLAG_DEFAULT from fbdev drivers
  fbdev: Remove flag FBINFO_FLAG_DEFAULT from fbdev drivers
  fbdev: Remove flag FBINFO_FLAG_DEFAULT from fbdev drivers
  fbdev/atafb: Remove flag FBINFO_FLAG_DEFAULT
  fbdev/pxafb: Remove flag FBINFO_FLAG_DEFAULT
  fbdev: Remove FBINFO_DEFAULT and FBINFO_FLAG_DEFAULT
  fbdev: Document that framebuffer_alloc() returns zero'ed data

 arch/sh/boards/mach-sh7763rdp/setup.c  | 2 +-
 drivers/auxdisplay/cfag12864bfb.c  | 1 -
 drivers/auxdisplay/ht16k33.c   | 1 -
 drivers/gpu/drm/drm_fbdev_dma.c| 1 -
 drivers/gpu/drm/drm_fbdev_generic.c| 1 -
 drivers/gpu/drm/gma500/fbdev.c | 2 +-
 drivers/gpu/drm/radeon/radeon_fbdev.c  | 2 +-
 drivers/hid/hid-picolcd_fb.c   | 1 -
 drivers/media/pci/ivtv/ivtvfb.c| 1 -
 drivers/media/test-drivers/vivid/vivid-osd.c   | 1 -
 drivers/staging/fbtft/fbtft-core.c | 2 +-
 drivers/staging/sm750fb/sm750.c| 1 -
 drivers/video/fbdev/68328fb.c  | 2 +-
 drivers/video/fbdev/acornfb.c  | 2 +-
 drivers/video/fbdev/amba-clcd.c| 1 -
 drivers/video/fbdev/amifb.c| 5 ++---
 drivers/video/fbdev/arcfb.c| 1 -
 drivers/video/fbdev/asiliantfb.c   | 1 -
 drivers/video/fbdev/atafb.c| 1 -
 drivers/video/fbdev/atmel_lcdfb.c  | 2 +-
 drivers/video/fbdev/aty/aty128fb.c | 1 -
 drivers/video/fbdev/aty/atyfb_base.c   | 3 +--
 drivers/video/fbdev/aty/radeon_base.c  | 3 +--
 drivers/video/fbdev/broadsheetfb.c | 2 +-
 drivers/video/fbdev/bw2.c  | 1 -
 drivers/video/fbdev/carminefb.c| 1 -
 drivers/video/fbdev/cg14.c | 2 +-
 drivers/video/fbdev/cg3.c  | 1 -
 drivers/video/fbdev/cg6.c  | 2 +-
 drivers/video/fbdev/chipsfb.c  | 1 -
 drivers/video/fbdev/cirrusfb.c | 3 +--
 drivers/video/fbdev/clps711x-fb.c  | 1 -
 drivers/video/fbdev/cobalt_lcdfb.c | 1 -
 drivers/video/fbdev/controlfb.c| 2 +-
 drivers/video/fbdev/core/fb_info.c | 3 ++-
 drivers/video/fbdev/cyber2000fb.c  | 2 +-
 drivers/video/fbdev/da8xx-fb.c | 1 -
 drivers/video/fbdev/efifb.c| 1 -
 drivers/video/fbdev/ep93xx-fb.c| 1 -
 drivers/video/fbdev/ffb.c  | 3 +--
 drivers/video/fbdev/fm2fb.c| 1 -
 drivers/video/fbdev/fsl-diu-fb.c   | 2 +-
 drivers/video/fbdev/g364fb.c   | 2 +-
 drivers/video/fbdev/gbefb.c| 1 -
 drivers/video/fbdev/geode/gx1fb_core.c | 1 -
 drivers/video/fbdev/geode/gxfb_core.c  | 1 -
 drivers/video/fbdev/geode/lxfb_core.c  | 1 -
 drivers/video/fbdev/goldfishfb.c   | 1 -
 drivers/video/fbdev/grvga.c| 2 +-
 drivers/video/fbdev/gxt4500.c  | 3 +--
 drivers/video/fbdev/hecubafb.c | 2 +-
 drivers/video/fbdev/hgafb.c| 2 +-
 drivers/video/fbdev/hitfb.c| 2 

[PATCH v2 01/18] drm: Remove flag FBINFO_DEFAULT from fbdev emulation

2023-07-13 Thread Thomas Zimmermann
The flag FBINFO_DEFAULT is 0 and has no effect, as struct fbinfo.flags
has been allocated to zero by framebuffer_alloc(). So do not set it.

Flags should signal differences from the default values. After cleaning
up all occurrences of FBINFO_DEFAULT, the token will be removed.

v2:
* fix commit message (Miguel)

Signed-off-by: Thomas Zimmermann 
Acked-by: Sam Ravnborg 
Cc: Patrik Jakobsson 
Cc: Alex Deucher 
Cc: "Christian König" 
Cc: "Pan, Xinhui" 
---
 drivers/gpu/drm/drm_fbdev_dma.c   | 1 -
 drivers/gpu/drm/drm_fbdev_generic.c   | 1 -
 drivers/gpu/drm/gma500/fbdev.c| 2 +-
 drivers/gpu/drm/radeon/radeon_fbdev.c | 2 +-
 4 files changed, 2 insertions(+), 4 deletions(-)

diff --git a/drivers/gpu/drm/drm_fbdev_dma.c b/drivers/gpu/drm/drm_fbdev_dma.c
index f9b1f7cd31b7..ee7c265b0585 100644
--- a/drivers/gpu/drm/drm_fbdev_dma.c
+++ b/drivers/gpu/drm/drm_fbdev_dma.c
@@ -123,7 +123,6 @@ static int drm_fbdev_dma_helper_fb_probe(struct 
drm_fb_helper *fb_helper,
drm_fb_helper_fill_info(info, fb_helper, sizes);
 
info->fbops = &drm_fbdev_dma_fb_ops;
-   info->flags = FBINFO_DEFAULT;
 
/* screen */
info->flags |= FBINFO_VIRTFB; /* system memory */
diff --git a/drivers/gpu/drm/drm_fbdev_generic.c 
b/drivers/gpu/drm/drm_fbdev_generic.c
index b9343fb6cf13..a0ea042b1526 100644
--- a/drivers/gpu/drm/drm_fbdev_generic.c
+++ b/drivers/gpu/drm/drm_fbdev_generic.c
@@ -109,7 +109,6 @@ static int drm_fbdev_generic_helper_fb_probe(struct 
drm_fb_helper *fb_helper,
drm_fb_helper_fill_info(info, fb_helper, sizes);
 
info->fbops = &drm_fbdev_generic_fb_ops;
-   info->flags = FBINFO_DEFAULT;
 
/* screen */
info->flags |= FBINFO_VIRTFB | FBINFO_READS_FAST;
diff --git a/drivers/gpu/drm/gma500/fbdev.c b/drivers/gpu/drm/gma500/fbdev.c
index 054426549fc6..be8f5fbd5260 100644
--- a/drivers/gpu/drm/gma500/fbdev.c
+++ b/drivers/gpu/drm/gma500/fbdev.c
@@ -215,7 +215,7 @@ static int psb_fbdev_fb_probe(struct drm_fb_helper 
*fb_helper,
}
 
info->fbops = &psb_fbdev_fb_ops;
-   info->flags = FBINFO_DEFAULT;
+
/* Accessed stolen memory directly */
info->screen_base = dev_priv->vram_addr + backing->offset;
info->screen_size = size;
diff --git a/drivers/gpu/drm/radeon/radeon_fbdev.c 
b/drivers/gpu/drm/radeon/radeon_fbdev.c
index f941e2e7cae6..68c06ac9acce 100644
--- a/drivers/gpu/drm/radeon/radeon_fbdev.c
+++ b/drivers/gpu/drm/radeon/radeon_fbdev.c
@@ -253,7 +253,7 @@ static int radeon_fbdev_fb_helper_fb_probe(struct 
drm_fb_helper *fb_helper,
}
 
info->fbops = &radeon_fbdev_fb_ops;
-   info->flags = FBINFO_DEFAULT;
+
/* radeon resume is fragile and needs a vt switch to help it along */
info->skip_vt_switch = false;
 
-- 
2.41.0



[PATCH v2 03/18] fbdev: Remove flag FBINFO_DEFAULT from fbdev drivers

2023-07-13 Thread Thomas Zimmermann
The flag FBINFO_DEFAULT is 0 and has no effect, as struct fbinfo.flags
has been allocated to zero by kzalloc(). So do not set it.

Flags should signal differences from the default values. After cleaning
up all occurrences of FBINFO_DEFAULT, the token will be removed.

v2:
* fix commit message (Miguel)

Signed-off-by: Thomas Zimmermann 
Acked-by: Sam Ravnborg 
Cc: Helge Deller 
Cc: Russell King 
---
 drivers/video/fbdev/controlfb.c   | 2 +-
 drivers/video/fbdev/cyber2000fb.c | 2 +-
 drivers/video/fbdev/valkyriefb.c  | 1 -
 drivers/video/fbdev/vermilion/vermilion.c | 2 +-
 drivers/video/fbdev/vt8500lcdfb.c | 3 +--
 5 files changed, 4 insertions(+), 6 deletions(-)

diff --git a/drivers/video/fbdev/controlfb.c b/drivers/video/fbdev/controlfb.c
index 82eeb139c4eb..717134c141ff 100644
--- a/drivers/video/fbdev/controlfb.c
+++ b/drivers/video/fbdev/controlfb.c
@@ -775,7 +775,7 @@ static void __init control_init_info(struct fb_info *info, 
struct fb_info_contro
info->par = &p->par;
info->fbops = &controlfb_ops;
info->pseudo_palette = p->pseudo_palette;
-info->flags = FBINFO_DEFAULT | FBINFO_HWACCEL_YPAN;
+   info->flags = FBINFO_HWACCEL_YPAN;
info->screen_base = p->frame_buffer + CTRLFB_OFF;
 
fb_alloc_cmap(&info->cmap, 256, 0);
diff --git a/drivers/video/fbdev/cyber2000fb.c 
b/drivers/video/fbdev/cyber2000fb.c
index 38c0a6866d76..98ea56a9abf1 100644
--- a/drivers/video/fbdev/cyber2000fb.c
+++ b/drivers/video/fbdev/cyber2000fb.c
@@ -1459,7 +1459,7 @@ static struct cfb_info *cyberpro_alloc_fb_info(unsigned 
int id, char *name)
cfb->fb.var.accel_flags = FB_ACCELF_TEXT;
 
cfb->fb.fbops   = &cyber2000fb_ops;
-   cfb->fb.flags   = FBINFO_DEFAULT | FBINFO_HWACCEL_YPAN;
+   cfb->fb.flags   = FBINFO_HWACCEL_YPAN;
cfb->fb.pseudo_palette  = cfb->pseudo_palette;
 
spin_lock_init(&cfb->reg_b0_lock);
diff --git a/drivers/video/fbdev/valkyriefb.c b/drivers/video/fbdev/valkyriefb.c
index b166b7cfe0e5..fd4488777032 100644
--- a/drivers/video/fbdev/valkyriefb.c
+++ b/drivers/video/fbdev/valkyriefb.c
@@ -535,7 +535,6 @@ static int __init valkyrie_init_info(struct fb_info *info,
 {
info->fbops = &valkyriefb_ops;
info->screen_base = p->frame_buffer + 0x1000;
-   info->flags = FBINFO_DEFAULT;
info->pseudo_palette = p->pseudo_palette;
info->par = &p->par;
return fb_alloc_cmap(&info->cmap, 256, 0);
diff --git a/drivers/video/fbdev/vermilion/vermilion.c 
b/drivers/video/fbdev/vermilion/vermilion.c
index 32e74e02a02f..71584c775efd 100644
--- a/drivers/video/fbdev/vermilion/vermilion.c
+++ b/drivers/video/fbdev/vermilion/vermilion.c
@@ -477,7 +477,7 @@ static int vml_pci_probe(struct pci_dev *dev, const struct 
pci_device_id *id)
}
 
info = &vinfo->info;
-   info->flags = FBINFO_DEFAULT | FBINFO_PARTIAL_PAN_OK;
+   info->flags = FBINFO_PARTIAL_PAN_OK;
 
err = vmlfb_enable_mmio(par);
if (err)
diff --git a/drivers/video/fbdev/vt8500lcdfb.c 
b/drivers/video/fbdev/vt8500lcdfb.c
index 31d4e85b220c..42d39a9d5130 100644
--- a/drivers/video/fbdev/vt8500lcdfb.c
+++ b/drivers/video/fbdev/vt8500lcdfb.c
@@ -300,8 +300,7 @@ static int vt8500lcd_probe(struct platform_device *pdev)
fbi->fb.var.vmode   = FB_VMODE_NONINTERLACED;
 
fbi->fb.fbops   = &vt8500lcd_ops;
-   fbi->fb.flags   = FBINFO_DEFAULT
-   | FBINFO_HWACCEL_COPYAREA
+   fbi->fb.flags   = FBINFO_HWACCEL_COPYAREA
| FBINFO_HWACCEL_FILLRECT
| FBINFO_HWACCEL_YPAN
| FBINFO_VIRTFB
-- 
2.41.0



[PATCH v2 04/18] fbdev: Remove flag FBINFO_DEFAULT from fbdev drivers

2023-07-13 Thread Thomas Zimmermann
The flag FBINFO_DEFAULT is 0 and has no effect, as struct fbinfo.flags
has been allocated to zero by devm_kzalloc(). So do not set it.

Flags should signal differences from the default values. After cleaning
up all occurrences of FBINFO_DEFAULT, the token will be removed.

v2:
* fix commit message (Miguel)

Signed-off-by: Thomas Zimmermann 
Acked-by: Sam Ravnborg 
Cc: Helge Deller 
---
 drivers/video/fbdev/pxafb.c| 1 -
 drivers/video/fbdev/sa1100fb.c | 1 -
 drivers/video/fbdev/wm8505fb.c | 3 +--
 drivers/video/fbdev/xilinxfb.c | 1 -
 4 files changed, 1 insertion(+), 5 deletions(-)

diff --git a/drivers/video/fbdev/pxafb.c b/drivers/video/fbdev/pxafb.c
index 2a8b1dea3a67..c8c4677d06b4 100644
--- a/drivers/video/fbdev/pxafb.c
+++ b/drivers/video/fbdev/pxafb.c
@@ -1826,7 +1826,6 @@ static struct pxafb_info *pxafb_init_fbinfo(struct device 
*dev,
fbi->fb.var.vmode   = FB_VMODE_NONINTERLACED;
 
fbi->fb.fbops   = &pxafb_ops;
-   fbi->fb.flags   = FBINFO_DEFAULT;
fbi->fb.node= -1;
 
addr = fbi;
diff --git a/drivers/video/fbdev/sa1100fb.c b/drivers/video/fbdev/sa1100fb.c
index a2408bf00ca0..3d76ce111488 100644
--- a/drivers/video/fbdev/sa1100fb.c
+++ b/drivers/video/fbdev/sa1100fb.c
@@ -1089,7 +1089,6 @@ static struct sa1100fb_info *sa1100fb_init_fbinfo(struct 
device *dev)
fbi->fb.var.vmode   = FB_VMODE_NONINTERLACED;
 
fbi->fb.fbops   = &sa1100fb_ops;
-   fbi->fb.flags   = FBINFO_DEFAULT;
fbi->fb.monspecs= monspecs;
fbi->fb.pseudo_palette  = fbi->pseudo_palette;
 
diff --git a/drivers/video/fbdev/wm8505fb.c b/drivers/video/fbdev/wm8505fb.c
index 10a8b1250103..5833147aa43d 100644
--- a/drivers/video/fbdev/wm8505fb.c
+++ b/drivers/video/fbdev/wm8505fb.c
@@ -285,8 +285,7 @@ static int wm8505fb_probe(struct platform_device *pdev)
fbi->fb.fix.accel   = FB_ACCEL_NONE;
 
fbi->fb.fbops   = &wm8505fb_ops;
-   fbi->fb.flags   = FBINFO_DEFAULT
-   | FBINFO_HWACCEL_COPYAREA
+   fbi->fb.flags   = FBINFO_HWACCEL_COPYAREA
| FBINFO_HWACCEL_FILLRECT
| FBINFO_HWACCEL_XPAN
| FBINFO_HWACCEL_YPAN
diff --git a/drivers/video/fbdev/xilinxfb.c b/drivers/video/fbdev/xilinxfb.c
index 2aa3a528277f..768a281a8d2c 100644
--- a/drivers/video/fbdev/xilinxfb.c
+++ b/drivers/video/fbdev/xilinxfb.c
@@ -324,7 +324,6 @@ static int xilinxfb_assign(struct platform_device *pdev,
drvdata->info.fix.line_length = pdata->xvirt * BYTES_PER_PIXEL;
 
drvdata->info.pseudo_palette = drvdata->pseudo_palette;
-   drvdata->info.flags = FBINFO_DEFAULT;
drvdata->info.var = xilinx_fb_var;
drvdata->info.var.height = pdata->screen_height_mm;
drvdata->info.var.width = pdata->screen_width_mm;
-- 
2.41.0



[PATCH v2 06/18] fbdev/fsl-diu-fb: Remove flag FBINFO_DEFAULT

2023-07-13 Thread Thomas Zimmermann
The flag FBINFO_DEFAULT is 0 and has no effect, as struct fbinfo.flags
has been allocated to zero by dmam_alloc_coherent(__GFP_ZERO). So do not
set it.

Flags should signal differences from the default values. After cleaning
up all occurrences of FBINFO_DEFAULT, the token will be removed.

v2:
* fix commit message (Miguel)

Signed-off-by: Thomas Zimmermann 
Acked-by: Sam Ravnborg 
Cc: Timur Tabi 
Cc: Helge Deller 
---
 drivers/video/fbdev/fsl-diu-fb.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/video/fbdev/fsl-diu-fb.c b/drivers/video/fbdev/fsl-diu-fb.c
index 785eb8a06943..c62b48f27ba9 100644
--- a/drivers/video/fbdev/fsl-diu-fb.c
+++ b/drivers/video/fbdev/fsl-diu-fb.c
@@ -1476,7 +1476,7 @@ static int install_fb(struct fb_info *info)
 
info->var.activate = FB_ACTIVATE_NOW;
info->fbops = &fsl_diu_ops;
-   info->flags = FBINFO_DEFAULT | FBINFO_VIRTFB | FBINFO_PARTIAL_PAN_OK |
+   info->flags = FBINFO_VIRTFB | FBINFO_PARTIAL_PAN_OK |
FBINFO_READS_FAST;
info->pseudo_palette = mfbi->pseudo_palette;
 
-- 
2.41.0



[PATCH v2 05/18] fbdev: Remove flag FBINFO_DEFAULT from fbdev drivers

2023-07-13 Thread Thomas Zimmermann
The flag FBINFO_DEFAULT is 0 and has no effect, as struct fbinfo.flags
has been allocated to zero by framebuffer_alloc(). So do not set it.

Flags should signal differences from the default values. After cleaning
up all occurrences of FBINFO_DEFAULT, the token will be removed.

v2:
* fix commit message (Miguel)

Signed-off-by: Thomas Zimmermann 
Acked-by: Sam Ravnborg 
Cc: Helge Deller 
Cc: Nicolas Ferre 
Cc: Benjamin Herrenschmidt 
Cc: Ferenc Bakonyi 
Cc: "K. Y. Srinivasan" 
Cc: Haiyang Zhang 
Cc: Wei Liu 
Cc: Dexuan Cui 
Cc: Antonino Daplas 
Cc: Maik Broemme 
Cc: Michael Ellerman 
Cc: Nicholas Piggin 
Cc: Christophe Leroy 
Cc: Kristoffer Ericson 
Cc: Hans de Goede 
Cc: Steve Glendinning 
Cc: Bernie Thompson 
Cc: Florian Tobias Schandinat 
---
 drivers/video/fbdev/amifb.c  | 5 ++---
 drivers/video/fbdev/asiliantfb.c | 1 -
 drivers/video/fbdev/atmel_lcdfb.c| 2 +-
 drivers/video/fbdev/aty/atyfb_base.c | 3 +--
 drivers/video/fbdev/aty/radeon_base.c| 3 +--
 drivers/video/fbdev/bw2.c| 1 -
 drivers/video/fbdev/carminefb.c  | 1 -
 drivers/video/fbdev/cg14.c   | 2 +-
 drivers/video/fbdev/cg3.c| 1 -
 drivers/video/fbdev/cg6.c| 2 +-
 drivers/video/fbdev/chipsfb.c| 1 -
 drivers/video/fbdev/cirrusfb.c   | 3 +--
 drivers/video/fbdev/clps711x-fb.c| 1 -
 drivers/video/fbdev/cobalt_lcdfb.c   | 1 -
 drivers/video/fbdev/ep93xx-fb.c  | 1 -
 drivers/video/fbdev/ffb.c| 3 +--
 drivers/video/fbdev/fm2fb.c  | 1 -
 drivers/video/fbdev/gbefb.c  | 1 -
 drivers/video/fbdev/geode/gx1fb_core.c   | 1 -
 drivers/video/fbdev/geode/gxfb_core.c| 1 -
 drivers/video/fbdev/geode/lxfb_core.c| 1 -
 drivers/video/fbdev/grvga.c  | 2 +-
 drivers/video/fbdev/hgafb.c  | 2 +-
 drivers/video/fbdev/hitfb.c  | 2 +-
 drivers/video/fbdev/hyperv_fb.c  | 2 --
 drivers/video/fbdev/i740fb.c | 2 +-
 drivers/video/fbdev/i810/i810_main.c | 4 ++--
 drivers/video/fbdev/imsttfb.c| 3 +--
 drivers/video/fbdev/intelfb/intelfbdrv.c | 4 ++--
 drivers/video/fbdev/kyro/fbdev.c | 1 -
 drivers/video/fbdev/leo.c| 1 -
 drivers/video/fbdev/mb862xx/mb862xxfbdrv.c   | 2 +-
 drivers/video/fbdev/mmp/fb/mmpfb.c   | 2 +-
 drivers/video/fbdev/neofb.c  | 2 +-
 drivers/video/fbdev/nvidia/nvidia.c  | 4 ++--
 drivers/video/fbdev/offb.c   | 2 +-
 drivers/video/fbdev/p9100.c  | 1 -
 drivers/video/fbdev/platinumfb.c | 1 -
 drivers/video/fbdev/pm2fb.c  | 3 +--
 drivers/video/fbdev/pm3fb.c  | 3 +--
 drivers/video/fbdev/pmag-aa-fb.c | 1 -
 drivers/video/fbdev/pmag-ba-fb.c | 1 -
 drivers/video/fbdev/pmagb-b-fb.c | 1 -
 drivers/video/fbdev/ps3fb.c  | 2 +-
 drivers/video/fbdev/pvr2fb.c | 2 +-
 drivers/video/fbdev/pxa168fb.c   | 2 +-
 drivers/video/fbdev/q40fb.c  | 1 -
 drivers/video/fbdev/riva/fbdev.c | 3 +--
 drivers/video/fbdev/s1d13xxxfb.c | 4 ++--
 drivers/video/fbdev/savage/savagefb_driver.c | 3 +--
 drivers/video/fbdev/simplefb.c   | 1 -
 drivers/video/fbdev/sis/sis_main.c   | 3 +--
 drivers/video/fbdev/skeletonfb.c | 2 +-
 drivers/video/fbdev/smscufx.c| 2 +-
 drivers/video/fbdev/sstfb.c  | 1 -
 drivers/video/fbdev/sunxvr1000.c | 1 -
 drivers/video/fbdev/sunxvr2500.c | 1 -
 drivers/video/fbdev/sunxvr500.c  | 1 -
 drivers/video/fbdev/tcx.c| 1 -
 drivers/video/fbdev/tdfxfb.c | 2 +-
 drivers/video/fbdev/tgafb.c  | 2 +-
 drivers/video/fbdev/tridentfb.c  | 2 +-
 drivers/video/fbdev/udlfb.c  | 2 +-
 drivers/video/fbdev/via/viafbdev.c   | 2 +-
 64 files changed, 41 insertions(+), 81 deletions(-)

diff --git a/drivers/video/fbdev/amifb.c b/drivers/video/fbdev/amifb.c
index d88265dbebf4..cea782283b9c 100644
--- a/drivers/video/fbdev/amifb.c
+++ b/drivers/video/fbdev/amifb.c
@@ -2427,7 +2427,7 @@ static int amifb_set_par(struct fb_info *info)
info->fix.ywrapstep = 1;
info->fix.xpanstep = 0;
info->fix.ypanstep = 0;
-   info->flags = FBINFO_DEFAULT | FBINFO_HWACCEL_YWRAP |
+   info->flags = FBINFO_HWACCEL_YWRAP |
FBINFO_READS_FAST; /* override SCROLL_REDRAW */
} else {
info->fix.ywrapstep = 0;
@@ -2436,7 +2436,7 @@ static int amifb_set_par(struct fb_info *info)
else
info->fix.xpanstep = 16 &l

[PATCH v2 07/18] vfio-mdev: Remove flag FBINFO_DEFAULT from fbdev sample driver

2023-07-13 Thread Thomas Zimmermann
The flag FBINFO_DEFAULT is 0 and has no effect, as struct fbinfo.flags
has been allocated to zero by framebuffer_alloc(). So do not set it.

Flags should signal differences from the default values. After cleaning
up all occurrences of FBINFO_DEFAULT, the token will be removed.

v2:
* fix commit message (Miguel)

Signed-off-by: Thomas Zimmermann 
Acked-by: Sam Ravnborg 
Cc: Kirti Wankhede 
---
 samples/vfio-mdev/mdpy-fb.c | 1 -
 1 file changed, 1 deletion(-)

diff --git a/samples/vfio-mdev/mdpy-fb.c b/samples/vfio-mdev/mdpy-fb.c
index 3c8001b9e407..cda477b28685 100644
--- a/samples/vfio-mdev/mdpy-fb.c
+++ b/samples/vfio-mdev/mdpy-fb.c
@@ -162,7 +162,6 @@ static int mdpy_fb_probe(struct pci_dev *pdev,
}
 
info->fbops = &mdpy_fb_ops;
-   info->flags = FBINFO_DEFAULT;
info->pseudo_palette = par->palette;
 
ret = register_framebuffer(info);
-- 
2.41.0



[PATCH v2 08/18] sh: Assign FB_MODE_IS_UNKNOWN to struct fb_videomode.flag

2023-07-13 Thread Thomas Zimmermann
Assign FB_MODE_IS_UNKNOWN to sh7763fb_videomode.flag instead of
FBINFO_FLAG_DEFAULT. Both are 0, so the stored value does not change.

FBINFO_FLAG_DEFAULT is a flag for a framebuffer in struct fb_info.
Flags for videomodes are prefixed with FB_MODE_.

v2:
* assign FB_MODE_IS_UNKNOWN (Adrian)

Signed-off-by: Thomas Zimmermann 
Acked-by: Sam Ravnborg 
Cc: Yoshinori Sato 
Cc: Rich Felker 
Cc: John Paul Adrian Glaubitz 
---
 arch/sh/boards/mach-sh7763rdp/setup.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/sh/boards/mach-sh7763rdp/setup.c 
b/arch/sh/boards/mach-sh7763rdp/setup.c
index 97e715e4e9b3..e25193001ea0 100644
--- a/arch/sh/boards/mach-sh7763rdp/setup.c
+++ b/arch/sh/boards/mach-sh7763rdp/setup.c
@@ -119,7 +119,7 @@ static struct fb_videomode sh7763fb_videomode = {
.vsync_len = 1,
.sync = 0,
.vmode = FB_VMODE_NONINTERLACED,
-   .flag = FBINFO_FLAG_DEFAULT,
+   .flag = FB_MODE_IS_UNKNOWN,
 };
 
 static struct sh7760fb_platdata sh7763fb_def_pdata = {
-- 
2.41.0



[PATCH v2 10/18] hid/picolcd: Remove flag FBINFO_FLAG_DEFAULT from fbdev driver

2023-07-13 Thread Thomas Zimmermann
The flag FBINFO_FLAG_DEFAULT is 0 and has no effect, as struct
fbinfo.flags has been allocated to zero by framebuffer_alloc(). So do
not set it.

Flags should signal differences from the default values. After cleaning
up all occurrences of FBINFO_DEFAULT, the token will be removed.

v2:
* fix commit message (Miguel)

Signed-off-by: Thomas Zimmermann 
Acked-by: Sam Ravnborg 
Acked-by: Benjamin Tissoires 
Acked-by: Bruno Prémont 
Cc: "Bruno Prémont" 
Cc: Jiri Kosina 
Cc: Benjamin Tissoires 
---
 drivers/hid/hid-picolcd_fb.c | 1 -
 1 file changed, 1 deletion(-)

diff --git a/drivers/hid/hid-picolcd_fb.c b/drivers/hid/hid-picolcd_fb.c
index dabcd054dad9..d726aaafb146 100644
--- a/drivers/hid/hid-picolcd_fb.c
+++ b/drivers/hid/hid-picolcd_fb.c
@@ -527,7 +527,6 @@ int picolcd_init_framebuffer(struct picolcd_data *data)
info->var = picolcdfb_var;
info->fix = picolcdfb_fix;
info->fix.smem_len   = PICOLCDFB_SIZE*8;
-   info->flags = FBINFO_FLAG_DEFAULT;
 
fbdata = info->par;
spin_lock_init(&fbdata->lock);
-- 
2.41.0



[PATCH v2 09/18] auxdisplay: Remove flag FBINFO_FLAG_DEFAULT from fbdev drivers

2023-07-13 Thread Thomas Zimmermann
The flag FBINFO_FLAG_DEFAULT is 0 and has no effect, as struct
fbinfo.flags has been allocated to zero by framebuffer_alloc(). So do
not set it.

Flags should signal differences from the default values. After cleaning
up all occurrences of FBINFO_DEFAULT, the token will be removed.

v2:
* fix commit message (Miguel)

Signed-off-by: Thomas Zimmermann 
Acked-by: Sam Ravnborg 
Acked-by: Miguel Ojeda 
Cc: Miguel Ojeda 
Cc: Robin van der Gracht 
---
 drivers/auxdisplay/cfag12864bfb.c | 1 -
 drivers/auxdisplay/ht16k33.c  | 1 -
 2 files changed, 2 deletions(-)

diff --git a/drivers/auxdisplay/cfag12864bfb.c 
b/drivers/auxdisplay/cfag12864bfb.c
index c2cab7e2b126..729845bcc803 100644
--- a/drivers/auxdisplay/cfag12864bfb.c
+++ b/drivers/auxdisplay/cfag12864bfb.c
@@ -79,7 +79,6 @@ static int cfag12864bfb_probe(struct platform_device *device)
info->var = cfag12864bfb_var;
info->pseudo_palette = NULL;
info->par = NULL;
-   info->flags = FBINFO_FLAG_DEFAULT;
 
if (register_framebuffer(info) < 0)
goto fballoced;
diff --git a/drivers/auxdisplay/ht16k33.c b/drivers/auxdisplay/ht16k33.c
index edaf92b7ea77..df3f37651e45 100644
--- a/drivers/auxdisplay/ht16k33.c
+++ b/drivers/auxdisplay/ht16k33.c
@@ -646,7 +646,6 @@ static int ht16k33_fbdev_probe(struct device *dev, struct 
ht16k33_priv *priv,
fbdev->info->var = ht16k33_fb_var;
fbdev->info->bl_dev = bl;
fbdev->info->pseudo_palette = NULL;
-   fbdev->info->flags = FBINFO_FLAG_DEFAULT;
fbdev->info->par = priv;
 
err = register_framebuffer(fbdev->info);
-- 
2.41.0



[PATCH v2 11/18] media: Remove flag FBINFO_FLAG_DEFAULT from fbdev drivers

2023-07-13 Thread Thomas Zimmermann
The flag FBINFO_FLAG_DEFAULT is 0 and has no effect, as struct
fbinfo.flags has been allocated to zero by kzalloc(). So do not
set it.

Flags should signal differences from the default values. After cleaning
up all occurrences of FBINFO_DEFAULT, the token will be removed.

v2:
* fix commit message (Miguel)

Signed-off-by: Thomas Zimmermann 
Acked-by: Sam Ravnborg 
Cc: Andy Walls 
Cc: Mauro Carvalho Chehab 
Cc: Hans Verkuil 
---
 drivers/media/pci/ivtv/ivtvfb.c  | 1 -
 drivers/media/test-drivers/vivid/vivid-osd.c | 1 -
 2 files changed, 2 deletions(-)

diff --git a/drivers/media/pci/ivtv/ivtvfb.c b/drivers/media/pci/ivtv/ivtvfb.c
index 0aeb9daaee4c..23c8c094e791 100644
--- a/drivers/media/pci/ivtv/ivtvfb.c
+++ b/drivers/media/pci/ivtv/ivtvfb.c
@@ -1048,7 +1048,6 @@ static int ivtvfb_init_vidmode(struct ivtv *itv)
/* Generate valid fb_info */
 
oi->ivtvfb_info.node = -1;
-   oi->ivtvfb_info.flags = FBINFO_FLAG_DEFAULT;
oi->ivtvfb_info.par = itv;
oi->ivtvfb_info.var = oi->ivtvfb_defined;
oi->ivtvfb_info.fix = oi->ivtvfb_fix;
diff --git a/drivers/media/test-drivers/vivid/vivid-osd.c 
b/drivers/media/test-drivers/vivid/vivid-osd.c
index ec25edc679b3..051f1805a16d 100644
--- a/drivers/media/test-drivers/vivid/vivid-osd.c
+++ b/drivers/media/test-drivers/vivid/vivid-osd.c
@@ -310,7 +310,6 @@ static int vivid_fb_init_vidmode(struct vivid_dev *dev)
/* Generate valid fb_info */
 
dev->fb_info.node = -1;
-   dev->fb_info.flags = FBINFO_FLAG_DEFAULT;
dev->fb_info.par = dev;
dev->fb_info.var = dev->fb_defined;
dev->fb_info.fix = dev->fb_fix;
-- 
2.41.0



[PATCH v2 12/18] staging: Remove flag FBINFO_FLAG_DEFAULT from fbdev drivers

2023-07-13 Thread Thomas Zimmermann
The flag FBINFO_FLAG_DEFAULT is 0 and has no effect, as struct
fbinfo.flags has been allocated to zero by framebuffer_alloc(). So do
not set it.

Flags should signal differences from the default values. After cleaning
up all occurrences of FBINFO_DEFAULT, the token will be removed.

v2:
* fix commit message (Miguel)

Signed-off-by: Thomas Zimmermann 
Acked-by: Sam Ravnborg 
Cc: Greg Kroah-Hartman 
Cc: Sudip Mukherjee 
Cc: Teddy Wang 
---
 drivers/staging/fbtft/fbtft-core.c | 2 +-
 drivers/staging/sm750fb/sm750.c| 1 -
 2 files changed, 1 insertion(+), 2 deletions(-)

diff --git a/drivers/staging/fbtft/fbtft-core.c 
b/drivers/staging/fbtft/fbtft-core.c
index 3a4abf3bae40..eac1d570f437 100644
--- a/drivers/staging/fbtft/fbtft-core.c
+++ b/drivers/staging/fbtft/fbtft-core.c
@@ -684,7 +684,7 @@ struct fb_info *fbtft_framebuffer_alloc(struct 
fbtft_display *display,
info->var.transp.offset =  0;
info->var.transp.length =  0;
 
-   info->flags =  FBINFO_FLAG_DEFAULT | FBINFO_VIRTFB;
+   info->flags =  FBINFO_VIRTFB;
 
par = info->par;
par->info = info;
diff --git a/drivers/staging/sm750fb/sm750.c b/drivers/staging/sm750fb/sm750.c
index c260f73cf570..79bcd5bd4938 100644
--- a/drivers/staging/sm750fb/sm750.c
+++ b/drivers/staging/sm750fb/sm750.c
@@ -807,7 +807,6 @@ static int lynxfb_set_fbinfo(struct fb_info *info, int 
index)
info->screen_base = crtc->v_screen;
pr_debug("screen_base vaddr = %p\n", info->screen_base);
info->screen_size = line_length * var->yres_virtual;
-   info->flags = FBINFO_FLAG_DEFAULT | 0;
 
/* set info->fix */
fix->type = FB_TYPE_PACKED_PIXELS;
-- 
2.41.0



[PATCH v2 13/18] fbdev: Remove flag FBINFO_FLAG_DEFAULT from fbdev drivers

2023-07-13 Thread Thomas Zimmermann
The flag FBINFO_FLAG_DEFAULT is 0 and has no effect, as struct
fbinfo.flags has been allocated to zero by kzalloc(). So do not
set it.

Flags should signal differences from the default values. After cleaning
up all occurrences of FBINFO_DEFAULT, the token will be removed.

v2:
* fix commit message (Miguel)

Signed-off-by: Thomas Zimmermann 
Acked-by: Sam Ravnborg 
Cc: Helge Deller 
---
 drivers/video/fbdev/amba-clcd.c | 1 -
 drivers/video/fbdev/matrox/matroxfb_crtc2.c | 5 ++---
 2 files changed, 2 insertions(+), 4 deletions(-)

diff --git a/drivers/video/fbdev/amba-clcd.c b/drivers/video/fbdev/amba-clcd.c
index e45338227be6..24d89e6fb780 100644
--- a/drivers/video/fbdev/amba-clcd.c
+++ b/drivers/video/fbdev/amba-clcd.c
@@ -461,7 +461,6 @@ static int clcdfb_register(struct clcd_fb *fb)
}
 
fb->fb.fbops= &clcdfb_ops;
-   fb->fb.flags= FBINFO_FLAG_DEFAULT;
fb->fb.pseudo_palette   = fb->cmap;
 
strncpy(fb->fb.fix.id, clcd_name, sizeof(fb->fb.fix.id));
diff --git a/drivers/video/fbdev/matrox/matroxfb_crtc2.c 
b/drivers/video/fbdev/matrox/matroxfb_crtc2.c
index 7655afa3fd50..372197c124de 100644
--- a/drivers/video/fbdev/matrox/matroxfb_crtc2.c
+++ b/drivers/video/fbdev/matrox/matroxfb_crtc2.c
@@ -603,9 +603,8 @@ static int matroxfb_dh_regit(const struct matrox_fb_info 
*minfo,
void* oldcrtc2;
 
m2info->fbcon.fbops = &matroxfb_dh_ops;
-   m2info->fbcon.flags = FBINFO_FLAG_DEFAULT;
-   m2info->fbcon.flags |= FBINFO_HWACCEL_XPAN |
-  FBINFO_HWACCEL_YPAN;
+   m2info->fbcon.flags = FBINFO_HWACCEL_XPAN |
+ FBINFO_HWACCEL_YPAN;
m2info->fbcon.pseudo_palette = m2info->cmap;
fb_alloc_cmap(&m2info->fbcon.cmap, 256, 1);
 
-- 
2.41.0



[PATCH v2 15/18] fbdev/atafb: Remove flag FBINFO_FLAG_DEFAULT

2023-07-13 Thread Thomas Zimmermann
The flag FBINFO_FLAG_DEFAULT is 0 and has no effect, as struct
fbinfo.flags has been allocated to zero by a static declaration. So do
not set it.

Flags should signal differences from the default values. After cleaning
up all occurrences of FBINFO_DEFAULT, the token will be removed.

v2:
* fix commit message (Miguel)

Signed-off-by: Thomas Zimmermann 
Acked-by: Sam Ravnborg 
Cc: Helge Deller 
---
 drivers/video/fbdev/atafb.c | 1 -
 1 file changed, 1 deletion(-)

diff --git a/drivers/video/fbdev/atafb.c b/drivers/video/fbdev/atafb.c
index 2bc4089865e6..c4a420b791b9 100644
--- a/drivers/video/fbdev/atafb.c
+++ b/drivers/video/fbdev/atafb.c
@@ -3112,7 +3112,6 @@ static int __init atafb_probe(struct platform_device 
*pdev)
 #ifdef ATAFB_FALCON
fb_info.pseudo_palette = current_par.hw.falcon.pseudo_palette;
 #endif
-   fb_info.flags = FBINFO_FLAG_DEFAULT;
 
if (!fb_find_mode(&fb_info.var, &fb_info, mode_option, atafb_modedb,
  NUM_TOTAL_MODES, &atafb_modedb[defmode],
-- 
2.41.0



[PATCH v2 14/18] fbdev: Remove flag FBINFO_FLAG_DEFAULT from fbdev drivers

2023-07-13 Thread Thomas Zimmermann
The flag FBINFO_FLAG_DEFAULT is 0 and has no effect, as struct
fbinfo.flags has been allocated to zero by framebuffer_alloc(). So
do not set it.

Flags should signal differences from the default values. After cleaning
up all occurrences of FBINFO_DEFAULT, the token will be removed.

v2:
* fix commit message (Miguel)

Signed-off-by: Thomas Zimmermann 
Acked-by: Sam Ravnborg 
Cc: Jaya Kumar 
Cc: Helge Deller 
Cc: Peter Jones 
Cc: Sascha Hauer 
Cc: Pengutronix Kernel Team 
Cc: Shawn Guo 
Cc: Fabio Estevam 
Cc: NXP Linux Team 
Cc: Maik Broemme 
Cc: Jingoo Han 
Cc: Sudip Mukherjee 
Cc: Teddy Wang 
Cc: Michal Januszewski 
---
 drivers/video/fbdev/arcfb.c| 1 -
 drivers/video/fbdev/aty/aty128fb.c | 1 -
 drivers/video/fbdev/broadsheetfb.c | 2 +-
 drivers/video/fbdev/da8xx-fb.c | 1 -
 drivers/video/fbdev/efifb.c| 1 -
 drivers/video/fbdev/goldfishfb.c   | 1 -
 drivers/video/fbdev/gxt4500.c  | 3 +--
 drivers/video/fbdev/hecubafb.c | 2 +-
 drivers/video/fbdev/imxfb.c| 3 +--
 drivers/video/fbdev/intelfb/intelfbdrv.c   | 1 -
 drivers/video/fbdev/metronomefb.c  | 2 +-
 drivers/video/fbdev/mx3fb.c| 1 -
 drivers/video/fbdev/omap/omapfb_main.c | 1 -
 drivers/video/fbdev/omap2/omapfb/omapfb-main.c | 1 -
 drivers/video/fbdev/s3c-fb.c   | 1 -
 drivers/video/fbdev/sh_mobile_lcdcfb.c | 2 --
 drivers/video/fbdev/sis/sis_main.c | 2 --
 drivers/video/fbdev/sm501fb.c  | 2 +-
 drivers/video/fbdev/sm712fb.c  | 1 -
 drivers/video/fbdev/uvesafb.c  | 3 +--
 drivers/video/fbdev/vesafb.c   | 2 +-
 drivers/video/fbdev/vfb.c  | 1 -
 drivers/video/fbdev/vga16fb.c  | 2 +-
 drivers/video/fbdev/xen-fbfront.c  | 2 +-
 24 files changed, 10 insertions(+), 29 deletions(-)

diff --git a/drivers/video/fbdev/arcfb.c b/drivers/video/fbdev/arcfb.c
index 9aaea3be8281..cff11cb04a55 100644
--- a/drivers/video/fbdev/arcfb.c
+++ b/drivers/video/fbdev/arcfb.c
@@ -546,7 +546,6 @@ static int arcfb_probe(struct platform_device *dev)
par->c2io_addr = c2io_addr;
par->cslut[0] = 0x00;
par->cslut[1] = 0x06;
-   info->flags = FBINFO_FLAG_DEFAULT;
spin_lock_init(&par->lock);
if (irq) {
par->irq = irq;
diff --git a/drivers/video/fbdev/aty/aty128fb.c 
b/drivers/video/fbdev/aty/aty128fb.c
index 2d9320a52e51..b44fc78ccd4f 100644
--- a/drivers/video/fbdev/aty/aty128fb.c
+++ b/drivers/video/fbdev/aty/aty128fb.c
@@ -1927,7 +1927,6 @@ static int aty128_init(struct pci_dev *pdev, const struct 
pci_device_id *ent)
 
/* fill in info */
info->fbops = &aty128fb_ops;
-   info->flags = FBINFO_FLAG_DEFAULT;
 
par->lcd_on = default_lcd_on;
par->crt_on = default_crt_on;
diff --git a/drivers/video/fbdev/broadsheetfb.c 
b/drivers/video/fbdev/broadsheetfb.c
index cb725a91b6bb..e51e14c29c55 100644
--- a/drivers/video/fbdev/broadsheetfb.c
+++ b/drivers/video/fbdev/broadsheetfb.c
@@ -1069,7 +1069,7 @@ static int broadsheetfb_probe(struct platform_device *dev)
 
mutex_init(&par->io_lock);
 
-   info->flags = FBINFO_FLAG_DEFAULT | FBINFO_VIRTFB;
+   info->flags = FBINFO_VIRTFB;
 
info->fbdefio = &broadsheetfb_defio;
fb_deferred_io_init(info);
diff --git a/drivers/video/fbdev/da8xx-fb.c b/drivers/video/fbdev/da8xx-fb.c
index 60cd1286370f..988dedcf6be8 100644
--- a/drivers/video/fbdev/da8xx-fb.c
+++ b/drivers/video/fbdev/da8xx-fb.c
@@ -1463,7 +1463,6 @@ static int fb_probe(struct platform_device *device)
da8xx_fb_var.bits_per_pixel = lcd_cfg->bpp;
 
/* Initialize fbinfo */
-   da8xx_fb_info->flags = FBINFO_FLAG_DEFAULT;
da8xx_fb_info->fix = da8xx_fb_fix;
da8xx_fb_info->var = da8xx_fb_var;
da8xx_fb_info->fbops = &da8xx_fb_ops;
diff --git a/drivers/video/fbdev/efifb.c b/drivers/video/fbdev/efifb.c
index 3d7be69ab593..3391c8e84210 100644
--- a/drivers/video/fbdev/efifb.c
+++ b/drivers/video/fbdev/efifb.c
@@ -555,7 +555,6 @@ static int efifb_probe(struct platform_device *dev)
info->fbops = &efifb_ops;
info->var = efifb_defined;
info->fix = efifb_fix;
-   info->flags = FBINFO_FLAG_DEFAULT;
 
orientation = drm_get_panel_orientation_quirk(efifb_defined.xres,
  efifb_defined.yres);
diff --git a/drivers/video/fbdev/goldfishfb.c b/drivers/video/fbdev/goldfishfb.c
index 6fa2108fd912..ef2528c3faa9 100644
--- a/drivers/video/fbdev/goldfishfb.c
+++ b/drivers/video/fbdev/goldfishfb.c
@@ -212,7 +212,6 @@ static int goldfish_fb_probe(struct platform_device *pdev)
height = readl(fb->reg_b

[PATCH v2 16/18] fbdev/pxafb: Remove flag FBINFO_FLAG_DEFAULT

2023-07-13 Thread Thomas Zimmermann
The flag FBINFO_FLAG_DEFAULT is 0 and has no effect, as struct
fbinfo.flags has been allocated to zero by devm_kzalloc(). So do not
set it.

Flags should signal differences from the default values. After cleaning
up all occurrences of FBINFO_DEFAULT, the token will be removed.

v2:
* fix commit message (Miguel)

Signed-off-by: Thomas Zimmermann 
Acked-by: Sam Ravnborg 
Cc: Helge Deller 
---
 drivers/video/fbdev/pxafb.c | 1 -
 1 file changed, 1 deletion(-)

diff --git a/drivers/video/fbdev/pxafb.c b/drivers/video/fbdev/pxafb.c
index c8c4677d06b4..beffb0602a2c 100644
--- a/drivers/video/fbdev/pxafb.c
+++ b/drivers/video/fbdev/pxafb.c
@@ -888,7 +888,6 @@ static void init_pxafb_overlay(struct pxafb_info *fbi, 
struct pxafb_layer *ofb,
ofb->fb.var.vmode   = FB_VMODE_NONINTERLACED;
 
ofb->fb.fbops   = &overlay_fb_ops;
-   ofb->fb.flags   = FBINFO_FLAG_DEFAULT;
ofb->fb.node= -1;
ofb->fb.pseudo_palette  = NULL;
 
-- 
2.41.0



[PATCH v2 17/18] fbdev: Remove FBINFO_DEFAULT and FBINFO_FLAG_DEFAULT

2023-07-13 Thread Thomas Zimmermann
Remove the unused flags FBINFO_DEFAULT and FBINFO_FLAG_DEFAULT. No
functional changes.

Signed-off-by: Thomas Zimmermann 
Acked-by: Sam Ravnborg 
Cc: Helge Deller 
---
 include/linux/fb.h | 3 ---
 1 file changed, 3 deletions(-)

diff --git a/include/linux/fb.h b/include/linux/fb.h
index 1d5c13f34b09..43458f582f35 100644
--- a/include/linux/fb.h
+++ b/include/linux/fb.h
@@ -383,7 +383,6 @@ struct fb_tile_ops {
 #endif /* CONFIG_FB_TILEBLITTING */
 
 /* FBINFO_* = fb_info.flags bit flags */
-#define FBINFO_DEFAULT 0
 #define FBINFO_HWACCEL_DISABLED0x0002
/* When FBINFO_HWACCEL_DISABLED is set:
 *  Hardware acceleration is turned off.  Software implementations
@@ -504,8 +503,6 @@ struct fb_info {
bool skip_vt_switch; /* no VT switch on suspend/resume required */
 };
 
-#define FBINFO_FLAG_DEFAULTFBINFO_DEFAULT
-
 /* This will go away
  * fbset currently hacks in FB_ACCELF_TEXT into var.accel_flags
  * when it wants to turn the acceleration engine on.  This is
-- 
2.41.0



[PATCH v2 18/18] fbdev: Document that framebuffer_alloc() returns zero'ed data

2023-07-13 Thread Thomas Zimmermann
Most fbdev drivers depend on framebuffer_alloc() to initialize the
allocated memory to 0. Document this guarantee.

Suggested-by: Miguel Ojeda 
Signed-off-by: Thomas Zimmermann 
Cc: Helge Deller 
---
 drivers/video/fbdev/core/fb_info.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/video/fbdev/core/fb_info.c 
b/drivers/video/fbdev/core/fb_info.c
index 8bdbefdd4b70..1b7615fc393d 100644
--- a/drivers/video/fbdev/core/fb_info.c
+++ b/drivers/video/fbdev/core/fb_info.c
@@ -13,7 +13,8 @@
  *
  * Creates a new frame buffer info structure. Also reserves @size bytes
  * for driver private data (info->par). info->par (if any) will be
- * aligned to sizeof(long).
+ * aligned to sizeof(long). Both, the instance of struct fb_info and
+ * the driver private data, are cleared to zero.
  *
  * Returns the new structure, or NULL if an error occurred.
  *
-- 
2.41.0



[PATCH v3 02/18] fbdev: Remove flag FBINFO_DEFAULT from fbdev drivers

2023-07-14 Thread Thomas Zimmermann
The flag FBINFO_DEFAULT is 0 and has no effect, as struct fbinfo.flags
has been allocated to zero by a static declaration. So do not set it.

Flags should signal differences from the default values. After cleaning
up all occurrences of FBINFO_DEFAULT, the token will be removed.

v2:
* fix commit message (Miguel)

Signed-off-by: Thomas Zimmermann 
Acked-by: Sam Ravnborg 
Cc: Helge Deller 
---
 drivers/video/fbdev/68328fb.c  | 2 +-
 drivers/video/fbdev/acornfb.c  | 2 +-
 drivers/video/fbdev/g364fb.c   | 2 +-
 drivers/video/fbdev/hpfb.c | 1 -
 drivers/video/fbdev/macfb.c| 1 -
 drivers/video/fbdev/maxinefb.c | 1 -
 6 files changed, 3 insertions(+), 6 deletions(-)

diff --git a/drivers/video/fbdev/68328fb.c b/drivers/video/fbdev/68328fb.c
index 07d6e8dc686b..956dd2399cc0 100644
--- a/drivers/video/fbdev/68328fb.c
+++ b/drivers/video/fbdev/68328fb.c
@@ -448,7 +448,7 @@ static int __init mc68x328fb_init(void)
fb_info.var.red.offset = fb_info.var.green.offset = 
fb_info.var.blue.offset = 0;
}
fb_info.pseudo_palette = &mc68x328fb_pseudo_palette;
-   fb_info.flags = FBINFO_DEFAULT | FBINFO_HWACCEL_YPAN;
+   fb_info.flags = FBINFO_HWACCEL_YPAN;
 
if (fb_alloc_cmap(&fb_info.cmap, 256, 0))
return -ENOMEM;
diff --git a/drivers/video/fbdev/acornfb.c b/drivers/video/fbdev/acornfb.c
index 1b72edc01cfb..8fec21dfca09 100644
--- a/drivers/video/fbdev/acornfb.c
+++ b/drivers/video/fbdev/acornfb.c
@@ -694,7 +694,7 @@ static void acornfb_init_fbinfo(void)
first = 0;
 
fb_info.fbops   = &acornfb_ops;
-   fb_info.flags   = FBINFO_DEFAULT | FBINFO_HWACCEL_YPAN;
+   fb_info.flags   = FBINFO_HWACCEL_YPAN;
fb_info.pseudo_palette  = current_par.pseudo_palette;
 
strcpy(fb_info.fix.id, "Acorn");
diff --git a/drivers/video/fbdev/g364fb.c b/drivers/video/fbdev/g364fb.c
index c5b7673ddc6c..0825cbde116e 100644
--- a/drivers/video/fbdev/g364fb.c
+++ b/drivers/video/fbdev/g364fb.c
@@ -219,7 +219,7 @@ int __init g364fb_init(void)
fb_info.screen_base = (char *) G364_MEM_BASE;   /* virtual kernel 
address */
fb_info.var = fb_var;
fb_info.fix = fb_fix;
-   fb_info.flags = FBINFO_DEFAULT | FBINFO_HWACCEL_YPAN;
+   fb_info.flags = FBINFO_HWACCEL_YPAN;
 
fb_alloc_cmap(&fb_info.cmap, 255, 0);
 
diff --git a/drivers/video/fbdev/hpfb.c b/drivers/video/fbdev/hpfb.c
index 77fbff47b1a8..406c1383cbda 100644
--- a/drivers/video/fbdev/hpfb.c
+++ b/drivers/video/fbdev/hpfb.c
@@ -287,7 +287,6 @@ static int hpfb_init_one(unsigned long phys_base, unsigned 
long virt_base)
else
strcat(fb_info.fix.id, "Catseye");
fb_info.fbops = &hpfb_ops;
-   fb_info.flags = FBINFO_DEFAULT;
fb_info.var   = hpfb_defined;
fb_info.screen_base = (char *)fb_start;
 
diff --git a/drivers/video/fbdev/macfb.c b/drivers/video/fbdev/macfb.c
index 44ff860a3f37..5ca208d992cc 100644
--- a/drivers/video/fbdev/macfb.c
+++ b/drivers/video/fbdev/macfb.c
@@ -876,7 +876,6 @@ static int __init macfb_init(void)
fb_info.var = macfb_defined;
fb_info.fix = macfb_fix;
fb_info.pseudo_palette  = pseudo_palette;
-   fb_info.flags   = FBINFO_DEFAULT;
 
err = fb_alloc_cmap(&fb_info.cmap, video_cmap_len, 0);
if (err)
diff --git a/drivers/video/fbdev/maxinefb.c b/drivers/video/fbdev/maxinefb.c
index 4e6b05232ae2..0ac1873b2acb 100644
--- a/drivers/video/fbdev/maxinefb.c
+++ b/drivers/video/fbdev/maxinefb.c
@@ -155,7 +155,6 @@ int __init maxinefb_init(void)
fb_info.screen_base = (char *)maxinefb_fix.smem_start;
fb_info.var = maxinefb_defined;
fb_info.fix = maxinefb_fix;
-   fb_info.flags = FBINFO_DEFAULT;
 
fb_alloc_cmap(&fb_info.cmap, 256, 0);
 
-- 
2.41.0



[PATCH v3 00/18] fbdev: Remove FBINFO_DEFAULT and FBINFO_FLAG_DEFAULT flags

2023-07-14 Thread Thomas Zimmermann
Remove the unused flags FBINFO_DEFAULT and FBINFO_FLAG_DEFAULT from
fbdev and drivers, as briefly discussed at [1]. Both flags were maybe
useful when fbdev had special handling for driver modules. With
commit 376b3ff54c9a ("fbdev: Nuke FBINFO_MODULE"), they are both 0
and have no further effect.

Patches 1 to 7 remove FBINFO_DEFAULT from drivers. Patches 2 to 5
split this by the way the fb_info struct is being allocated. All flags
are cleared to zero during the allocation.

Patches 8 to 16 do the same for FBINFO_FLAG_DEFAULT. Patch 8 fixes
an actual bug in how arch/sh uses the token for struct fb_videomode,
which is unrelated.

Patch 17 removes both flag constants from  and patch 18
documents the zero'ed memory returned by framebuffer_alloc().

v3:
* sh: include board name in commit message (Adrian)
* docs: reword text (Miguel)
v2:
* sh: use FB_MODE_IS_UNKNOWN (Adrian)
* fix commit messages (Miguel)
* document framebuffer_alloc()'s zero'ed memory (Miguel)

[1] 
https://lore.kernel.org/dri-devel/877crer8fm@minerva.mail-host-address-is-not-set/

Thomas Zimmermann (18):
  drm: Remove flag FBINFO_DEFAULT from fbdev emulation
  fbdev: Remove flag FBINFO_DEFAULT from fbdev drivers
  fbdev: Remove flag FBINFO_DEFAULT from fbdev drivers
  fbdev: Remove flag FBINFO_DEFAULT from fbdev drivers
  fbdev: Remove flag FBINFO_DEFAULT from fbdev drivers
  fbdev/fsl-diu-fb: Remove flag FBINFO_DEFAULT
  vfio-mdev: Remove flag FBINFO_DEFAULT from fbdev sample driver
  sh: mach-sh7763rdp: Assign FB_MODE_IS_UNKNOWN to struct
fb_videomode.flag
  auxdisplay: Remove flag FBINFO_FLAG_DEFAULT from fbdev drivers
  hid/picolcd: Remove flag FBINFO_FLAG_DEFAULT from fbdev driver
  media: Remove flag FBINFO_FLAG_DEFAULT from fbdev drivers
  staging: Remove flag FBINFO_FLAG_DEFAULT from fbdev drivers
  fbdev: Remove flag FBINFO_FLAG_DEFAULT from fbdev drivers
  fbdev: Remove flag FBINFO_FLAG_DEFAULT from fbdev drivers
  fbdev/atafb: Remove flag FBINFO_FLAG_DEFAULT
  fbdev/pxafb: Remove flag FBINFO_FLAG_DEFAULT
  fbdev: Remove FBINFO_DEFAULT and FBINFO_FLAG_DEFAULT
  fbdev: Document that framebuffer_alloc() returns zero'ed data

 arch/sh/boards/mach-sh7763rdp/setup.c  | 2 +-
 drivers/auxdisplay/cfag12864bfb.c  | 1 -
 drivers/auxdisplay/ht16k33.c   | 1 -
 drivers/gpu/drm/drm_fbdev_dma.c| 1 -
 drivers/gpu/drm/drm_fbdev_generic.c| 1 -
 drivers/gpu/drm/gma500/fbdev.c | 2 +-
 drivers/gpu/drm/radeon/radeon_fbdev.c  | 2 +-
 drivers/hid/hid-picolcd_fb.c   | 1 -
 drivers/media/pci/ivtv/ivtvfb.c| 1 -
 drivers/media/test-drivers/vivid/vivid-osd.c   | 1 -
 drivers/staging/fbtft/fbtft-core.c | 2 +-
 drivers/staging/sm750fb/sm750.c| 1 -
 drivers/video/fbdev/68328fb.c  | 2 +-
 drivers/video/fbdev/acornfb.c  | 2 +-
 drivers/video/fbdev/amba-clcd.c| 1 -
 drivers/video/fbdev/amifb.c| 5 ++---
 drivers/video/fbdev/arcfb.c| 1 -
 drivers/video/fbdev/asiliantfb.c   | 1 -
 drivers/video/fbdev/atafb.c| 1 -
 drivers/video/fbdev/atmel_lcdfb.c  | 2 +-
 drivers/video/fbdev/aty/aty128fb.c | 1 -
 drivers/video/fbdev/aty/atyfb_base.c   | 3 +--
 drivers/video/fbdev/aty/radeon_base.c  | 3 +--
 drivers/video/fbdev/broadsheetfb.c | 2 +-
 drivers/video/fbdev/bw2.c  | 1 -
 drivers/video/fbdev/carminefb.c| 1 -
 drivers/video/fbdev/cg14.c | 2 +-
 drivers/video/fbdev/cg3.c  | 1 -
 drivers/video/fbdev/cg6.c  | 2 +-
 drivers/video/fbdev/chipsfb.c  | 1 -
 drivers/video/fbdev/cirrusfb.c | 3 +--
 drivers/video/fbdev/clps711x-fb.c  | 1 -
 drivers/video/fbdev/cobalt_lcdfb.c | 1 -
 drivers/video/fbdev/controlfb.c| 2 +-
 drivers/video/fbdev/core/fb_info.c | 3 ++-
 drivers/video/fbdev/cyber2000fb.c  | 2 +-
 drivers/video/fbdev/da8xx-fb.c | 1 -
 drivers/video/fbdev/efifb.c| 1 -
 drivers/video/fbdev/ep93xx-fb.c| 1 -
 drivers/video/fbdev/ffb.c  | 3 +--
 drivers/video/fbdev/fm2fb.c| 1 -
 drivers/video/fbdev/fsl-diu-fb.c   | 2 +-
 drivers/video/fbdev/g364fb.c   | 2 +-
 drivers/video/fbdev/gbefb.c| 1 -
 drivers/video/fbdev/geode/gx1fb_core.c | 1 -
 drivers/video/fbdev/geode/gxfb_core.c  | 1 -
 drivers/video/fbdev/geode/lxfb_core.c  | 1 -
 drivers/video/fbdev/goldfishfb.c   | 1 -
 drivers/video/fbdev/grvga.c| 2 +-
 drivers/video/fbdev/gxt4500.c  | 3 +--
 drivers/video/fbdev/hecubafb.c | 2 +

[PATCH v3 04/18] fbdev: Remove flag FBINFO_DEFAULT from fbdev drivers

2023-07-14 Thread Thomas Zimmermann
The flag FBINFO_DEFAULT is 0 and has no effect, as struct fbinfo.flags
has been allocated to zero by devm_kzalloc(). So do not set it.

Flags should signal differences from the default values. After cleaning
up all occurrences of FBINFO_DEFAULT, the token will be removed.

v2:
* fix commit message (Miguel)

Signed-off-by: Thomas Zimmermann 
Acked-by: Sam Ravnborg 
Cc: Helge Deller 
---
 drivers/video/fbdev/pxafb.c| 1 -
 drivers/video/fbdev/sa1100fb.c | 1 -
 drivers/video/fbdev/wm8505fb.c | 3 +--
 drivers/video/fbdev/xilinxfb.c | 1 -
 4 files changed, 1 insertion(+), 5 deletions(-)

diff --git a/drivers/video/fbdev/pxafb.c b/drivers/video/fbdev/pxafb.c
index 2a8b1dea3a67..c8c4677d06b4 100644
--- a/drivers/video/fbdev/pxafb.c
+++ b/drivers/video/fbdev/pxafb.c
@@ -1826,7 +1826,6 @@ static struct pxafb_info *pxafb_init_fbinfo(struct device 
*dev,
fbi->fb.var.vmode   = FB_VMODE_NONINTERLACED;
 
fbi->fb.fbops   = &pxafb_ops;
-   fbi->fb.flags   = FBINFO_DEFAULT;
fbi->fb.node= -1;
 
addr = fbi;
diff --git a/drivers/video/fbdev/sa1100fb.c b/drivers/video/fbdev/sa1100fb.c
index a2408bf00ca0..3d76ce111488 100644
--- a/drivers/video/fbdev/sa1100fb.c
+++ b/drivers/video/fbdev/sa1100fb.c
@@ -1089,7 +1089,6 @@ static struct sa1100fb_info *sa1100fb_init_fbinfo(struct 
device *dev)
fbi->fb.var.vmode   = FB_VMODE_NONINTERLACED;
 
fbi->fb.fbops   = &sa1100fb_ops;
-   fbi->fb.flags   = FBINFO_DEFAULT;
fbi->fb.monspecs= monspecs;
fbi->fb.pseudo_palette  = fbi->pseudo_palette;
 
diff --git a/drivers/video/fbdev/wm8505fb.c b/drivers/video/fbdev/wm8505fb.c
index 10a8b1250103..5833147aa43d 100644
--- a/drivers/video/fbdev/wm8505fb.c
+++ b/drivers/video/fbdev/wm8505fb.c
@@ -285,8 +285,7 @@ static int wm8505fb_probe(struct platform_device *pdev)
fbi->fb.fix.accel   = FB_ACCEL_NONE;
 
fbi->fb.fbops   = &wm8505fb_ops;
-   fbi->fb.flags   = FBINFO_DEFAULT
-   | FBINFO_HWACCEL_COPYAREA
+   fbi->fb.flags   = FBINFO_HWACCEL_COPYAREA
| FBINFO_HWACCEL_FILLRECT
| FBINFO_HWACCEL_XPAN
| FBINFO_HWACCEL_YPAN
diff --git a/drivers/video/fbdev/xilinxfb.c b/drivers/video/fbdev/xilinxfb.c
index 2aa3a528277f..768a281a8d2c 100644
--- a/drivers/video/fbdev/xilinxfb.c
+++ b/drivers/video/fbdev/xilinxfb.c
@@ -324,7 +324,6 @@ static int xilinxfb_assign(struct platform_device *pdev,
drvdata->info.fix.line_length = pdata->xvirt * BYTES_PER_PIXEL;
 
drvdata->info.pseudo_palette = drvdata->pseudo_palette;
-   drvdata->info.flags = FBINFO_DEFAULT;
drvdata->info.var = xilinx_fb_var;
drvdata->info.var.height = pdata->screen_height_mm;
drvdata->info.var.width = pdata->screen_width_mm;
-- 
2.41.0



[PATCH v3 01/18] drm: Remove flag FBINFO_DEFAULT from fbdev emulation

2023-07-14 Thread Thomas Zimmermann
The flag FBINFO_DEFAULT is 0 and has no effect, as struct fbinfo.flags
has been allocated to zero by framebuffer_alloc(). So do not set it.

Flags should signal differences from the default values. After cleaning
up all occurrences of FBINFO_DEFAULT, the token will be removed.

v2:
* fix commit message (Miguel)

Signed-off-by: Thomas Zimmermann 
Acked-by: Sam Ravnborg 
Cc: Patrik Jakobsson 
Cc: Alex Deucher 
Cc: "Christian König" 
Cc: "Pan, Xinhui" 
---
 drivers/gpu/drm/drm_fbdev_dma.c   | 1 -
 drivers/gpu/drm/drm_fbdev_generic.c   | 1 -
 drivers/gpu/drm/gma500/fbdev.c| 2 +-
 drivers/gpu/drm/radeon/radeon_fbdev.c | 2 +-
 4 files changed, 2 insertions(+), 4 deletions(-)

diff --git a/drivers/gpu/drm/drm_fbdev_dma.c b/drivers/gpu/drm/drm_fbdev_dma.c
index f9b1f7cd31b7..ee7c265b0585 100644
--- a/drivers/gpu/drm/drm_fbdev_dma.c
+++ b/drivers/gpu/drm/drm_fbdev_dma.c
@@ -123,7 +123,6 @@ static int drm_fbdev_dma_helper_fb_probe(struct 
drm_fb_helper *fb_helper,
drm_fb_helper_fill_info(info, fb_helper, sizes);
 
info->fbops = &drm_fbdev_dma_fb_ops;
-   info->flags = FBINFO_DEFAULT;
 
/* screen */
info->flags |= FBINFO_VIRTFB; /* system memory */
diff --git a/drivers/gpu/drm/drm_fbdev_generic.c 
b/drivers/gpu/drm/drm_fbdev_generic.c
index b9343fb6cf13..a0ea042b1526 100644
--- a/drivers/gpu/drm/drm_fbdev_generic.c
+++ b/drivers/gpu/drm/drm_fbdev_generic.c
@@ -109,7 +109,6 @@ static int drm_fbdev_generic_helper_fb_probe(struct 
drm_fb_helper *fb_helper,
drm_fb_helper_fill_info(info, fb_helper, sizes);
 
info->fbops = &drm_fbdev_generic_fb_ops;
-   info->flags = FBINFO_DEFAULT;
 
/* screen */
info->flags |= FBINFO_VIRTFB | FBINFO_READS_FAST;
diff --git a/drivers/gpu/drm/gma500/fbdev.c b/drivers/gpu/drm/gma500/fbdev.c
index 054426549fc6..be8f5fbd5260 100644
--- a/drivers/gpu/drm/gma500/fbdev.c
+++ b/drivers/gpu/drm/gma500/fbdev.c
@@ -215,7 +215,7 @@ static int psb_fbdev_fb_probe(struct drm_fb_helper 
*fb_helper,
}
 
info->fbops = &psb_fbdev_fb_ops;
-   info->flags = FBINFO_DEFAULT;
+
/* Accessed stolen memory directly */
info->screen_base = dev_priv->vram_addr + backing->offset;
info->screen_size = size;
diff --git a/drivers/gpu/drm/radeon/radeon_fbdev.c 
b/drivers/gpu/drm/radeon/radeon_fbdev.c
index f941e2e7cae6..68c06ac9acce 100644
--- a/drivers/gpu/drm/radeon/radeon_fbdev.c
+++ b/drivers/gpu/drm/radeon/radeon_fbdev.c
@@ -253,7 +253,7 @@ static int radeon_fbdev_fb_helper_fb_probe(struct 
drm_fb_helper *fb_helper,
}
 
info->fbops = &radeon_fbdev_fb_ops;
-   info->flags = FBINFO_DEFAULT;
+
/* radeon resume is fragile and needs a vt switch to help it along */
info->skip_vt_switch = false;
 
-- 
2.41.0



[PATCH v3 03/18] fbdev: Remove flag FBINFO_DEFAULT from fbdev drivers

2023-07-14 Thread Thomas Zimmermann
The flag FBINFO_DEFAULT is 0 and has no effect, as struct fbinfo.flags
has been allocated to zero by kzalloc(). So do not set it.

Flags should signal differences from the default values. After cleaning
up all occurrences of FBINFO_DEFAULT, the token will be removed.

v2:
* fix commit message (Miguel)

Signed-off-by: Thomas Zimmermann 
Acked-by: Sam Ravnborg 
Cc: Helge Deller 
Cc: Russell King 
---
 drivers/video/fbdev/controlfb.c   | 2 +-
 drivers/video/fbdev/cyber2000fb.c | 2 +-
 drivers/video/fbdev/valkyriefb.c  | 1 -
 drivers/video/fbdev/vermilion/vermilion.c | 2 +-
 drivers/video/fbdev/vt8500lcdfb.c | 3 +--
 5 files changed, 4 insertions(+), 6 deletions(-)

diff --git a/drivers/video/fbdev/controlfb.c b/drivers/video/fbdev/controlfb.c
index 82eeb139c4eb..717134c141ff 100644
--- a/drivers/video/fbdev/controlfb.c
+++ b/drivers/video/fbdev/controlfb.c
@@ -775,7 +775,7 @@ static void __init control_init_info(struct fb_info *info, 
struct fb_info_contro
info->par = &p->par;
info->fbops = &controlfb_ops;
info->pseudo_palette = p->pseudo_palette;
-info->flags = FBINFO_DEFAULT | FBINFO_HWACCEL_YPAN;
+   info->flags = FBINFO_HWACCEL_YPAN;
info->screen_base = p->frame_buffer + CTRLFB_OFF;
 
fb_alloc_cmap(&info->cmap, 256, 0);
diff --git a/drivers/video/fbdev/cyber2000fb.c 
b/drivers/video/fbdev/cyber2000fb.c
index 38c0a6866d76..98ea56a9abf1 100644
--- a/drivers/video/fbdev/cyber2000fb.c
+++ b/drivers/video/fbdev/cyber2000fb.c
@@ -1459,7 +1459,7 @@ static struct cfb_info *cyberpro_alloc_fb_info(unsigned 
int id, char *name)
cfb->fb.var.accel_flags = FB_ACCELF_TEXT;
 
cfb->fb.fbops   = &cyber2000fb_ops;
-   cfb->fb.flags   = FBINFO_DEFAULT | FBINFO_HWACCEL_YPAN;
+   cfb->fb.flags   = FBINFO_HWACCEL_YPAN;
cfb->fb.pseudo_palette  = cfb->pseudo_palette;
 
spin_lock_init(&cfb->reg_b0_lock);
diff --git a/drivers/video/fbdev/valkyriefb.c b/drivers/video/fbdev/valkyriefb.c
index b166b7cfe0e5..fd4488777032 100644
--- a/drivers/video/fbdev/valkyriefb.c
+++ b/drivers/video/fbdev/valkyriefb.c
@@ -535,7 +535,6 @@ static int __init valkyrie_init_info(struct fb_info *info,
 {
info->fbops = &valkyriefb_ops;
info->screen_base = p->frame_buffer + 0x1000;
-   info->flags = FBINFO_DEFAULT;
info->pseudo_palette = p->pseudo_palette;
info->par = &p->par;
return fb_alloc_cmap(&info->cmap, 256, 0);
diff --git a/drivers/video/fbdev/vermilion/vermilion.c 
b/drivers/video/fbdev/vermilion/vermilion.c
index 32e74e02a02f..71584c775efd 100644
--- a/drivers/video/fbdev/vermilion/vermilion.c
+++ b/drivers/video/fbdev/vermilion/vermilion.c
@@ -477,7 +477,7 @@ static int vml_pci_probe(struct pci_dev *dev, const struct 
pci_device_id *id)
}
 
info = &vinfo->info;
-   info->flags = FBINFO_DEFAULT | FBINFO_PARTIAL_PAN_OK;
+   info->flags = FBINFO_PARTIAL_PAN_OK;
 
err = vmlfb_enable_mmio(par);
if (err)
diff --git a/drivers/video/fbdev/vt8500lcdfb.c 
b/drivers/video/fbdev/vt8500lcdfb.c
index 31d4e85b220c..42d39a9d5130 100644
--- a/drivers/video/fbdev/vt8500lcdfb.c
+++ b/drivers/video/fbdev/vt8500lcdfb.c
@@ -300,8 +300,7 @@ static int vt8500lcd_probe(struct platform_device *pdev)
fbi->fb.var.vmode   = FB_VMODE_NONINTERLACED;
 
fbi->fb.fbops   = &vt8500lcd_ops;
-   fbi->fb.flags   = FBINFO_DEFAULT
-   | FBINFO_HWACCEL_COPYAREA
+   fbi->fb.flags   = FBINFO_HWACCEL_COPYAREA
| FBINFO_HWACCEL_FILLRECT
| FBINFO_HWACCEL_YPAN
| FBINFO_VIRTFB
-- 
2.41.0



[PATCH v3 05/18] fbdev: Remove flag FBINFO_DEFAULT from fbdev drivers

2023-07-14 Thread Thomas Zimmermann
The flag FBINFO_DEFAULT is 0 and has no effect, as struct fbinfo.flags
has been allocated to zero by framebuffer_alloc(). So do not set it.

Flags should signal differences from the default values. After cleaning
up all occurrences of FBINFO_DEFAULT, the token will be removed.

v2:
* fix commit message (Miguel)

Signed-off-by: Thomas Zimmermann 
Acked-by: Sam Ravnborg 
Cc: Helge Deller 
Cc: Nicolas Ferre 
Cc: Benjamin Herrenschmidt 
Cc: Ferenc Bakonyi 
Cc: "K. Y. Srinivasan" 
Cc: Haiyang Zhang 
Cc: Wei Liu 
Cc: Dexuan Cui 
Cc: Antonino Daplas 
Cc: Maik Broemme 
Cc: Michael Ellerman 
Cc: Nicholas Piggin 
Cc: Christophe Leroy 
Cc: Kristoffer Ericson 
Cc: Hans de Goede 
Cc: Steve Glendinning 
Cc: Bernie Thompson 
Cc: Florian Tobias Schandinat 
---
 drivers/video/fbdev/amifb.c  | 5 ++---
 drivers/video/fbdev/asiliantfb.c | 1 -
 drivers/video/fbdev/atmel_lcdfb.c| 2 +-
 drivers/video/fbdev/aty/atyfb_base.c | 3 +--
 drivers/video/fbdev/aty/radeon_base.c| 3 +--
 drivers/video/fbdev/bw2.c| 1 -
 drivers/video/fbdev/carminefb.c  | 1 -
 drivers/video/fbdev/cg14.c   | 2 +-
 drivers/video/fbdev/cg3.c| 1 -
 drivers/video/fbdev/cg6.c| 2 +-
 drivers/video/fbdev/chipsfb.c| 1 -
 drivers/video/fbdev/cirrusfb.c   | 3 +--
 drivers/video/fbdev/clps711x-fb.c| 1 -
 drivers/video/fbdev/cobalt_lcdfb.c   | 1 -
 drivers/video/fbdev/ep93xx-fb.c  | 1 -
 drivers/video/fbdev/ffb.c| 3 +--
 drivers/video/fbdev/fm2fb.c  | 1 -
 drivers/video/fbdev/gbefb.c  | 1 -
 drivers/video/fbdev/geode/gx1fb_core.c   | 1 -
 drivers/video/fbdev/geode/gxfb_core.c| 1 -
 drivers/video/fbdev/geode/lxfb_core.c| 1 -
 drivers/video/fbdev/grvga.c  | 2 +-
 drivers/video/fbdev/hgafb.c  | 2 +-
 drivers/video/fbdev/hitfb.c  | 2 +-
 drivers/video/fbdev/hyperv_fb.c  | 2 --
 drivers/video/fbdev/i740fb.c | 2 +-
 drivers/video/fbdev/i810/i810_main.c | 4 ++--
 drivers/video/fbdev/imsttfb.c| 3 +--
 drivers/video/fbdev/intelfb/intelfbdrv.c | 4 ++--
 drivers/video/fbdev/kyro/fbdev.c | 1 -
 drivers/video/fbdev/leo.c| 1 -
 drivers/video/fbdev/mb862xx/mb862xxfbdrv.c   | 2 +-
 drivers/video/fbdev/mmp/fb/mmpfb.c   | 2 +-
 drivers/video/fbdev/neofb.c  | 2 +-
 drivers/video/fbdev/nvidia/nvidia.c  | 4 ++--
 drivers/video/fbdev/offb.c   | 2 +-
 drivers/video/fbdev/p9100.c  | 1 -
 drivers/video/fbdev/platinumfb.c | 1 -
 drivers/video/fbdev/pm2fb.c  | 3 +--
 drivers/video/fbdev/pm3fb.c  | 3 +--
 drivers/video/fbdev/pmag-aa-fb.c | 1 -
 drivers/video/fbdev/pmag-ba-fb.c | 1 -
 drivers/video/fbdev/pmagb-b-fb.c | 1 -
 drivers/video/fbdev/ps3fb.c  | 2 +-
 drivers/video/fbdev/pvr2fb.c | 2 +-
 drivers/video/fbdev/pxa168fb.c   | 2 +-
 drivers/video/fbdev/q40fb.c  | 1 -
 drivers/video/fbdev/riva/fbdev.c | 3 +--
 drivers/video/fbdev/s1d13xxxfb.c | 4 ++--
 drivers/video/fbdev/savage/savagefb_driver.c | 3 +--
 drivers/video/fbdev/simplefb.c   | 1 -
 drivers/video/fbdev/sis/sis_main.c   | 3 +--
 drivers/video/fbdev/skeletonfb.c | 2 +-
 drivers/video/fbdev/smscufx.c| 2 +-
 drivers/video/fbdev/sstfb.c  | 1 -
 drivers/video/fbdev/sunxvr1000.c | 1 -
 drivers/video/fbdev/sunxvr2500.c | 1 -
 drivers/video/fbdev/sunxvr500.c  | 1 -
 drivers/video/fbdev/tcx.c| 1 -
 drivers/video/fbdev/tdfxfb.c | 2 +-
 drivers/video/fbdev/tgafb.c  | 2 +-
 drivers/video/fbdev/tridentfb.c  | 2 +-
 drivers/video/fbdev/udlfb.c  | 2 +-
 drivers/video/fbdev/via/viafbdev.c   | 2 +-
 64 files changed, 41 insertions(+), 81 deletions(-)

diff --git a/drivers/video/fbdev/amifb.c b/drivers/video/fbdev/amifb.c
index d88265dbebf4..cea782283b9c 100644
--- a/drivers/video/fbdev/amifb.c
+++ b/drivers/video/fbdev/amifb.c
@@ -2427,7 +2427,7 @@ static int amifb_set_par(struct fb_info *info)
info->fix.ywrapstep = 1;
info->fix.xpanstep = 0;
info->fix.ypanstep = 0;
-   info->flags = FBINFO_DEFAULT | FBINFO_HWACCEL_YWRAP |
+   info->flags = FBINFO_HWACCEL_YWRAP |
FBINFO_READS_FAST; /* override SCROLL_REDRAW */
} else {
info->fix.ywrapstep = 0;
@@ -2436,7 +2436,7 @@ static int amifb_set_par(struct fb_info *info)
else
info->fix.xpanstep = 16 &l

[PATCH v3 06/18] fbdev/fsl-diu-fb: Remove flag FBINFO_DEFAULT

2023-07-14 Thread Thomas Zimmermann
The flag FBINFO_DEFAULT is 0 and has no effect, as struct fbinfo.flags
has been allocated to zero by dmam_alloc_coherent(__GFP_ZERO). So do not
set it.

Flags should signal differences from the default values. After cleaning
up all occurrences of FBINFO_DEFAULT, the token will be removed.

v2:
* fix commit message (Miguel)

Signed-off-by: Thomas Zimmermann 
Acked-by: Sam Ravnborg 
Cc: Timur Tabi 
Cc: Helge Deller 
---
 drivers/video/fbdev/fsl-diu-fb.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/video/fbdev/fsl-diu-fb.c b/drivers/video/fbdev/fsl-diu-fb.c
index 785eb8a06943..c62b48f27ba9 100644
--- a/drivers/video/fbdev/fsl-diu-fb.c
+++ b/drivers/video/fbdev/fsl-diu-fb.c
@@ -1476,7 +1476,7 @@ static int install_fb(struct fb_info *info)
 
info->var.activate = FB_ACTIVATE_NOW;
info->fbops = &fsl_diu_ops;
-   info->flags = FBINFO_DEFAULT | FBINFO_VIRTFB | FBINFO_PARTIAL_PAN_OK |
+   info->flags = FBINFO_VIRTFB | FBINFO_PARTIAL_PAN_OK |
FBINFO_READS_FAST;
info->pseudo_palette = mfbi->pseudo_palette;
 
-- 
2.41.0



[PATCH v3 07/18] vfio-mdev: Remove flag FBINFO_DEFAULT from fbdev sample driver

2023-07-14 Thread Thomas Zimmermann
The flag FBINFO_DEFAULT is 0 and has no effect, as struct fbinfo.flags
has been allocated to zero by framebuffer_alloc(). So do not set it.

Flags should signal differences from the default values. After cleaning
up all occurrences of FBINFO_DEFAULT, the token will be removed.

v2:
* fix commit message (Miguel)

Signed-off-by: Thomas Zimmermann 
Acked-by: Sam Ravnborg 
Cc: Kirti Wankhede 
---
 samples/vfio-mdev/mdpy-fb.c | 1 -
 1 file changed, 1 deletion(-)

diff --git a/samples/vfio-mdev/mdpy-fb.c b/samples/vfio-mdev/mdpy-fb.c
index 3c8001b9e407..cda477b28685 100644
--- a/samples/vfio-mdev/mdpy-fb.c
+++ b/samples/vfio-mdev/mdpy-fb.c
@@ -162,7 +162,6 @@ static int mdpy_fb_probe(struct pci_dev *pdev,
}
 
info->fbops = &mdpy_fb_ops;
-   info->flags = FBINFO_DEFAULT;
info->pseudo_palette = par->palette;
 
ret = register_framebuffer(info);
-- 
2.41.0



[PATCH v3 08/18] sh: mach-sh7763rdp: Assign FB_MODE_IS_UNKNOWN to struct fb_videomode.flag

2023-07-14 Thread Thomas Zimmermann
Assign FB_MODE_IS_UNKNOWN to sh7763fb_videomode.flag instead of
FBINFO_FLAG_DEFAULT. Both are 0, so the stored value does not change.

FBINFO_FLAG_DEFAULT is a flag for a framebuffer in struct fb_info.
Flags for videomodes are prefixed with FB_MODE_.

v3:
* include board name in commit message (Adrian)
v2:
* assign FB_MODE_IS_UNKNOWN (Adrian)

Signed-off-by: Thomas Zimmermann 
Acked-by: Sam Ravnborg 
Acked-by: John Paul Adrian Glaubitz 
Cc: Yoshinori Sato 
Cc: Rich Felker 
Cc: John Paul Adrian Glaubitz 
---
 arch/sh/boards/mach-sh7763rdp/setup.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/sh/boards/mach-sh7763rdp/setup.c 
b/arch/sh/boards/mach-sh7763rdp/setup.c
index 97e715e4e9b3..e25193001ea0 100644
--- a/arch/sh/boards/mach-sh7763rdp/setup.c
+++ b/arch/sh/boards/mach-sh7763rdp/setup.c
@@ -119,7 +119,7 @@ static struct fb_videomode sh7763fb_videomode = {
.vsync_len = 1,
.sync = 0,
.vmode = FB_VMODE_NONINTERLACED,
-   .flag = FBINFO_FLAG_DEFAULT,
+   .flag = FB_MODE_IS_UNKNOWN,
 };
 
 static struct sh7760fb_platdata sh7763fb_def_pdata = {
-- 
2.41.0



  1   2   3   4   >