devicetree.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
To: Dmitry Baryshkov <dmitry.baryshkov@oss.qualcomm.com>,
	Krzysztof Kozlowski <krzk@kernel.org>
Cc: "Rob Herring" <robh@kernel.org>,
	"Saravana Kannan" <saravanak@google.com>,
	"Rafael J. Wysocki" <rafael@kernel.org>,
	"Viresh Kumar" <viresh.kumar@linaro.org>,
	"Matthias Brugger" <matthias.bgg@gmail.com>,
	"AngeloGioacchino Del Regno"
	<angelogioacchino.delregno@collabora.com>,
	"Yangtao Li" <tiny.windzz@gmail.com>,
	"Chen-Yu Tsai" <wens@kernel.org>,
	"Jernej Skrabec" <jernej.skrabec@gmail.com>,
	"Samuel Holland" <samuel@sholland.org>,
	"Lorenzo Pieralisi" <lpieralisi@kernel.org>,
	"Daniel Lezcano" <daniel.lezcano@linaro.org>,
	"Bjorn Andersson" <andersson@kernel.org>,
	"Konrad Dybcio" <konradybcio@kernel.org>,
	"Thomas Gleixner" <tglx@linutronix.de>,
	"Nicolas Ferre" <nicolas.ferre@microchip.com>,
	"Alexandre Belloni" <alexandre.belloni@bootlin.com>,
	"Claudiu Beznea" <claudiu.beznea@tuxon.dev>,
	"Maximilian Luz" <luzmaximilian@gmail.com>,
	"Hans de Goede" <hansg@kernel.org>,
	"Ilpo Järvinen" <ilpo.jarvinen@linux.intel.com>,
	"Daniel Lezcano" <daniel.lezcano@kernel.org>,
	"Thierry Reding" <thierry.reding@gmail.com>,
	"Jonathan Hunter" <jonathanh@nvidia.com>,
	devicetree@vger.kernel.org, linux-kernel@vger.kernel.org,
	linux-pm@vger.kernel.org, linux-arm-kernel@lists.infradead.org,
	linux-mediatek@lists.infradead.org, linux-sunxi@lists.linux.dev,
	linux-arm-msm@vger.kernel.org,
	platform-driver-x86@vger.kernel.org, linux-tegra@vger.kernel.org
Subject: Re: [PATCH 11/13] soc: qcom: Simplify with of_machine_get_match_data()
Date: Sun, 9 Nov 2025 20:06:18 +0100	[thread overview]
Message-ID: <86139020-d2bf-4dc8-8b38-d7faba838e46@linaro.org> (raw)
In-Reply-To: <3q5bpkktogs3pxjboihynjduabqrcuayyexjqdv3cgp5krjaxo@afnknyguuzxl>

