From patchwork Sat Apr 13 10:32:49 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Srinivas Kandagatla X-Patchwork-Id: 162155 Delivered-To: patch@linaro.org Received: by 2002:a02:c6d8:0:0:0:0:0 with SMTP id r24csp637341jan; Sat, 13 Apr 2019 03:33:19 -0700 (PDT) X-Google-Smtp-Source: APXvYqynHj+1zV9mjOHb+x4/AarMijseYb8grdr3tk/WCfB3xl2qvbWruOKGs8fKOrkp+XKc2mOp X-Received: by 2002:a63:1654:: with SMTP id 20mr59381573pgw.166.1555151599851; Sat, 13 Apr 2019 03:33:19 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1555151599; cv=none; d=google.com; s=arc-20160816; b=oPz9cguChrzL/x2tld4rRCfRxdru7C43gM/YPeLqeje8EJYxPRNOFufv447u2E0yJ9 zykfxBZd7GJwa6kXlamldUePlV+5p9rojfJUtV7gc36Yfwrpk73MtYPSuc3Ppqw69Yqk mylE+8mjP54aQELpqhv1s04RxH3RD3l6GiVxu2jH7MpBaVWeYoHqmNoAotb442NjX45M pw9uAtohanzkp4KxTQDZrQoOkfcDDIbQM6rsksySOLq2fyd9NkDqg3ofa2k0GAThptQC 79sYG8FI+O5lR8st6OCyKXWnR2H15d9qSo93OR3ODl39OgcPqyYUsuw4gl1AgGv3cfrq beww== 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 :dkim-signature; bh=nNPpw+rYp+nE314xH14BqLfXGNb/4oweWZkI/NC8IjY=; b=k7kuFrHe8APeDDTpTo94zlRS/hc03FT2dHlYNm8r+qavD0ScJJp8/+ekkUUb/EAfdZ Ta6zQLtwNUFV+/0efnrcPIjAOWFQeekA4t33eLvd6EOrFrbTuXGKKT9/RuYbjMr74lyt JiGnnZ1icXte3PALQfWdpJptXTubDwXurQHWF1zwJMqM13MJx2WcseD6CSIC1N3owUZn qp6PQJfMz6KhWzUUi8RVi7nRP/NiSLETnMVeZt7vVFvZ1kDyFft8hY/7ZKrJth46H2ty sOykC+3KAVl7NTGmV2OckdkFT00i6QGr6veZtlCXr82ekX5wpfzf3TQD1UgeJxHrDLpG k6hw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=zpU7S8VU; 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=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id o6si41298622plh.186.2019.04.13.03.33.19; Sat, 13 Apr 2019 03:33:19 -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; dkim=pass header.i=@linaro.org header.s=google header.b=zpU7S8VU; 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=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727159AbfDMKdO (ORCPT + 30 others); Sat, 13 Apr 2019 06:33:14 -0400 Received: from mail-wr1-f65.google.com ([209.85.221.65]:43747 "EHLO mail-wr1-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726973AbfDMKdM (ORCPT ); Sat, 13 Apr 2019 06:33:12 -0400 Received: by mail-wr1-f65.google.com with SMTP id k17so10468244wrx.10 for ; Sat, 13 Apr 2019 03:33:11 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=nNPpw+rYp+nE314xH14BqLfXGNb/4oweWZkI/NC8IjY=; b=zpU7S8VUTR5+V/055bQG1wq6vOiKakxbSFIT5RpW9xJ64Jiy3HansEgBcZAUVJkplR uAzW10x7KClD4jttOOA0yWjMry+WuoUio3C3W01FZZNKQrSvjTc5wj5CxRIwgTKAVlWS I5WueUuKOeapaAxisqg+8yciLWQWeZ7xq/bXA+zDklW7K0XH6f/vJImuQS1/O6PLuKOR VvUcJxQ32HYMqU5kSusPP0lXHQEAKbL4jyYYVNxBDgYR90rNb9zZ7wRLL/bfY0Rop5le OAvh0aeRHT298XF7hj7xOB3O0c4ekxrmCuw1l76SFyNPRJ7ze74rzsgmTOTx8E9EVfA8 ZOCQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=nNPpw+rYp+nE314xH14BqLfXGNb/4oweWZkI/NC8IjY=; b=NOZEE5gsRPREDcqP6vTdq5FVAHY0yQESlXRUvhaP12Iiyn6RLbEq4R4GX7JBr98y5a vjduHnq3TSSOqQ34Wo39o2dZEh92B8lL6aGQJjLVIhyhhEJ9xIT4DGVDiMflCheoo/Zt x9UypZ7cYdGQ+Ltw/EawsADdaebr9B4vDpXmc6kOxR3Hmnzp7b/yK64vdcxpAJNOgaLw Z3COn/6uisabQGZe9BuqOJozorqNpesZe/atMjkT1sK8BCPfM69ThPTPNgaKhXVos9S/ LswsgipcZXISfU21FAA5MO81u74OhzfsHZYtlODzakTBVWY3Q0IX/bt+FUN6hs+nImja hTgQ== X-Gm-Message-State: APjAAAXDZQr54/FNF1a+wYeyRdKnWwBUw9U/Uq0x7f2OmriMco8tsuKW Uhp7p8ZmZ4wZdDM5AgZwa80VWQ== X-Received: by 2002:adf:f98d:: with SMTP id f13mr40243264wrr.98.1555151590781; Sat, 13 Apr 2019 03:33:10 -0700 (PDT) Received: from srini-hackbox.lan (cpc89974-aztw32-2-0-cust43.18-1.cable.virginm.net. [86.30.250.44]) by smtp.gmail.com with ESMTPSA id u17sm19547303wmu.36.2019.04.13.03.33.09 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Sat, 13 Apr 2019 03:33:10 -0700 (PDT) From: Srinivas Kandagatla To: gregkh@linuxfoundation.org Cc: linux-kernel@vger.kernel.org, srinivas.kandagatla@linaro.org Subject: [RESEND PATCH 04/20] nvmem: sunxi_sid: Read out SID for randomness without looping Date: Sat, 13 Apr 2019 11:32:49 +0100 Message-Id: <20190413103305.9576-5-srinivas.kandagatla@linaro.org> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190413103305.9576-1-srinivas.kandagatla@linaro.org> References: <20190413103305.9576-1-srinivas.kandagatla@linaro.org> MIME-Version: 1.0 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 Acked-by: Maxime Ripard Signed-off-by: Srinivas Kandagatla --- drivers/nvmem/sunxi_sid.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) -- 2.21.0 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);