[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20190318073354.12151-2-wens@kernel.org>
Date: Mon, 18 Mar 2019 15:33:49 +0800
From: Chen-Yu Tsai <wens@...nel.org>
To: Srinivas Kandagatla <srinivas.kandagatla@...aro.org>,
Maxime Ripard <maxime.ripard@...tlin.com>
Cc: linux-sunxi@...glegroups.com, Chen-Yu Tsai <wens@...e.org>,
linux-arm-kernel@...ts.infradead.org, devicetree@...r.kernel.org,
linux-kernel@...r.kernel.org
Subject: [PATCH 1/6] nvmem: sunxi_sid: Read out SID for randomness without looping
From: Chen-Yu Tsai <wens@...e.org>
Since the reg_read callbacks already support arbitrary, but 4-byte
aligned. offsets and lengths into the SID, there is no need for another
for loop just to use it to read 1 byte at a time.
Read out the whole SID block in one go.
Signed-off-by: Chen-Yu Tsai <wens@...e.org>
---
drivers/nvmem/sunxi_sid.c | 5 ++---
1 file changed, 2 insertions(+), 3 deletions(-)
diff --git a/drivers/nvmem/sunxi_sid.c b/drivers/nvmem/sunxi_sid.c
index 570a2e354f30..704c35edf796 100644
--- a/drivers/nvmem/sunxi_sid.c
+++ b/drivers/nvmem/sunxi_sid.c
@@ -154,7 +154,7 @@ static int sunxi_sid_probe(struct platform_device *pdev)
struct resource *res;
struct nvmem_device *nvmem;
struct sunxi_sid *sid;
- int i, size;
+ int size;
char *randomness;
const struct sunxi_sid_cfg *cfg;
@@ -189,8 +189,7 @@ static int sunxi_sid_probe(struct platform_device *pdev)
if (!randomness)
return -ENOMEM;
- for (i = 0; i < size; i++)
- econfig.reg_read(sid, i, &randomness[i], 1);
+ econfig.reg_read(sid, 0, randomness, size);
add_device_randomness(randomness, size);
kfree(randomness);
--
2.20.1
Powered by blists - more mailing lists