Commit 9c4adfb5 authored by Chen-Yu Tsai's avatar Chen-Yu Tsai Committed by Greg Kroah-Hartman

nvmem: sunxi_sid: Read out SID for randomness without looping

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: default avatarChen-Yu Tsai <wens@csie.org>
Acked-by: default avatarMaxime Ripard <maxime.ripard@bootlin.com>
Signed-off-by: default avatarSrinivas Kandagatla <srinivas.kandagatla@linaro.org>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent dd4c1047
...@@ -154,7 +154,7 @@ static int sunxi_sid_probe(struct platform_device *pdev) ...@@ -154,7 +154,7 @@ static int sunxi_sid_probe(struct platform_device *pdev)
struct resource *res; struct resource *res;
struct nvmem_device *nvmem; struct nvmem_device *nvmem;
struct sunxi_sid *sid; struct sunxi_sid *sid;
int i, size; int size;
char *randomness; char *randomness;
const struct sunxi_sid_cfg *cfg; const struct sunxi_sid_cfg *cfg;
...@@ -189,8 +189,7 @@ static int sunxi_sid_probe(struct platform_device *pdev) ...@@ -189,8 +189,7 @@ static int sunxi_sid_probe(struct platform_device *pdev)
if (!randomness) if (!randomness)
return -ENOMEM; return -ENOMEM;
for (i = 0; i < size; i++) econfig.reg_read(sid, 0, randomness, size);
econfig.reg_read(sid, i, &randomness[i], 1);
add_device_randomness(randomness, size); add_device_randomness(randomness, size);
kfree(randomness); kfree(randomness);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment