diff mbox series

[20/32] media/ivtvfb: Initialize fb_ops to fbdev I/O-memory helpers

Message ID 20231115102954.7102-21-tzimmermann@suse.de (mailing list archive)
State Handled Elsewhere
Headers show
Series fbdev: Modularize helpers for struct fb_ops | expand

Commit Message

Thomas Zimmermann Nov. 15, 2023, 10:19 a.m. UTC
Initialize the instance of struct fb_ops with fbdev initializer
macros for framebuffers in I/O address space. This explictily sets
the read/write, draw and mmap callbacks to the correct default
implementation.

Fbdev drivers sometimes rely on the callbacks being NULL for a
default implementation to be invoked; hence requireing 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.

Set the callbacks via macros. No functional changes.

Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
Cc: Andy Walls <awalls@md.metrocast.net>
Cc: Mauro Carvalho Chehab <mchehab@kernel.org>
Cc: linux-media@vger.kernel.org
---
 drivers/media/pci/ivtv/Kconfig  | 4 +---
 drivers/media/pci/ivtv/ivtvfb.c | 6 +++---
 2 files changed, 4 insertions(+), 6 deletions(-)

Comments

Javier Martinez Canillas Nov. 16, 2023, 11:26 a.m. UTC | #1
Thomas Zimmermann <tzimmermann@suse.de> writes:

> Initialize the instance of struct fb_ops with fbdev initializer
> macros for framebuffers in I/O address space. This explictily sets
> the read/write, draw and mmap callbacks to the correct default
> implementation.
>
> Fbdev drivers sometimes rely on the callbacks being NULL for a
> default implementation to be invoked; hence requireing 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.
>
> Set the callbacks via macros. No functional changes.
>
> Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
> Cc: Andy Walls <awalls@md.metrocast.net>
> Cc: Mauro Carvalho Chehab <mchehab@kernel.org>
> Cc: linux-media@vger.kernel.org
> ---

Reviewed-by: Javier Martinez Canillas <javierm@redhat.com>
Hans Verkuil Nov. 20, 2023, 8:52 a.m. UTC | #2
Hi Thomas,

On 15/11/2023 11:19, Thomas Zimmermann wrote:
> Initialize the instance of struct fb_ops with fbdev initializer
> macros for framebuffers in I/O address space. This explictily sets
> the read/write, draw and mmap callbacks to the correct default
> implementation.
> 
> Fbdev drivers sometimes rely on the callbacks being NULL for a
> default implementation to be invoked; hence requireing 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.
> 
> Set the callbacks via macros. No functional changes.

Makes sense, shall I pick up this patch?

If you prefer to take it, then you can add:

Reviewed-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>

Regards,

	Hans

> 
> Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
> Cc: Andy Walls <awalls@md.metrocast.net>
> Cc: Mauro Carvalho Chehab <mchehab@kernel.org>
> Cc: linux-media@vger.kernel.org
> ---
>  drivers/media/pci/ivtv/Kconfig  | 4 +---
>  drivers/media/pci/ivtv/ivtvfb.c | 6 +++---
>  2 files changed, 4 insertions(+), 6 deletions(-)
> 
> diff --git a/drivers/media/pci/ivtv/Kconfig b/drivers/media/pci/ivtv/Kconfig
> index 9be52101bc4f2..2498f9079b756 100644
> --- a/drivers/media/pci/ivtv/Kconfig
> +++ b/drivers/media/pci/ivtv/Kconfig
> @@ -48,9 +48,7 @@ config VIDEO_IVTV_ALSA
>  config VIDEO_FB_IVTV
>  	tristate "Conexant cx23415 framebuffer support"
>  	depends on VIDEO_IVTV && FB
> -	select FB_CFB_FILLRECT
> -	select FB_CFB_COPYAREA
> -	select FB_CFB_IMAGEBLIT
> +	select FB_IOMEM_HELPERS
>  	help
>  	  This is a framebuffer driver for the Conexant cx23415 MPEG
>  	  encoder/decoder.
> diff --git a/drivers/media/pci/ivtv/ivtvfb.c b/drivers/media/pci/ivtv/ivtvfb.c
> index 23c8c094e791b..410477e3e6216 100644
> --- a/drivers/media/pci/ivtv/ivtvfb.c
> +++ b/drivers/media/pci/ivtv/ivtvfb.c
> @@ -927,17 +927,17 @@ static int ivtvfb_blank(int blank_mode, struct fb_info *info)
>  
>  static const struct fb_ops ivtvfb_ops = {
>  	.owner = THIS_MODULE,
> +	.fb_read        = fb_io_read,
>  	.fb_write       = ivtvfb_write,
>  	.fb_check_var   = ivtvfb_check_var,
>  	.fb_set_par     = ivtvfb_set_par,
>  	.fb_setcolreg   = ivtvfb_setcolreg,
> -	.fb_fillrect    = cfb_fillrect,
> -	.fb_copyarea    = cfb_copyarea,
> -	.fb_imageblit   = cfb_imageblit,
> +	__FB_DEFAULT_IOMEM_OPS_DRAW,
>  	.fb_cursor      = NULL,
>  	.fb_ioctl       = ivtvfb_ioctl,
>  	.fb_pan_display = ivtvfb_pan_display,
>  	.fb_blank       = ivtvfb_blank,
> +	__FB_DEFAULT_IOMEM_OPS_MMAP,
>  };
>  
>  /* Restore hardware after firmware restart */
Thomas Zimmermann Nov. 20, 2023, 11:29 a.m. UTC | #3
Hi

