public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Mathieu Poirier <mathieu.poirier@linaro.org>
To: Tanmay Shah <tanmay.shah@amd.com>
Cc: andersson@kernel.org, linux-remoteproc@vger.kernel.org,
	linux-kernel@vger.kernel.org, kernel test robot <lkp@intel.com>,
	Tarak Reddy <tarak.reddy@amd.com>
Subject: Re: [PATCH v3 2/2] remoteproc: enhance rproc_put() for clusters
Date: Wed, 5 Apr 2023 11:05:22 -0600	[thread overview]
Message-ID: <20230405170522.GB3812912@p14s> (raw)
In-Reply-To: <20230328164921.1895937-3-tanmay.shah@amd.com>

On Tue, Mar 28, 2023 at 09:49:24AM -0700, Tanmay Shah wrote:
> This patch enhances rproc_put() to support remoteproc clusters
> with multiple child nodes as in rproc_get_by_phandle().
> 
> Reported-by: kernel test robot <lkp@intel.com>
> Link: https://lore.kernel.org/oe-kbuild-all/202303221441.cuBnpvye-lkp@intel.com/
> Signed-off-by: Tarak Reddy <tarak.reddy@amd.com>
> Signed-off-by: Tanmay Shah <tanmay.shah@amd.com>
> ---
> 
> Changes in v3:
>   - remove module_put call that was introduced in the patch by mistake
>   - remove redundant check in rproc_put
>   - Add inline comments in rproc_put that explains functionality
> 
> Changes in v2:
>   - Introduce this patch to fix rproc_put as per modified rproc_get_by_phandle
> 
>  drivers/remoteproc/remoteproc_core.c | 17 ++++++++++++++++-
>  1 file changed, 16 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/remoteproc/remoteproc_core.c b/drivers/remoteproc/remoteproc_core.c
> index a3e7c8798381..d8f28c6fe3a3 100644
> --- a/drivers/remoteproc/remoteproc_core.c
> +++ b/drivers/remoteproc/remoteproc_core.c
> @@ -2559,7 +2559,22 @@ EXPORT_SYMBOL(rproc_free);
>   */
>  void rproc_put(struct rproc *rproc)
>  {
> -	module_put(rproc->dev.parent->driver->owner);
> +	struct platform_device *cluster_pdev;
> +
> +	if (rproc->dev.parent->driver) {
> +		module_put(rproc->dev.parent->driver->owner);
> +	} else {
> +		/*
> +		 * If the remoteproc's parent does not have a driver,
> +		 * driver is associated with the cluster.
> +		 */
> +		cluster_pdev = of_find_device_by_node(rproc->dev.parent->of_node->parent);
> +		if (cluster_pdev) {
> +			module_put(cluster_pdev->dev.driver->owner);
> +			put_device(&cluster_pdev->dev);
> +		}
> +	}
> +

This looks good to me now.

Bjorn, please have a look at this set when you have a minute.

Thanks,
Mathieu

>  	put_device(&rproc->dev);
>  }
>  EXPORT_SYMBOL(rproc_put);
> -- 
> 2.25.1
> 

      reply	other threads:[~2023-04-05 17:05 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-03-28 16:49 [PATCH v3 0/2] remoteproc: get rproc devices for clusters Tanmay Shah
2023-03-28 16:49 ` [PATCH v3 1/2] remoteproc: Make rproc_get_by_phandle() work " Tanmay Shah
2023-03-28 16:49 ` [PATCH v3 2/2] remoteproc: enhance rproc_put() " Tanmay Shah
2023-04-05 17:05   ` Mathieu Poirier [this message]

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=20230405170522.GB3812912@p14s \
    --to=mathieu.poirier@linaro.org \
    --cc=andersson@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-remoteproc@vger.kernel.org \
    --cc=lkp@intel.com \
    --cc=tanmay.shah@amd.com \
    --cc=tarak.reddy@amd.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