Patchwork [U-Boot,v4,1/3] S5P: serial: Use the inline function instead of static value

login
register
mail settings
Submitter Minkyu Kang
Date Jan. 24, 2011, 7:33 a.m.
Message ID <4D3D2B49.9050100@samsung.com>
Download mbox | patch
Permalink /patch/80092/
State Accepted
Commit e0617c621def4bea5c6013dbc698ecf4f75d97c1
Headers show

Comments

Minkyu Kang - Jan. 24, 2011, 7:33 a.m.
Signed-off-by: Minkyu Kang <mk7.kang@samsung.com>
---
 arch/arm/include/asm/arch-s5pc1xx/uart.h |    5 ++++-
 drivers/serial/serial_s5p.c              |    2 +-
 2 files changed, 5 insertions(+), 2 deletions(-)
Minkyu Kang - Jan. 27, 2011, 12:25 p.m.
On 24 January 2011 16:33, Minkyu Kang <mk7.kang@samsung.com> wrote:
> Signed-off-by: Minkyu Kang <mk7.kang@samsung.com>
> ---
>  arch/arm/include/asm/arch-s5pc1xx/uart.h |    5 ++++-
>  drivers/serial/serial_s5p.c              |    2 +-
>  2 files changed, 5 insertions(+), 2 deletions(-)
>
applied to u-boot-samsung

Minkyu Kang
Graeme Russ - Jan. 27, 2011, 9:33 p.m.
Hi Minkyu,

On Mon, Jan 24, 2011 at 6:33 PM, Minkyu Kang <mk7.kang@samsung.com> wrote:
> Signed-off-by: Minkyu Kang <mk7.kang@samsung.com>
> ---
>  arch/arm/include/asm/arch-s5pc1xx/uart.h |    5 ++++-
>  drivers/serial/serial_s5p.c              |    2 +-
>  2 files changed, 5 insertions(+), 2 deletions(-)
>
> diff --git a/arch/arm/include/asm/arch-s5pc1xx/uart.h b/arch/arm/include/asm/arch-s5pc1xx/uart.h
> index f6eeab4..1c56739 100644
> --- a/arch/arm/include/asm/arch-s5pc1xx/uart.h
> +++ b/arch/arm/include/asm/arch-s5pc1xx/uart.h
> @@ -48,7 +48,10 @@ struct s5p_uart {
>        unsigned char   res3[0x3d0];
>  };
>
> -static int use_divslot = 1;
> +static inline int s5p_uart_divslot(void)
> +{
> +       return 1;
> +}
>
>  #endif /* __ASSEMBLY__ */
>
> diff --git a/drivers/serial/serial_s5p.c b/drivers/serial/serial_s5p.c
> index 9c1cbf4..f1ffa29 100644
> --- a/drivers/serial/serial_s5p.c
> +++ b/drivers/serial/serial_s5p.c
> @@ -72,7 +72,7 @@ void serial_setbrg_dev(const int dev_index)
>
>        writel(val / 16 - 1, &uart->ubrdiv);
>
> -       if (use_divslot)
> +       if (s5p_uart_divslot())
>                writew(udivslot[val % 16], &uart->rest.slot);
>        else
>                writeb(val % 16, &uart->rest.value);

Just for my own curiosity, what is the reason behind this?

I would have thought a #define would even work quite nicely.

Regards,

Graeme

Patch

diff --git a/arch/arm/include/asm/arch-s5pc1xx/uart.h b/arch/arm/include/asm/arch-s5pc1xx/uart.h
index f6eeab4..1c56739 100644
--- a/arch/arm/include/asm/arch-s5pc1xx/uart.h
+++ b/arch/arm/include/asm/arch-s5pc1xx/uart.h
@@ -48,7 +48,10 @@  struct s5p_uart {
 	unsigned char	res3[0x3d0];
 };
 
-static int use_divslot = 1;
+static inline int s5p_uart_divslot(void)
+{
+	return 1;
+}
 
 #endif	/* __ASSEMBLY__ */
 
diff --git a/drivers/serial/serial_s5p.c b/drivers/serial/serial_s5p.c
index 9c1cbf4..f1ffa29 100644
--- a/drivers/serial/serial_s5p.c
+++ b/drivers/serial/serial_s5p.c
@@ -72,7 +72,7 @@  void serial_setbrg_dev(const int dev_index)
 
 	writel(val / 16 - 1, &uart->ubrdiv);
 
-	if (use_divslot)
+	if (s5p_uart_divslot())
 		writew(udivslot[val % 16], &uart->rest.slot);
 	else
 		writeb(val % 16, &uart->rest.value);