Am 20.11.23 um 09:52 schrieb Hans Verkuil:
> Hi Thomas,
> 
> On 15/11/2023 11:19, Thomas Zimmermann wrote:
>> Initialize the instance of struct fb_ops with fbdev initializer
>> macros for framebuffers in I/O address space. This explictily sets
>> the read/write, draw and mmap callbacks to the correct default
>> implementation.
>>
>> Fbdev drivers sometimes rely on the callbacks being NULL for a
>> default implementation to be invoked; hence requireing 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.
>>
>> Set the callbacks via macros. No functional changes.
> 
> Makes sense, shall I pick up this patch?
> 
> If you prefer to take it, then you can add:
> 
> Reviewed-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>

Thanks. The series' final patches depend on this one. I'd preferably 
merge it at once through drm-misc.

Best regards
Thomas

> 
> Regards,
> 
> 	Hans
> 
>>
>> Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
>> Cc: Andy Walls <awalls@md.metrocast.net>
>> Cc: Mauro Carvalho Chehab <mchehab@kernel.org>
>> Cc: linux-media@vger.kernel.org
>> ---
>>   drivers/media/pci/ivtv/Kconfig  | 4 +---
>>   drivers/media/pci/ivtv/ivtvfb.c | 6 +++---
>>   2 files changed, 4 insertions(+), 6 deletions(-)
>>
>> diff --git a/drivers/media/pci/ivtv/Kconfig b/drivers/media/pci/ivtv/Kconfig
>> index 9be52101bc4f2..2498f9079b756 100644
>> --- a/drivers/media/pci/ivtv/Kconfig
>> +++ b/drivers/media/pci/ivtv/Kconfig
>> @@ -48,9 +48,7 @@ config VIDEO_IVTV_ALSA
>>   config VIDEO_FB_IVTV
>>   	tristate "Conexant cx23415 framebuffer support"
>>   	depends on VIDEO_IVTV && FB
>> -	select FB_CFB_FILLRECT
>> -	select FB_CFB_COPYAREA
>> -	select FB_CFB_IMAGEBLIT
>> +	select FB_IOMEM_HELPERS
>>   	help
>>   	  This is a framebuffer driver for the Conexant cx23415 MPEG
>>   	  encoder/decoder.
>> diff --git a/drivers/media/pci/ivtv/ivtvfb.c b/drivers/media/pci/ivtv/ivtvfb.c
>> index 23c8c094e791b..410477e3e6216 100644
>> --- a/drivers/media/pci/ivtv/ivtvfb.c
>> +++ b/drivers/media/pci/ivtv/ivtvfb.c
>> @@ -927,17 +927,17 @@ static int ivtvfb_blank(int blank_mode, struct fb_info *info)
>>   
>>   static const struct fb_ops ivtvfb_ops = {
>>   	.owner = THIS_MODULE,
>> +	.fb_read        = fb_io_read,
>>   	.fb_write       = ivtvfb_write,
>>   	.fb_check_var   = ivtvfb_check_var,
>>   	.fb_set_par     = ivtvfb_set_par,
>>   	.fb_setcolreg   = ivtvfb_setcolreg,
>> -	.fb_fillrect    = cfb_fillrect,
>> -	.fb_copyarea    = cfb_copyarea,
>> -	.fb_imageblit   = cfb_imageblit,
>> +	__FB_DEFAULT_IOMEM_OPS_DRAW,
>>   	.fb_cursor      = NULL,
>>   	.fb_ioctl       = ivtvfb_ioctl,
>>   	.fb_pan_display = ivtvfb_pan_display,
>>   	.fb_blank       = ivtvfb_blank,
>> +	__FB_DEFAULT_IOMEM_OPS_MMAP,
>>   };
>>   
>>   /* Restore hardware after firmware restart */
>
diff mbox series

Patch

diff --git a/drivers/media/pci/ivtv/Kconfig b/drivers/media/pci/ivtv/Kconfig
index 9be52101bc4f2..2498f9079b756 100644
--- a/drivers/media/pci/ivtv/Kconfig
+++ b/drivers/media/pci/ivtv/Kconfig
@@ -48,9 +48,7 @@  config VIDEO_IVTV_ALSA
 config VIDEO_FB_IVTV
 	tristate "Conexant cx23415 framebuffer support"
 	depends on VIDEO_IVTV && FB
-	select FB_CFB_FILLRECT
-	select FB_CFB_COPYAREA
-	select FB_CFB_IMAGEBLIT
+	select FB_IOMEM_HELPERS
 	help
 	  This is a framebuffer driver for the Conexant cx23415 MPEG
 	  encoder/decoder.
diff --git a/drivers/media/pci/ivtv/ivtvfb.c b/drivers/media/pci/ivtv/ivtvfb.c
index 23c8c094e791b..410477e3e6216 100644
--- a/drivers/media/pci/ivtv/ivtvfb.c
+++ b/drivers/media/pci/ivtv/ivtvfb.c
@@ -927,17 +927,17 @@  static int ivtvfb_blank(int blank_mode, struct fb_info *info)
 
 static const struct fb_ops ivtvfb_ops = {
 	.owner = THIS_MODULE,
+	.fb_read        = fb_io_read,
 	.fb_write       = ivtvfb_write,
 	.fb_check_var   = ivtvfb_check_var,
 	.fb_set_par     = ivtvfb_set_par,
 	.fb_setcolreg   = ivtvfb_setcolreg,
-	.fb_fillrect    = cfb_fillrect,
-	.fb_copyarea    = cfb_copyarea,
-	.fb_imageblit   = cfb_imageblit,
+	__FB_DEFAULT_IOMEM_OPS_DRAW,
 	.fb_cursor      = NULL,
 	.fb_ioctl       = ivtvfb_ioctl,
 	.fb_pan_display = ivtvfb_pan_display,
 	.fb_blank       = ivtvfb_blank,
+	__FB_DEFAULT_IOMEM_OPS_MMAP,
 };
 
 /* Restore hardware after firmware restart */