From patchwork Mon Jul 11 15:35:48 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Geert Uytterhoeven X-Patchwork-Id: 589581 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 287E1CCA47B for ; Mon, 11 Jul 2022 15:35:58 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229685AbiGKPf5 (ORCPT ); Mon, 11 Jul 2022 11:35:57 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59396 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229633AbiGKPf4 (ORCPT ); Mon, 11 Jul 2022 11:35:56 -0400 Received: from laurent.telenet-ops.be (laurent.telenet-ops.be [IPv6:2a02:1800:110:4::f00:19]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6C31861D91 for ; Mon, 11 Jul 2022 08:35:55 -0700 (PDT) Received: from ramsan.of.borg ([84.195.186.194]) by laurent.telenet-ops.be with bizsmtp id trbs2700b4C55Sk01rbsZy; Mon, 11 Jul 2022 17:35:53 +0200 Received: from rox.of.borg ([192.168.97.57]) by ramsan.of.borg with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.93) (envelope-from ) id 1oAvRw-0036pt-Ek; Mon, 11 Jul 2022 17:35:52 +0200 Received: from geert by rox.of.borg with local (Exim 4.93) (envelope-from ) id 1oAvRv-006sIs-K9; Mon, 11 Jul 2022 17:35:51 +0200 From: Geert Uytterhoeven To: Helge Deller Cc: linux-fbdev@vger.kernel.org, dri-devel@lists.freedesktop.org, linux-m68k@vger.kernel.org, linux-kernel@vger.kernel.org, Geert Uytterhoeven Subject: [PATCH] video: fbdev: amiga: Simplify amifb_pan_display() Date: Mon, 11 Jul 2022 17:35:48 +0200 Message-Id: X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-fbdev@vger.kernel.org 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 --- 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; }