On 08/11/2025 17:31, Dmitry Baryshkov wrote:
> On Fri, Nov 07, 2025 at 03:58:26PM +0100, Krzysztof Kozlowski wrote:
>> On 07/11/2025 15:23, Dmitry Baryshkov wrote:
>>> On Fri, Nov 07, 2025 at 08:08:28AM +0100, Krzysztof Kozlowski wrote:
>>>> On 07/11/2025 08:02, Krzysztof Kozlowski wrote:
>>>>> On 07/11/2025 04:19, Dmitry Baryshkov wrote:
>>>>>> On Thu, Nov 06, 2025 at 08:07:18PM +0100, Krzysztof Kozlowski wrote:
>>>>>>> Replace open-coded getting root OF node, matching against it and getting
>>>>>>> the match data with new of_machine_get_match_data() helper.
>>>>>>>
>>>>>>> Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
>>>>>>>
>>>>>>> ---
>>>>>>>
>>>>>>> Depends on the first OF patch.
>>>>>>> ---
>>>>>>>  drivers/soc/qcom/qcom_pd_mapper.c | 17 ++---------------
>>>>>>>  1 file changed, 2 insertions(+), 15 deletions(-)
>>>>>>>
>>>>>>> diff --git a/drivers/soc/qcom/qcom_pd_mapper.c b/drivers/soc/qcom/qcom_pd_mapper.c
>>>>>>> index 1bcbe69688d2..07198d44b559 100644
>>>>>>> --- a/drivers/soc/qcom/qcom_pd_mapper.c
>>>>>>> +++ b/drivers/soc/qcom/qcom_pd_mapper.c
>>>>>>> @@ -613,25 +613,12 @@ static void qcom_pdm_stop(struct qcom_pdm_data *data)
>>>>>>>  static struct qcom_pdm_data *qcom_pdm_start(void)
>>>>>>>  {
>>>>>>>  	const struct qcom_pdm_domain_data * const *domains;
>>>>>>> -	const struct of_device_id *match;
>>>>>>>  	struct qcom_pdm_data *data;
>>>>>>> -	struct device_node *root;
>>>>>>>  	int ret, i;
>>>>>>>  
>>>>>>> -	root = of_find_node_by_path("/");
>>>>>>> -	if (!root)
>>>>>>> -		return ERR_PTR(-ENODEV);
>>>>>>> -
>>>>>>> -	match = of_match_node(qcom_pdm_domains, root);
>>>>>>> -	of_node_put(root);
>>>>>>> -	if (!match) {
>>>>>>> -		pr_notice("PDM: no support for the platform, userspace daemon might be required.\n");
>>>>>>> -		return ERR_PTR(-ENODEV);
>>>>>>> -	}
>>>>>>> -
>>>>>>> -	domains = match->data;
>>>>>>> +	domains = of_machine_get_match_data(qcom_pdm_domains);
>>>>>>>  	if (!domains) {
>>>>>>> -		pr_debug("PDM: no domains\n");
>>>>>>> +		pr_notice("PDM: no support for the platform or no domains, userspace daemon might be required.\n");
>>>>>>>  		return ERR_PTR(-ENODEV);
>>>>>>>  	}
>>>>>>
>>>>>> Here you are mixing two cases:
>>>>>> - There is not match in the table (in which case the driver should print
>>>>>>   a notice)
>>>>>>
>>>>>> - There is a match in the table, but the data is NULL (the platform
>>>>>>   doesn't have PDM domains). In this case there should be no notice.
>>>>>
>>>>>
>>>>> Why? Existing code printed notice in both cases. Why refactoring which
>>>>> tries to keep code functionally equivalent should change it?
>>>>
>>>> Ah, you mean there was a debug before. Well, then I am a bit confused
>>>> because table has entries without data (so expected condition) but old
>>>> code returned ERRNO in such case - so unexpected condition.
>>>>
>>>> Wail failing the probe on expected condition?
>>>>
>>>> Unless it is not really expected and notice in second case is valid as well.
>>>
>>> If we know that there are no domains on the platform, then the notice
>>> definitely doesn't apply. Failing the probe is a separate topic. The
>>> rest of the code expects that _qcom_pdm_data is not NULL.
>>
>> I hoped that separate topic would be the reason, after commit msg
>> adjustments, to keep this change, but if you insist that this must stay
>> debug, then this patch should be just dropped because it is impossible
>> to achieve with current helpers.
> 
> Having the same pr_notice would be misleading: we point users to running
> userspace daemon, while we _know_ that the daemon is useless because
> there are no PDs. One of the ways to solve it would be to add extra
> wrapping, so that the data in the match table is never NULL.

The message does not matter. It still returns ENODEV which is failing
the probe. This leaves error messages in the dmesg already, if pdm is
ever probed for these devices, so my change of debug->notice here
really, really does not matter. Failing of probe is always a failure of
system, so it is not an expected behavior.

Anyway, I will just drop this change as I said.


Best regards,
Krzysztof

  reply	other threads:[~2025-11-09 19:06 UTC|newest]

Thread overview: 35+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-11-06 19:07 [PATCH 00/13] of: Add wrappers to match root node with OF device ID tables Krzysztof Kozlowski
2025-11-06 19:07 ` [PATCH 01/13] " Krzysztof Kozlowski
2025-11-06 19:53   ` Frank Li
2025-11-07  7:00     ` Krzysztof Kozlowski
2025-11-07 17:11       ` Frank Li
2025-11-06 19:07 ` [PATCH 02/13] cpufreq: dt-platdev: Simplify with of_machine_get_match_data() Krzysztof Kozlowski
2025-11-10 11:07   ` Viresh Kumar
2025-11-06 19:07 ` [PATCH 03/13] cpufreq: mediatek: " Krzysztof Kozlowski
2025-11-10 11:07   ` Viresh Kumar
2025-11-06 19:07 ` [PATCH 04/13] cpufreq: sun50i: Simplify with of_machine_device_match() Krzysztof Kozlowski
2025-11-07 13:12   ` Chen-Yu Tsai
2025-11-10 11:07   ` Viresh Kumar
2025-11-06 19:07 ` [PATCH 05/13] cpufreq: ti: " Krzysztof Kozlowski
2025-11-08 14:38   ` Krzysztof Kozlowski
2025-11-06 19:07 ` [PATCH 06/13] cpuidle: big_little: " Krzysztof Kozlowski
2025-11-06 19:07 ` [PATCH 07/13] firmware: qcom: scm: " Krzysztof Kozlowski
2025-11-07  8:45   ` Konrad Dybcio
2025-11-06 19:07 ` [PATCH 08/13] irqchip/atmel-aic: Simplify with of_machine_get_match_data() Krzysztof Kozlowski
2025-11-10 14:10   ` Nicolas Ferre
2025-11-06 19:07 ` [PATCH 09/13] platform: surface: " Krzysztof Kozlowski
2025-11-10 11:49   ` Ilpo Järvinen
2025-11-06 19:07 ` [PATCH 10/13] powercap: dtpm: " Krzysztof Kozlowski
2025-11-06 19:07 ` [PATCH 11/13] soc: qcom: " Krzysztof Kozlowski
2025-11-07  3:19   ` Dmitry Baryshkov
2025-11-07  7:02     ` Krzysztof Kozlowski
2025-11-07  7:08       ` Krzysztof Kozlowski
2025-11-07 14:23         ` Dmitry Baryshkov
2025-11-07 14:58           ` Krzysztof Kozlowski
2025-11-08 16:31             ` Dmitry Baryshkov
2025-11-09 19:06               ` Krzysztof Kozlowski [this message]
2025-11-06 19:07 ` [PATCH 12/13] soc: qcom: ubwc: " Krzysztof Kozlowski
2025-11-07  3:19   ` Dmitry Baryshkov
2025-11-06 19:07 ` [PATCH 13/13] soc: tegra: Simplify with of_machine_device_match() Krzysztof Kozlowski
2025-11-07 10:41   ` Jon Hunter
2025-11-07  9:12 ` [PATCH 00/13] of: Add wrappers to match root node with OF device ID tables AngeloGioacchino Del Regno

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=86139020-d2bf-4dc8-8b38-d7faba838e46@linaro.org \
    --to=krzysztof.kozlowski@linaro.org \
    --cc=alexandre.belloni@bootlin.com \
    --cc=andersson@kernel.org \
    --cc=angelogioacchino.delregno@collabora.com \
    --cc=claudiu.beznea@tuxon.dev \
    --cc=daniel.lezcano@kernel.org \
    --cc=daniel.lezcano@linaro.org \
    --cc=devicetree@vger.kernel.org \
    --cc=dmitry.baryshkov@oss.qualcomm.com \
    --cc=hansg@kernel.org \
    --cc=ilpo.jarvinen@linux.intel.com \
    --cc=jernej.skrabec@gmail.com \
    --cc=jonathanh@nvidia.com \
    --cc=konradybcio@kernel.org \
    --cc=krzk@kernel.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-arm-msm@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mediatek@lists.infradead.org \
    --cc=linux-pm@vger.kernel.org \
    --cc=linux-sunxi@lists.linux.dev \
    --cc=linux-tegra@vger.kernel.org \
    --cc=lpieralisi@kernel.org \
    --cc=luzmaximilian@gmail.com \
    --cc=matthias.bgg@gmail.com \
    --cc=nicolas.ferre@microchip.com \
    --cc=platform-driver-x86@vger.kernel.org \
    --cc=rafael@kernel.org \
    --cc=robh@kernel.org \
    --cc=samuel@sholland.org \
    --cc=saravanak@google.com \
    --cc=tglx@linutronix.de \
    --cc=thierry.reding@gmail.com \
    --cc=tiny.windzz@gmail.com \
    --cc=viresh.kumar@linaro.org \
    --cc=wens@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).