linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] ARM: imx: refactor mxc_iomux_mode()
@ 2014-10-21 14:35 Dmitry Voytik
  2014-10-27 14:20 ` Dmitry Voytik
  0 siblings, 1 reply; 5+ messages in thread
From: Dmitry Voytik @ 2014-10-21 14:35 UTC (permalink / raw)
  To: linux-arm-kernel

Refactor mxc_iomux_mode():
 - since it always returns 0 make it to return void
 - remove unnecessary ret variable
 - declare variables according to the kernel coding style

Signed-off-by: Dmitry Voytik <voytikd@gmail.com>
---
 arch/arm/mach-imx/iomux-imx31.c | 8 ++++----
 arch/arm/mach-imx/iomux-mx3.h   | 2 +-
 2 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/arch/arm/mach-imx/iomux-imx31.c b/arch/arm/mach-imx/iomux-imx31.c
index 1657fe6..d6a3075 100644
--- a/arch/arm/mach-imx/iomux-imx31.c
+++ b/arch/arm/mach-imx/iomux-imx31.c
@@ -44,9 +44,11 @@ static unsigned long mxc_pin_alloc_map[NB_PORTS * 32 / BITS_PER_LONG];
 /*
  * set the mode for a IOMUX pin.
  */
-int mxc_iomux_mode(unsigned int pin_mode)
+void mxc_iomux_mode(unsigned int pin_mode)
 {
-	u32 field, l, mode, ret = 0;
+	u32 field;
+	u32 l;
+	u32 mode;
 	void __iomem *reg;
 
 	reg = IOMUXSW_MUX_CTL + (pin_mode & IOMUX_REG_MASK);
@@ -61,8 +63,6 @@ int mxc_iomux_mode(unsigned int pin_mode)
 	__raw_writel(l, reg);
 
 	spin_unlock(&gpio_mux_lock);
-
-	return ret;
 }
 
 /*
diff --git a/arch/arm/mach-imx/iomux-mx3.h b/arch/arm/mach-imx/iomux-mx3.h
index f79f78a..0a5adba 100644
--- a/arch/arm/mach-imx/iomux-mx3.h
+++ b/arch/arm/mach-imx/iomux-mx3.h
@@ -144,7 +144,7 @@ void mxc_iomux_set_gpr(enum iomux_gp_func, bool en);
  * It is called by the setup functions and should not be called directly anymore.
  * It is here visible for backward compatibility
  */
-int mxc_iomux_mode(unsigned int pin_mode);
+void mxc_iomux_mode(unsigned int pin_mode);
 
 #define IOMUX_PADNUM_MASK	0x1ff
 #define IOMUX_GPIONUM_SHIFT	9
-- 
1.9.1

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [PATCH] ARM: imx: refactor mxc_iomux_mode()
  2014-10-21 14:35 [PATCH] ARM: imx: refactor mxc_iomux_mode() Dmitry Voytik
@ 2014-10-27 14:20 ` Dmitry Voytik
  2014-11-04 12:21   ` Peter Chen
  0 siblings, 1 reply; 5+ messages in thread
From: Dmitry Voytik @ 2014-10-27 14:20 UTC (permalink / raw)
  To: linux-arm-kernel

Hi Shawn,

Any comments on this?
Thanks.

On Tue, Oct 21, 2014 at 06:35:51PM +0400, Dmitry Voytik wrote:
> Refactor mxc_iomux_mode():
>  - since it always returns 0 make it to return void
>  - remove unnecessary ret variable
>  - declare variables according to the kernel coding style
> 
> Signed-off-by: Dmitry Voytik <voytikd@gmail.com>
> ---
>  arch/arm/mach-imx/iomux-imx31.c | 8 ++++----
>  arch/arm/mach-imx/iomux-mx3.h   | 2 +-
>  2 files changed, 5 insertions(+), 5 deletions(-)
> 
> diff --git a/arch/arm/mach-imx/iomux-imx31.c b/arch/arm/mach-imx/iomux-imx31.c
> index 1657fe6..d6a3075 100644
> --- a/arch/arm/mach-imx/iomux-imx31.c
> +++ b/arch/arm/mach-imx/iomux-imx31.c
> @@ -44,9 +44,11 @@ static unsigned long mxc_pin_alloc_map[NB_PORTS * 32 / BITS_PER_LONG];
>  /*
>   * set the mode for a IOMUX pin.
>   */
> -int mxc_iomux_mode(unsigned int pin_mode)
> +void mxc_iomux_mode(unsigned int pin_mode)
>  {
> -	u32 field, l, mode, ret = 0;
> +	u32 field;
> +	u32 l;
> +	u32 mode;
>  	void __iomem *reg;
>  
>  	reg = IOMUXSW_MUX_CTL + (pin_mode & IOMUX_REG_MASK);
> @@ -61,8 +63,6 @@ int mxc_iomux_mode(unsigned int pin_mode)
>  	__raw_writel(l, reg);
>  
>  	spin_unlock(&gpio_mux_lock);
> -
> -	return ret;
>  }
>  
>  /*
> diff --git a/arch/arm/mach-imx/iomux-mx3.h b/arch/arm/mach-imx/iomux-mx3.h
> index f79f78a..0a5adba 100644
> --- a/arch/arm/mach-imx/iomux-mx3.h
> +++ b/arch/arm/mach-imx/iomux-mx3.h
> @@ -144,7 +144,7 @@ void mxc_iomux_set_gpr(enum iomux_gp_func, bool en);
>   * It is called by the setup functions and should not be called directly anymore.
>   * It is here visible for backward compatibility
>   */
> -int mxc_iomux_mode(unsigned int pin_mode);
> +void mxc_iomux_mode(unsigned int pin_mode);
>  
>  #define IOMUX_PADNUM_MASK	0x1ff
>  #define IOMUX_GPIONUM_SHIFT	9
> -- 
> 1.9.1
> 
> --
> To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
> the body of a message to majordomo at vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> Please read the FAQ at  http://www.tux.org/lkml/

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [PATCH] ARM: imx: refactor mxc_iomux_mode()
  2014-10-27 14:20 ` Dmitry Voytik
