[v4,2/2] remoteproc: enhance rproc_put() for clusters

Message ID 20240103221124.3063683-3-tanmay.shah@amd.com
State New
Headers
Series remoteproc: get rproc devices for clusters |

Commit Message

Tanmay Shah Jan. 3, 2024, 10:11 p.m. UTC
  This patch enhances rproc_put() to support remoteproc clusters
with multiple child nodes as in rproc_get_by_phandle().

Signed-off-by: Tarak Reddy <tarak.reddy@amd.com>
Signed-off-by: Tanmay Shah <tanmay.shah@amd.com>
---
 drivers/remoteproc/remoteproc_core.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)
  

Comments

Bjorn Andersson Jan. 26, 2024, 5:38 p.m. UTC | #1
On Wed, Jan 03, 2024 at 02:11:25PM -0800, Tanmay Shah wrote:
> This patch enhances rproc_put() to support remoteproc clusters
> with multiple child nodes as in rproc_get_by_phandle().
> 
> Signed-off-by: Tarak Reddy <tarak.reddy@amd.com>
> Signed-off-by: Tanmay Shah <tanmay.shah@amd.com>

As described in the first patch, this documents that Tarak first
certified the origin of this patch, then you certify the origin as you
handle the patch.

But according to From: you're the author, so how could Tarak have
certified the origin before you authored the patch?

Either correct the author, or add Co-developed-by, if that's what
happened.

> ---
>  drivers/remoteproc/remoteproc_core.c | 6 +++++-
>  1 file changed, 5 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/remoteproc/remoteproc_core.c b/drivers/remoteproc/remoteproc_core.c
> index 0b3b34085e2f..f276956f2c5c 100644
> --- a/drivers/remoteproc/remoteproc_core.c
> +++ b/drivers/remoteproc/remoteproc_core.c
> @@ -2554,7 +2554,11 @@ EXPORT_SYMBOL(rproc_free);
>   */
>  void rproc_put(struct rproc *rproc)
>  {
> -	module_put(rproc->dev.parent->driver->owner);
> +	if (rproc->dev.parent->driver)
> +		module_put(rproc->dev.parent->driver->owner);
> +	else
> +		module_put(rproc->dev.parent->parent->driver->owner);
> +

This does however highlight a bug that was introduced by patch 1, please
avoid this by squashing the two patches together (and use
Co-developed-by as needed).

Regards,
Bjorn

>  	put_device(&rproc->dev);
>  }
>  EXPORT_SYMBOL(rproc_put);
> -- 
> 2.25.1
>
  
Tanmay Shah Jan. 29, 2024, 5:43 p.m. UTC | #2
On 1/26/24 11:38 AM, Bjorn Andersson wrote:
> On Wed, Jan 03, 2024 at 02:11:25PM -0800, Tanmay Shah wrote:
> > This patch enhances rproc_put() to support remoteproc clusters
> > with multiple child nodes as in rproc_get_by_phandle().
> > 
> > Signed-off-by: Tarak Reddy <tarak.reddy@amd.com>
> > Signed-off-by: Tanmay Shah <tanmay.shah@amd.com>
>
> As described in the first patch, this documents that Tarak first
> certified the origin of this patch, then you certify the origin as you
> handle the patch.
>
> But according to From: you're the author, so how could Tarak have
> certified the origin before you authored the patch?
>
> Either correct the author, or add Co-developed-by, if that's what
> happened.
>
> > ---
> >  drivers/remoteproc/remoteproc_core.c | 6 +++++-
> >  1 file changed, 5 insertions(+), 1 deletion(-)
> > 
> > diff --git a/drivers/remoteproc/remoteproc_core.c b/drivers/remoteproc/remoteproc_core.c
> > index 0b3b34085e2f..f276956f2c5c 100644
> > --- a/drivers/remoteproc/remoteproc_core.c
> > +++ b/drivers/remoteproc/remoteproc_core.c
> > @@ -2554,7 +2554,11 @@ EXPORT_SYMBOL(rproc_free);
> >   */
> >  void rproc_put(struct rproc *rproc)
> >  {
> > -	module_put(rproc->dev.parent->driver->owner);
> > +	if (rproc->dev.parent->driver)
> > +		module_put(rproc->dev.parent->driver->owner);
> > +	else
> > +		module_put(rproc->dev.parent->parent->driver->owner);
> > +
>
> This does however highlight a bug that was introduced by patch 1, please
> avoid this by squashing the two patches together (and use
> Co-developed-by as needed).

Thanks Bjorn for catching this. This change originally was developed by Tarak, but I sent upstream based on his patch so I missed

to update his name as author. I should update author name.

However, if we are going to squash this in first patch, then I think, first patch's author will stay as it is.

Following Action Item on me for v5:

1) Fix commit text in first patch.

2) Squash second patch in first.

3) Add my s-o-b signature after Mathieu's

4) Add Tarak's s-o-b as well. As he developed second patch.

Hope got it all.


Thanks,

Tanmay

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

Patch

diff --git a/drivers/remoteproc/remoteproc_core.c b/drivers/remoteproc/remoteproc_core.c
index 0b3b34085e2f..f276956f2c5c 100644
--- a/drivers/remoteproc/remoteproc_core.c
+++ b/drivers/remoteproc/remoteproc_core.c
@@ -2554,7 +2554,11 @@  EXPORT_SYMBOL(rproc_free);
  */
 void rproc_put(struct rproc *rproc)
 {
-	module_put(rproc->dev.parent->driver->owner);
+	if (rproc->dev.parent->driver)
+		module_put(rproc->dev.parent->driver->owner);
+	else
+		module_put(rproc->dev.parent->parent->driver->owner);
+
 	put_device(&rproc->dev);
 }
 EXPORT_SYMBOL(rproc_put);