* [PATCH] video: fbdev: amiga: Simplify amifb_pan_display()
@ 2022-07-11 15:35 Geert Uytterhoeven
2022-07-11 21:20 ` Helge Deller
0 siblings, 1 reply; 2+ messages in thread
From: Geert Uytterhoeven @ 2022-07-11 15:35 UTC (permalink / raw)
To: Helge Deller
Cc: linux-fbdev, dri-devel, linux-m68k, linux-kernel, Geert Uytterhoeven
The fb_pan_display() function in the core already takes care of
validating most panning parameters before calling the driver's
.fb_pan_display() callback, and of updating the panning state
afterwards, so there is no need to repeat that in the driver.
Remove the duplicate code.
Signed-off-by: Geert Uytterhoeven <geert@linux-m68k.org>
---
drivers/video/fbdev/amifb.c | 15 ++-------------
1 file changed, 2 insertions(+), 13 deletions(-)
diff --git a/drivers/video/fbdev/amifb.c b/drivers/video/fbdev/amifb.c
index 6e07a97bbd31a1dd..d88265dbebf4cb19 100644
--- a/drivers/video/fbdev/amifb.c
+++ b/drivers/video/fbdev/amifb.c
@@ -2540,27 +2540,16 @@ static int amifb_blank(int blank, struct fb_info *info)
static int amifb_pan_display(struct fb_var_screeninfo *var,
struct fb_info *info)
{
- if (var->vmode & FB_VMODE_YWRAP) {
- if (var->yoffset < 0 ||
- var->yoffset >= info->var.yres_virtual || var->xoffset)
- return -EINVAL;
- } else {
+ if (!(var->vmode & FB_VMODE_YWRAP)) {
/*
* TODO: There will be problems when xpan!=1, so some columns
* on the right side will never be seen
*/
if (var->xoffset + info->var.xres >
- upx(16 << maxfmode, info->var.xres_virtual) ||
- var->yoffset + info->var.yres > info->var.yres_virtual)
+ upx(16 << maxfmode, info->var.xres_virtual))
return -EINVAL;
}
ami_pan_var(var, info);
- info->var.xoffset = var->xoffset;
- info->var.yoffset = var->yoffset;
- if (var->vmode & FB_VMODE_YWRAP)
- info->var.vmode |= FB_VMODE_YWRAP;
- else
- info->var.vmode &= ~FB_VMODE_YWRAP;
return 0;
}
--
2.25.1
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [PATCH] video: fbdev: amiga: Simplify amifb_pan_display()
2022-07-11 15:35 [PATCH] video: fbdev: amiga: Simplify amifb_pan_display() Geert Uytterhoeven
@ 2022-07-11 21:20 ` Helge Deller
0 siblings, 0 replies; 2+ messages in thread
From: Helge Deller @ 2022-07-11 21:20 UTC (permalink / raw)
To: Geert Uytterhoeven; +Cc: linux-fbdev, dri-devel, linux-m68k, linux-kernel
On 7/11/22 17:35, Geert Uytterhoeven wrote:
> The fb_pan_display() function in the core already takes care of
> validating most panning parameters before calling the driver's
> .fb_pan_display() callback, and of updating the panning state
> afterwards, so there is no need to repeat that in the driver.
>
> Remove the duplicate code.
>
> Signed-off-by: Geert Uytterhoeven <geert@linux-m68k.org>
I've applied this and the other 3 patches to the fbdev git tree.
Thanks!
Helge
> ---
> drivers/video/fbdev/amifb.c | 15 ++-------------
> 1 file changed, 2 insertions(+), 13 deletions(-)
>
> diff --git a/drivers/video/fbdev/amifb.c b/drivers/video/fbdev/amifb.c
> index 6e07a97bbd31a1dd..d88265dbebf4cb19 100644
> --- a/drivers/video/fbdev/amifb.c
> +++ b/drivers/video/fbdev/amifb.c
> @@ -2540,27 +2540,16 @@ static int amifb_blank(int blank, struct fb_info *info)
> static int amifb_pan_display(struct fb_var_screeninfo *var,
> struct fb_info *info)
> {
> - if (var->vmode & FB_VMODE_YWRAP) {
> - if (var->yoffset < 0 ||
> - var->yoffset >= info->var.yres_virtual || var->xoffset)
> - return -EINVAL;
> - } else {
> + if (!(var->vmode & FB_VMODE_YWRAP)) {
> /*
> * TODO: There will be problems when xpan!=1, so some columns
> * on the right side will never be seen
> */
> if (var->xoffset + info->var.xres >
> - upx(16 << maxfmode, info->var.xres_virtual) ||
> - var->yoffset + info->var.yres > info->var.yres_virtual)
> + upx(16 << maxfmode, info->var.xres_virtual))
> return -EINVAL;
> }
> ami_pan_var(var, info);
> - info->var.xoffset = var->xoffset;
> - info->var.yoffset = var->yoffset;
> - if (var->vmode & FB_VMODE_YWRAP)
> - info->var.vmode |= FB_VMODE_YWRAP;
> - else
> - info->var.vmode &= ~FB_VMODE_YWRAP;
> return 0;
> }
>
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2022-07-11 21:21 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-07-11 15:35 [PATCH] video: fbdev: amiga: Simplify amifb_pan_display() Geert Uytterhoeven
2022-07-11 21:20 ` Helge Deller
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®