Received: by 2002:a25:ad19:0:0:0:0:0 with SMTP id y25csp713481ybi; Tue, 16 Jul 2019 04:12:09 -0700 (PDT) X-Google-Smtp-Source: APXvYqyfI2mnPCv3ahnAbjbXXCS8IhT411ypc3Z2qy2Kc4z1zJVPD0GHNy4xsPSeoXneUmC2o9n7 X-Received: by 2002:a65:4841:: with SMTP id i1mr32590168pgs.316.1563275529526; Tue, 16 Jul 2019 04:12:09 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1563275529; cv=none; d=google.com; s=arc-20160816; b=CJhWYPjKH6CQw+2g9sf7liwdG0718On8ywF4EeJkxZUA1LRf6UY9/EiWmz6tEtc1kS niOEV84D9MZFqejSApnu0AGHtaVnUdNKgQRYs+zv4Fpezfgkj7oR0TBD8j/0x880UGNj y4BMYKscTUESPd2eBQOyuiBdvO9fN2i/4RaaURGZwW9qsWlpJDs9SHBRlMS7Qn+CVXIr d8FaJiWxZTDkUDsXK9HFM6NNfYceM35O2Z0N57+aCOjafdstAos9fXEvT4gvhNO5Wd9J KxCohEPmY8rB19/x29QVu9PDcByj3t+cClk2sNavkv6b4WYIlPd4OxZRT19AIz87EMu6 LPAw== 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=De8/nFrlZkmJ1Y3LPB15A9cMZ47Zx0HgH86pautMcVU=; b=P8OtubnA7DhwX75c44gFR04wUL99aeu07EQgT37u2uURIH4UBUdvcHrW6z6pkFh0mm DA7PhQz5vltQDbaydxDswVtQ5tThhtLjzJijyKGNu4Rpoca0rjXM4cM/VSZZgcUENQA4 8m9fSJCHIigjDTjrZJHISerrL93uk1T7MNS2R8JAZXLrsDTChceF/KmoNc+qvwDDwQFy 3MvhRuCI4LqtiTro5vGhzR5dVo5NBTaCGBVhWUhd7+guXz0/RseA+e0t6OifBzae61Xc UDigRMpTegugIe5vp6XbkAGGXDoxMonLWWk+2EbgF6Ei5iX4cjSeiFZvs97pytIGRvTZ AQRA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=MhfVgsHK; 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 11si17901194pla.248.2019.07.16.04.11.53; Tue, 16 Jul 2019 04:12:09 -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=MhfVgsHK; 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 S2387564AbfGPLLV (ORCPT + 99 others); Tue, 16 Jul 2019 07:11:21 -0400 Received: from mail-lf1-f66.google.com ([209.85.167.66]:43793 "EHLO mail-lf1-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1733200AbfGPLLU (ORCPT ); Tue, 16 Jul 2019 07:11:20 -0400 Received: by mail-lf1-f66.google.com with SMTP id c19so13396684lfm.10 for ; Tue, 16 Jul 2019 04:11:19 -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=De8/nFrlZkmJ1Y3LPB15A9cMZ47Zx0HgH86pautMcVU=; b=MhfVgsHKsWQWV+8Cx6DkHX920ij+HAPhqcs/LrfxSWnmUhcZwwObqzXGuH2sYRl9AN iwPdTxgDU9BNifyfjbzo6FeK/XCISN8ezsTqNs3u+GIJ3lhKG+pQTJmQuOD83xC4g0Ic lLW+8JbnEAHxIKLzKd2ifrwLiko0942eLh4/D5+V5u4nf2DHsjtiGII+6s8AA9vCq1YZ 5xhMqY8nftd9xW7FikIn+LRybyEglGiHdlkPwuKOmaS9kE2uxv312YGl9Y8dzzmC9TRf YJQ9y8PNnM0Nh8pMom8u5ubKRutmYrih0UEOweKK6LfRjVtpvK4OqKR8HkFLMPoKr9Al 8pJA== 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=De8/nFrlZkmJ1Y3LPB15A9cMZ47Zx0HgH86pautMcVU=; b=PAFELwj+kIFXZE9OX9gTcjRZOUSi29e8//65uBwXj7gZkmPqpqR7wU0KifmUNuRa5h rF9unTZ9hqPVNy1zori1hrWDSXIu8u2LzcQaaNTb/WesAVZV7Prwxz7e9G5uAJQ//Li8 ddk2r//DFCRPlSOZHcmO4E0dBlZGlEjB/yhGLHRKUkrS9XiPdptzZac9HLvyTSorcgXl FgfNTj+pN6Z3tSZFMs41yUo2p+EjKCNl6eeb48P5jAEPr6AdDBq4nz5QSmQ9kmKlQC/d jeFlLkZo/djhl9mbAjSzjsg7baTAH39Q62TodapcYAtM9wcPdpusVZylZEVleoT5iOaJ KuiA== X-Gm-Message-State: APjAAAUBNKFO+iDq14Jrjr/7CYkcOi4ejIKqW0qAzIkp01L+5ovhrE/c mdZlIKdzwxmaoLsUYiAuZKwL4A== X-Received: by 2002:ac2:528e:: with SMTP id q14mr13449179lfm.17.1563275478425; Tue, 16 Jul 2019 04:11:18 -0700 (PDT) Received: from centauri (ua-83-226-229-61.bbcust.telenor.se. [83.226.229.61]) by smtp.gmail.com with ESMTPSA id t25sm2793658lfg.7.2019.07.16.04.11.17 (version=TLS1_3 cipher=AEAD-AES256-GCM-SHA384 bits=256/256); Tue, 16 Jul 2019 04:11:17 -0700 (PDT) Date: Tue, 16 Jul 2019 13:11:15 +0200 From: Niklas Cassel To: Viresh Kumar Cc: Andy Gross , Ilia Lin , "Rafael J. Wysocki" , linux-arm-msm@vger.kernel.org, jorge.ramirez-ortiz@linaro.org, sboyd@kernel.org, vireshk@kernel.org, bjorn.andersson@linaro.org, ulf.hansson@linaro.org, linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH 04/13] cpufreq: qcom: Refactor the driver to make it easier to extend Message-ID: <20190716111115.GA13918@centauri> References: <20190705095726.21433-1-niklas.cassel@linaro.org> <20190705095726.21433-5-niklas.cassel@linaro.org> <20190710063026.7yyoxjsqp2ck3z6n@vireshk-i7> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20190710063026.7yyoxjsqp2ck3z6n@vireshk-i7> User-Agent: Mutt/1.12.0 (2019-05-25) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Jul 10, 2019 at 12:00:26PM +0530, Viresh Kumar wrote: > On 05-07-19, 11:57, Niklas Cassel wrote: > > + drv->opp_tables = kcalloc(num_possible_cpus(), sizeof(*drv->opp_tables), > > + GFP_KERNEL); > > + if (!drv->opp_tables) { > > + ret = -ENOMEM; > > + goto free_drv; > > + } > > > > for_each_possible_cpu(cpu) { > > cpu_dev = get_cpu_device(cpu); > > @@ -166,19 +195,23 @@ static int qcom_cpufreq_probe(struct platform_device *pdev) > > goto free_opp; > > } > > > > - opp_tables[cpu] = dev_pm_opp_set_supported_hw(cpu_dev, > > - &versions, 1); > > - if (IS_ERR(opp_tables[cpu])) { > > - ret = PTR_ERR(opp_tables[cpu]); > > - dev_err(cpu_dev, "Failed to set supported hardware\n"); > > - goto free_opp; > > + if (drv->data->get_version) { > > Why depend on get_version here ? The OPP table is already allocated > unconditionally. Since the reading of the speedbin efuse is now optional, it is now inside "if (drv->data->get_version)". So if I don't also protect "dev_pm_opp_set_supported_hw()" with "if (drv->data->get_version)" I get: [ 3.135092] cpu cpu0: _opp_is_supported: failed to read opp-supported-hw property at index 0: -22 [ 3.139364] cpu cpu0: _opp_is_supported: failed to read opp-supported-hw property at index 0: -22 [ 3.148330] cpu cpu0: _opp_is_supported: failed to read opp-supported-hw property at index 0: -22 Probably since drv->versions is initialized to 0, and if there is no opp-supported-hw in device tree, OPP framework prints failures. So it feels safest to only call dev_pm_opp_set_supported_hw() if we know that we are supposed to parse the speedbin efuse. Kind regards, Niklas > > > + drv->opp_tables[cpu] = > > + dev_pm_opp_set_supported_hw(cpu_dev, > > + &drv->versions, 1); > > + if (IS_ERR(drv->opp_tables[cpu])) { > > + ret = PTR_ERR(drv->opp_tables[cpu]); > > + dev_err(cpu_dev, > > + "Failed to set supported hardware\n"); > > + goto free_opp; > > + } > > } > > } > > -- > viresh