diff options
author | Chen-Yu Tsai <wens@csie.org> | 2019-04-13 06:32:49 -0400 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2019-04-25 13:43:11 -0400 |
commit | 9c4adfb5dc1326f94d3e212a8b5dfb238839b9ae (patch) | |
tree | c3070ab54583aa7ea61c366800c926604a4a8a66 /drivers/nvmem | |
parent | dd4c1047b1d6e05f28a1318aa1c4df627f2e91d4 (diff) |
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: Chen-Yu Tsai <wens@csie.org>
Acked-by: Maxime Ripard <maxime.ripard@bootlin.com>
Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/nvmem')
-rw-r--r-- | drivers/nvmem/sunxi_sid.c | 5 |
1 files 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) | |||
154 | struct resource *res; | 154 | struct resource *res; |
155 | struct nvmem_device *nvmem; | 155 | struct nvmem_device *nvmem; |
156 | struct sunxi_sid *sid; | 156 | struct sunxi_sid *sid; |
157 | int i, size; | 157 | int size; |
158 | char *randomness; | 158 | char *randomness; |
159 | const struct sunxi_sid_cfg *cfg; | 159 | const struct sunxi_sid_cfg *cfg; |
160 | 160 | ||
@@ -189,8 +189,7 @@ static int sunxi_sid_probe(struct platform_device *pdev) | |||
189 | if (!randomness) | 189 | if (!randomness) |
190 | return -ENOMEM; | 190 | return -ENOMEM; |
191 | 191 | ||
192 | for (i = 0; i < size; i++) | 192 | econfig.reg_read(sid, 0, randomness, size); |
193 | econfig.reg_read(sid, i, &randomness[i], 1); | ||
194 | 193 | ||
195 | add_device_randomness(randomness, size); | 194 | add_device_randomness(randomness, size); |
196 | kfree(randomness); | 195 | kfree(randomness); |