[PATCH 02/14] drm/tidss: dispc: Switch to GENMASK instead of FLD_MASK
Maxime Ripard
mripard at kernel.org
Wed Jul 30 08:57:02 UTC 2025
The dispc FLD_MASK function is an exact equivalent of the GENMASK macro.
Let's convert the dispc driver to the latter.
Signed-off-by: Maxime Ripard <mripard at kernel.org>
---
drivers/gpu/drm/tidss/tidss_dispc.c | 11 +++--------
1 file changed, 3 insertions(+), 8 deletions(-)
diff --git a/drivers/gpu/drm/tidss/tidss_dispc.c b/drivers/gpu/drm/tidss/tidss_dispc.c
index 8ec06412cffa71512cead9725bb43440258eb1ec..5a0904acbed279506df2edad559dfe06f25cd7b5 100644
--- a/drivers/gpu/drm/tidss/tidss_dispc.c
+++ b/drivers/gpu/drm/tidss/tidss_dispc.c
@@ -607,28 +607,23 @@ void tidss_disable_oldi(struct tidss_device *tidss, u32 hw_videoport)
/*
* TRM gives bitfields as start:end, where start is the higher bit
* number. For example 7:0
*/
-static u32 FLD_MASK(u32 start, u32 end)
-{
- return ((1 << (start - end + 1)) - 1) << end;
-}
-
static u32 FLD_VAL(u32 val, u32 start, u32 end)
{
- return (val << end) & FLD_MASK(start, end);
+ return (val << end) & GENMASK(start, end);
}
static u32 FLD_GET(u32 val, u32 start, u32 end)
{
- return (val & FLD_MASK(start, end)) >> end;
+ return (val & GENMASK(start, end)) >> end;
}
static u32 FLD_MOD(u32 orig, u32 val, u32 start, u32 end)
{
- return (orig & ~FLD_MASK(start, end)) | FLD_VAL(val, start, end);
+ return (orig & ~GENMASK(start, end)) | FLD_VAL(val, start, end);
}
static u32 REG_GET(struct dispc_device *dispc, u32 idx, u32 start, u32 end)
{
return FLD_GET(dispc_read(dispc, idx), start, end);
--
2.50.1
More information about the dri-devel
mailing list