diff mbox

[v2,1/5] clk: remove duplicated code with __clk_set_parent_after

Message ID 1431610143-21853-2-git-send-email-aisheng.dong@freescale.com (mailing list archive)
State New, archived
Headers show

Commit Message

Dong Aisheng May 14, 2015, 1:28 p.m. UTC
__clk_set_parent_after() actually used the second argument then we
could put this duplicate logic in there and call it with a different
order of arguments in the success vs. error paths in this function.

Cc: Mike Turquette <mturquette@linaro.org>
Cc: Stephen Boyd <sboyd@codeaurora.org>
Suggested-by: Stephen Boyd <sboyd@codeaurora.org>
Signed-off-by: Dong Aisheng <aisheng.dong@freescale.com>
---
 drivers/clk/clk.c | 8 +-------
 1 file changed, 1 insertion(+), 7 deletions(-)

Comments

Mike Turquette May 28, 2015, 4:09 a.m. UTC | #1
Quoting Dong Aisheng (2015-05-14 06:28:59)
> __clk_set_parent_after() actually used the second argument then we
> could put this duplicate logic in there and call it with a different
> order of arguments in the success vs. error paths in this function.
> 
> Cc: Mike Turquette <mturquette@linaro.org>
> Cc: Stephen Boyd <sboyd@codeaurora.org>
> Suggested-by: Stephen Boyd <sboyd@codeaurora.org>
> Signed-off-by: Dong Aisheng <aisheng.dong@freescale.com>

Patch looks good to me.

