Received: by 2002:ac0:946b:0:0:0:0:0 with SMTP id j40csp3268519imj; Mon, 11 Feb 2019 17:30:26 -0800 (PST) X-Google-Smtp-Source: AHgI3IZOK9BCjM7irqJVB3t6SqZxog6Z3Lm6jH4jJHFUAHnk7xKpPpnPm9imKhJ8BysmF86FV9sw X-Received: by 2002:a17:902:be10:: with SMTP id r16mr1333637pls.304.1549935026690; Mon, 11 Feb 2019 17:30:26 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1549935026; cv=none; d=google.com; s=arc-20160816; b=iy6vmUKlJ9gfbh6ySrdZPZaJAAthPQZfd96HJd0Q2Kw5RN80zp4GT31vGd8j1D8kYt E0v88/qaBP+WFAX3axF8Si+k0lG4a/huyTVUwyrdiPxD5vEYRWKSnHoeqyVUul1O5SEB 8b6pL+k4+iAdIyt/8e7O0rhsPZXkdwtvaRs7hDKYrSBEYxNjuIZXIRi/Dqvlza7gc9Al Th+wD1uw+P+D3qmcrSvMJESnw68DoyEZC+5KzgbuNAgzTsJqSzs8k4PZ/4Ehl0YWcz99 zd7nSvMQSCiHe2fanM2A3OuhRm3ddsO2RUEb6mnePs9XnLidm9Y2gJcy/BP/5l08X1g8 NwAQ== 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=iDKhzuYj+a3oz8dDa1jA+k2u2PxNm8eiTNka/uah3w0=; b=GlonPfcpHP5Y8lhzWbOrEZ711MQ2HZXKVOJaSNhZsLmAR7Pd5GPOgilZ3shjZfBkKF TsHjaopHMyJbdCkHwc3QGsm9dfiKOs9HlCCrhvpe/h5NHg2snkW1N5SBlVscrG09KaDO xi3Bf8yvge5Oabr5sDRhU5IPQBMoNaw2FOcLyQIS9y/UbMumPzdXVh9OJJK+x+4AasFE voTfU8LIvS/laUYtP7EL1cZMSR3wAsbI7zqXyWXpg0PRQpW249WKp7f7h/T/5JjwSmzg IbK8B816up36KHzfwBmE0mlCzMfve5eMs0Jd50mELmvderE2Hz62XdLnGAx4uM42dN/D RC1g== 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id a2si7082395pgc.449.2019.02.11.17.30.10; Mon, 11 Feb 2019 17:30:26 -0800 (PST) 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727036AbfBLB35 (ORCPT + 99 others); Mon, 11 Feb 2019 20:29:57 -0500 Received: from smtp-out-so.shaw.ca ([64.59.136.138]:38712 "EHLO smtp-out-so.shaw.ca" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726253AbfBLB35 (ORCPT ); Mon, 11 Feb 2019 20:29:57 -0500 X-Greylist: delayed 300 seconds by postgrey-1.27 at vger.kernel.org; Mon, 11 Feb 2019 20:29:57 EST Received: from tethys.mmayer.net ([70.68.144.247]) by shaw.ca with ESMTP id tMoxg0aBZnBo4tMoygxuBp; Mon, 11 Feb 2019 18:25:12 -0700 X-Authority-Analysis: v=2.3 cv=J8fUEzvS c=1 sm=1 tr=0 a=5Vvn7CJLxh9yo+qVPaC6cg==:117 a=5Vvn7CJLxh9yo+qVPaC6cg==:17 a=CFTnQlWoA9kA:10 a=Q-fNiiVtAAAA:8 a=8SHd0I_PIW9-B648SIoA:9 a=Fp8MccfUoT0GBdDC_Lng:22 Received: by tethys.mmayer.net (Postfix, from userid 501) id 2DE26300BE54AB; Mon, 11 Feb 2019 17:25:11 -0800 (PST) From: Markus Mayer To: Brian Norris , Florian Fainelli , Gregory Fong Cc: Markus Mayer , Broadcom Kernel List , ARM Kernel List , Linux Kernel Mailing List Subject: [PATCH 2/3] soc: brcmstb: dpfe: optimize generic_show() Date: Mon, 11 Feb 2019 17:24:42 -0800 Message-Id: <20190212012443.21819-3-code@mmayer.net> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190212012443.21819-1-code@mmayer.net> References: <20190212012443.21819-1-code@mmayer.net> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-CMAE-Envelope: MS4wfOAYmQTxl3zMxNymv1fRFLjaANYo3+g7uICio1b4AKt7wwmuZiPN320uU7dPNl+BeiTaMlVukvpKiGuu1e1lOdVt5wSCZ4muuRRGgM3KgU86I3m0bY5B 0lDLcT0ynboThqE3g860/diULKc4Vav3H+5KkvAE/IXo3sIBheFJBfS9Pk+kILsij0TwyaCQjgd81WgEYInxSMloswUoPP/kV1wWQQzPpuw+v3SpavEQ85Hg qmIpBLS7j1Pc9UoLTvIvcWNEUatnouGqmBsd/RqOAcUHoWE/CHkq4XPxte5mfKE/hmqcOGbpFmi/Eg1W/JJJ0cinZQaC0W90F8JwxkC3GfyF0zdSHDtuwddI Loj3JGyTSNOgU2R/PUOvWn9HQYD6+nrPeAsuTJ6G5LlJQGXVSLPHoeJ+jxPkPJQr4ZkSS/IGKT6oP4rLf0FgpaEGbzKFTg== Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Markus Mayer We can pass a (struct priv_data *) to generic_show() rather than a (struct device *). For two of the three callers of this function, the change means one less call to dev_get_drvdata(). For the third caller, it makes no difference. Signed-off-by: Markus Mayer --- drivers/memory/brcmstb_dpfe.c | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-) diff --git a/drivers/memory/brcmstb_dpfe.c b/drivers/memory/brcmstb_dpfe.c index 8e1ccdb0e59d..1095c1d95df4 100644 --- a/drivers/memory/brcmstb_dpfe.c +++ b/drivers/memory/brcmstb_dpfe.c @@ -527,12 +527,10 @@ static int brcmstb_dpfe_download_firmware(struct platform_device *pdev, } static ssize_t generic_show(unsigned int command, u32 response[], - struct device *dev, char *buf) + struct private_data *priv, char *buf) { - struct private_data *priv; int ret; - priv = dev_get_drvdata(dev); if (!priv) return sprintf(buf, "ERROR: driver private data not set\n"); @@ -547,10 +545,12 @@ static ssize_t show_info(struct device *dev, struct device_attribute *devattr, char *buf) { u32 response[MSG_FIELD_MAX]; + struct private_data *priv; unsigned int info; ssize_t ret; - ret = generic_show(DPFE_CMD_GET_INFO, response, dev, buf); + priv = dev_get_drvdata(dev); + ret = generic_show(DPFE_CMD_GET_INFO, response, priv, buf); if (ret) return ret; @@ -573,12 +573,11 @@ static ssize_t show_refresh(struct device *dev, u32 mr4; ssize_t ret; - ret = generic_show(DPFE_CMD_GET_REFRESH, response, dev, buf); + priv = dev_get_drvdata(dev); + ret = generic_show(DPFE_CMD_GET_REFRESH, response, priv, buf); if (ret) return ret; - priv = dev_get_drvdata(dev); - info = get_msg_ptr(priv, response[MSG_ARG0], buf, &ret); if (!info) return ret; @@ -632,12 +631,11 @@ static ssize_t show_vendor(struct device *dev, struct device_attribute *devattr, void __iomem *info; ssize_t ret; - ret = generic_show(DPFE_CMD_GET_VENDOR, response, dev, buf); + priv = dev_get_drvdata(dev); + ret = generic_show(DPFE_CMD_GET_VENDOR, response, priv, buf); if (ret) return ret; - priv = dev_get_drvdata(dev); - info = get_msg_ptr(priv, response[MSG_ARG0], buf, &ret); if (!info) return ret; -- 2.17.1