Re: [PATCH] serial: DCC(JTAG) serial and console emulation support

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed, 2010-10-06 at 11:21 -0400, Nicolas Pitre wrote:

> static inline char
> __dcc_getchar(void)
> {
>      char __c;
> 
> #if !defined(CONFIG_CPU_V7)
>      asm("mrc p14, 0, %0, c0, c5, 0  @ read comms data reg"
>              : "=r" (__c) : : "cc");
> #else
>      asm(
>      "get_wait:      mrc p14, 0, pc, c0, c1, 0                       \n\
>                      bne get_wait                                    \n\
>                      mrc p14, 0, %0, c0, c5, 0       @ read comms data reg"
>              : "=r" (__c) : : "cc");
> #endif
> 
>      return __c;
> }
> 
> static inline void
> __dcc_putchar(char c)
> {
> #if !defined(CONFIG_CPU_V7)
>      asm("mcr p14, 0, %0, c0, c5, 0  @ write a char"
>              : /* no output register */
>              : "r" (c) : "cc");
> #else
>      asm(
>      "put_wait:      mrc p14, 0, pc, c0, c1, 0                   \n\
>                      bcs put_wait                                \n\
>                      mcr p14, 0, %0, c0, c5, 0                   "
>      : : "r" (c) : "cc");
> #endif
> }
> 
> To me the above is easier to read.  Not a big deal since the functions 
> are rather small, but still an improvement.  Searching for __dcc_putchar 
> would produce a single hit, and if the prototype has to change it is 
> done in only one place, etc.

It makes the internals of the function much more busy. There's more
stuff that could be executing that you have to think about while
reviewing the function.

> BTW the cc clobber in the asm for __dcc_putchar() is unneeded.

Without it caused a crash in __dcc_getchar() ..

Daniel

-- 
Sent by an consultant of the Qualcomm Innovation Center, Inc.
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora
Forum.


--
To unsubscribe from this list: send the line "unsubscribe linux-arm-msm" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [Linux for Sparc]     [IETF Annouce]     [Security]     [Bugtraq]     [Linux MIPS]     [ECOS]     [Asterisk Internet PBX]     [Linux API]

  Powered by Linux