From patchwork Mon Mar 18 07:33:49 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chen-Yu Tsai X-Patchwork-Id: 10856929 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id E0FCE15AC for ; Mon, 18 Mar 2019 07:34:30 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id B726628D34 for ; Mon, 18 Mar 2019 07:34:30 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id A490728E59; Mon, 18 Mar 2019 07:34:30 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.2 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 33E5828D34 for ; Mon, 18 Mar 2019 07:34:30 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=FaY1b1YtDc2ninZH2Yx0HOJcPnF1DdI9Sx9N5nhNvok=; b=fhcXFjqWoYO6zm BrvoYyvx7tjZwf4xlJBNFHR6zvk+22NvOkCPcuaG5W/VAm5E4gN/QoDjLRLRZmk1LkB21fjItEU7q hJWPRVkHvd5sDByVkw/QtOEH1NcJ3uXHRGgusSB0ZfhYtekYZYZUWihDEIlNS8KW6CtZBqdXZC/E3 VHmb/3NvP7ZUwq4xXALzBkFV5y4u1o+vzoooGyS6eMJ1oRS6Hc02cY+5lVgBor3Hwgojx1ZE1SZaf 78cibODIqBtBjOuaXkP5fge+rn7DBgQb/loR3QTSXiZxteQmyq9hH/9mmXIqkrtGFhWotBYAnqFoT VZJK1nS665fg52yiV0aw==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1h5mmt-0001ze-0y; Mon, 18 Mar 2019 07:34:23 +0000 Received: from mirror2.csie.ntu.edu.tw ([140.112.30.76] helo=wens.csie.org) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1h5mmo-0001wk-QJ for linux-arm-kernel@lists.infradead.org; Mon, 18 Mar 2019 07:34:20 +0000 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 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 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190318_003418_985237_14BF38F8 X-CRM114-Status: GOOD ( 10.85 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: devicetree@vger.kernel.org, linux-sunxi@googlegroups.com, Chen-Yu Tsai , linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP 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);