Re: [PATCH v2 26/32] staging/sm750fb: Initialize fb_ops with fbdev macros

2023-11-27 Thread Greg Kroah-Hartman
On Mon, Nov 27, 2023 at 02:15:55PM +0100, Thomas Zimmermann wrote:
> Initialize all instances of struct fb_ops with fbdev initializer
> macros for framebuffers in I/O 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: Sudip Mukherjee 
> Cc: Teddy Wang 
> Cc: Greg Kroah-Hartman 
> Cc: linux-stag...@lists.linux.dev
> Reviewed-by: Javier Martinez Canillas 

Acked-by: Greg Kroah-Hartman 


[PATCH v2 26/32] staging/sm750fb: Initialize fb_ops with fbdev macros

2023-11-27 Thread Thomas Zimmermann
Initialize all instances of struct fb_ops with fbdev initializer
macros for framebuffers in I/O 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: Sudip Mukherjee 
Cc: Teddy Wang 
Cc: Greg Kroah-Hartman 
Cc: linux-stag...@lists.linux.dev
Reviewed-by: Javier Martinez Canillas 
---
 drivers/staging/sm750fb/sm750.c | 12 ++--
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/drivers/staging/sm750fb/sm750.c b/drivers/staging/sm750fb/sm750.c
index 35098516f53c9..04c1b32a22c5e 100644
--- a/drivers/staging/sm750fb/sm750.c
+++ b/drivers/staging/sm750fb/sm750.c
@@ -665,31 +665,28 @@ static int sm750fb_set_drv(struct lynxfb_par *par)
 
 static const struct fb_ops lynxfb_ops = {
.owner = THIS_MODULE,
+   FB_DEFAULT_IOMEM_OPS,
.fb_check_var =  lynxfb_ops_check_var,
.fb_set_par = lynxfb_ops_set_par,
.fb_setcolreg = lynxfb_ops_setcolreg,
.fb_blank = lynxfb_ops_blank,
.fb_pan_display = lynxfb_ops_pan_display,
-   .fb_fillrect = cfb_fillrect,
-   .fb_imageblit = cfb_imageblit,
-   .fb_copyarea = cfb_copyarea,
 };
 
 static const struct fb_ops lynxfb_ops_with_cursor = {
.owner = THIS_MODULE,
+   FB_DEFAULT_IOMEM_OPS,
.fb_check_var =  lynxfb_ops_check_var,
.fb_set_par = lynxfb_ops_set_par,
.fb_setcolreg = lynxfb_ops_setcolreg,
.fb_blank = lynxfb_ops_blank,
.fb_pan_display = lynxfb_ops_pan_display,
-   .fb_fillrect = cfb_fillrect,
-   .fb_copyarea = cfb_copyarea,
-   .fb_imageblit = cfb_imageblit,
.fb_cursor = lynxfb_ops_cursor,
 };
 
 static const struct fb_ops lynxfb_ops_accel = {
.owner = THIS_MODULE,
+   __FB_DEFAULT_IOMEM_OPS_RDWR,
.fb_check_var =  lynxfb_ops_check_var,
.fb_set_par = lynxfb_ops_set_par,
.fb_setcolreg = lynxfb_ops_setcolreg,
@@ -698,10 +695,12 @@ static const struct fb_ops lynxfb_ops_accel = {
.fb_fillrect = lynxfb_ops_fillrect,
.fb_copyarea = lynxfb_ops_copyarea,
.fb_imageblit = lynxfb_ops_imageblit,
+   __FB_DEFAULT_IOMEM_OPS_MMAP,
 };
 
 static const struct fb_ops lynxfb_ops_accel_with_cursor = {
.owner = THIS_MODULE,
+   __FB_DEFAULT_IOMEM_OPS_RDWR,
.fb_check_var =  lynxfb_ops_check_var,
.fb_set_par = lynxfb_ops_set_par,
.fb_setcolreg = lynxfb_ops_setcolreg,
@@ -711,6 +710,7 @@ static const struct fb_ops lynxfb_ops_accel_with_cursor = {
.fb_copyarea = lynxfb_ops_copyarea,
.fb_imageblit = lynxfb_ops_imageblit,
.fb_cursor = lynxfb_ops_cursor,
+   __FB_DEFAULT_IOMEM_OPS_MMAP,
 };
 
 static int lynxfb_set_fbinfo(struct fb_info *info, int index)
-- 
2.43.0