[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <282a5a3d5d9f143d22cb5ef84fc43891ffdb03e5.1619511801.git.nandor.han@vaisala.com>
Date: Tue, 27 Apr 2021 11:26:33 +0300
From: Nandor Han <nandor.han@...sala.com>
To: srinivas.kandagatla@...aro.org, robh+dt@...nel.org,
linux-kernel@...r.kernel.org, devicetree@...r.kernel.org
Cc: Nandor Han <nandor.han@...sala.com>
Subject: [PATCH 3/4] nvmem: snvs_lpgpr: use cell stride for regmap size calculation
Using a hard-coded value for calculating the number of registers to read
makes future changes more challenging.
Change the calculation to use the NVMEM cell stride instead of a hard
coded value. This will allow specifying different NVMEM cell sizes.
Signed-off-by: Nandor Han <nandor.han@...sala.com>
---
drivers/nvmem/snvs_lpgpr.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/drivers/nvmem/snvs_lpgpr.c b/drivers/nvmem/snvs_lpgpr.c
index 4692aa985bd6..35457421314a 100644
--- a/drivers/nvmem/snvs_lpgpr.c
+++ b/drivers/nvmem/snvs_lpgpr.c
@@ -72,7 +72,7 @@ static int snvs_lpgpr_write(void *context, unsigned int offset, void *val,
return -EPERM;
return regmap_bulk_write(priv->regmap, dcfg->offset + offset, val,
- bytes / 4);
+ bytes / priv->cfg.stride);
}
static int snvs_lpgpr_read(void *context, unsigned int offset, void *val,
@@ -81,8 +81,8 @@ static int snvs_lpgpr_read(void *context, unsigned int offset, void *val,
struct snvs_lpgpr_priv *priv = context;
const struct snvs_lpgpr_cfg *dcfg = priv->dcfg;
- return regmap_bulk_read(priv->regmap, dcfg->offset + offset,
- val, bytes / 4);
+ return regmap_bulk_read(priv->regmap, dcfg->offset + offset, val,
+ bytes / priv->cfg.stride);
}
static int snvs_lpgpr_probe(struct platform_device *pdev)
--
2.26.3
Powered by blists - more mailing lists