From patchwork Sat Nov 11 10:41:53 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dario Binacchi X-Patchwork-Id: 13453049 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 bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 09E0BC4167D for ; Sat, 11 Nov 2023 10:43:17 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-ID:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=290+j3tVNZiTiJ9o79tdliFAWBUJjecWdAwaAbY1C6U=; b=yzCWTa25PMxiow iVwEJgeVqjUaUqxrPpT4peiNdHU0yEg8QbqJdzz4yvztfIivFLDMjZL6CMXelkaS/PQqTtKrf5NRA fmM/OgZufJWKCDNq3q/70jPlDJ8y6y8zY9MJWLpWW/wYddGQ5K4/4vRaZBIqtMkKrIAjio7nmOEsy kKSoEJq6E3LPYMP5KbZ44G9LNOldw2i3TtCBGTwMsUGwNRi77JS2pBFN0MpReiaivPYEMF4YDmBkm 8GJesODLrznyGZ+dyo87bL9Pb97C2KYIRmwwrbsyMp5mGxisnjZr5fqJbRg5cUSoRMImkUJAaoQ39 X4z15WWsLioJFDrMKzww==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1r1lRy-00AMFY-0x; Sat, 11 Nov 2023 10:42:50 +0000 Received: from mail-ej1-x634.google.com ([2a00:1450:4864:20::634]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1r1lRr-00AMAv-22 for linux-arm-kernel@lists.infradead.org; Sat, 11 Nov 2023 10:42:45 +0000 Received: by mail-ej1-x634.google.com with SMTP id a640c23a62f3a-9d216597f64so460521366b.3 for ; Sat, 11 Nov 2023 02:42:43 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amarulasolutions.com; s=google; t=1699699361; x=1700304161; darn=lists.infradead.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=ZuBW6agG70lIoCkGnVCWEFfcl6uwNB9B1+pa2Yxc8Go=; b=Z4I7KAb36S7x4iOlVTtgKvsiBlnW7aJuHVN/QVfybxfwgrwevF/xH+GG6U83+Dx5SW JZV4eCV/BAXj+VJKHJc3eQOPJrEFojEKxY3UskfghVFsC6MOwbTQYTruzNloijlQCGtZ bEhcGqTvjWoRCo2p5lJWInrSZLriE/HWqOEEc= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1699699361; x=1700304161; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=ZuBW6agG70lIoCkGnVCWEFfcl6uwNB9B1+pa2Yxc8Go=; b=JCMboNVDt+RL4Cs38o7F8rvqh8LufNavVm1LfF5ToMKT8KSKLIHRA9eSnXOSP34IvU asEVOFFEOJDqJZO8qonJl2NHZh5qQG+Ubc7HWl8Q3grvc7nGjxDm74D3GM0NN0sUPuyg ixOluIS7PsMrb+Dx9UYNbiBWAYnp0YJ7bxvrlVMnwGbECqW+ffJdPW2W8rrOn2QslpBH KIadrlXyH7dMXgz4EWDoH7lARTaCvCbZlA5RV4LTccnEXNh+gUsilmNCptGdvSXhjgDB IqdVH+9PyAJKUgLatNVvMh08Cs6fofzzIyNzUgTC7cowqZrW315P8gCnu1mgWRGxB4aa 1o9A== X-Gm-Message-State: AOJu0Yws+bTyG0sLhinGSVB2nPBQtkNesdnKbD6BtfyRrOjC4aqSbLzX pRcxfWukrNxD8zQjEIkR1zjKAw== X-Google-Smtp-Source: AGHT+IFbVhFnBfDEfeThETUmx79l/FqCUdUKdBP1kZUSVO8UVeOwurpqW+LCgtJFLlAn08avd0DyXw== X-Received: by 2002:a17:906:3c9:b0:9e6:59d5:7a86 with SMTP id c9-20020a17090603c900b009e659d57a86mr915376eja.57.1699699361285; Sat, 11 Nov 2023 02:42:41 -0800 (PST) Received: from dario-ThinkPad-T14s-Gen-2i.homenet.telecomitalia.it (host-79-20-97-182.retail.telecomitalia.it. [79.20.97.182]) by smtp.gmail.com with ESMTPSA id ga33-20020a1709070c2100b0099e12a49c8fsm872183ejc.173.2023.11.11.02.42.40 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 11 Nov 2023 02:42:41 -0800 (PST) From: Dario Binacchi To: linux-kernel@vger.kernel.org Cc: linux-amarula@amarulasolutions.com, Dario Binacchi , Fabio Estevam , Helge Deller , NXP Linux Team , Pengutronix Kernel Team , Sascha Hauer , Shawn Guo , dri-devel@lists.freedesktop.org, linux-arm-kernel@lists.infradead.org, linux-fbdev@vger.kernel.org Subject: [PATCH 04/10] fbdev: imxfb: replace some magic numbers with constants Date: Sat, 11 Nov 2023 11:41:53 +0100 Message-ID: <20231111104225.136512-5-dario.binacchi@amarulasolutions.com> X-Mailer: git-send-email 2.42.0 In-Reply-To: <20231111104225.136512-1-dario.binacchi@amarulasolutions.com> References: <20231111104225.136512-1-dario.binacchi@amarulasolutions.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20231111_024244_026300_20552530 X-CRM114-Status: GOOD ( 11.63 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org The patch gets rid of magic numbers replacing them with appropriate macros. Signed-off-by: Dario Binacchi --- drivers/video/fbdev/imxfb.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/drivers/video/fbdev/imxfb.c b/drivers/video/fbdev/imxfb.c index b7ef43a7930a..485e57fa9389 100644 --- a/drivers/video/fbdev/imxfb.c +++ b/drivers/video/fbdev/imxfb.c @@ -89,6 +89,7 @@ struct imx_fb_videomode { #define PCR_BPIX_12 4 #define PCR_BPIX_16 5 #define PCR_BPIX_18 6 +#define PCR_PCD_MASK GENMASK(5, 0) #define LCDC_HCR 0x1C #define HCR_H_WIDTH_MASK GENMASK(31, 26) @@ -414,8 +415,8 @@ static int imxfb_check_var(struct fb_var_screeninfo *var, struct fb_info *info) pcr = (unsigned int)tmp; - if (--pcr > 0x3F) { - pcr = 0x3F; + if (--pcr > PCR_PCD_MASK) { + pcr = PCR_PCD_MASK; printk(KERN_WARNING "Must limit pixel clock to %luHz\n", lcd_clk / pcr); } @@ -444,7 +445,7 @@ static int imxfb_check_var(struct fb_var_screeninfo *var, struct fb_info *info) } /* add sync polarities */ - pcr |= imxfb_mode->pcr & ~(0x3f | (7 << 25)); + pcr |= imxfb_mode->pcr & ~(PCR_PCD_MASK | PCR_BPIX_MASK); fbi->pcr = pcr; /*