All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/3] media: imx7-media-csi: Use functions instead of macros
@ 2019-06-01 17:51 Fabio Estevam
  2019-06-01 17:51 ` [PATCH 2/3] media: imx7-media-csi: Use u32 for storing register reads Fabio Estevam
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Fabio Estevam @ 2019-06-01 17:51 UTC (permalink / raw)
  To: hverkuil-cisco; +Cc: rmfrfs, p.zabel, slongerbeam, linux-media, Fabio Estevam

Currently there is a macro for reading and another macro for writing
to the CSI registers.

Functions can do parameter type checking, which leads to a safer code,
so switch from macro to function implementation.

Signed-off-by: Fabio Estevam <festevam@gmail.com>
---
 drivers/staging/media/imx/imx7-media-csi.c | 14 ++++++++++----
 1 file changed, 10 insertions(+), 4 deletions(-)

diff --git a/drivers/staging/media/imx/imx7-media-csi.c b/drivers/staging/media/imx/imx7-media-csi.c
index b1af8694899e..8abdf253696d 100644
--- a/drivers/staging/media/imx/imx7-media-csi.c
+++ b/drivers/staging/media/imx/imx7-media-csi.c
@@ -195,10 +195,16 @@ struct imx7_csi {
 	struct completion last_eof_completion;
 };
 
-#define imx7_csi_reg_read(_csi, _offset) \
-	__raw_readl((_csi)->regbase + (_offset))
-#define imx7_csi_reg_write(_csi, _val, _offset) \
-	__raw_writel(_val, (_csi)->regbase + (_offset))
+static u32 imx7_csi_reg_read(struct imx7_csi *csi, unsigned int offset)
+{
+	return readl(csi->regbase + offset);
+}
+
+static void imx7_csi_reg_write(struct imx7_csi *csi, unsigned int value,
+			       unsigned int offset)
+{
+	writel(value, csi->regbase + offset);
+}
 
 static void imx7_csi_hw_reset(struct imx7_csi *csi)
 {
-- 
2.17.1


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

end of thread, other threads:[~2019-06-03 17:48 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-06-01 17:51 [PATCH 1/3] media: imx7-media-csi: Use functions instead of macros Fabio Estevam
2019-06-01 17:51 ` [PATCH 2/3] media: imx7-media-csi: Use u32 for storing register reads Fabio Estevam
2019-06-01 17:51 ` [PATCH 3/3] media: imx7-media-csi: Remove unneeded error message Fabio Estevam
2019-06-03 17:48 ` [PATCH 1/3] media: imx7-media-csi: Use functions instead of macros Rui Miguel Silva

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.