From patchwork Tue Oct 25 07:32:52 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Manivannan Sadhasivam X-Patchwork-Id: 10561 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp861640wru; Tue, 25 Oct 2022 00:39:05 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7fXp79XCXhmkgXUaYyXbzvO2LhBs1AejM5JSqTXvVVJO/fuErs9QLoQUT6k3EyXpZKbTuf X-Received: by 2002:a17:90b:11d4:b0:212:ee83:481 with SMTP id gv20-20020a17090b11d400b00212ee830481mr15925017pjb.36.1666683544751; Tue, 25 Oct 2022 00:39:04 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666683544; cv=none; d=google.com; s=arc-20160816; b=IifQdxoP4B9KJMqWrsprB8tnBA1qyWGvtOpXtGBwL1p21hr+qlUfRt6WxbC6lYal6z nH6IDccOKtjpWN+LfyxJzPfMdItkrXGQAq0xaQUg5daWAj/VuCRKt7/GDTj9qG1vOcOB yVwoEQ7eEc/oBWRKL+U/yDiTak7H4/6FjXV4YYygYBsHohiP9x5F9Py6DwyKtqV5nBDt grnN1Y3f96SsIboI4zo5xqniVKovKYarnBk82Tx76sQyKeA9Sj/32oc9phMqoGlGgLXH oK0qhh08vePArFYU9E19LmJDWiT+TBFVUACV0dJv4VT0AyY9vO2H92InOzILHJZE31uK 9M7Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=3UeGRLt0I6Ca0YYYt9StoKBqh2LnPMLZ6623L26cNAw=; b=BEqwlPCXs62ye4KUoC/1AOS2tFRF/P91JfKaZmirfnsfXDCnq/XieCVw5R0n2r0ygA kMtZYTHOemOgHMw344S1OUEWAxrEEYp7p4mB75+lw6ZGgRBPQBfUSfpUBGCPqsKG6EvA k74A2fKB+MMJynhJHz0qi+KTcIZbF0DZotrUi9emyFrG2yZUaSYD3ks161jmsssDViU5 8sgSyF0G5Vdds9wzg1LMb1Zh8JznS7S0PTaASOniyA+UBjUvEFlLuBUt1wk1EnjOw2Qf D4zyZV9ZL+yzB4rz2PT+CtUI5oBnmne4D4Vh9SMfr14dwbaXE+7NyKVMv8Q9/N93fTKY h7nw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="X0RL/rMF"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id ls2-20020a17090b350200b0020169c73d8bsi2851170pjb.2.2022.10.25.00.38.51; Tue, 25 Oct 2022 00:39:04 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="X0RL/rMF"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S231795AbiJYHeZ (ORCPT + 99 others); Tue, 25 Oct 2022 03:34:25 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60830 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231834AbiJYHdf (ORCPT ); Tue, 25 Oct 2022 03:33:35 -0400 Received: from mail-pf1-x42f.google.com (mail-pf1-x42f.google.com [IPv6:2607:f8b0:4864:20::42f]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B6F88159A11 for ; Tue, 25 Oct 2022 00:33:34 -0700 (PDT) Received: by mail-pf1-x42f.google.com with SMTP id w189so9620174pfw.4 for ; Tue, 25 Oct 2022 00:33:34 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=3UeGRLt0I6Ca0YYYt9StoKBqh2LnPMLZ6623L26cNAw=; b=X0RL/rMFeNQR0WlRbmLCElOKWXzvpdlLvDkjR4YTO7u8TR4XMeO2egtQYx8G/jG5qe Wwz3GBRVRRS9nmz47gxJTR96yUXyD6Cd2gy4jCSHBB5RW2/j0sralt9LqxBu7qxPaxfy lGRQw5xJXlCUN60USUCLU0Ktmn0e/YcDqhTsNBNH3ovUkH5ooHLe9cQ2TZMaMIojLlpJ 1ytohEqsESYOtThDKvxNer4zMK9Z8+UA8/P1CD2Lkm34l9Ie+cYYAI//1N/bDxqpbLpc o16rasF6aua2DiHsO348m9fI0oif7ZymhXfonnK13z5c9SvceN/jYgrqRYxuTM3opm7m KSNw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=3UeGRLt0I6Ca0YYYt9StoKBqh2LnPMLZ6623L26cNAw=; b=t4nkVwlHSX5oq2X7GdXta7aa6gkhkX5QzFdhLH5O3aS+bNmiKiodL9rtjh6kBQaPMN iv6+bkK/oUi4/sRPZncnUrG1zxlyquH//WL8+/vieXhABhzpYLON0cjkm2vBwswAXU7m ApbZifkgDOucVSIi4dQJHOG2vcSc54//RJrVpPefZWDttLE6gqRi48uMKCEIrhH6WcvU KziU897WHvhA3Ag7/10bo7KA1hfRZjFZxhZ4bcVHnw771aPpQxG9jgDOOORV+sLCaBCu j8QED+7XuxvkuI9G1cwXxFYPSDC1oEE+53AhRkUXkRLe4Mte61noGf7v94gELFPFmIH9 0VBQ== X-Gm-Message-State: ACrzQf2kFRcKakt46xnv+RAvO1OuYMWWOmcLl39rGdcmbNq8cQsjCEM8 1LvTvrHOYcuQKE09Dx7fI4Mf X-Received: by 2002:a63:5164:0:b0:43b:e57c:a15f with SMTP id r36-20020a635164000000b0043be57ca15fmr31182269pgl.586.1666683214172; Tue, 25 Oct 2022 00:33:34 -0700 (PDT) Received: from localhost.localdomain ([117.193.211.146]) by smtp.gmail.com with ESMTPSA id c1-20020a17090a4d0100b0020dda7efe61sm5048369pjg.5.2022.10.25.00.33.29 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 25 Oct 2022 00:33:32 -0700 (PDT) From: Manivannan Sadhasivam To: andersson@kernel.org, viresh.kumar@linaro.org, krzysztof.kozlowski+dt@linaro.org, rafael@kernel.org, robh+dt@kernel.org Cc: johan@kernel.org, devicetree@vger.kernel.org, linux-arm-msm@vger.kernel.org, linux-kernel@vger.kernel.org, linux-pm@vger.kernel.org, Manivannan Sadhasivam Subject: [PATCH v2 5/7] cpufreq: qcom-hw: Use cached dev pointer in probe() Date: Tue, 25 Oct 2022 13:02:52 +0530 Message-Id: <20221025073254.1564622-6-manivannan.sadhasivam@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20221025073254.1564622-1-manivannan.sadhasivam@linaro.org> References: <20221025073254.1564622-1-manivannan.sadhasivam@linaro.org> MIME-Version: 1.0 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747644364697388021?= X-GMAIL-MSGID: =?utf-8?q?1747644364697388021?= There are multiple instances of dev pointer used in the probe() function. Instead of referencing pdev->dev all the time, let's use a cached dev pointer to simplify the code. Signed-off-by: Manivannan Sadhasivam --- drivers/cpufreq/qcom-cpufreq-hw.c | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/drivers/cpufreq/qcom-cpufreq-hw.c b/drivers/cpufreq/qcom-cpufreq-hw.c index 1842e9facaa1..bc991ef10c05 100644 --- a/drivers/cpufreq/qcom-cpufreq-hw.c +++ b/drivers/cpufreq/qcom-cpufreq-hw.c @@ -604,18 +604,19 @@ static struct cpufreq_driver cpufreq_qcom_hw_driver = { static int qcom_cpufreq_hw_driver_probe(struct platform_device *pdev) { + struct device *dev = &pdev->dev; struct device *cpu_dev; struct clk *clk; int ret, i, num_domains; - clk = clk_get(&pdev->dev, "xo"); + clk = clk_get(dev, "xo"); if (IS_ERR(clk)) return PTR_ERR(clk); xo_rate = clk_get_rate(clk); clk_put(clk); - clk = clk_get(&pdev->dev, "alternate"); + clk = clk_get(dev, "alternate"); if (IS_ERR(clk)) return PTR_ERR(clk); @@ -634,11 +635,11 @@ static int qcom_cpufreq_hw_driver_probe(struct platform_device *pdev) return ret; /* Allocate qcom_cpufreq_data based on the available frequency domains in DT */ - num_domains = of_property_count_elems_of_size(pdev->dev.of_node, "reg", sizeof(u32) * 4); + num_domains = of_property_count_elems_of_size(dev->of_node, "reg", sizeof(u32) * 4); if (num_domains <= 0) return num_domains; - qcom_cpufreq.data = devm_kzalloc(&pdev->dev, sizeof(struct qcom_cpufreq_data) * num_domains, + qcom_cpufreq.data = devm_kzalloc(dev, sizeof(struct qcom_cpufreq_data) * num_domains, GFP_KERNEL); if (!qcom_cpufreq.data) return -ENOMEM; @@ -650,7 +651,7 @@ static int qcom_cpufreq_hw_driver_probe(struct platform_device *pdev) base = devm_platform_get_and_ioremap_resource(pdev, i, &res); if (IS_ERR(base)) { - dev_err(&pdev->dev, "Failed to map resource %pR\n", res); + dev_err(dev, "Failed to map resource %pR\n", res); return PTR_ERR(base); } @@ -660,9 +661,9 @@ static int qcom_cpufreq_hw_driver_probe(struct platform_device *pdev) ret = cpufreq_register_driver(&cpufreq_qcom_hw_driver); if (ret) - dev_err(&pdev->dev, "CPUFreq HW driver failed to register\n"); + dev_err(dev, "CPUFreq HW driver failed to register\n"); else - dev_dbg(&pdev->dev, "QCOM CPUFreq HW driver initialized\n"); + dev_dbg(dev, "QCOM CPUFreq HW driver initialized\n"); return ret; }