mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Marc Kleine-Budde <mkl@pengutronix.de>
To: sha@pengutronix.de
Cc: barebox@lists.infradead.org
Subject: [PATCH 3/3] nvmem: ocotp: mark data as const
Date: Mon, 12 Feb 2024 14:27:53 +0100	[thread overview]
Message-ID: <20240212132901.1641599-4-mkl@pengutronix.de> (raw)
In-Reply-To: <20240212132901.1641599-1-mkl@pengutronix.de>

Mark values obtained from "priv->data->ctrl" as const.

Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
---
 drivers/nvmem/ocotp.c | 24 ++++++++++++------------
 1 file changed, 12 insertions(+), 12 deletions(-)

diff --git a/drivers/nvmem/ocotp.c b/drivers/nvmem/ocotp.c
index 16d2a6be9fce..c282efefa824 100644
--- a/drivers/nvmem/ocotp.c
+++ b/drivers/nvmem/ocotp.c
@@ -275,11 +275,11 @@ static int imx6_ocotp_prepare(struct ocotp_priv *priv)
 
 static int imx6_fuse_read_addr(struct ocotp_priv *priv, u32 addr, u32 *pdata)
 {
+	const u32 bm_ctrl_error = priv->data->ctrl->bm_error;
+	const u32 bm_ctrl_addr = priv->data->ctrl->bm_addr;
+	const u32 bm_ctrl_wr_unlock = priv->data->ctrl->bm_wr_unlock;
 	u32 ctrl_reg;
 	int ret;
-	u32 bm_ctrl_error = priv->data->ctrl->bm_error;
-	u32 bm_ctrl_addr = priv->data->ctrl->bm_addr;
-	u32 bm_ctrl_wr_unlock = priv->data->ctrl->bm_wr_unlock;
 
 	writel(bm_ctrl_error, priv->base + OCOTP_CTRL_CLR);
 
@@ -304,13 +304,13 @@ static int imx6_fuse_read_addr(struct ocotp_priv *priv, u32 addr, u32 *pdata)
 
 static int imx7_fuse_read_addr(struct ocotp_priv *priv, u32 index, u32 *pdata)
 {
+	const u32 bm_ctrl_error = priv->data->ctrl->bm_error;
+	const u32 bm_ctrl_addr = priv->data->ctrl->bm_addr;
+	const u32 bm_ctrl_wr_unlock = priv->data->ctrl->bm_wr_unlock;
 	u32 ctrl_reg;
 	u32 bank_addr;
 	u16 word;
 	int ret;
-	u32 bm_ctrl_error = priv->data->ctrl->bm_error;
-	u32 bm_ctrl_addr = priv->data->ctrl->bm_addr;
-	u32 bm_ctrl_wr_unlock = priv->data->ctrl->bm_wr_unlock;
 
 	word = index & 0x3;
 	bank_addr = index >> 2;
@@ -391,10 +391,10 @@ static int imx_ocotp_reg_read(void *ctx, unsigned int reg, unsigned int *val)
 
 static void imx_ocotp_clear_unlock(struct ocotp_priv *priv, u32 index)
 {
+	const u32 bm_ctrl_error = priv->data->ctrl->bm_error;
+	const u32 bm_ctrl_addr = priv->data->ctrl->bm_addr;
+	const u32 bm_ctrl_wr_unlock = priv->data->ctrl->bm_wr_unlock;
 	u32 ctrl_reg;
-	u32 bm_ctrl_error = priv->data->ctrl->bm_error;
-	u32 bm_ctrl_addr = priv->data->ctrl->bm_addr;
-	u32 bm_ctrl_wr_unlock = priv->data->ctrl->bm_wr_unlock;
 
 	writel(bm_ctrl_error, priv->base + OCOTP_CTRL_CLR);
 
@@ -408,8 +408,8 @@ static void imx_ocotp_clear_unlock(struct ocotp_priv *priv, u32 index)
 
 static int imx6_fuse_blow_addr(struct ocotp_priv *priv, u32 index, u32 value)
 {
+	const u32 bm_ctrl_error = priv->data->ctrl->bm_error;
 	int ret;
-	u32 bm_ctrl_error = priv->data->ctrl->bm_error;
 
 	imx_ocotp_clear_unlock(priv, index);
 
@@ -474,7 +474,7 @@ static int imx7_fuse_blow_addr(struct ocotp_priv *priv, u32 index, u32 value)
 
 static int imx6_ocotp_reload_shadow(struct ocotp_priv *priv)
 {
-	u32 bm_ctrl_reload_shadows = priv->data->ctrl->bm_reload_shadows;
+	const u32 bm_ctrl_reload_shadows = priv->data->ctrl->bm_reload_shadows;
 
 	dev_info(&priv->dev, "reloading shadow registers...\n");
 	writel(bm_ctrl_reload_shadows, priv->base + OCOTP_CTRL_SET);
@@ -486,8 +486,8 @@ static int imx6_ocotp_reload_shadow(struct ocotp_priv *priv)
 static int imx6_ocotp_blow_one_u32(struct ocotp_priv *priv, u32 index, u32 data,
 			    u32 *pfused_value)
 {
+	const u32 bm_ctrl_error = priv->data->ctrl->bm_error;
 	int ret;
-	u32 bm_ctrl_error = priv->data->ctrl->bm_error;
 
 	ret = imx6_ocotp_prepare(priv);
 	if (ret) {
-- 
2.43.0





  parent reply	other threads:[~2024-02-12 13:29 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-02-12 13:27 [PATCH 0/3] habv4/ocotp: style fixes Marc Kleine-Budde
2024-02-12 13:27 ` [PATCH 1/3] habv4: convert comments to common coding style Marc Kleine-Budde
2024-02-12 13:27 ` [PATCH 2/3] nvmem: ocotp: use tab for indention only Marc Kleine-Budde
2024-02-12 13:27 ` Marc Kleine-Budde [this message]
2024-02-13  9:11 ` [PATCH 0/3] habv4/ocotp: style fixes Sascha Hauer

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=20240212132901.1641599-4-mkl@pengutronix.de \
    --to=mkl@pengutronix.de \
    --cc=barebox@lists.infradead.org \
    --cc=sha@pengutronix.de \
    /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