linux-arm-msm.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Deepak Kumar Singh <deesin@codeaurora.org>
To: Bjorn Andersson <bjorn.andersson@linaro.org>,
	Deepak Kumar Singh <deesin@qti.qualcomm.com>
Cc: clew@codeaurora.org, sibis@codeaurora.org,
	linux-kernel@vger.kernel.org, linux-arm-msm@vger.kernel.org,
	linux-remoteproc@vger.kernel.org, Andy Gross <agross@kernel.org>
Subject: Re: [PATCH V2 1/2] soc: qcom: aoss: Expose send for generic usecase
Date: Wed, 5 May 2021 13:14:07 +0530	[thread overview]
Message-ID: <926738e1-6786-aa6f-5a85-784d624575c7@codeaurora.org> (raw)
In-Reply-To: <YHYJVjvjUyXtrNmC@builder.lan>


On 4/14/2021 2:42 AM, Bjorn Andersson wrote:
> On Thu 08 Apr 23:39 CDT 2021, Deepak Kumar Singh wrote:
> [..]
>> +/**
>> + * qmp_get() - get a qmp handle from a device
>> + * @dev: client device pointer
>> + *
>> + * Return: handle to qmp device on success, ERR_PTR() on failure
>> + */
>> +struct qmp *qmp_get(struct device *dev)
>> +{
>> +	struct platform_device *pdev;
>> +	struct device_node *np;
>> +	struct qmp *qmp;
>> +
>> +	if (!dev || !dev->of_node)
>> +		return ERR_PTR(-EINVAL);
>> +
>> +	np = of_parse_phandle(dev->of_node, "qcom,qmp", 0);
>> +	if (!np)
>> +		return ERR_PTR(-ENODEV);
>> +
>> +	pdev = of_find_device_by_node(np);
>> +	if (!pdev)
>> +		return ERR_PTR(-EINVAL);
>> +
>> +	qmp = platform_get_drvdata(pdev);
>> +	return qmp ? qmp : ERR_PTR(-EPROBE_DEFER);
>> +}
>> +EXPORT_SYMBOL(qmp_get);
>> +
>> +void qmp_put(struct platform_device *pdev)
>> +{
>> +	platform_device_put(pdev);
> I was expecting that the devres allocated struct qmp would stick around
> until the struct device's release callback came. As described in my
> answer to Mani yesterday I was wrong.
>
> As such you need to make sure that struct qmp stays around until
> qmp_remove() and all qmp_put() calls has been made.
>
> I presume a reasonable way to achieve this is to not use devm to
> allocate our struct qmp, add a kref to the object. So this would have to
> be a kref_put() on that instead of the platform_device_put() I asked you
> to implement here.
>
> Sorry about that.
>
>
> The rest of the patch looks good.
>
> Regards,
> Bjorn

Hi Bjorn,

Even if we use kref_put(), would it not require platform_device_put()? 
As per my understanding of_find_device_by_node(np) will increment 
node/pdev kobj refcount which both needs to be decremented.


  reply	other threads:[~2021-05-05  7:44 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-04-09  4:39 [PATCH V2 0/2] " Deepak Kumar Singh
2021-04-09  4:39 ` [PATCH V2 1/2] " Deepak Kumar Singh
2021-04-13 21:12   ` Bjorn Andersson
2021-05-05  7:44     ` Deepak Kumar Singh [this message]
2021-04-09  4:39 ` [PATCH V2 2/2] soc: qcom: aoss: Add debugfs entry Deepak Kumar Singh
2021-04-09  8:09   ` Manivannan Sadhasivam

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=926738e1-6786-aa6f-5a85-784d624575c7@codeaurora.org \
    --to=deesin@codeaurora.org \
    --cc=agross@kernel.org \
    --cc=bjorn.andersson@linaro.org \
    --cc=clew@codeaurora.org \
    --cc=deesin@qti.qualcomm.com \
    --cc=linux-arm-msm@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-remoteproc@vger.kernel.org \
    --cc=sibis@codeaurora.org \
    --subject='Re: [PATCH V2 1/2] soc: qcom: aoss: Expose send for generic usecase' \
    /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

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).