Received: by 2002:a05:6a10:9afc:0:0:0:0 with SMTP id t28csp1408074pxm; Thu, 24 Feb 2022 02:30:58 -0800 (PST) X-Google-Smtp-Source: ABdhPJxkDTqVmwnOhW7cWk0o4r2IC46GnCGmFLYIPIhO9Q4wRNxCQrjt02pai9roU/3ftOavOur4 X-Received: by 2002:a62:7c11:0:b0:4e1:7ede:9ca9 with SMTP id x17-20020a627c11000000b004e17ede9ca9mr2240790pfc.84.1645698658624; Thu, 24 Feb 2022 02:30:58 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1645698658; cv=none; d=google.com; s=arc-20160816; b=b2GJeUAD21mHTO1weHpGXkpcL5oIMX4a2mCUC45rbpgMHcBDvnZlBaTitHSjhDooRr RkeS4S3o/NcUxIeuPBlT/8jYdQYhCVPcbhmqrkGOUKvtkR7zBPZ4jVdYnr1fUCB1KA2e InpGIKxC+XO6thqjVAKotfkw+SggBaG6nPqIt7TvqK6nATB72A8Wd0U3n0cEjWJlTAii CZQ2Qd3PTrVpw12LWXV0jyPLtwQsU65oNyDOT256d8KHl526q8Ud3g8H+RjxxQ83Bub8 HbyKu0JANMLRmdNQeIfjAafODicKKEf8x2XLeZkXHD1Iya1caO60RVvWt/pCU4zi9MA2 Scaw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:from :references:cc:to:content-language:subject:user-agent:mime-version :date:message-id; bh=QRTUTEMrpiliUO4P7yeD9OThk+r5ZlFUB5/WxwsX4LE=; b=XfRkVI6F8TkVqTXEpgYOlCYNB+gfu4RU7wNSjpHNu/TrjbFvDvbkY1yZm1Yiq3cm3m ThgdJqJ+zwiSvEZ9ncgfwyYGctjNecO5Og2pPIXHnVVB3cu9X806YfZ1tRhrYQ5LnpDs igDAvcrt1CSxts2ba+FBeHUXw3fJOhThnrKSC5NBnfiJXXY3aWaZG6aSw+XXvlAwNs4W 2C9qepQJ80OHQsdArVNFmzqRmzf7eQebrrrbqxUpH3Ff7LPpD9ODAYWVL4YSIwMWfSxj KlAMG6oEhmm2g8OyBHPDLY9SVBLVKHfZ1E1Srn299DrJfz9mABGBDAnGsZidDVgMsNWp fjlQ== ARC-Authentication-Results: i=1; mx.google.com; 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=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id g10si1972569plo.527.2022.02.24.02.30.41; Thu, 24 Feb 2022 02:30:58 -0800 (PST) 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; 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=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232743AbiBXJo0 (ORCPT + 99 others); Thu, 24 Feb 2022 04:44:26 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36444 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232878AbiBXJoZ (ORCPT ); Thu, 24 Feb 2022 04:44:25 -0500 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id CA0A627DF19; Thu, 24 Feb 2022 01:43:55 -0800 (PST) Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 9574AED1; Thu, 24 Feb 2022 01:43:55 -0800 (PST) Received: from [10.57.8.211] (unknown [10.57.8.211]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id A57C23F70D; Thu, 24 Feb 2022 01:43:53 -0800 (PST) Message-ID: Date: Thu, 24 Feb 2022 09:43:52 +0000 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.5.0 Subject: Re: [PATCH v3 3/4] OPP: Add support of "opp-microwatt" for advanced EM registration Content-Language: en-US To: Viresh Kumar Cc: linux-kernel@vger.kernel.org, dietmar.eggemann@arm.com, rafael@kernel.org, daniel.lezcano@linaro.org, nm@ti.com, sboyd@kernel.org, mka@chromium.org, dianders@chromium.org, robh+dt@kernel.org, devicetree@vger.kernel.org, linux-pm@vger.kernel.org References: <20220224081131.27282-1-lukasz.luba@arm.com> <20220224081131.27282-4-lukasz.luba@arm.com> <20220224091346.xmnpj27vllpa4cuy@vireshk-i7> <9c8f15a3-563f-3bed-61a4-2f72b0c20e89@arm.com> <20220224094216.mtxjjx65bbjzalqx@vireshk-i7> From: Lukasz Luba In-Reply-To: <20220224094216.mtxjjx65bbjzalqx@vireshk-i7> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00,NICE_REPLY_A, RCVD_IN_DNSWL_HI,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE 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 On 2/24/22 09:42, Viresh Kumar wrote: > On 24-02-22, 09:33, Lukasz Luba wrote: >> On 2/24/22 09:13, Viresh Kumar wrote: >>> On 24-02-22, 08:11, Lukasz Luba wrote: >>>> diff --git a/drivers/opp/of.c b/drivers/opp/of.c > >>>> +static bool _of_has_opp_microwatt_property(struct device *dev) >>>> +{ >>>> + unsigned long power, freq = 0; >>>> + struct dev_pm_opp *opp; >>>> + >>>> + /* Check if at least one OPP has needed property */ >>>> + opp = dev_pm_opp_find_freq_ceil(dev, &freq); >>>> + if (IS_ERR(opp)) >>>> + return false; >>>> + >>>> + power = dev_pm_opp_get_power(opp); >>>> + dev_pm_opp_put(opp); >>>> + if (!power) >>> >>> Instead of this heavy stuff, just pick the first OPP from the opp >>> table and see its power-value. >> >> It is the first opp: freq=0. >> You mean by parsing the the DT node instead, like I had in v2 version? > > No, I was thinking if you can simply do: > > opp = list_first_entry(&opp_table->opp_list, struct dev_pm_opp, node); > > But that requires locking, etc as well. So maybe this is fine. > OK, so I'll leave it as is now. Thank you for the comments. I'll work on v4