All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] media: ti-vpe: cal: Fix compilation on 32-bit ARM
@ 2020-08-23  5:02 Laurent Pinchart
  2020-08-24  9:23 ` Sakari Ailus
  0 siblings, 1 reply; 6+ messages in thread
From: Laurent Pinchart @ 2020-08-23  5:02 UTC (permalink / raw)
  To: linux-media; +Cc: Tomi Valkeinen, Benoit Parrot

When compiled on 32-bit ARM, the CAL driver fails with the FIELD_PREP()
macro complaining that the mask is not constant. While all callers of
the inline cal_write_field() function pass a constant mask, the mask
parameter itself is a variable, which likely doesn't please the
compiler.

Fix it by replacing FIELD_PREP() with a manual implementation.

Fixes: 50797fb30b95 ("media: ti-vpe: cal: Turn reg_(read|write)_field() into inline functions")
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
---
 drivers/media/platform/ti-vpe/cal.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/media/platform/ti-vpe/cal.h b/drivers/media/platform/ti-vpe/cal.h
index e496083715d2..4123405ee0cf 100644
--- a/drivers/media/platform/ti-vpe/cal.h
+++ b/drivers/media/platform/ti-vpe/cal.h
@@ -226,7 +226,7 @@ static inline void cal_write_field(struct cal_dev *cal, u32 offset, u32 value,
 	u32 val = cal_read(cal, offset);
 
 	val &= ~mask;
-	val |= FIELD_PREP(mask, value);
+	val |= (value << __ffs(mask)) & mask;
 	cal_write(cal, offset, val);
 }
 
-- 
Regards,

Laurent Pinchart


^ permalink raw reply related	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2020-08-25 12:52 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-08-23  5:02 [PATCH] media: ti-vpe: cal: Fix compilation on 32-bit ARM Laurent Pinchart
2020-08-24  9:23 ` Sakari Ailus
2020-08-24 10:54   ` Laurent Pinchart
2020-08-25 12:11     ` Tomi Valkeinen
2020-08-25 12:19       ` Laurent Pinchart
2020-08-25 12:51         ` Tomi Valkeinen

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.