[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <DBKEDPOEQHOJ.2DA0F5PUZGCJO@linaro.org>
Date: Thu, 24 Jul 2025 16:41:02 +0100
From: "Alexey Klimov" <alexey.klimov@...aro.org>
To: "Krzysztof Kozlowski" <krzk@...nel.org>
Cc: "Srinivas Kandagatla" <srini@...nel.org>, "Liam Girdwood"
<lgirdwood@...il.com>, "Mark Brown" <broonie@...nel.org>, "Rob Herring"
<robh@...nel.org>, "Krzysztof Kozlowski" <krzk+dt@...nel.org>, "Conor
Dooley" <conor+dt@...nel.org>, "Stephen Boyd" <sboyd@...nel.org>, "Lee
Jones" <lee@...nel.org>, "Jaroslav Kysela" <perex@...ex.cz>, "Takashi Iwai"
<tiwai@...e.com>, <linux-arm-msm@...r.kernel.org>,
<linux-sound@...r.kernel.org>, <devicetree@...r.kernel.org>,
<linux-kernel@...r.kernel.org>, "Dmitry Baryshkov"
<dmitry.baryshkov@....qualcomm.com>, "Srinivas Kandagatla"
<srinivas.kandagatla@....qualcomm.com>
Subject: Re: [PATCH v2 2/3] ASoC: codecs: add new pm4125 audio codec driver
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?
So I guess the right place is in pm4125_remove() right after
component_master_del()?
>> +
>> + pm4125->txnode = of_parse_phandle(np, "qcom,tx-device", 0);
>> + if (!pm4125->txnode)
>> + return dev_err_probe(dev, -ENODEV, "Couldn't parse phandle to qcom,tx-device\n");
>> + component_match_add_release(dev, matchptr, component_release_of, component_compare_of,
>> + pm4125->txnode);
>> + of_node_put(pm4125->txnode);
>
> Same problem here.
Thank you,
Alexey
Powered by blists - more mailing lists