@ 2014-11-04 12:21   ` Peter Chen
  2014-11-06 18:36     ` Dmitry Voytik
  0 siblings, 1 reply; 5+ messages in thread
From: Peter Chen @ 2014-11-04 12:21 UTC (permalink / raw)
  To: linux-arm-kernel


> 
> On Tue, Oct 21, 2014 at 06:35:51PM +0400, Dmitry Voytik wrote:
> > Refactor mxc_iomux_mode():
> >  - since it always returns 0 make it to return void
> >  - remove unnecessary ret variable
> >  - declare variables according to the kernel coding style
> >
> > Signed-off-by: Dmitry Voytik <voytikd@gmail.com>
> > ---
> >  arch/arm/mach-imx/iomux-imx31.c | 8 ++++----
> >  arch/arm/mach-imx/iomux-mx3.h   | 2 +-
> >  2 files changed, 5 insertions(+), 5 deletions(-)
> >
> > diff --git a/arch/arm/mach-imx/iomux-imx31.c
> > b/arch/arm/mach-imx/iomux-imx31.c index 1657fe6..d6a3075 100644
> > --- a/arch/arm/mach-imx/iomux-imx31.c
> > +++ b/arch/arm/mach-imx/iomux-imx31.c
> > @@ -44,9 +44,11 @@ static unsigned long mxc_pin_alloc_map[NB_PORTS *
> > 32 / BITS_PER_LONG];
> >  /*
> >   * set the mode for a IOMUX pin.
> >   */
> > -int mxc_iomux_mode(unsigned int pin_mode)
> > +void mxc_iomux_mode(unsigned int pin_mode)
> >  {
> > -	u32 field, l, mode, ret = 0;
> > +	u32 field;
> > +	u32 l;
> > +	u32 mode;
> >  	void __iomem *reg;
> >

Why you use three lines to define it, it makes the function longer.
Besides, Shawn's email changes to : <shawn.guo@linaro.org>

Peter

> >  	reg = IOMUXSW_MUX_CTL + (pin_mode & IOMUX_REG_MASK); @@ -
> 61,8 +63,6
> > @@ int mxc_iomux_mode(unsigned int pin_mode)
> >  	__raw_writel(l, reg);
> >
> >  	spin_unlock(&gpio_mux_lock);
> > -
> > -	return ret;
> >  }
> >
> >  /*
> > diff --git a/arch/arm/mach-imx/iomux-mx3.h
> > b/arch/arm/mach-imx/iomux-mx3.h index f79f78a..0a5adba 100644
> > --- a/arch/arm/mach-imx/iomux-mx3.h
> > +++ b/arch/arm/mach-imx/iomux-mx3.h
> > @@ -144,7 +144,7 @@ void mxc_iomux_set_gpr(enum iomux_gp_func, bool
> en);
> >   * It is called by the setup functions and should not be called directly
> anymore.
> >   * It is here visible for backward compatibility
> >   */
> > -int mxc_iomux_mode(unsigned int pin_mode);
> > +void mxc_iomux_mode(unsigned int pin_mode);
> >
> >  #define IOMUX_PADNUM_MASK	0x1ff
> >  #define IOMUX_GPIONUM_SHIFT	9
> > --
> > 1.9.1
> >
> > --
> > To unsubscribe from this list: send the line "unsubscribe
> > linux-kernel" in the body of a message to majordomo at vger.kernel.org
> > More majordomo info at  http://vger.kernel.org/majordomo-info.html
> > Please read the FAQ at  http://www.tux.org/lkml/
> 
> _______________________________________________
> linux-arm-kernel mailing list
> linux-arm-kernel at lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [PATCH] ARM: imx: refactor mxc_iomux_mode()
  2014-11-04 12:21   ` Peter Chen
@ 2014-11-06 18:36     ` Dmitry Voytik
  0 siblings, 0 replies; 5+ messages in thread
