From: Fabio Estevam <festevam@gmail.com>
To: hverkuil-cisco@xs4all.nl
Cc: rmfrfs@gmail.com, p.zabel@pengutronix.de, slongerbeam@gmail.com,
linux-media@vger.kernel.org, Fabio Estevam <festevam@gmail.com>
Subject: [PATCH 1/3] media: imx7-media-csi: Use functions instead of macros
Date: Sat, 1 Jun 2019 14:51:38 -0300 [thread overview]
Message-ID: <20190601175140.16305-1-festevam@gmail.com> (raw)
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
next reply other threads:[~2019-06-01 17:51 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-06-01 17:51 Fabio Estevam [this message]
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
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=20190601175140.16305-1-festevam@gmail.com \
--to=festevam@gmail.com \
--cc=hverkuil-cisco@xs4all.nl \
--cc=linux-media@vger.kernel.org \
--cc=p.zabel@pengutronix.de \
--cc=rmfrfs@gmail.com \
--cc=slongerbeam@gmail.com \
/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 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.