mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Konrad Dybcio <konradybcio@gmail.com>
To: Stephen Boyd <sboyd@kernel.org>,
	AngeloGioacchino Del Regno
	<angelogioacchino.delregno@collabora.com>,
	Joe Hattori <joe@pf.is.s.u-tokyo.ac.jp>,
	Konrad Dybcio <konradybcio@kernel.org>,
	Matthias Brugger <matthias.bgg@gmail.com>,
	Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
Cc: Marijn Suijten <marijn.suijten@somainline.org>,
	linux-kernel@vger.kernel.org,
	Bjorn Andersson <bjorn.andersson@oss.qualcomm.com>,
	Abel Vesa <abel.vesa@linaro.org>,
	Johan Hovold <johan+linaro@kernel.org>,
	linux-arm-kernel@lists.infradead.org,
	linux-mediatek@lists.infradead.org,
	Konrad Dybcio <konrad.dybcio@oss.qualcomm.com>
Subject: Re: [PATCH v2] spmi: Fix controller->node != parent->node breakage
Date: Mon, 13 Jan 2025 23:12:28 +0100	[thread overview]
Message-ID: <58cb6c37-0ea0-4866-a2b1-92cb0f0391a7@gmail.com> (raw)
In-Reply-To: <5b139af8d639e20a14c8bd00e8e03a4a.sboyd@kernel.org>



On 1/13/25 22:52, Stephen Boyd wrote:
> Quoting Konrad Dybcio (2025-01-13 05:02:58)
>> From: Konrad Dybcio <konrad.dybcio@oss.qualcomm.com>
>>
>> On some platforms, like recent Qualcomm SoCs with multi-bus SPMI
>> arbiters, controller->node must be assigned to the individual buses'
>> subnodes, as the slave devices are children of these, like so:
>>
>> arbiter@c400000
>>          spmi@c42d000
>>                  pmic@0
>>
>>          spmi@c432000
>>                  pmic@0
>>
>> The commit referenced in Fixes changed that assignment, such that
>> spmi_controller_alloc() always assumes the PMICs come directly under
>> the arbiter node (which is true when there's only a single bus per
>> controller).
>>
>> Make controller->node specifiable to both benefit from Joe's refcount
>> improvements and un-break the aforementioned platforms.
> 
> How is it broken? I see spmi_pmic_arb_bus_init() calls
> devm_spmi_controller_alloc() which sets the of_node to the parent device
> and then spmi_pmic_arb_bus_init() overwrites that with
> 'ctrl->dev.of_node = node' later on in the same function. That will
> cause one more of_node_put() than is expected. I don't see that removed
> in this patch though, so the leak is still there?
> 
>>
>> Fixes: 821b07853e32 ("spmi: hisi-spmi-controller: manage the OF node reference in device initialization and cleanup")
> 
> I've dropped this patch from my queue. I don't know if we're really
> doing anything better by managing the of_node lifetime in that function
> vs. letting the callers assign the node they want and manage the
> lifetime themselves. Maybe we don't need to do anything? Presumably the
> parent device driver will unregister the controller anyway, so the
> lifetime of the of_node will be ensured regardless. For subnodes like
> qcom SPMI, the subnodes are child nodes of the parent device so they
> won't be removed. If they are dynamic nodes, then the caller can manage
> the lifetime.

Stephen, the wrong node gets assigned in the qcom driver with
multi-master controllers, resulting in probe failures.

Since the introduction of the commit referenced in fixes,
of_spmi_register_devices() sees the controller's subnodes
(which describe each of the two masters) as slave devices
- meaning no "real" devices ever get to probe

Konrad


  reply	other threads:[~2025-01-13 22:12 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-01-13 13:02 Konrad Dybcio
2025-01-13 13:52 ` AngeloGioacchino Del Regno
2025-01-13 21:52 ` Stephen Boyd
2025-01-13 22:12   ` Konrad Dybcio [this message]
2025-01-14 18:30     ` Stephen Boyd
2025-01-14 20:37       ` Konrad Dybcio
2025-01-15 23:16         ` Stephen Boyd
2025-01-16  4:54           ` Joe Hattori

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=58cb6c37-0ea0-4866-a2b1-92cb0f0391a7@gmail.com \
    --to=konradybcio@gmail.com \
    --cc=abel.vesa@linaro.org \
    --cc=angelogioacchino.delregno@collabora.com \
    --cc=bjorn.andersson@oss.qualcomm.com \
    --cc=joe@pf.is.s.u-tokyo.ac.jp \
    --cc=johan+linaro@kernel.org \
    --cc=konrad.dybcio@oss.qualcomm.com \
    --cc=konradybcio@kernel.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mediatek@lists.infradead.org \
    --cc=marijn.suijten@somainline.org \
    --cc=matthias.bgg@gmail.com \
    --cc=mchehab+huawei@kernel.org \
    --cc=sboyd@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

all inboxes | Powered by JetHome®