From: Dmitry Voytik @ 2014-11-06 18:36 UTC (permalink / raw)
  To: linux-arm-kernel

Hi Peter,

On Tue, Nov 04, 2014 at 12:21:55PM +0000, Peter Chen wrote:

> > > -int mxc_iomux_mode(unsigned int pin_mode)
> > > +void mxc_iomux_mode(unsigned int pin_mode)
> > >  {
> > > -	u32 field, l, mode, ret = 0;
> > > +	u32 field;
> > > +	u32 l;
> > > +	u32 mode;
> > >  	void __iomem *reg;
> > >
> 
> Why you use three lines to define it, it makes the function longer.

You're right but there is a recommendation in coding style to declare
variables on separate lines (see Documentation/CodingStyle,
line 469), which improves readability, imho. By the way I saw many
times, that maintainers asked to declare variables separately.

> Besides, Shawn's email changes to : <shawn.guo@linaro.org>

Oops, didn't see that. Thanks!

WBR.

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [PATCH] ARM: imx: refactor mxc_iomux_mode()
@ 2014-11-06 18:55 Dmitry Voytik
  0 siblings, 0 replies; 5+ messages in thread
From: Dmitry Voytik @ 2014-11-06 18:55 UTC (permalink / raw)
  To: linux-arm-kernel

Refactor mxc_iomux_mode():
 - since it always returns 0 make it to return void
 - remove unnecessary ret variable
 - declare variables according to the kernel coding style

Signed-off-by: Dmitry Voytik <voytikd@gmail.com>
---
 arch/arm/mach-imx/iomux-imx31.c | 8 ++++----
 arch/arm/mach-imx/iomux-mx3.h   | 2 +-
 2 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/arch/arm/mach-imx/iomux-imx31.c b/arch/arm/mach-imx/iomux-imx31.c
index 1657fe6..d6a3075 100644
--- a/arch/arm/mach-imx/iomux-imx31.c
+++ b/arch/arm/mach-imx/iomux-imx31.c
@@ -44,9 +44,11 @@ static unsigned long mxc_pin_alloc_map[NB_PORTS * 32 / BITS_PER_LONG];
 /*
  * set the mode for a IOMUX pin.
  */
-int mxc_iomux_mode(unsigned int pin_mode)
+void mxc_iomux_mode(unsigned int pin_mode)
 {
-	u32 field, l, mode, ret = 0;
+	u32 field;
+	u32 l;
+	u32 mode;
 	void __iomem *reg;
 
 	reg = IOMUXSW_MUX_CTL + (pin_mode & IOMUX_REG_MASK);
@@ -61,8 +63,6 @@ int mxc_iomux_mode(unsigned int pin_mode)
 	__raw_writel(l, reg);
 
 	spin_unlock(&gpio_mux_lock);
-
-	return ret;
 }
 
 /*
diff --git a/arch/arm/mach-imx/iomux-mx3.h b/arch/arm/mach-imx/iomux-mx3.h
index f79f78a..0a5adba 100644
--- a/arch/arm/mach-imx/iomux-mx3.h
+++ b/arch/arm/mach-imx/iomux-mx3.h
@@ -144,7 +144,7 @@ void mxc_iomux_set_gpr(enum iomux_gp_func, bool en);
  * It is called by the setup functions and should not be called directly anymore.
  * It is here visible for backward compatibility
  */
-int mxc_iomux_mode(unsigned int pin_mode);
+void mxc_iomux_mode(unsigned int pin_mode);
 
 #define IOMUX_PADNUM_MASK	0x1ff
 #define IOMUX_GPIONUM_SHIFT	9
-- 
1.9.1

^ permalink raw reply related	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2014-11-06 18:55 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-10-21 14:35 [PATCH] ARM: imx: refactor mxc_iomux_mode() Dmitry Voytik
2014-10-27 14:20 ` Dmitry Voytik
2014-11-04 12:21   ` Peter Chen
2014-11-06 18:36     ` Dmitry Voytik
  -- strict thread matches above, loose matches on Subject: below --
2014-11-06 18:55 Dmitry Voytik

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