From patchwork Tue Sep 8 07:57:12 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Manivannan Sadhasivam X-Patchwork-Id: 249277 Delivered-To: patch@linaro.org Received: by 2002:a92:5b9c:0:0:0:0:0 with SMTP id c28csp4326500ilg; Tue, 8 Sep 2020 00:58:01 -0700 (PDT) X-Google-Smtp-Source: ABdhPJz0wredG3L6O5YSrv9RZ480vuFv+EGbq4o6H8JQd7i6aK2ALRDeire1QJ2dI8WxPa6z5rtV X-Received: by 2002:a17:906:8143:: with SMTP id z3mr5969026ejw.323.1599551881720; Tue, 08 Sep 2020 00:58:01 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1599551881; cv=none; d=google.com; s=arc-20160816; b=R2m8iazr2A8Y8BbhY/7uKIbsgVY1McVFHuudyCYGj7ZdRyvPcvitKH57cIBlX5TrLX ArPClketCblv5+YwK6BK73PC91btPXl+7nyakS56JtoFwKQHnkh/yoFf3YH/DDLAriyW Ar5VcV3yjSPreAOETaGjDU762n4UfmMnY8Zw9XNUW7lMdghwQ4xsZIS1P4ZIwi2QQs8F z+95RqssCqs+QiO4iPYTSQknzHnnQWP1syYGkErjvyKmU15olanqQmwUhVWY1IlV1dRU aIs76BVxBlvPLfO+bvpIIpe4tMVm/zC+8e03/3eE2BFhO5UVe67Ln0phmLlPAVDcokHa 3KOg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature; bh=JGfwbA2hMX/PUVpH89svS+V4Ld5w43WoS4VhDZ1+uvE=; b=P4jaIJ9f9JsmGReufLPPN0RifDiKXEBEsVKAfmZ0NHK1kvKfpB/4nQT5ioCDV1TrLq rK4SiGkDjFbUCG0R+QS9YKpVdzm7ehIBVeMzS3bK4k+MxYxxxNJ/fFj4+MjdW57O/Tzl hN4nCURrrRGMCdCLBXLMMBHwIOtTD/PSOVtmwdPW3CZE1+EJR0JB3a1jveQ7zOIvLY0E cebnSUULzk9HHknjEPRONWu7dfcMs0FAxVoHfxi4CkLuKvV1v0pmoHtWiXhdysmhYA3D iL9ewxjeBMZ6J8w6Q9AKt+Ay6iHUue/j/YvucjZEDsv/ZjP8XogLWmJQQuFzBV8/DQ10 l1Jg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=pJO2glLc; spf=pass (google.com: domain of linux-arm-msm-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-arm-msm-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. [23.128.96.18]) by mx.google.com with ESMTP id e9si11696398ejt.529.2020.09.08.00.58.01; Tue, 08 Sep 2020 00:58:01 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-arm-msm-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=pJO2glLc; spf=pass (google.com: domain of linux-arm-msm-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-arm-msm-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 S1729922AbgIHH55 (ORCPT + 15 others); Tue, 8 Sep 2020 03:57:57 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36300 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729635AbgIHH5s (ORCPT ); Tue, 8 Sep 2020 03:57:48 -0400 Received: from mail-pg1-x542.google.com (mail-pg1-x542.google.com [IPv6:2607:f8b0:4864:20::542]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4653BC06179A for ; Tue, 8 Sep 2020 00:57:43 -0700 (PDT) Received: by mail-pg1-x542.google.com with SMTP id 34so59032pgo.13 for ; Tue, 08 Sep 2020 00:57:43 -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; bh=JGfwbA2hMX/PUVpH89svS+V4Ld5w43WoS4VhDZ1+uvE=; b=pJO2glLcWONMCZxzk++7qzEcyoK2rePLlHNeofmiirHWh9yz0rixKMU4YYLAImgiYp O/Glo7upyvln7QHfW1GLAIWWmw8mENdE4QXXuvlfh/M4KmtzVm0ERJ4YVjDXJnFIrrZE 2y3CH5O+NooqYIeggydwNGkxErOu3EKUGYdPX5bj9TFXKKBnHT1MJyrtqk/DYo0FMqu7 MK8++Fqvu1MRd0oTlYdTqIOpTh50MiMjcBdKuoqt0EczUr7D8D83tcEDL3zuFI1Vy1GD MM1V4WBh+3eVxrn+najs/OsxLtZoXYWND6kZ1KMfD7FAaXNtUSae3k7FRZpj5hfib2hM 9SBw== 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; bh=JGfwbA2hMX/PUVpH89svS+V4Ld5w43WoS4VhDZ1+uvE=; b=F+SAFfmx/giowhnbo2z5uGdmxaP3YLDtcc3rMVucqG0Ummy3QDYPmWR+i6WazW9ZpX qWsdLMz/CarCxoG0Jq9rU/lBsEQ9gpFhAvTAXeg3q1EYXUzppNusvqlVvhBOS8WZ8dB8 hXuy92nFY38moTs8QkzYdz8UoaekId2DUqjkmp6n3sI51VPvVkQpcm1NI4yS2rhuaAKL TWB2ffdHReH1X++T2N2yJUHTZyRW6ayWm9sIR7Q7EX5jRr8AkrzrhwnrPGIVIL7ScLlm PnBOg8+usGVFUnOdUQyyeqe/WaOKtzClBVuQPDgP8xvPVv/aCAJT8zhtRj4w3h3uoZbU VDlw== X-Gm-Message-State: AOAM531f0jKApcdOwHA9KTqczCXcmvjKNQgMC/31qT0pd46K27gxRGlh q9tZ2Aqxt11n8FOZ2y4MscH/ X-Received: by 2002:a17:902:8342:: with SMTP id z2mr21724921pln.3.1599551862494; Tue, 08 Sep 2020 00:57:42 -0700 (PDT) Received: from localhost.localdomain ([103.59.133.81]) by smtp.googlemail.com with ESMTPSA id m21sm7560154pfo.13.2020.09.08.00.57.38 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 08 Sep 2020 00:57:42 -0700 (PDT) From: Manivannan Sadhasivam To: rjw@rjwysocki.net, viresh.kumar@linaro.org, robh+dt@kernel.org, agross@kernel.org, bjorn.andersson@linaro.org Cc: amitk@kernel.org, linux-pm@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-msm@vger.kernel.org, dmitry.baryshkov@linaro.org, tdas@codeaurora.org, Manivannan Sadhasivam Subject: [PATCH 3/7] cpufreq: qcom-hw: Make use of cpufreq driver_data for passing pdev Date: Tue, 8 Sep 2020 13:27:12 +0530 Message-Id: <20200908075716.30357-4-manivannan.sadhasivam@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200908075716.30357-1-manivannan.sadhasivam@linaro.org> References: <20200908075716.30357-1-manivannan.sadhasivam@linaro.org> Sender: linux-arm-msm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org Get rid of global_pdev pointer and make use of cpufreq driver_data for passing the reference of pdev. This aligns with what other cpufreq drivers are doing. Signed-off-by: Manivannan Sadhasivam --- drivers/cpufreq/qcom-cpufreq-hw.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) -- 2.17.1 diff --git a/drivers/cpufreq/qcom-cpufreq-hw.c b/drivers/cpufreq/qcom-cpufreq-hw.c index 3fb044b907a8..ccea34f61152 100644 --- a/drivers/cpufreq/qcom-cpufreq-hw.c +++ b/drivers/cpufreq/qcom-cpufreq-hw.c @@ -30,7 +30,6 @@ #define REG_PERF_STATE 0x920 static unsigned long cpu_hw_rate, xo_rate; -static struct platform_device *global_pdev; static bool icc_scaling_enabled; static int qcom_cpufreq_set_bw(struct cpufreq_policy *policy, @@ -240,7 +239,8 @@ static void qcom_get_related_cpus(int index, struct cpumask *m) static int qcom_cpufreq_hw_cpu_init(struct cpufreq_policy *policy) { - struct device *dev = &global_pdev->dev; + struct platform_device *pdev = cpufreq_get_driver_data(); + struct device *dev = &pdev->dev; struct of_phandle_args args; struct device_node *cpu_np; struct device *cpu_dev; @@ -267,7 +267,7 @@ static int qcom_cpufreq_hw_cpu_init(struct cpufreq_policy *policy) index = args.args[0]; - res = platform_get_resource(global_pdev, IORESOURCE_MEM, index); + res = platform_get_resource(pdev, IORESOURCE_MEM, index); if (!res) return -ENODEV; @@ -316,11 +316,12 @@ static int qcom_cpufreq_hw_cpu_exit(struct cpufreq_policy *policy) { struct device *cpu_dev = get_cpu_device(policy->cpu); void __iomem *base = policy->driver_data - REG_PERF_STATE; + struct platform_device *pdev = cpufreq_get_driver_data(); dev_pm_opp_remove_all_dynamic(cpu_dev); dev_pm_opp_of_cpumask_remove_table(policy->related_cpus); kfree(policy->freq_table); - devm_iounmap(&global_pdev->dev, base); + devm_iounmap(&pdev->dev, base); return 0; } @@ -365,7 +366,7 @@ static int qcom_cpufreq_hw_driver_probe(struct platform_device *pdev) cpu_hw_rate = clk_get_rate(clk) / CLK_HW_DIV; clk_put(clk); - global_pdev = pdev; + cpufreq_qcom_hw_driver.driver_data = pdev; /* Check for optional interconnect paths on CPU0 */ cpu_dev = get_cpu_device(0);