devicetree.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Alexey Klimov" <alexey.klimov@linaro.org>
To: "Krzysztof Kozlowski" <krzk@kernel.org>
Cc: "Srinivas Kandagatla" <srini@kernel.org>,
	"Liam Girdwood" <lgirdwood@gmail.com>,
	"Mark Brown" <broonie@kernel.org>,
	"Rob Herring" <robh@kernel.org>,
	"Krzysztof Kozlowski" <krzk+dt@kernel.org>,
	"Conor Dooley" <conor+dt@kernel.org>,
	"Stephen Boyd" <sboyd@kernel.org>, "Lee Jones" <lee@kernel.org>,
	"Jaroslav Kysela" <perex@perex.cz>,
	"Takashi Iwai" <tiwai@suse.com>, <linux-arm-msm@vger.kernel.org>,
	<linux-sound@vger.kernel.org>, <devicetree@vger.kernel.org>,
	<linux-kernel@vger.kernel.org>,
	"Dmitry Baryshkov" <dmitry.baryshkov@oss.qualcomm.com>,
	"Srinivas Kandagatla" <srinivas.kandagatla@oss.qualcomm.com>
Subject: Re: [PATCH v2 2/3] ASoC: codecs: add new pm4125 audio codec driver
Date: Thu, 14 Aug 2025 00:08:55 +0100	[thread overview]
Message-ID: <DC1OFJFCKMLD.28U6N6FES0OC8@linaro.org> (raw)
In-Reply-To: <20250711-hungry-uppish-taipan-a0a35a@krzk-bin>

On Fri Jul 11, 2025 at 9:29 AM BST, Krzysztof Kozlowski wrote:
> On Fri, Jul 11, 2025 at 04:00:11AM +0100, Alexey Klimov wrote:
>> +static void pm4125_unbind(struct device *dev)
>> +{
>> +	struct pm4125_priv *pm4125 = dev_get_drvdata(dev);
>> +
>> +	snd_soc_unregister_component(dev);
>> +	device_link_remove(dev, pm4125->txdev);
>> +	device_link_remove(dev, pm4125->rxdev);
>> +	device_link_remove(pm4125->rxdev, pm4125->txdev);
>> +	component_unbind_all(dev, pm4125);
>> +}
>> +
>> +static const struct component_master_ops pm4125_comp_ops = {
>> +	.bind = pm4125_bind,
>> +	.unbind = pm4125_unbind,
>> +};
>> +
>> +static int pm4125_add_slave_components(struct pm4125_priv *pm4125, struct device *dev,
>> +				       struct component_match **matchptr)
>> +{
>> +	struct device_node *np = dev->of_node;
>> +
>> +	pm4125->rxnode = of_parse_phandle(np, "qcom,rx-device", 0);
>> +	if (!pm4125->rxnode)
>> +		return dev_err_probe(dev, -ENODEV, "Couldn't parse phandle to qcom,rx-device\n");
>> +	component_match_add_release(dev, matchptr, component_release_of, component_compare_of,
>> +				    pm4125->rxnode);
>> +	of_node_put(pm4125->rxnode);
>
> If you drop it here, then you do not need to keep it in pm4125 in the
> first place. But this will point you to the problem - what if
> pm4125_bind() is called after you dropped the reference?

Thanks for pointing this out.
It looks like that component_release_of callback should handle that so I
don't think we need of_node_put() here at all.

Best regards,
Alexey

  parent reply	other threads:[~2025-08-13 23:08 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-07-11  3:00 [PATCH v2 0/3] Add PM4125 audio codec driver Alexey Klimov
2025-07-11  3:00 ` [PATCH v2 1/3] dt-bindings: sound: add bindings for pm4125 audio codec Alexey Klimov
2025-07-11  8:27   ` Krzysztof Kozlowski
2025-07-18 13:43   ` Lee Jones
2025-07-24 15:17     ` Alexey Klimov
2025-07-24 15:48       ` Krzysztof Kozlowski
2025-08-13 22:28         ` Alexey Klimov
2025-07-11  3:00 ` [PATCH v2 2/3] ASoC: codecs: add new pm4125 audio codec driver Alexey Klimov
2025-07-11  8:29   ` Krzysztof Kozlowski
2025-07-24 15:41     ` Alexey Klimov
2025-08-13 23:08     ` Alexey Klimov [this message]
2025-07-11 13:32   ` Srinivas Kandagatla
2025-08-13 23:07     ` Alexey Klimov
2025-07-11 15:15   ` Christophe JAILLET
2025-08-13 23:04     ` Alexey Klimov
2025-07-11  3:00 ` [PATCH v2 3/3] MAINTAINERS: add Qualcomm PM4125 audio codec to drivers list Alexey Klimov

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=DC1OFJFCKMLD.28U6N6FES0OC8@linaro.org \
    --to=alexey.klimov@linaro.org \
    --cc=broonie@kernel.org \
    --cc=conor+dt@kernel.org \
    --cc=devicetree@vger.kernel.org \
    --cc=dmitry.baryshkov@oss.qualcomm.com \
    --cc=krzk+dt@kernel.org \
    --cc=krzk@kernel.org \
    --cc=lee@kernel.org \
    --cc=lgirdwood@gmail.com \
    --cc=linux-arm-msm@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-sound@vger.kernel.org \
    --cc=perex@perex.cz \
    --cc=robh@kernel.org \
    --cc=sboyd@kernel.org \
    --cc=srini@kernel.org \
    --cc=srinivas.kandagatla@oss.qualcomm.com \
    --cc=tiwai@suse.com \
    /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).