Also just noticed that the second argument to __clk_set_parent_after is
never used :-(

Regards,
Mike

> ---
>  drivers/clk/clk.c | 8 +-------
>  1 file changed, 1 insertion(+), 7 deletions(-)
> 
> diff --git a/drivers/clk/clk.c b/drivers/clk/clk.c
> index 659f2b0..0e813ea 100644
> --- a/drivers/clk/clk.c
> +++ b/drivers/clk/clk.c
> @@ -1159,14 +1159,8 @@ static int __clk_set_parent(struct clk_core *core, struct clk_core *parent,
>                 flags = clk_enable_lock();
>                 clk_reparent(core, old_parent);
>                 clk_enable_unlock(flags);
> +               __clk_set_parent_after(core, old_parent, parent);
>  
> -               if (core->prepare_count) {
> -                       flags = clk_enable_lock();
> -                       clk_core_disable(core);
> -                       clk_core_disable(parent);
> -                       clk_enable_unlock(flags);
> -                       clk_core_unprepare(parent);
> -               }
>                 return ret;
>         }
>  
> -- 
> 1.9.1
>
Aisheng Dong May 28, 2015, 8:25 a.m. UTC | #2
On Wed, May 27, 2015 at 09:09:19PM -0700, Michael Turquette wrote:
> Quoting Dong Aisheng (2015-05-14 06:28:59)
> > __clk_set_parent_after() actually used the second argument then we
> > could put this duplicate logic in there and call it with a different
> > order of arguments in the success vs. error paths in this function.
> > 
> > Cc: Mike Turquette <mturquette@linaro.org>
> > Cc: Stephen Boyd <sboyd@codeaurora.org>
> > Suggested-by: Stephen Boyd <sboyd@codeaurora.org>
> > Signed-off-by: Dong Aisheng <aisheng.dong@freescale.com>
> 
> Patch looks good to me.
> 

Thanks for the review.

> Also just noticed that the second argument to __clk_set_parent_after is
> never used :-(
> 

Yes, before this patch series, it's never used. :)

Regards
Dong Aisheng

> Regards,
> Mike
> 
> > ---
> >  drivers/clk/clk.c | 8 +-------
> >  1 file changed, 1 insertion(+), 7 deletions(-)
> > 
> > diff --git a/drivers/clk/clk.c b/drivers/clk/clk.c
> > index 659f2b0..0e813ea 100644
> > --- a/drivers/clk/clk.c
> > +++ b/drivers/clk/clk.c
> > @@ -1159,14 +1159,8 @@ static int __clk_set_parent(struct clk_core *core, struct clk_core *parent,
> >                 flags = clk_enable_lock();
> >                 clk_reparent(core, old_parent);
> >                 clk_enable_unlock(flags);
> > +               __clk_set_parent_after(core, old_parent, parent);
> >  
> > -               if (core->prepare_count) {
> > -                       flags = clk_enable_lock();
> > -                       clk_core_disable(core);
> > -                       clk_core_disable(parent);
> > -                       clk_enable_unlock(flags);
> > -                       clk_core_unprepare(parent);
> > -               }
> >                 return ret;
> >         }
> >  
> > -- 
> > 1.9.1
> >
Aisheng Dong July 15, 2015, 12:25 p.m. UTC | #3
Hi Mike,

On Wed, May 27, 2015 at 09:09:19PM -0700, Michael Turquette wrote:
> Quoting Dong Aisheng (2015-05-14 06:28:59)
> > __clk_set_parent_after() actually used the second argument then we
> > could put this duplicate logic in there and call it with a different
> > order of arguments in the success vs. error paths in this function.
> > 
> > Cc: Mike Turquette <mturquette@linaro.org>
> > Cc: Stephen Boyd <sboyd@codeaurora.org>
> > Suggested-by: Stephen Boyd <sboyd@codeaurora.org>
> > Signed-off-by: Dong Aisheng <aisheng.dong@freescale.com>
> 
> Patch looks good to me.
> 
> Also just noticed that the second argument to __clk_set_parent_after is
> never used :-(
> 

Ping...

I did not see this patch series in your tree for v4.2 rc.
Is this got missed?

Regards
Dong Aisheng

> Regards,
> Mike
> 
> > ---
> >  drivers/clk/clk.c | 8 +-------
> >  1 file changed, 1 insertion(+), 7 deletions(-)
> > 
> > diff --git a/drivers/clk/clk.c b/drivers/clk/clk.c
> > index 659f2b0..0e813ea 100644
> > --- a/drivers/clk/clk.c
> > +++ b/drivers/clk/clk.c
> > @@ -1159,14 +1159,8 @@ static int __clk_set_parent(struct clk_core *core, struct clk_core *parent,
> >                 flags = clk_enable_lock();
> >                 clk_reparent(core, old_parent);
> >                 clk_enable_unlock(flags);
> > +               __clk_set_parent_after(core, old_parent, parent);
> >  
> > -               if (core->prepare_count) {
> > -                       flags = clk_enable_lock();
> > -                       clk_core_disable(core);
> > -                       clk_core_disable(parent);
> > -                       clk_enable_unlock(flags);
> > -                       clk_core_unprepare(parent);
> > -               }
> >                 return ret;
> >         }
> >  
> > -- 
> > 1.9.1
> >
Aisheng Dong July 15, 2015, 12:29 p.m. UTC | #4
On Wed, Jul 15, 2015 at 08:25:24PM +0800, Dong Aisheng wrote:
> Hi Mike,
> 
> On Wed, May 27, 2015 at 09:09:19PM -0700, Michael Turquette wrote:
> > Quoting Dong Aisheng (2015-05-14 06:28:59)
> > > __clk_set_parent_after() actually used the second argument then we
> > > could put this duplicate logic in there and call it with a different
> > > order of arguments in the success vs. error paths in this function.
> > > 
> > > Cc: Mike Turquette <mturquette@linaro.org>
> > > Cc: Stephen Boyd <sboyd@codeaurora.org>
> > > Suggested-by: Stephen Boyd <sboyd@codeaurora.org>
> > > Signed-off-by: Dong Aisheng <aisheng.dong@freescale.com>
> > 
> > Patch looks good to me.
> > 
> > Also just noticed that the second argument to __clk_set_parent_after is
> > never used :-(
> > 
> 
> Ping...
> 
> I did not see this patch series in your tree for v4.2 rc.
> Is this got missed?
> 

Updated Mike's email address.

Regards
Dong Aisheng

> Regards
> Dong Aisheng
> 
> > Regards,
> > Mike
> > 
> > > ---
> > >  drivers/clk/clk.c | 8 +-------
> > >  1 file changed, 1 insertion(+), 7 deletions(-)
> > > 
> > > diff --git a/drivers/clk/clk.c b/drivers/clk/clk.c
> > > index 659f2b0..0e813ea 100644
> > > --- a/drivers/clk/clk.c
> > > +++ b/drivers/clk/clk.c
> > > @@ -1159,14 +1159,8 @@ static int __clk_set_parent(struct clk_core *core, struct clk_core *parent,
> > >                 flags = clk_enable_lock();
> > >                 clk_reparent(core, old_parent);
> > >                 clk_enable_unlock(flags);
> > > +               __clk_set_parent_after(core, old_parent, parent);
> > >  
> > > -               if (core->prepare_count) {
> > > -                       flags = clk_enable_lock();
> > > -                       clk_core_disable(core);
> > > -                       clk_core_disable(parent);
> > > -                       clk_enable_unlock(flags);
> > > -                       clk_core_unprepare(parent);
> > > -               }
> > >                 return ret;
> > >         }
> > >  
> > > -- 
> > > 1.9.1
> > >
Aisheng Dong July 22, 2015, 2:08 p.m. UTC | #5
Ping...

On Wed, Jul 15, 2015 at 08:29:56PM +0800, Dong Aisheng wrote:
> On Wed, Jul 15, 2015 at 08:25:24PM +0800, Dong Aisheng wrote:
> > Hi Mike,
> > 
> > On Wed, May 27, 2015 at 09:09:19PM -0700, Michael Turquette wrote:
> > > Quoting Dong Aisheng (2015-05-14 06:28:59)
> > > > __clk_set_parent_after() actually used the second argument then we
> > > > could put this duplicate logic in there and call it with a different
> > > > order of arguments in the success vs. error paths in this function.
> > > > 
> > > > Cc: Mike Turquette <mturquette@linaro.org>
> > > > Cc: Stephen Boyd <sboyd@codeaurora.org>
> > > > Suggested-by: Stephen Boyd <sboyd@codeaurora.org>
> > > > Signed-off-by: Dong Aisheng <aisheng.dong@freescale.com>
> > > 
> > > Patch looks good to me.
> > > 
> > > Also just noticed that the second argument to __clk_set_parent_after is
> > > never used :-(
> > > 
> > 
> > Ping...
> > 
> > I did not see this patch series in your tree for v4.2 rc.
> > Is this got missed?
> > 
> 
> Updated Mike's email address.
> 
> Regards
> Dong Aisheng
> 
> > Regards
> > Dong Aisheng
> > 
> > > Regards,
> > > Mike
> > > 
> > > > ---
> > > >  drivers/clk/clk.c | 8 +-------
> > > >  1 file changed, 1 insertion(+), 7 deletions(-)
> > > > 
> > > > diff --git a/drivers/clk/clk.c b/drivers/clk/clk.c
> > > > index 659f2b0..0e813ea 100644
> > > > --- a/drivers/clk/clk.c
> > > > +++ b/drivers/clk/clk.c
> > > > @@ -1159,14 +1159,8 @@ static int __clk_set_parent(struct clk_core *core, struct clk_core *parent,
> > > >                 flags = clk_enable_lock();
> > > >                 clk_reparent(core, old_parent);
> > > >                 clk_enable_unlock(flags);
> > > > +               __clk_set_parent_after(core, old_parent, parent);
> > > >  
> > > > -               if (core->prepare_count) {
> > > > -                       flags = clk_enable_lock();
> > > > -                       clk_core_disable(core);
> > > > -                       clk_core_disable(parent);
> > > > -                       clk_enable_unlock(flags);
> > > > -                       clk_core_unprepare(parent);
> > > > -               }
> > > >                 return ret;
> > > >         }
> > > >  
> > > > -- 
> > > > 1.9.1
> > > >
Michael Turquette July 24, 2015, 12:11 a.m. UTC | #6
Quoting Dong Aisheng (2015-07-22 07:08:10)
> Ping...
> 
> On Wed, Jul 15, 2015 at 08:29:56PM +0800, Dong Aisheng wrote:
> > On Wed, Jul 15, 2015 at 08:25:24PM +0800, Dong Aisheng wrote:
> > > Hi Mike,
> > > 
> > > On Wed, May 27, 2015 at 09:09:19PM -0700, Michael Turquette wrote:
> > > > Quoting Dong Aisheng (2015-05-14 06:28:59)
> > > > > __clk_set_parent_after() actually used the second argument then we
> > > > > could put this duplicate logic in there and call it with a different
> > > > > order of arguments in the success vs. error paths in this function.
> > > > > 
> > > > > Cc: Mike Turquette <mturquette@linaro.org>
> > > > > Cc: Stephen Boyd <sboyd@codeaurora.org>
> > > > > Suggested-by: Stephen Boyd <sboyd@codeaurora.org>
> > > > > Signed-off-by: Dong Aisheng <aisheng.dong@freescale.com>
> > > > 
> > > > Patch looks good to me.
> > > > 
> > > > Also just noticed that the second argument to __clk_set_parent_after is
> > > > never used :-(
> > > > 
> > > 
> > > Ping...
> > > 
> > > I did not see this patch series in your tree for v4.2 rc.
> > > Is this got missed?

Dong Aisheng,

Yes it was missed. My apologies. Can you refresh it and re-send?

Thanks,
Mike

> > > 
> > 
> > Updated Mike's email address.
> > 
> > Regards
> > Dong Aisheng
> > 
> > > Regards
> > > Dong Aisheng
> > > 
> > > > Regards,
> > > > Mike
> > > > 
> > > > > ---
> > > > >  drivers/clk/clk.c | 8 +-------
> > > > >  1 file changed, 1 insertion(+), 7 deletions(-)
> > > > > 
> > > > > diff --git a/drivers/clk/clk.c b/drivers/clk/clk.c
> > > > > index 659f2b0..0e813ea 100644
> > > > > --- a/drivers/clk/clk.c
> > > > > +++ b/drivers/clk/clk.c
> > > > > @@ -1159,14 +1159,8 @@ static int __clk_set_parent(struct clk_core *core, struct clk_core *parent,
> > > > >                 flags = clk_enable_lock();
> > > > >                 clk_reparent(core, old_parent);
> > > > >                 clk_enable_unlock(flags);
> > > > > +               __clk_set_parent_after(core, old_parent, parent);
> > > > >  
> > > > > -               if (core->prepare_count) {
> > > > > -                       flags = clk_enable_lock();
> > > > > -                       clk_core_disable(core);
> > > > > -                       clk_core_disable(parent);
> > > > > -                       clk_enable_unlock(flags);
> > > > > -                       clk_core_unprepare(parent);
> > > > > -               }
> > > > >                 return ret;
> > > > >         }
> > > > >  
> > > > > -- 
> > > > > 1.9.1
> > > > > 
> --
> To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> Please read the FAQ at  http://www.tux.org/lkml/
Aisheng Dong July 24, 2015, 3:23 a.m. UTC | #7
On Thu, Jul 23, 2015 at 05:11:35PM -0700, Michael Turquette wrote:
> Quoting Dong Aisheng (2015-07-22 07:08:10)
> > Ping...
> > 
> > On Wed, Jul 15, 2015 at 08:29:56PM +0800, Dong Aisheng wrote:
> > > On Wed, Jul 15, 2015 at 08:25:24PM +0800, Dong Aisheng wrote:
> > > > Hi Mike,
> > > > 
> > > > On Wed, May 27, 2015 at 09:09:19PM -0700, Michael Turquette wrote:
> > > > > Quoting Dong Aisheng (2015-05-14 06:28:59)
> > > > > > __clk_set_parent_after() actually used the second argument then we
> > > > > > could put this duplicate logic in there and call it with a different
> > > > > > order of arguments in the success vs. error paths in this function.
> > > > > > 
> > > > > > Cc: Mike Turquette <mturquette@linaro.org>
> > > > > > Cc: Stephen Boyd <sboyd@codeaurora.org>
> > > > > > Suggested-by: Stephen Boyd <sboyd@codeaurora.org>
> > > > > > Signed-off-by: Dong Aisheng <aisheng.dong@freescale.com>
> > > > > 
> > > > > Patch looks good to me.
> > > > > 
> > > > > Also just noticed that the second argument to __clk_set_parent_after is
> > > > > never used :-(
> > > > > 
> > > > 
> > > > Ping...
> > > > 
> > > > I did not see this patch series in your tree for v4.2 rc.
> > > > Is this got missed?
> 
> Dong Aisheng,
> 
> Yes it was missed. My apologies. Can you refresh it and re-send?
> 

Will do it.
Thanks

Regards
Dong Aisheng

> Thanks,
> Mike
> 
> > > > 
> > > 
> > > Updated Mike's email address.
> > > 
> > > Regards
> > > Dong Aisheng
> > > 
> > > > Regards
> > > > Dong Aisheng
> > > > 
> > > > > Regards,
> > > > > Mike
> > > > > 
> > > > > > ---
> > > > > >  drivers/clk/clk.c | 8 +-------
> > > > > >  1 file changed, 1 insertion(+), 7 deletions(-)
> > > > > > 
> > > > > > diff --git a/drivers/clk/clk.c b/drivers/clk/clk.c
> > > > > > index 659f2b0..0e813ea 100644
> > > > > > --- a/drivers/clk/clk.c
> > > > > > +++ b/drivers/clk/clk.c
> > > > > > @@ -1159,14 +1159,8 @@ static int __clk_set_parent(struct clk_core *core, struct clk_core *parent,
> > > > > >                 flags = clk_enable_lock();
> > > > > >                 clk_reparent(core, old_parent);
> > > > > >                 clk_enable_unlock(flags);
> > > > > > +               __clk_set_parent_after(core, old_parent, parent);
> > > > > >  
> > > > > > -               if (core->prepare_count) {
> > > > > > -                       flags = clk_enable_lock();
> > > > > > -                       clk_core_disable(core);
> > > > > > -                       clk_core_disable(parent);
> > > > > > -                       clk_enable_unlock(flags);
> > > > > > -                       clk_core_unprepare(parent);
> > > > > > -               }
> > > > > >                 return ret;
> > > > > >         }
> > > > > >  
> > > > > > -- 
> > > > > > 1.9.1
> > > > > > 
> > --
> > To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
> > the body of a message to majordomo@vger.kernel.org
> > More majordomo info at  http://vger.kernel.org/majordomo-info.html
> > Please read the FAQ at  http://www.tux.org/lkml/
diff mbox

Patch

diff --git a/drivers/clk/clk.c b/drivers/clk/clk.c
index 659f2b0..0e813ea 100644
--- a/drivers/clk/clk.c
+++ b/drivers/clk/clk.c
@@ -1159,14 +1159,8 @@  static int __clk_set_parent(struct clk_core *core, struct clk_core *parent,
 		flags = clk_enable_lock();
 		clk_reparent(core, old_parent);
 		clk_enable_unlock(flags);
+		__clk_set_parent_after(core, old_parent, parent);
 
-		if (core->prepare_count) {
-			flags = clk_enable_lock();
-			clk_core_disable(core);
-			clk_core_disable(parent);
-			clk_enable_unlock(flags);
-			clk_core_unprepare(parent);
-		}
 		return ret;
 	}