* [PATCH] Staging: sm750fb: Remove an unnecessary local variable in a function
@ 2019-03-13 15:32 Madhumitha Prabakaran
2019-03-13 15:35 ` [Outreachy kernel] " Julia Lawall
0 siblings, 1 reply; 4+ messages in thread
From: Madhumitha Prabakaran @ 2019-03-13 15:32 UTC (permalink / raw)
To: sudipm.mukherjee, teddy.wang, gregkh, outreachy-kernel
Cc: Madhumitha Prabakaran
Remove an unnecessary local variable in sm750_format_pll_reg function
and replace its initialization directly in return type.
Issue suggested by Coccinelle using ret.cocci.
Signed-off-by: Madhumitha Prabakaran <madhumithabiw@gmail.com>
---
drivers/staging/sm750fb/ddk750_chip.c | 5 +----
1 file changed, 1 insertion(+), 4 deletions(-)
diff --git a/drivers/staging/sm750fb/ddk750_chip.c b/drivers/staging/sm750fb/ddk750_chip.c
index 90f5480304f4..93abfa8b0090 100644
--- a/drivers/staging/sm750fb/ddk750_chip.c
+++ b/drivers/staging/sm750fb/ddk750_chip.c
@@ -391,7 +391,6 @@ unsigned int sm750_format_pll_reg(struct pll_value *pPLL)
unsigned int OD = pPLL->OD;
unsigned int M = pPLL->M;
unsigned int N = pPLL->N;
- unsigned int reg = 0;
/*
* Note that all PLL's have the same format. Here, we just use
@@ -399,13 +398,11 @@ unsigned int sm750_format_pll_reg(struct pll_value *pPLL)
* register. On returning a 32 bit number, the value can be
* applied to any PLL in the calling function.
*/
- reg = PLL_CTRL_POWER |
+ return PLL_CTRL_POWER |
#ifndef VALIDATION_CHIP
((POD << PLL_CTRL_POD_SHIFT) & PLL_CTRL_POD_MASK) |
#endif
((OD << PLL_CTRL_OD_SHIFT) & PLL_CTRL_OD_MASK) |
((N << PLL_CTRL_N_SHIFT) & PLL_CTRL_N_MASK) |
((M << PLL_CTRL_M_SHIFT) & PLL_CTRL_M_MASK);
-
- return reg;
}
--
2.17.1
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [Outreachy kernel] [PATCH] Staging: sm750fb: Remove an unnecessary local variable in a function
2019-03-13 15:32 [PATCH] Staging: sm750fb: Remove an unnecessary local variable in a function Madhumitha Prabakaran
@ 2019-03-13 15:35 ` Julia Lawall
2019-03-13 15:39 ` Madhumthia Prabakaran
0 siblings, 1 reply; 4+ messages in thread
From: Julia Lawall @ 2019-03-13 15:35 UTC (permalink / raw)
To: Madhumitha Prabakaran
Cc: sudipm.mukherjee, teddy.wang, gregkh, outreachy-kernel
On Wed, 13 Mar 2019, Madhumitha Prabakaran wrote:
> Remove an unnecessary local variable in sm750_format_pll_reg function
> and replace its initialization directly in return type.
> Issue suggested by Coccinelle using ret.cocci.
>
> Signed-off-by: Madhumitha Prabakaran <madhumithabiw@gmail.com>
> ---
> drivers/staging/sm750fb/ddk750_chip.c | 5 +----
> 1 file changed, 1 insertion(+), 4 deletions(-)
>
> diff --git a/drivers/staging/sm750fb/ddk750_chip.c b/drivers/staging/sm750fb/ddk750_chip.c
> index 90f5480304f4..93abfa8b0090 100644
> --- a/drivers/staging/sm750fb/ddk750_chip.c
> +++ b/drivers/staging/sm750fb/ddk750_chip.c
> @@ -391,7 +391,6 @@ unsigned int sm750_format_pll_reg(struct pll_value *pPLL)
> unsigned int OD = pPLL->OD;
> unsigned int M = pPLL->M;
> unsigned int N = pPLL->N;
> - unsigned int reg = 0;
>
> /*
> * Note that all PLL's have the same format. Here, we just use
> @@ -399,13 +398,11 @@ unsigned int sm750_format_pll_reg(struct pll_value *pPLL)
> * register. On returning a 32 bit number, the value can be
> * applied to any PLL in the calling function.
> */
> - reg = PLL_CTRL_POWER |
> + return PLL_CTRL_POWER |
> #ifndef VALIDATION_CHIP
> ((POD << PLL_CTRL_POD_SHIFT) & PLL_CTRL_POD_MASK) |
> #endif
> ((OD << PLL_CTRL_OD_SHIFT) & PLL_CTRL_OD_MASK) |
> ((N << PLL_CTRL_N_SHIFT) & PLL_CTRL_N_MASK) |
> ((M << PLL_CTRL_M_SHIFT) & PLL_CTRL_M_MASK);
> -
> - return reg;
This is going better in the right direction. But maybe it is less
readable than before, with that very large expression and the ifndef...
julia
> }
> --
> 2.17.1
>
> --
> You received this message because you are subscribed to the Google Groups "outreachy-kernel" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to outreachy-kernel+unsubscribe@googlegroups.com.
> To post to this group, send email to outreachy-kernel@googlegroups.com.
> To view this discussion on the web visit https://groups.google.com/d/msgid/outreachy-kernel/20190313153205.4974-1-madhumithabiw%40gmail.com.
> For more options, visit https://groups.google.com/d/optout.
>
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [Outreachy kernel] [PATCH] Staging: sm750fb: Remove an unnecessary local variable in a function
2019-03-13 15:35 ` [Outreachy kernel] " Julia Lawall
@ 2019-03-13 15:39 ` Madhumthia Prabakaran
2019-03-13 19:49 ` Julia Lawall
0 siblings, 1 reply; 4+ messages in thread
From: Madhumthia Prabakaran @ 2019-03-13 15:39 UTC (permalink / raw)
To: Julia Lawall, outreachy-kernel
On Wed, Mar 13, 2019 at 04:35:39PM +0100, Julia Lawall wrote:
>
>
> On Wed, 13 Mar 2019, Madhumitha Prabakaran wrote:
>
> > Remove an unnecessary local variable in sm750_format_pll_reg function
> > and replace its initialization directly in return type.
> > Issue suggested by Coccinelle using ret.cocci.
> >
> > Signed-off-by: Madhumitha Prabakaran <madhumithabiw@gmail.com>
> > ---
> > drivers/staging/sm750fb/ddk750_chip.c | 5 +----
> > 1 file changed, 1 insertion(+), 4 deletions(-)
> >
> > diff --git a/drivers/staging/sm750fb/ddk750_chip.c b/drivers/staging/sm750fb/ddk750_chip.c
> > index 90f5480304f4..93abfa8b0090 100644
> > --- a/drivers/staging/sm750fb/ddk750_chip.c
> > +++ b/drivers/staging/sm750fb/ddk750_chip.c
> > @@ -391,7 +391,6 @@ unsigned int sm750_format_pll_reg(struct pll_value *pPLL)
> > unsigned int OD = pPLL->OD;
> > unsigned int M = pPLL->M;
> > unsigned int N = pPLL->N;
> > - unsigned int reg = 0;
> >
> > /*
> > * Note that all PLL's have the same format. Here, we just use
> > @@ -399,13 +398,11 @@ unsigned int sm750_format_pll_reg(struct pll_value *pPLL)
> > * register. On returning a 32 bit number, the value can be
> > * applied to any PLL in the calling function.
> > */
> > - reg = PLL_CTRL_POWER |
> > + return PLL_CTRL_POWER |
> > #ifndef VALIDATION_CHIP
> > ((POD << PLL_CTRL_POD_SHIFT) & PLL_CTRL_POD_MASK) |
> > #endif
> > ((OD << PLL_CTRL_OD_SHIFT) & PLL_CTRL_OD_MASK) |
> > ((N << PLL_CTRL_N_SHIFT) & PLL_CTRL_N_MASK) |
> > ((M << PLL_CTRL_M_SHIFT) & PLL_CTRL_M_MASK);
> > -
> > - return reg;
>
> This is going better in the right direction. But maybe it is less
> readable than before, with that very large expression and the ifndef...
>
> julia
>
> > }
> > --
> > 2.17.1
> >
> > --
> > You received this message because you are subscribed to the Google Groups "outreachy-kernel" group.
> > To unsubscribe from this group and stop receiving emails from it, send an email to outreachy-kernel+unsubscribe@googlegroups.com.
> > To post to this group, send email to outreachy-kernel@googlegroups.com.
> > To view this discussion on the web visit https://groups.google.com/d/msgid/outreachy-kernel/20190313153205.4974-1-madhumithabiw%40gmail.com.
> > For more options, visit https://groups.google.com/d/optout.
> >
>
> --
> You received this message because you are subscribed to the Google Groups "outreachy-kernel" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to outreachy-kernel+unsubscribe@googlegroups.com.
> To post to this group, send email to outreachy-kernel@googlegroups.com.
> To view this discussion on the web visit https://groups.google.com/d/msgid/outreachy-kernel/alpine.DEB.2.20.1903131634500.27312%40hadrien.
> For more options, visit https://groups.google.com/d/optout.
Do you want me to drop this? As the previous code is more readable than this one.
thanks,
Madhumitha
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [Outreachy kernel] [PATCH] Staging: sm750fb: Remove an unnecessary local variable in a function
2019-03-13 15:39 ` Madhumthia Prabakaran
@ 2019-03-13 19:49 ` Julia Lawall
0 siblings, 0 replies; 4+ messages in thread
From: Julia Lawall @ 2019-03-13 19:49 UTC (permalink / raw)
To: Madhumthia Prabakaran; +Cc: outreachy-kernel
On Wed, 13 Mar 2019, Madhumthia Prabakaran wrote:
> On Wed, Mar 13, 2019 at 04:35:39PM +0100, Julia Lawall wrote:
> >
> >
> > On Wed, 13 Mar 2019, Madhumitha Prabakaran wrote:
> >
> > > Remove an unnecessary local variable in sm750_format_pll_reg function
> > > and replace its initialization directly in return type.
> > > Issue suggested by Coccinelle using ret.cocci.
> > >
> > > Signed-off-by: Madhumitha Prabakaran <madhumithabiw@gmail.com>
> > > ---
> > > drivers/staging/sm750fb/ddk750_chip.c | 5 +----
> > > 1 file changed, 1 insertion(+), 4 deletions(-)
> > >
> > > diff --git a/drivers/staging/sm750fb/ddk750_chip.c b/drivers/staging/sm750fb/ddk750_chip.c
> > > index 90f5480304f4..93abfa8b0090 100644
> > > --- a/drivers/staging/sm750fb/ddk750_chip.c
> > > +++ b/drivers/staging/sm750fb/ddk750_chip.c
> > > @@ -391,7 +391,6 @@ unsigned int sm750_format_pll_reg(struct pll_value *pPLL)
> > > unsigned int OD = pPLL->OD;
> > > unsigned int M = pPLL->M;
> > > unsigned int N = pPLL->N;
> > > - unsigned int reg = 0;
> > >
> > > /*
> > > * Note that all PLL's have the same format. Here, we just use
> > > @@ -399,13 +398,11 @@ unsigned int sm750_format_pll_reg(struct pll_value *pPLL)
> > > * register. On returning a 32 bit number, the value can be
> > > * applied to any PLL in the calling function.
> > > */
> > > - reg = PLL_CTRL_POWER |
> > > + return PLL_CTRL_POWER |
> > > #ifndef VALIDATION_CHIP
> > > ((POD << PLL_CTRL_POD_SHIFT) & PLL_CTRL_POD_MASK) |
> > > #endif
> > > ((OD << PLL_CTRL_OD_SHIFT) & PLL_CTRL_OD_MASK) |
> > > ((N << PLL_CTRL_N_SHIFT) & PLL_CTRL_N_MASK) |
> > > ((M << PLL_CTRL_M_SHIFT) & PLL_CTRL_M_MASK);
> > > -
> > > - return reg;
> >
> > This is going better in the right direction. But maybe it is less
> > readable than before, with that very large expression and the ifndef...
> >
> > julia
> >
> > > }
> > > --
> > > 2.17.1
> > >
> > > --
> > > You received this message because you are subscribed to the Google Groups "outreachy-kernel" group.
> > > To unsubscribe from this group and stop receiving emails from it, send an email to outreachy-kernel+unsubscribe@googlegroups.com.
> > > To post to this group, send email to outreachy-kernel@googlegroups.com.
> > > To view this discussion on the web visit https://groups.google.com/d/msgid/outreachy-kernel/20190313153205.4974-1-madhumithabiw%40gmail.com.
> > > For more options, visit https://groups.google.com/d/optout.
> > >
> >
> > --
> > You received this message because you are subscribed to the Google Groups "outreachy-kernel" group.
> > To unsubscribe from this group and stop receiving emails from it, send an email to outreachy-kernel+unsubscribe@googlegroups.com.
> > To post to this group, send email to outreachy-kernel@googlegroups.com.
> > To view this discussion on the web visit https://groups.google.com/d/msgid/outreachy-kernel/alpine.DEB.2.20.1903131634500.27312%40hadrien.
> > For more options, visit https://groups.google.com/d/optout.
>
> Do you want me to drop this? As the previous code is more readable than this one.
I don't know. Greg decides...
julia
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2019-03-13 19:49 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-03-13 15:32 [PATCH] Staging: sm750fb: Remove an unnecessary local variable in a function Madhumitha Prabakaran
2019-03-13 15:35 ` [Outreachy kernel] " Julia Lawall
2019-03-13 15:39 ` Madhumthia Prabakaran
2019-03-13 19:49 ` Julia Lawall
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.