devicetree.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Chen-Yu Tsai <wens-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>
To: Srinivas Kandagatla
	<srinivas.kandagatla-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>,
	Maxime Ripard
	<maxime.ripard-LDxbnhwyfcJBDgjK7y7TUQ@public.gmane.org>
Cc: linux-sunxi-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org,
	Chen-Yu Tsai <wens-jdAy2FN1RRM@public.gmane.org>,
	linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org,
	devicetree-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
Subject: [PATCH 1/6] nvmem: sunxi_sid: Read out SID for randomness without looping
Date: Mon, 18 Mar 2019 15:33:49 +0800	[thread overview]
Message-ID: <20190318073354.12151-2-wens@kernel.org> (raw)
In-Reply-To: <20190318073354.12151-1-wens-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>

From: Chen-Yu Tsai <wens-jdAy2FN1RRM@public.gmane.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-jdAy2FN1RRM@public.gmane.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

  parent reply	other threads:[~2019-03-18  7:33 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-03-18  7:33 [PATCH 0/6] nvmem: sunxi_sid: native format and A83T/H5 support Chen-Yu Tsai
     [not found] ` <20190318073354.12151-1-wens-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>
2019-03-18  7:33   ` Chen-Yu Tsai [this message]
2019-03-18  7:33   ` [PATCH 2/6] nvmem: sunxi_sid: Optimize register read-out method Chen-Yu Tsai
2019-03-18  7:33   ` [PATCH 3/6] nvmem: sunxi_sid: Dynamically allocate nvmem_config structure Chen-Yu Tsai
2019-03-18  7:33   ` [PATCH 4/6] nvmem: sunxi_sid: Read out data in native format Chen-Yu Tsai
     [not found]     ` <20190318073354.12151-5-wens-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>
2019-03-18  8:42       ` Maxime Ripard
2019-03-18  8:45         ` Chen-Yu Tsai
     [not found]           ` <CAGb2v67H9FkjKjSE5a7fUCb_t95Zfuk1p0bjWYJxjMqhMN-hfg-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2019-03-18  8:57             ` Maxime Ripard
2019-03-18  9:09               ` Chen-Yu Tsai
     [not found]                 ` <CAGb2v64pq5V0_nZ7f0ZPwuNxNU8HbY0A6CqeC6TMd2z2xhJHwg-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2019-03-18  9:25                   ` Maxime Ripard
2019-03-18  7:33   ` [PATCH 6/6] ARM: dts: sunxi: h3/h5: Add device node for SID Chen-Yu Tsai
2019-03-19  1:55     ` [linux-sunxi] " Samuel Holland
     [not found]       ` <8e9ef57f-1d24-b151-f8a4-812b7bb65388-RkNLwX/CsU9g9hUCZPvPmw@public.gmane.org>
2019-03-19  3:17         ` Chen-Yu Tsai
2019-03-18  7:33 ` [PATCH 5/6] nvmem: sunxi_sid: Support SID on A83T and H5 Chen-Yu Tsai
2019-03-20 14:25 ` [PATCH 0/6] nvmem: sunxi_sid: native format and A83T/H5 support Srinivas Kandagatla
2019-03-21  9:06   ` Chen-Yu Tsai

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=20190318073354.12151-2-wens@kernel.org \
    --to=wens-dgejt+ai2ygdnm+yrofe0a@public.gmane.org \
    --cc=devicetree-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org \
    --cc=linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=linux-sunxi-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org \
    --cc=maxime.ripard-LDxbnhwyfcJBDgjK7y7TUQ@public.gmane.org \
    --cc=srinivas.kandagatla-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org \
    --cc=wens-jdAy2FN1RRM@public.gmane.org \
    /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;
as well as URLs for NNTP newsgroup(s).