Received: by 2002:a05:6a10:5bc5:0:0:0:0 with SMTP id os5csp1471267pxb; Wed, 20 Oct 2021 05:55:27 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzUg66+SNP3toqumkpKl1ofP1i8xg3PM/OpRrxnJlk9r59Sm5eF9b59+B+WDfDx31nhovoC X-Received: by 2002:a17:90a:9d81:: with SMTP id k1mr7295385pjp.153.1634734527326; Wed, 20 Oct 2021 05:55:27 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1634734527; cv=none; d=google.com; s=arc-20160816; b=iAzj+vuvJyznkOSaqzIzX3BAdym2jRz6gqP7POfVuLKccMCgzSaqr5PCbjXVX+NC6r pGDTHEYfIoDfAzJZGqP3vB6Xb3duwrhnFvS3UWP/drs6v0yQmnfU+gjUBRDGW6VNsOzm IbqzHjKIrnqIcXmx8JGjG4D5EQm2RY+VIgum631Q8pPjqKwqga9i1w+X6c4fE4pGMpoo cyh2QMZDfb7TgCm56MpqG5LFyIAaLa5pbNrbI2pyo7I5uuhlXK4gdiy3M43tjEn8fkSY ji8RklQnnDhp5YSpkXWFjpPdyROVWydq3FPwbwdmUo1CxAM7Fc6YYfH8dLc8zYE5LoW7 ggYw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:content-language :in-reply-to:mime-version:user-agent:date:message-id:from:references :cc:to:subject; bh=Ozw9GxlkNUK3tiAd5hVg1GDqX4oUZKHfHC8cmCkgvFM=; b=OiK49VB/kpFWIiiKXaayb/AnrdTicK0mQHIPsHOCaYxaHQziG+nHCp73Nu3Oq2f7O/ D7mxwaeRfC8p1Iv7FMpWgoDPJgVopu5YvBYZnf58U1+K4KE8G3iR42++vzgIrYj7sM1i OFRYeE7y0v0AF5fea+pq+FJDoF2a8Q+s7t1cfChBDtqv8zP5Ri+mo+tX5ejtmVUZqMkU j47G+3/XWtNmQP7POJsiN43wlWG1q5L9OWbFJCeM9rGFQYp+y/d+hR7fLvTgaFLg9GWA zAsx2kzrE7+zEpG4iZ0O6C7V39+y15tU//U1rpt6huZxxjibhV6EAqEXiYS9J0fLqp6v vfTw== ARC-Authentication-Results: i=1; mx.google.com; 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=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id pi1si8709536pjb.77.2021.10.20.05.55.14; Wed, 20 Oct 2021 05:55:27 -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; 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=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230174AbhJTM4X (ORCPT + 99 others); Wed, 20 Oct 2021 08:56:23 -0400 Received: from foss.arm.com ([217.140.110.172]:59878 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229817AbhJTM4W (ORCPT ); Wed, 20 Oct 2021 08:56:22 -0400 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 BA1551FB; Wed, 20 Oct 2021 05:54:07 -0700 (PDT) Received: from [10.57.23.81] (unknown [10.57.23.81]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 83E853F73D; Wed, 20 Oct 2021 05:54:06 -0700 (PDT) Subject: Re: [PATCH] PM: EM: do not allow pd creation prior to debugfs initialization To: Chandrasekhar L Cc: rafael.j.wysocki@intel.com, qperret@google.com, daniel.lezcano@linaro.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-arm-msm@vger.kernel.org References: <20211019152819.6141-1-clingutla@codeaurora.org> <0c42bec7-4358-a8d6-b1db-f52218a8e59a@codeaurora.org> From: Lukasz Luba Message-ID: Date: Wed, 20 Oct 2021 13:54:04 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.9.0 MIME-Version: 1.0 In-Reply-To: <0c42bec7-4358-a8d6-b1db-f52218a8e59a@codeaurora.org> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 10/20/21 1:03 PM, Chandrasekhar L wrote: > Thanks Lukasz for comment. > For any reason (ex: HW dependency, etc), if  init_call level of cpufreq/devfreq driver changed > prior to fs_init call, we would land there right? It's not the same triggering point, so we should be safe. > > One of such example is, 'drivers/cpufreq/qcom-cpufreq-hw.c' uses postcore_initcall(). It uses the postcore_initcall to probe and register a driver into the cpufreq framework. Then the cpufreq framework later constructs the 'policy' and calls your cpufreq_driver::init() function that your driver provided during registration. Thus, these are two different phases. It used to be true that if a driver required to use an 'advanced' EM registration with custom private 'em_data_callback', we put the registration call into that .init() code [1] (old [2]). Recently Viresh added a dedicated callback for this, which IMO is good and avoids confusion where to put that custom registration code. In your driver code, there is also this callback but using a generic function [3]. It's a 'simple' EM, which is based on OPP framework helper. A few drivers use that option, if their platform doesn't need the 'advanced' EM (but that's not in $subject). Regards, Lukasz [1] https://elixir.bootlin.com/linux/v5.15-rc1/source/drivers/cpufreq/scmi-cpufreq.c#L249 [2] https://elixir.bootlin.com/linux/v5.14/source/drivers/cpufreq/scmi-cpufreq.c#L192 [3] https://elixir.bootlin.com/linux/v5.15-rc6/source/drivers/cpufreq/qcom-cpufreq-hw.c#L561