fbdev/sbus: Initializers for struct fb_ops
cover fbdev/sbus: Initializers for struct fb_ops
Add initializer macros for struct fb_ops of drivers that operate on SBUS-based framebuffers. Also add a Kconfig token to select the correct dependencies.
All drivers for SBUS-based framebuffers use the regular helpers for framebuffers in I/O memory (fb_io_*() and cfb_*()). Each driver provides its own implementation of mmap and ioctls around common helpers from sbuslib.o. Patches 1 to 3 clean up the code a bit and add a initializer macros that set up struct fb_ops correctly.
Patches 4 to 11 convert the drivers. Each patch slightly renames the driver's mmap and ioctl functions so that it matches the name pattern of sbuslib.o.
Like the other fbdev initializer macros, the SBUS helpers are easily grep-able. In a later patch, they can be left to empty values if the rsp. functionality, such as file I/O or console, has been disabled.
There are no functional changes. The helpers set the defaults that the drivers already use. The fb_io_*() functions that the initializer macro sets are the defaults if struct fb_ops.fb_read or .fb_write are NULL. After all drivers have been updated to set them explicitly, the defaults can be dropped and the functions can be made optional.
Build-tested on sparc64.
Thomas Zimmermann (11):
fbdev/sbus: Build sbuslib.o if CONFIG_FB_SBUS has been selected fbdev/sbus: Forward declare all necessary structures in header fbdev/sbus: Add initializer macros and Kconfig tokens for SBUS support fbdev/bw2: Use initializer macro for struct fb_ops fbdev/cg14: Use initializer macro for struct fb_ops fbdev/cg3: Use initializer macro for struct fb_ops fbdev/cg6: Use initializer macro for struct fb_ops fbdev/ffb: Use initializer macro for struct fb_ops fbdev/leo: Use initializer macro for struct fb_ops fbdev/p9100: Use initializer macro for struct fb_ops fbdev/tcx: Use initializer macro for struct fb_ops
drivers/video/fbdev/Kconfig | 30 ++++++++++++---------------- drivers/video/fbdev/Makefile | 17 ++++++++-------- drivers/video/fbdev/bw2.c | 17 +++++----------- drivers/video/fbdev/cg14.c | 19 ++++++------------ drivers/video/fbdev/cg3.c | 17 +++++----------- drivers/video/fbdev/cg6.c | 17 ++++++++-------- drivers/video/fbdev/ffb.c | 17 ++++++++-------- drivers/video/fbdev/leo.c | 19 ++++++------------ drivers/video/fbdev/p9100.c | 18 +++++------------ drivers/video/fbdev/sbuslib.h | 37 ++++++++++++++++++++++++++++++++++- drivers/video/fbdev/tcx.c | 20 ++++++------------- 11 files changed, 106 insertions(+), 122 deletions(-)
Signature · 1 line
2.41.0
PATCH 1/11 fbdev/sbus: Build sbuslib.o if CONFIG_FB_SBUS has been selected
Avoid duplicate listings of sbuslib.o in the Makefile by building it if CONFIG_FB_SBUS has been selected. Remove the object file from the various drivers' build rules.
--- drivers/video/fbdev/Makefile | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-)
drivers/video/fbdev/Makefile +9 -8
@@ -8,6 +8,7 @@ obj-y += core/ obj-$(CONFIG_FB_MACMODES) += macmodes.o +obj-$(CONFIG_FB_SBUS) += sbuslib.o obj-$(CONFIG_FB_WMT_GE_ROPS) += wmt_ge_rops.o # Hardware specific drivers go first
@@ -45,14 +46,14 @@ obj-$(CONFIG_FB_LE80578) += vermilion/ obj-$(CONFIG_FB_S3) += s3fb.o obj-$(CONFIG_FB_ARK) += arkfb.o obj-$(CONFIG_FB_STI) += stifb.o -obj-$(CONFIG_FB_FFB) += ffb.o sbuslib.o -obj-$(CONFIG_FB_CG6) += cg6.o sbuslib.o -obj-$(CONFIG_FB_CG3) += cg3.o sbuslib.o -obj-$(CONFIG_FB_BW2) += bw2.o sbuslib.o -obj-$(CONFIG_FB_CG14) += cg14.o sbuslib.o -obj-$(CONFIG_FB_P9100) += p9100.o sbuslib.o -obj-$(CONFIG_FB_TCX) += tcx.o sbuslib.o -obj-$(CONFIG_FB_LEO) += leo.o sbuslib.o +obj-$(CONFIG_FB_FFB) += ffb.o +obj-$(CONFIG_FB_CG6) += cg6.o +obj-$(CONFIG_FB_CG3) += cg3.o +obj-$(CONFIG_FB_BW2) += bw2.o +obj-$(CONFIG_FB_CG14) += cg14.o +obj-$(CONFIG_FB_P9100) += p9100.o +obj-$(CONFIG_FB_TCX) += tcx.o +obj-$(CONFIG_FB_LEO) += leo.o obj-$(CONFIG_FB_ACORN) += acornfb.o obj-$(CONFIG_FB_ATARI) += atafb.o c2p_iplan2.o atafb_mfb.o \ atafb_iplan2p2.o atafb_iplan2p4.o atafb_iplan2p8.o
Signature · 1 line
2.41.0
PATCH 2/11 fbdev/sbus: Forward declare all necessary structures in header
In reply to Thomas ZimmermannIn sbuslib.h, declare all of the header file's structs at the top. No functional changes.
--- drivers/video/fbdev/sbuslib.h | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)
drivers/video/fbdev/sbuslib.h +5 -1
@@ -3,6 +3,11 @@ #ifndef _SBUSLIB_H #define _SBUSLIB_H +struct device_node; +struct fb_info; +struct fb_var_screeninfo; +struct vm_area_struct; + struct sbus_mmap_map { unsigned long voff; unsigned long poff;
@@ -14,7 +19,6 @@ struct sbus_mmap_map {extern void sbusfb_fill_var (struct fb_var_screeninfo *var,struct device_node *dp,int bpp); -struct vm_area_struct ; extern int sbusfb_mmap_helper(struct sbus_mmap_map *map, unsigned long physbase, unsigned long fbsize, unsigned long iospace,
Signature · 1 line
2.41.0
PATCH 3/11 fbdev/sbus: Add initializer macros and Kconfig tokens for SBUS support
In reply to Thomas ZimmermannAdd macros to initialize struct fb_ops for drivers that support framebuffers on Sparc's SBUS. Also add a Kconfig token that selects the necessary helpers.
--- drivers/video/fbdev/Kconfig | 6 ++++++ drivers/video/fbdev/sbuslib.h | 31 +++++++++++++++++++++++++++++++ 2 files changed, 37 insertions(+)
drivers/video/fbdev/Kconfig +6 -0
@@ -518,6 +518,12 @@ config FB_SBUS help Say Y if you want support for SBUS or UPA based frame buffer device. +config FB_SBUS_HELPERS + bool + select FB_CFB_COPYAREA + select FB_CFB_FILLRECT + select FB_CFB_IMAGEBLIT + config FB_BW2 bool "BWtwo support" depends on (FB = y) && (SPARC && FB_SBUS)
drivers/video/fbdev/sbuslib.h +31 -0
@@ -29,4 +29,35 @@ int sbusfb_ioctl_helper(unsigned long cmd, unsigned long arg,int sbusfb_compat_ioctl (struct fb_info *info,unsigned int cmd,unsigned long arg); +/* +* Initialize struct fb_ops for SBUS I/O. +*/ + +#define __FB_DEFAULT_SBUS_OPS_RDWR (__prefix) \ + .fb_read = fb_io_read, \ + .fb_write = fb_io_write + +#define __FB_DEFAULT_SBUS_OPS_DRAW (__prefix) \ + .fb_fillrect = cfb_fillrect, \ + .fb_copyarea = cfb_copyarea, \ + .fb_imageblit = cfb_imageblit + +#ifdef CONFIG_COMPAT +#define __FB_DEFAULT_SBUS_OPS_IOCTL (__prefix) \ + .fb_ioctl = __prefix ## _sbusfb_ioctl, \ + .fb_compat_ioctl = sbusfb_compat_ioctl +#else +#define __FB_DEFAULT_SBUS_OPS_IOCTL (__prefix) \ + .fb_ioctl = __prefix ## _sbusfb_ioctl +#endif + +#define __FB_DEFAULT_SBUS_OPS_MMAP (__prefix) \ + .fb_mmap = __prefix ## _sbusfb_mmap + +#define FB_DEFAULT_SBUS_OPS (__prefix) \ + __FB_DEFAULT_SBUS_OPS_RDWR(__prefix), \ + __FB_DEFAULT_SBUS_OPS_DRAW(__prefix), \ + __FB_DEFAULT_SBUS_OPS_IOCTL(__prefix), \ + __FB_DEFAULT_SBUS_OPS_MMAP(__prefix) +#endif /* _SBUSLIB_H */
Signature · 1 line
2.41.0
PATCH 4/11 fbdev/bw2: Use initializer macro for struct fb_ops
In reply to Thomas ZimmermannInitialize struct fb_ops to the correct default values with the macro FB_DEFAULT_SBUS_OPS(). Rename the ioctl and mmap callbacks to use the infix _sbusfb_. This makes them fit the SBUS helpers' naming pattern. Also make the driver depend on FB_SBUS_HELPERS, which selects the correct modules.
--- drivers/video/fbdev/Kconfig | 4 +--- drivers/video/fbdev/bw2.c | 17 +++++------------ 2 files changed, 6 insertions(+), 15 deletions(-)
drivers/video/fbdev/Kconfig +1 -3
@@ -527,9 +527,7 @@ config FB_SBUS_HELPERS config FB_BW2 bool "BWtwo support" depends on (FB = y) && (SPARC && FB_SBUS) - select FB_CFB_FILLRECT - select FB_CFB_COPYAREA - select FB_CFB_IMAGEBLIT + select FB_SBUS_HELPERS help This is the frame buffer device driver for the BWtwo frame buffer.
drivers/video/fbdev/bw2.c +5 -12
@@ -31,8 +31,8 @@static int bw2_blank (int ,struct fb_info *); -static int bw2_mmap (struct fb_info *,struct vm_area_struct *); -static int bw2_ioctl (struct fb_info *,unsigned int ,unsigned long ); +static int bw2_sbusfb_mmap (struct fb_info *info,struct vm_area_struct *vma); +static int bw2_sbusfb_ioctl (struct fb_info *info,unsigned int cmd,unsigned long arg);/* * Frame buffer operations
@@ -40,15 +40,8 @@ static int bw2_ioctl(struct fb_info *, unsigned int, unsigned long);static const struct fb_ops bw2_ops = { .owner =THIS_MODULE , +FB_DEFAULT_SBUS_OPS (bw2), .fb_blank = bw2_blank, - .fb_fillrect = cfb_fillrect, - .fb_copyarea = cfb_copyarea, - .fb_imageblit = cfb_imageblit, - .fb_mmap = bw2_mmap, - .fb_ioctl = bw2_ioctl, -#ifdef CONFIG_COMPAT - .fb_compat_ioctl = sbusfb_compat_ioctl, -#endif };/* OBio addresses for the bwtwo registers */
@@ -161,7 +154,7 @@ static struct sbus_mmap_map bw2_mmap_map[] = { { .size = 0 } }; -static int bw2_mmap (struct fb_info *info,struct vm_area_struct *vma) +static int bw2_sbusfb_mmap (struct fb_info *info,struct vm_area_struct *vma) {struct bw2_par *par = (struct bw2_par *)info->par;
@@ -171,7 +164,7 @@ static int bw2_mmap(struct fb_info *info, struct vm_area_struct *vma) vma); } -static int bw2_ioctl (struct fb_info *info,unsigned int cmd,unsigned long arg) +static int bw2_sbusfb_ioctl (struct fb_info *info,unsigned int cmd,unsigned long arg) {return sbusfb_ioctl_helper (cmd, arg, info,FBTYPE_SUN2BW ,1 , info->fix.smem_len);
Signature · 1 line
2.41.0
PATCH 5/11 fbdev/cg14: Use initializer macro for struct fb_ops
In reply to Thomas ZimmermannInitialize struct fb_ops to the correct default values with the macro FB_DEFAULT_SBUS_OPS(). Rename the ioctl and mmap callbacks to use the infix _sbusfb_. This makes them fit the SBUS helpers' naming pattern. Also make the driver depend on FB_SBUS_HELPERS, which selects the correct modules.
--- drivers/video/fbdev/Kconfig | 4 +--- drivers/video/fbdev/cg14.c | 19 ++++++------------- 2 files changed, 7 insertions(+), 16 deletions(-)
drivers/video/fbdev/Kconfig +1 -3
@@ -571,9 +571,7 @@ config FB_TCX config FB_CG14 bool "CGfourteen (SX) support" depends on FB_SBUS - select FB_CFB_FILLRECT - select FB_CFB_COPYAREA - select FB_CFB_IMAGEBLIT + select FB_SBUS_HELPERS help This is the frame buffer device driver for the CGfourteen frame buffer on Desktop SPARCsystems with the SX graphics option.
drivers/video/fbdev/cg14.c +6 -13
@@ -31,27 +31,20 @@static int cg14_setcolreg (unsigned ,unsigned ,unsigned ,unsigned ,unsigned ,struct fb_info *); - -static int cg14_mmap (struct fb_info *,struct vm_area_struct *); -static int cg14_ioctl (struct fb_info *,unsigned int ,unsigned long );static int cg14_pan_display (struct fb_var_screeninfo *,struct fb_info *); +static int cg14_sbusfb_mmap (struct fb_info *info,struct vm_area_struct *vma); +static int cg14_sbusfb_ioctl (struct fb_info *info,unsigned int cmd,unsigned long arg); +/* * Frame buffer operations */ static const struct fb_ops cg14_ops = { .owner =THIS_MODULE , +FB_DEFAULT_SBUS_OPS (cg14), .fb_setcolreg = cg14_setcolreg, .fb_pan_display = cg14_pan_display, - .fb_fillrect = cfb_fillrect, - .fb_copyarea = cfb_copyarea, - .fb_imageblit = cfb_imageblit, - .fb_mmap = cg14_mmap, - .fb_ioctl = cg14_ioctl, -#ifdef CONFIG_COMPAT - .fb_compat_ioctl = sbusfb_compat_ioctl, -#endif };#define CG14_MCR_INTENABLE_SHIFT 7
@@ -265,7 +258,7 @@ static int cg14_setcolreg(unsigned regno,return 0 ; } -static int cg14_mmap (struct fb_info *info,struct vm_area_struct *vma) +static int cg14_sbusfb_mmap (struct fb_info *info,struct vm_area_struct *vma) {struct cg14_par *par = (struct cg14_par *) info->par;
@@ -274,7 +267,7 @@ static int cg14_mmap(struct fb_info *info, struct vm_area_struct *vma) par->iospace, vma); } -static int cg14_ioctl (struct fb_info *info,unsigned int cmd,unsigned long arg) +static int cg14_sbusfb_ioctl (struct fb_info *info,unsigned int cmd,unsigned long arg) {struct cg14_par *par = (struct cg14_par *) info->par;struct cg14_regs __iomem *regs = par->regs;
Signature · 1 line
2.41.0
PATCH 6/11 fbdev/cg3: Use initializer macro for struct fb_ops
In reply to Thomas ZimmermannInitialize struct fb_ops to the correct default values with the macro FB_DEFAULT_SBUS_OPS(). Rename the ioctl and mmap callbacks to use the infix _sbusfb_. This makes them fit the SBUS helpers' naming pattern. Also make the driver depend on FB_SBUS_HELPERS, which selects the correct modules.
--- drivers/video/fbdev/Kconfig | 4 +--- drivers/video/fbdev/cg3.c | 17 +++++------------ 2 files changed, 6 insertions(+), 15 deletions(-)
drivers/video/fbdev/Kconfig +1 -3
@@ -534,9 +534,7 @@ config FB_BW2 config FB_CG3 bool "CGthree support" depends on (FB = y) && (SPARC && FB_SBUS) - select FB_CFB_FILLRECT - select FB_CFB_COPYAREA - select FB_CFB_IMAGEBLIT + select FB_SBUS_HELPERS help This is the frame buffer device driver for the CGthree frame buffer.
drivers/video/fbdev/cg3.c +5 -12
@@ -33,8 +33,8 @@ static int cg3_setcolreg(unsigned, unsigned, unsigned, unsigned, unsigned, struct fb_info *);static int cg3_blank (int ,struct fb_info *); -static int cg3_mmap (struct fb_info *,struct vm_area_struct *); -static int cg3_ioctl (struct fb_info *,unsigned int ,unsigned long ); +static int cg3_sbusfb_mmap (struct fb_info *info,struct vm_area_struct *vma); +static int cg3_sbusfb_ioctl (struct fb_info *info,unsigned int cmd,unsigned long arg);/* * Frame buffer operations
@@ -42,16 +42,9 @@ static int cg3_ioctl(struct fb_info *, unsigned int, unsigned long);static const struct fb_ops cg3_ops = { .owner =THIS_MODULE , +FB_DEFAULT_SBUS_OPS (cg3), .fb_setcolreg = cg3_setcolreg, .fb_blank = cg3_blank, - .fb_fillrect = cfb_fillrect, - .fb_copyarea = cfb_copyarea, - .fb_imageblit = cfb_imageblit, - .fb_mmap = cg3_mmap, - .fb_ioctl = cg3_ioctl, -#ifdef CONFIG_COMPAT - .fb_compat_ioctl = sbusfb_compat_ioctl, -#endif };
@@ -225,7 +218,7 @@ static struct sbus_mmap_map cg3_mmap_map[] = { { .size = 0 } }; -static int cg3_mmap (struct fb_info *info,struct vm_area_struct *vma) +static int cg3_sbusfb_mmap (struct fb_info *info,struct vm_area_struct *vma) {struct cg3_par *par = (struct cg3_par *)info->par;
@@ -235,7 +228,7 @@ static int cg3_mmap(struct fb_info *info, struct vm_area_struct *vma) vma); } -static int cg3_ioctl (struct fb_info *info,unsigned int cmd,unsigned long arg) +static int cg3_sbusfb_ioctl (struct fb_info *info,unsigned int cmd,unsigned long arg) {return sbusfb_ioctl_helper (cmd, arg, info,FBTYPE_SUN3COLOR ,8 , info->fix.smem_len);
Signature · 1 line
2.41.0
PATCH 7/11 fbdev/cg6: Use initializer macro for struct fb_ops
In reply to Thomas ZimmermannInitialize struct fb_ops to the correct default values with the internal __FB_DEFAULT_SBUS_OPS_*() macros. Rename the ioctl and mmap callbacks to use the infix _sbusfb_. This makes them fit the SBUS helpers' naming pattern.
It is not possible to use set all defaults via FB_DEAFULT_SBUS_OPS(), as cg6 provides its own implementation of fb_fillrect, fb_copyarea, and fb_imageblit. Hence we also avoid FB_SBUS_HELPERS, but let the driver select its dependencies individually instead.
--- drivers/video/fbdev/cg6.c | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-)
drivers/video/fbdev/cg6.c +8 -9
@@ -37,16 +37,18 @@ static void cg6_imageblit(struct fb_info *, const struct fb_image *);static void cg6_fillrect (struct fb_info *,const struct fb_fillrect *);static void cg6_copyarea (struct fb_info *info,const struct fb_copyarea *area);static int cg6_sync (struct fb_info *); -static int cg6_mmap (struct fb_info *,struct vm_area_struct *); -static int cg6_ioctl (struct fb_info *,unsigned int ,unsigned long );static int cg6_pan_display (struct fb_var_screeninfo *,struct fb_info *); +static int cg6_sbusfb_mmap (struct fb_info *info,struct vm_area_struct *vma); +static int cg6_sbusfb_ioctl (struct fb_info *info,unsigned int cmd,unsigned long arg); +/* * Frame buffer operations */ static const struct fb_ops cg6_ops = { .owner =THIS_MODULE , +__FB_DEFAULT_SBUS_OPS_RDWR (cg6), .fb_setcolreg = cg6_setcolreg, .fb_blank = cg6_blank, .fb_pan_display = cg6_pan_display,
@@ -54,11 +56,8 @@ static const struct fb_ops cg6_ops = { .fb_copyarea = cg6_copyarea, .fb_imageblit = cg6_imageblit, .fb_sync = cg6_sync, - .fb_mmap = cg6_mmap, - .fb_ioctl = cg6_ioctl, -#ifdef CONFIG_COMPAT - .fb_compat_ioctl = sbusfb_compat_ioctl, -#endif + __FB_DEFAULT_SBUS_OPS_IOCTL(cg6), + __FB_DEFAULT_SBUS_OPS_MMAP(cg6), };/* Offset of interesting structures in the OBIO space */
@@ -590,7 +589,7 @@ static struct sbus_mmap_map cg6_mmap_map[] = { { .size = 0 } }; -static int cg6_mmap (struct fb_info *info,struct vm_area_struct *vma) +static int cg6_sbusfb_mmap (struct fb_info *info,struct vm_area_struct *vma) {struct cg6_par *par = (struct cg6_par *)info->par;
@@ -599,7 +598,7 @@ static int cg6_mmap(struct fb_info *info, struct vm_area_struct *vma) par->which_io, vma); } -static int cg6_ioctl (struct fb_info *info,unsigned int cmd,unsigned long arg) +static int cg6_sbusfb_ioctl (struct fb_info *info,unsigned int cmd,unsigned long arg) {return sbusfb_ioctl_helper (cmd, arg, info,FBTYPE_SUNFAST_COLOR ,8 , info->fix.smem_len);
Signature · 1 line
2.41.0
PATCH 8/11 fbdev/ffb: Use initializer macro for struct fb_ops
In reply to Thomas ZimmermannInitialize struct fb_ops to the correct default values with the internal __FB_DEFAULT_SBUS_OPS_*() macros. Rename the ioctl and mmap callbacks to use the infix _sbusfb_. This makes them fit the SBUS helpers' naming pattern.
It is not possible to use set all defaults via FB_DEAFULT_SBUS_OPS(), as ffb provides its own implementation of fb_fillrect, fb_copyarea, and fb_imageblit. Hence we also avoid FB_SBUS_HELPERS, but let the driver select its dependencies individually instead.
--- drivers/video/fbdev/ffb.c | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-)
drivers/video/fbdev/ffb.c +8 -9
@@ -37,16 +37,18 @@ static void ffb_imageblit(struct fb_info *, const struct fb_image *);static void ffb_fillrect (struct fb_info *,const struct fb_fillrect *);static void ffb_copyarea (struct fb_info *,const struct fb_copyarea *);static int ffb_sync (struct fb_info *); -static int ffb_mmap (struct fb_info *,struct vm_area_struct *); -static int ffb_ioctl (struct fb_info *,unsigned int ,unsigned long );static int ffb_pan_display (struct fb_var_screeninfo *,struct fb_info *); +static int ffb_sbusfb_mmap (struct fb_info *info,struct vm_area_struct *vma); +static int ffb_sbusfb_ioctl (struct fb_info *info,unsigned int cmd,unsigned long arg); +/* * Frame buffer operations */ static const struct fb_ops ffb_ops = { .owner =THIS_MODULE , +__FB_DEFAULT_SBUS_OPS_RDWR (ffb), .fb_setcolreg = ffb_setcolreg, .fb_blank = ffb_blank, .fb_pan_display = ffb_pan_display,
@@ -54,11 +56,8 @@ static const struct fb_ops ffb_ops = { .fb_copyarea = ffb_copyarea, .fb_imageblit = ffb_imageblit, .fb_sync = ffb_sync, - .fb_mmap = ffb_mmap, - .fb_ioctl = ffb_ioctl, -#ifdef CONFIG_COMPAT - .fb_compat_ioctl = sbusfb_compat_ioctl, -#endif + __FB_DEFAULT_SBUS_OPS_IOCTL(ffb), + __FB_DEFAULT_SBUS_OPS_MMAP(ffb), };/* Register layout and definitions */
@@ -850,7 +849,7 @@ static struct sbus_mmap_map ffb_mmap_map[] = { { .size = 0 } }; -static int ffb_mmap (struct fb_info *info,struct vm_area_struct *vma) +static int ffb_sbusfb_mmap (struct fb_info *info,struct vm_area_struct *vma) {struct ffb_par *par = (struct ffb_par *)info->par;
@@ -859,7 +858,7 @@ static int ffb_mmap(struct fb_info *info, struct vm_area_struct *vma) 0, vma); } -static int ffb_ioctl (struct fb_info *info,unsigned int cmd,unsigned long arg) +static int ffb_sbusfb_ioctl (struct fb_info *info,unsigned int cmd,unsigned long arg) {struct ffb_par *par = (struct ffb_par *)info->par;
Signature · 1 line
2.41.0
PATCH 9/11 fbdev/leo: Use initializer macro for struct fb_ops
In reply to Thomas ZimmermannInitialize struct fb_ops to the correct default values with the macro FB_DEFAULT_SBUS_OPS(). Rename the ioctl and mmap callbacks to use the infix _sbusfb_. This makes them fit the SBUS helpers' naming pattern. Also make the driver depend on FB_SBUS_HELPERS, which selects the correct modules.
--- drivers/video/fbdev/Kconfig | 4 +--- drivers/video/fbdev/leo.c | 19 ++++++------------- 2 files changed, 7 insertions(+), 16 deletions(-)
drivers/video/fbdev/Kconfig +1 -3
@@ -587,9 +587,7 @@ config FB_P9100 config FB_LEO bool "Leo (ZX) support" depends on FB_SBUS - select FB_CFB_FILLRECT - select FB_CFB_COPYAREA - select FB_CFB_IMAGEBLIT + select FB_SBUS_HELPERS help This is the frame buffer device driver for the SBUS-based Sun ZX (leo) frame buffer cards.
drivers/video/fbdev/leo.c +6 -13
@@ -31,28 +31,21 @@static int leo_setcolreg (unsigned ,unsigned ,unsigned ,unsigned ,unsigned ,struct fb_info *);static int leo_blank (int ,struct fb_info *); - -static int leo_mmap (struct fb_info *,struct vm_area_struct *); -static int leo_ioctl (struct fb_info *,unsigned int ,unsigned long );static int leo_pan_display (struct fb_var_screeninfo *,struct fb_info *); +static int leo_sbusfb_mmap (struct fb_info *info,struct vm_area_struct *vma); +static int leo_sbusfb_ioctl (struct fb_info *info,unsigned int cmd,unsigned long arg); +/* * Frame buffer operations */ static const struct fb_ops leo_ops = { .owner =THIS_MODULE , +FB_DEFAULT_SBUS_OPS (leo), .fb_setcolreg = leo_setcolreg, .fb_blank = leo_blank, .fb_pan_display = leo_pan_display, - .fb_fillrect = cfb_fillrect, - .fb_copyarea = cfb_copyarea, - .fb_imageblit = cfb_imageblit, - .fb_mmap = leo_mmap, - .fb_ioctl = leo_ioctl, -#ifdef CONFIG_COMPAT - .fb_compat_ioctl = sbusfb_compat_ioctl, -#endif };#define LEO_OFF_LC_SS0_KRN 0x00200000UL
@@ -414,7 +407,7 @@ static struct sbus_mmap_map leo_mmap_map[] = { { .size = 0 } }; -static int leo_mmap (struct fb_info *info,struct vm_area_struct *vma) +static int leo_sbusfb_mmap (struct fb_info *info,struct vm_area_struct *vma) {struct leo_par *par = (struct leo_par *)info->par;
@@ -423,7 +416,7 @@ static int leo_mmap(struct fb_info *info, struct vm_area_struct *vma) par->which_io, vma); } -static int leo_ioctl (struct fb_info *info,unsigned int cmd,unsigned long arg) +static int leo_sbusfb_ioctl (struct fb_info *info,unsigned int cmd,unsigned long arg) {return sbusfb_ioctl_helper (cmd, arg, info,FBTYPE_SUNLEO ,32 , info->fix.smem_len);
Signature · 1 line
2.41.0
PATCH 10/11 fbdev/p9100: Use initializer macro for struct fb_ops
In reply to Thomas ZimmermannInitialize struct fb_ops to the correct default values with the macro FB_DEFAULT_SBUS_OPS(). Rename the ioctl and mmap callbacks to use the infix _sbusfb_. This makes them fit the SBUS helpers' naming pattern. Also make the driver depend on FB_SBUS_HELPERS, which selects the correct modules.
--- drivers/video/fbdev/Kconfig | 4 +--- drivers/video/fbdev/p9100.c | 18 +++++------------- 2 files changed, 6 insertions(+), 16 deletions(-)
drivers/video/fbdev/Kconfig +1 -3
@@ -577,9 +577,7 @@ config FB_CG14 config FB_P9100 bool "P9100 (Sparcbook 3 only) support" depends on FB_SBUS - select FB_CFB_FILLRECT - select FB_CFB_COPYAREA - select FB_CFB_IMAGEBLIT + select FB_SBUS_HELPERS help This is the frame buffer device driver for the P9100 card supported on Sparcbook 3 machines.
drivers/video/fbdev/p9100.c +5 -13
@@ -31,8 +31,8 @@ static int p9100_setcolreg(unsigned, unsigned, unsigned, unsigned, unsigned, struct fb_info *);static int p9100_blank (int ,struct fb_info *); -static int p9100_mmap (struct fb_info *,struct vm_area_struct *); -static int p9100_ioctl (struct fb_info *,unsigned int ,unsigned long ); +static int p9100_sbusfb_mmap (struct fb_info *info,struct vm_area_struct *vma); +static int p9100_sbusfb_ioctl (struct fb_info *info,unsigned int cmd,unsigned long arg);/* * Frame buffer operations
@@ -40,16 +40,9 @@ static int p9100_ioctl(struct fb_info *, unsigned int, unsigned long);static const struct fb_ops p9100_ops = { .owner =THIS_MODULE , +FB_DEFAULT_SBUS_OPS (p9100), .fb_setcolreg = p9100_setcolreg, .fb_blank = p9100_blank, - .fb_fillrect = cfb_fillrect, - .fb_copyarea = cfb_copyarea, - .fb_imageblit = cfb_imageblit, - .fb_mmap = p9100_mmap, - .fb_ioctl = p9100_ioctl, -#ifdef CONFIG_COMPAT - .fb_compat_ioctl = sbusfb_compat_ioctl, -#endif };/* P9100 control registers */
@@ -218,7 +211,7 @@ static struct sbus_mmap_map p9100_mmap_map[] = { { 0, 0, 0 } }; -static int p9100_mmap (struct fb_info *info,struct vm_area_struct *vma) +static int p9100_sbusfb_mmap (struct fb_info *info,struct vm_area_struct *vma) {struct p9100_par *par = (struct p9100_par *)info->par;
@@ -227,8 +220,7 @@ static int p9100_mmap(struct fb_info *info, struct vm_area_struct *vma) par->which_io, vma); } -static int p9100_ioctl (struct fb_info *info,unsigned int cmd, -unsigned long arg) +static int p9100_sbusfb_ioctl (struct fb_info *info,unsigned int cmd,unsigned long arg) {/* Make it look like a cg3. */ return sbusfb_ioctl_helper(cmd, arg, info,
Signature · 1 line
2.41.0
PATCH 11/11 fbdev/tcx: Use initializer macro for struct fb_ops
In reply to Thomas ZimmermannInitialize struct fb_ops to the correct default values with the macro FB_DEFAULT_SBUS_OPS(). Rename the ioctl and mmap callbacks to use the infix _sbusfb_. This makes them fit the SBUS helpers' naming pattern. Also make the driver depend on FB_SBUS_HELPERS, which selects the correct modules.
--- drivers/video/fbdev/Kconfig | 4 +--- drivers/video/fbdev/tcx.c | 20 ++++++-------------- 2 files changed, 7 insertions(+), 17 deletions(-)
drivers/video/fbdev/Kconfig +1 -3
@@ -559,9 +559,7 @@ config FB_FFB config FB_TCX bool "TCX (SS4/SS5 only) support" depends on FB_SBUS - select FB_CFB_FILLRECT - select FB_CFB_COPYAREA - select FB_CFB_IMAGEBLIT + select FB_SBUS_HELPERS help This is the frame buffer device driver for the TCX 24/8bit frame buffer.
drivers/video/fbdev/tcx.c +6 -14
@@ -32,28 +32,21 @@static int tcx_setcolreg (unsigned ,unsigned ,unsigned ,unsigned ,unsigned ,struct fb_info *);static int tcx_blank (int ,struct fb_info *); - -static int tcx_mmap (struct fb_info *,struct vm_area_struct *); -static int tcx_ioctl (struct fb_info *,unsigned int ,unsigned long );static int tcx_pan_display (struct fb_var_screeninfo *,struct fb_info *); +static int tcx_sbusfb_mmap (struct fb_info *info,struct vm_area_struct *vma); +static int tcx_sbusfb_ioctl (struct fb_info *info,unsigned int cmd,unsigned long arg); +/* * Frame buffer operations */ static const struct fb_ops tcx_ops = { .owner =THIS_MODULE , +FB_DEFAULT_SBUS_OPS (tcx), .fb_setcolreg = tcx_setcolreg, .fb_blank = tcx_blank, .fb_pan_display = tcx_pan_display, - .fb_fillrect = cfb_fillrect, - .fb_copyarea = cfb_copyarea, - .fb_imageblit = cfb_imageblit, - .fb_mmap = tcx_mmap, - .fb_ioctl = tcx_ioctl, -#ifdef CONFIG_COMPAT - .fb_compat_ioctl = sbusfb_compat_ioctl, -#endif };/* THC definitions */
@@ -299,7 +292,7 @@ static struct sbus_mmap_map __tcx_mmap_map[TCX_MMAP_ENTRIES] = { { .size = 0 } }; -static int tcx_mmap (struct fb_info *info,struct vm_area_struct *vma) +static int tcx_sbusfb_mmap (struct fb_info *info,struct vm_area_struct *vma) {struct tcx_par *par = (struct tcx_par *)info->par;
@@ -308,8 +301,7 @@ static int tcx_mmap(struct fb_info *info, struct vm_area_struct *vma) par->which_io, vma); } -static int tcx_ioctl (struct fb_info *info,unsigned int cmd, -unsigned long arg) +static int tcx_sbusfb_ioctl (struct fb_info *info,unsigned int cmd,unsigned long arg) {struct tcx_par *par = (struct tcx_par *) info->par;
Signature · 1 line
2.41.0
Hi Thomas,
Quoted 19 lines · Thomas Zimmermann
Add initializer macros for struct
fb_opsof drivers that operate on SBUS-based framebuffers. Also add aKconfigtoken to select the correct dependencies.All drivers for SBUS-based framebuffers use the regular helpers for framebuffers in I/O memory (fb_io_*() and cfb_*()). Each driver provides its own implementation of mmap and ioctls around common helpers from sbuslib.o. Patches 1 to 3 clean up the code a bit and add a initializer macros that set up struct
fb_opscorrectly.Patches 4 to 11 convert the drivers. Each patch slightly renames the driver's mmap and ioctl functions so that it matches the name pattern of sbuslib.o.
Like the other fbdev initializer macros, the SBUS helpers are easily grep-able. In a later patch, they can be left to empty values if the rsp. functionality, such as file I/O or console, has been disabled.
Quoted 5 lines
There are no functional changes. The helpers set the defaults that the drivers already use. The fb_io_*() functions that the initializer macro sets are the defaults if struct fb_ops.fb_read or .fb_write are NULL. After all drivers have been updated to set them explicitly, the defaults can be dropped and the functions can be made optional.
I have looked thought it all and it looks good. I throw it after my sparc32 build setup - also OK.
cg6 and ffb uses their own imageblit and friends, but this is nicely handled in the patches.
I also like how you managed to handle the compat case.
All are:
Sam
Hi Sam
Am 07.08.23 um 19:11 schrieb Sam Ravnborg:
...
Quoted 1 line
Reviewed-by Sam Ravnborg <[email protected]>
I completely missed your review. Thanks a lot. I've now pushed the patches to drm-misc-next.
Best regards
Thomas
Quoted 2 lines
Sam
Signature · 6 lines
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)