From: Dario Binacchi <dario.binacchi@amarulasolutions.com>
To: linux-kernel@vger.kernel.org
Cc: linux-amarula@amarulasolutions.com,
Dario Binacchi <dario.binacchi@amarulasolutions.com>,
Fabio Estevam <festevam@gmail.com>, Helge Deller <deller@gmx.de>,
NXP Linux Team <linux-imx@nxp.com>,
Pengutronix Kernel Team <kernel@pengutronix.de>,
Sascha Hauer <s.hauer@pengutronix.de>,
Shawn Guo <shawnguo@kernel.org>,
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 [thread overview]
Message-ID: <20231111104225.136512-5-dario.binacchi@amarulasolutions.com> (raw)
In-Reply-To: <20231111104225.136512-1-dario.binacchi@amarulasolutions.com>
The patch gets rid of magic numbers replacing them with appropriate
macros.
Signed-off-by: Dario Binacchi <dario.binacchi@amarulasolutions.com>
---
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;
/*
--
2.42.0
next prev parent reply other threads:[~2023-11-11 10:43 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-11-11 10:41 [PATCH 00/10] Fix left margin setup and code cleanup Dario Binacchi
2023-11-11 10:41 ` [PATCH 01/10] fbdev: imxfb: fix left margin setting Dario Binacchi
2023-11-11 10:41 ` [PATCH 02/10] fbdev: imxfb: move PCR bitfields near their offset Dario Binacchi
2023-11-11 10:41 ` [PATCH 03/10] fbdev: imxfb: use BIT, FIELD_{GET,PREP} and GENMASK macros Dario Binacchi
2023-11-11 10:41 ` Dario Binacchi [this message]
2023-11-11 10:41 ` [PATCH 05/10] fbdev: imxfb: add missing SPDX tag Dario Binacchi
2023-11-11 10:41 ` [PATCH 06/10] fbdev: imxfb: drop ftrace-like logging Dario Binacchi
2023-11-11 10:41 ` [PATCH 07/10] fbdev: imxfb: add missing spaces after ',' Dario Binacchi
2023-11-11 10:41 ` [PATCH 08/10] fbdev: imxfb: Fix style warnings relating to printk() Dario Binacchi
2023-11-11 10:41 ` [PATCH 09/10] fbdev: imxfb: use __func__ for function name Dario Binacchi
2023-11-11 10:41 ` [PATCH 10/10] fbdev: imxfb: add '*/' on a separate line in block comment Dario Binacchi
2023-11-11 15:50 ` [PATCH 00/10] Fix left margin setup and code cleanup Helge Deller
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20231111104225.136512-5-dario.binacchi@amarulasolutions.com \
--to=dario.binacchi@amarulasolutions.com \
--cc=deller@gmx.de \
--cc=dri-devel@lists.freedesktop.org \
--cc=festevam@gmail.com \
--cc=kernel@pengutronix.de \
--cc=linux-amarula@amarulasolutions.com \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-fbdev@vger.kernel.org \
--cc=linux-imx@nxp.com \
--cc=linux-kernel@vger.kernel.org \
--cc=s.hauer@pengutronix.de \
--cc=shawnguo@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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®