Received: by 2002:ac0:bc90:0:0:0:0:0 with SMTP id a16csp193717img; Mon, 18 Mar 2019 00:36:41 -0700 (PDT) X-Google-Smtp-Source: APXvYqwViqtXdoB/7sGME5qPosk473KAzgiFw1cRH2wKWlQGPuw4sBi9G4sfo1wKgJUF+uwm6utX X-Received: by 2002:a17:902:8c8b:: with SMTP id t11mr18205499plo.148.1552894601782; Mon, 18 Mar 2019 00:36:41 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1552894601; cv=none; d=google.com; s=arc-20160816; b=Qm6izcDPGTT9uUtEJ2u0Pb2r7CJTnJS1exvJyE7G4k1b18u7wfrHuPcmTdoHYy3th6 cX9noDKkAJM66tWYNld7ksXxnsG2gKXkyv3CESsoPsf8J/epmw+Dsjf5OgsZUAiau1i0 tZaeE2yeqN3rZuHGjmrn4fFr3o8vCehAI4PfOuk8C58SWWuE+qUsh/CFP0Llfdu9WWUt hAh83tRm223gERzJHMwhW0ggtIZwSqGB5KHunrALcbKrXzrBGo4GOgu2NyUDeUcBNXMN g8uBPrr2fVkbEGv3kt6igxOZftV7TnBRBVLzrW0h7m3pVySlSHi+ipJoOym6v25hxjHr PotQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=dVU5p3E+23TPuVE3F2K2aS8ySpveu+zZ1esTl+u8WEI=; b=fULJkx0rOCzrCH5MUUClyBX1J8iDtAP1V58JEmgJum2jXyGLQfRptelOZfY0/awWsR MuPFU6fNJQxytF5iCySieRtn1LVChAkc1irugd4oNdpOY2F2mwEy8XPmIAVDLEb6y/5u aY3i1MftZobGCpMXZL2b2Ni2tTameOjVhGyxzvs/vy/X6A1lWFQ+Ijwrk+Q3VfT8dJUm gSJ+vNLWUkJohYEjiOfRAqjw90J3tBEGMy94CsuRmrOsn4KGZf529Tp0l1XQozQxSDSA c5wJh7TDrXQUqAcmaYsoZo3dr+didFRUqdXHTimgoz2QTHml2jilh86sDIk8WfjGUH6v 6YlQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id p17si8515767pgg.259.2019.03.18.00.36.26; Mon, 18 Mar 2019 00:36:41 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727376AbfCRHeP (ORCPT + 99 others); Mon, 18 Mar 2019 03:34:15 -0400 Received: from mirror2.csie.ntu.edu.tw ([140.112.30.76]:40880 "EHLO wens.csie.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726135AbfCRHeO (ORCPT ); Mon, 18 Mar 2019 03:34:14 -0400 Received: by wens.csie.org (Postfix, from userid 1000) id F24A35F9F2; Mon, 18 Mar 2019 15:34:11 +0800 (CST) From: Chen-Yu Tsai To: Srinivas Kandagatla , Maxime Ripard Cc: linux-sunxi@googlegroups.com, Chen-Yu Tsai , linux-arm-kernel@lists.infradead.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH 1/6] nvmem: sunxi_sid: Read out SID for randomness without looping Date: Mon, 18 Mar 2019 15:33:49 +0800 Message-Id: <20190318073354.12151-2-wens@kernel.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190318073354.12151-1-wens@kernel.org> References: <20190318073354.12151-1-wens@kernel.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Chen-Yu Tsai 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 --- 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