From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-wr1-f46.google.com (mail-wr1-f46.google.com [209.85.221.46]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 0083A221554 for ; Sun, 9 Nov 2025 19:06:23 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.221.46 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1762715186; cv=none; b=ofuhaZLEaCuoUiR+9A0ya38dlSyNHUTGTBkpv93urhgBh1LFBPxeU9Lho77nqso8x74fQYR4vKmep1GJoBVG9Q3RvLz6hVdSZ0aMpgUoAIHHJLOZZjWOuBnEEfmP51JE8fgjo4xYsloZWxhS+zBnKz+ZIjrjH7fwSd5Oxl6rIoE= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1762715186; c=relaxed/simple; bh=Tz6nhPicBjCYLSfhTOnICUxIjj/xdpDaK6V9VOSBwHA=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=gFexAfY8z8jxgGU3kPUq7+t62gwICLeUG+U+bb8DAfGgtKU/M6Ocq4db6SVsSseqbNKJ2scKMGe1w/6K/VVN9FCXXLDmZKkuujtFfJHJqMjsrzJR4mxdB/jrxyQRECdZzdDrZ64xuRQ34sh9PdvShzX+89La67mwgjMhp3G+MhY= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org; spf=pass smtp.mailfrom=linaro.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b=B65LChY6; arc=none smtp.client-ip=209.85.221.46 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linaro.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="B65LChY6" Received: by mail-wr1-f46.google.com with SMTP id ffacd0b85a97d-429c84bf326so191783f8f.3 for ; Sun, 09 Nov 2025 11:06:23 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1762715182; x=1763319982; darn=vger.kernel.org; h=content-transfer-encoding:in-reply-to:autocrypt:content-language :from:references:cc:to:subject:user-agent:mime-version:date :message-id:from:to:cc:subject:date:message-id:reply-to; bh=1Y3W5ywvn7drSnOuge5r3/YGn5rwH+Mp+hb7awIgl3s=; b=B65LChY6jJUiR7kXvfDNjLOTHeMfkhSj8MCFPILDsx4naw8lCKBjVAE6TL0T//SZ85 VVYbdFvuU/9PDgsDB1OS4kUDbzDE8lG0rVXeXbpJN2LWVAMU0rSszpTXH3qgyGg+MRN9 7JXg/p8dZnOTCokVt1jyNtpuOn9yPX0p54SRNysSfCVAZ8zYPvHWIgREvFu0V8v6sZef 3pjyQaQqRPdXy57eHc/L9GOkKSRCgRVZ7J/ZLW4WzM5Q+JxtwjpLkV5S8ixrtKM7p12F MSsYTs6azESLWQramtm0czari3LdUOWjq25zdjZBHotkC1WyFDxT+8dZ4oUsJd60oTrx r3Lw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1762715182; x=1763319982; h=content-transfer-encoding:in-reply-to:autocrypt:content-language :from:references:cc:to:subject:user-agent:mime-version:date :message-id:x-gm-gg:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=1Y3W5ywvn7drSnOuge5r3/YGn5rwH+Mp+hb7awIgl3s=; b=AAXWtK0SpEBcjVeugbzHMWUMTmqq6V0F0+78ZJ89V5bcgYL75fitfZ6VILcmgQygwT wkbR47FR8sEfKt/zlSr3T9h+Ek+ClN7IbDxznGc2KDD91nS5noqDDKS8s9GTt7lbW26r QDT5zY6dZwfe0Ntv7vv2dkNS4pEqHUbQOmLSvlNKnskf+jPwynPD+rNAYWl4lOdCBt5J LJr+760rTOQFEYBtBbiZJmPqMYSwyfr9vR9mOz8g2fAB73w1Qr09CGEaeECroqc/Cads vnpj6nkM9rNtfVy3jyLHu8APwhsX7Rw1eKpk5767LWKGROfrkOzPJkL94pNjHgZk6mHI AcBg== X-Forwarded-Encrypted: i=1; AJvYcCW048xYXSCaOSU+ZXhzMgAgxmWhAYlBxKojuTx4r0yifPaf4Xl14tL9DJlYMBZdtYLj6d3dAC9IIt8ij91D@vger.kernel.org X-Gm-Message-State: AOJu0YxvsSUOoNPceTaTrv2arXNDM6xbwXITNSpnYHr77i3m2+FfKjsI 57uKc0b42YRjcYOPit6ypXjHaXTJy2Zn9oBfGd7JE+P7OFwWUPgl0wAlqoQkItDMyrw= X-Gm-Gg: ASbGncvr3gsuhaT4ZjlCycjlO9+jnlIgPI5e9uaIQdvmo/9HOAZb6iImYRs6DffZRtq A8H2EKFOW/OMn04SDk43lsrIknxEdJAwXfr/0bjuETVyPs+2wdKM742A2un1qz6dz+MPavyMNS5 cfdE2OTfQHXD4rveKktm5dd1Rxd8H9iOuE79BhLzWfnhGxT9lHPybJQDVzKZz15WZRaomALdACb U3y4CKXUQsDvIGS5ZKcXq8r6SGWwGONxiU1tgHCZ5ELKbFeF9CF4GQM6tPQUXwEoPBN1YQL73XG CBhcQay7YL02OQoGga1zZ1xbQZtyKV5TChapfUQfijAkCh0BbB/fXU/Bhx6aD4QG+PIMU7P2wZs 9TZ7UJGJv69FEK44WICFnnvVgacl7hsq4MZQyUwzM91F44BbQWW/6ELQvDmjZdGBfOFKN6s0joF OiwB5Jf50GUBr7B6wIZCxOF7UPm1U/CI4= X-Google-Smtp-Source: AGHT+IE/lbhJ0vCe2mId2P7awStumT/sI1M3BLEL1gPp+PFhAxOunSK8kwDpAn8OgL+MDe5CdFcyfg== X-Received: by 2002:a05:6000:2002:b0:426:fe0a:1bb3 with SMTP id ffacd0b85a97d-42b2dcab74dmr2388569f8f.7.1762715182253; Sun, 09 Nov 2025 11:06:22 -0800 (PST) Received: from [192.168.1.29] ([178.197.219.123]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-42b380a3a30sm4153513f8f.4.2025.11.09.11.06.19 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Sun, 09 Nov 2025 11:06:21 -0800 (PST) Message-ID: <86139020-d2bf-4dc8-8b38-d7faba838e46@linaro.org> Date: Sun, 9 Nov 2025 20:06:18 +0100 Precedence: bulk X-Mailing-List: linux-arm-msm@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH 11/13] soc: qcom: Simplify with of_machine_get_match_data() To: Dmitry Baryshkov , Krzysztof Kozlowski Cc: Rob Herring , Saravana Kannan , "Rafael J. Wysocki" , Viresh Kumar , Matthias Brugger , AngeloGioacchino Del Regno , Yangtao Li , Chen-Yu Tsai , Jernej Skrabec , Samuel Holland , Lorenzo Pieralisi , Daniel Lezcano , Bjorn Andersson , Konrad Dybcio , Thomas Gleixner , Nicolas Ferre , Alexandre Belloni , Claudiu Beznea , Maximilian Luz , Hans de Goede , =?UTF-8?Q?Ilpo_J=C3=A4rvinen?= , Daniel Lezcano , Thierry Reding , Jonathan Hunter , 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 References: <20251106-b4-of-match-matchine-data-v1-0-d780ea1780c2@linaro.org> <20251106-b4-of-match-matchine-data-v1-11-d780ea1780c2@linaro.org> <8fc8c945-ae67-4c58-837d-40bdf4d60035@kernel.org> <3q5bpkktogs3pxjboihynjduabqrcuayyexjqdv3cgp5krjaxo@afnknyguuzxl> From: Krzysztof Kozlowski Content-Language: en-US Autocrypt: addr=krzysztof.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cVUqa+XdUEciwG/SgNyxBZepj41oVq FPSVE+Ni2tNrW/e16b8mgXNngHSnbsr6pAIXZH3qFW+4TKPMGZ2rZ6zITrMip+12jgw4mGjy 5y06JZvA02rZT2k9aa7i9dUUFggaanI09jNGbRA/ABEBAAHCwXwEGAEKACYCGwwWIQSb0H4O DFH41ZZ3t1Qbk0N9O0FimwUCaBdQXwUJFpZbKgAKCRAbk0N9O0Fim07TD/92Vcmzn/jaEBcq yT48ODfDIQVvg2nIDW+qbHtJ8DOT0d/qVbBTU7oBuo0xuHo+MTBp0pSTWbThLsSN1AuyP8wF KChC0JPcwOZZRS0dl3lFgg+c+rdZUHjsa247r+7fvm2zGG1/u+33lBJgnAIH5lSCjhP4VXiG q5ngCxGRuBq+0jNCKyAOC/vq2cS/dgdXwmf2aL8G7QVREX7mSl0x+CjWyrpFc1D/9NV/zIWB G1NR1fFb+oeOVhRGubYfiS62htUQjGLK7qbTmrd715kH9Noww1U5HH7WQzePt/SvC0RhQXNj XKBB+lwwM+XulFigmMF1KybRm7MNoLBrGDa3yGpAkHMkJ7NM4iSMdSxYAr60RtThnhKc2kLI zd8GqyBh0nGPIL+1ZVMBDXw1Eu0/Du0rWt1zAKXQYVAfBLCTmkOnPU0fjR7qVT41xdJ6KqQM NGQeV+0o9X91X6VBeK6Na3zt5y4eWkve65DRlk1aoeBmhAteioLZlXkqu0pZv+PKIVf+zFKu h0At/TN/618e/QVlZPbMeNSp3S3ieMP9Q6y4gw5CfgiDRJ2K9g99m6Rvlx1qwom6QbU06ltb vJE2K9oKd9nPp1NrBfBdEhX8oOwdCLJXEq83vdtOEqE42RxfYta4P3by0BHpcwzYbmi/Et7T 2+47PN9NZAOyb771QoVr8A== In-Reply-To: <3q5bpkktogs3pxjboihynjduabqrcuayyexjqdv3cgp5krjaxo@afnknyguuzxl> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit 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 >>>>>>> >>>>>>> --- >>>>>>> >>>>>>> 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