Received: by 2002:a25:868d:0:0:0:0:0 with SMTP id z13csp291613ybk; Tue, 12 May 2020 23:44:40 -0700 (PDT) X-Google-Smtp-Source: APiQypJHTcBm4M+A6YqcZlW/7wpahNdDnPhlmq1jDJvznEHYk3s2Q3lrmdG8xWBqYfhOGmOa2PIG X-Received: by 2002:aa7:dcc3:: with SMTP id w3mr19670642edu.231.1589352280341; Tue, 12 May 2020 23:44:40 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1589352280; cv=none; d=google.com; s=arc-20160816; b=p5TfmpsTexXbAzyOaZQNAb+OUHQeHzgfeAKLVrzT5Z5JjlgWEekbkLaDtCnE6dULaE G+xoDd2hikJlROVVBFfrzrSfBLjeXYELBn28QSeCOsng8kcVDI1K2nJabegSVXtiAckM 3KE2DeFSGlo8UdXfRftPTAmApg8Mhu2q6yhWv2SSt6291CeeKcgv0gBJ63VLRHrUrYND M+wkNQr4KA2dOj2MiJgP1krZoEH6uiot9rSTliFmt4RPOoSd1GYm6+7uTGKpUWqBXGHR Mni9lsmNSvJgkJn5dZUULDA1gIYyT2RtNmIOfgdIwMsGR8wfkuPQT7s3E7kxdrzy57fN TxRw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=uV9bBaTw0tJvxNRTn3rCW/1JXCNDLBhH/iWFHyMVTBE=; b=Bp/w/bWPpdhCGQt1jJisEWPyM+BhES429zaCqtQs0h1yh0TdjgvscDtv4yfaip8KCO WF+VP0g1bOKb4FsWnx6TSVqxIgcnwJsJBbstS+5bitzq+Bkf4kf1csnPFcdz0YILfksM nodvDH927U7NXkF6/JgDuXeNWTzsym2AD/ukBQQ3QsxR/ZGrVFGPNDJRafLVa5X6MB7j 5jFurmy8GPvPjBD6qUtktymxMEcCVJlyOdjsEeN128Jfp9ZYLO82hVW1q+guiTruz+BW UltYdnUl5YyQQfjuAyzv4dmoF7T5U1D3zsUQhTqMxFwtIBa3QDNU5SqdFmUJNb6ZIGsJ HEIA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=DwrxDAXM; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 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. [23.128.96.18]) by mx.google.com with ESMTP id c90si9105474edd.306.2020.05.12.23.44.17; Tue, 12 May 2020 23:44:40 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-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=DwrxDAXM; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 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 S1728784AbgEMGmo (ORCPT + 99 others); Wed, 13 May 2020 02:42:44 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48332 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728712AbgEMGmn (ORCPT ); Wed, 13 May 2020 02:42:43 -0400 Received: from mail-pf1-x442.google.com (mail-pf1-x442.google.com [IPv6:2607:f8b0:4864:20::442]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B5217C061A0F for ; Tue, 12 May 2020 23:42:43 -0700 (PDT) Received: by mail-pf1-x442.google.com with SMTP id v63so7573174pfb.10 for ; Tue, 12 May 2020 23:42:43 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=uV9bBaTw0tJvxNRTn3rCW/1JXCNDLBhH/iWFHyMVTBE=; b=DwrxDAXM1Dmb9a0+R6V0fJcQ+7mkOX/VTCvmSYpaibcHNZUR8S0eNh8WaLtFN7/ueK po5fGew1zfdjzwZ3OB8bG2A4iba36emUZa6uB1eW5ix/bp449E9QkOyw761Hb97mp2uY 1woBEMeFuoYUYqHEvMUK+Am0AQbEejb1dgJeyicYC9UQBdPdX50TbnXTw6xifmc+hzKp sCuckJ3RWBDZefiNXjrUvWkdyCjvB2dwgVMTv2LVZFLKvdhVM2KDyuntRg9nQ/xiJfG5 cBHu+9F99oy2Bmm5cl/rSlDArm7VmD5fF4dOKUznXV0Z17e9mxYLt+FLz7APCaads/cp KIfA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=uV9bBaTw0tJvxNRTn3rCW/1JXCNDLBhH/iWFHyMVTBE=; b=ifcB3l0wi1+bCZZWU0KDA/DHu1Kqvpo+dbNW6Ucaf1eeIEv1yS34ljRHK81yF7z2BC GssPw94EqC/wLd751h4b80FRCGmqHcJQovUnvJCDViZj+qlFRxb/+q/fXWJKUjPOdZBb 3ku7BM5DjG6Z2yIsUq9CvFca4OXbtcVRGjPmncIxs28j5w4XxQDVQls1kh3enaypopbA 73bFr30JptDm8OXy+JQpHdFnlwD/uEX8N8VD2sRpAlTEXU6cbqeTgVZI7oFEpMpOsUoL ejTUdHfmJvQO2l/sHPQ/DhLLFPTSN+m9/sgrvcNW9AvGuDig0b+YGgXdqsl5MSxit5sA iRJg== X-Gm-Message-State: AOAM533TphNSGFYbgdtD+4D3pAnSCnHIRbjVABbXuOuHH3BCPDqHGeMs RRydEimpYJcsUzarn9B9sQ2zrA== X-Received: by 2002:a63:1946:: with SMTP id 6mr5667506pgz.287.1589352163229; Tue, 12 May 2020 23:42:43 -0700 (PDT) Received: from localhost ([122.167.130.103]) by smtp.gmail.com with ESMTPSA id gz19sm14406418pjb.7.2020.05.12.23.42.42 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Tue, 12 May 2020 23:42:42 -0700 (PDT) Date: Wed, 13 May 2020 12:12:40 +0530 From: Viresh Kumar To: Georgi Djakov Cc: vireshk@kernel.org, nm@ti.com, sboyd@kernel.org, rjw@rjwysocki.net, saravanak@google.com, sibis@codeaurora.org, mka@chromium.org, robh+dt@kernel.org, rnayak@codeaurora.org, bjorn.andersson@linaro.org, vincent.guittot@linaro.org, jcrouse@codeaurora.org, evgreen@chromium.org, linux-pm@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH v8 08/10] cpufreq: dt: Validate all interconnect paths Message-ID: <20200513064240.dpyz32brehhztex3@vireshk-i7> References: <20200512125327.1868-1-georgi.djakov@linaro.org> <20200512125327.1868-9-georgi.djakov@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200512125327.1868-9-georgi.djakov@linaro.org> User-Agent: NeoMutt/20180716-391-311a52 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 12-05-20, 15:53, Georgi Djakov wrote: > Currently when we check for the available resources, we assume that there > is only one interconnect path, but in fact it could be more than one. Do > some validation to determine the number of paths and verify if each one > of them is available. > > Signed-off-by: Georgi Djakov > --- > v8: > * New patch. Merged this with the 7th patch and applied this delta: diff --git a/drivers/cpufreq/cpufreq-dt.c b/drivers/cpufreq/cpufreq-dt.c index 15d70112454c..79742bbd221f 100644 --- a/drivers/cpufreq/cpufreq-dt.c +++ b/drivers/cpufreq/cpufreq-dt.c @@ -13,7 +13,6 @@ #include #include #include -#include #include #include #include @@ -91,49 +90,6 @@ static const char *find_supply_name(struct device *dev) return name; } -static int find_icc_paths(struct device *dev) -{ - struct device_node *np; - struct icc_path **paths; - int i, count, num_paths; - int ret = 0; - - np = of_node_get(dev->of_node); - if (!np) - return 0; - - count = of_count_phandle_with_args(np, "interconnects", - "#interconnect-cells"); - of_node_put(np); - if (count < 0) - return 0; - - /* two phandles when #interconnect-cells = <1> */ - if (count % 2) { - dev_err(dev, "%s: Invalid interconnects values\n", __func__); - return -EINVAL; - } - - num_paths = count / 2; - paths = kcalloc(num_paths, sizeof(*paths), GFP_KERNEL); - if (!paths) - return -ENOMEM; - - for (i = 0; i < num_paths; i++) { - paths[i] = of_icc_get_by_index(dev, i); - ret = PTR_ERR_OR_ZERO(paths[i]); - if (ret) - break; - } - - while (i--) - icc_put(paths[i]); - - kfree(paths); - - return ret; -} - static int resources_available(void) { struct device *cpu_dev; @@ -165,15 +121,9 @@ static int resources_available(void) clk_put(cpu_clk); - ret = find_icc_paths(cpu_dev); - if (ret) { - if (ret == -EPROBE_DEFER) - dev_dbg(cpu_dev, "defer icc path: %d\n", ret); - else - dev_err(cpu_dev, "failed to get icc path: %d\n", ret); - + ret = dev_pm_opp_of_find_icc_paths(cpu_dev, NULL); + if (ret) return ret; - } name = find_supply_name(cpu_dev); /* Platform doesn't require regulator */ -- viresh