[U-Boot] [PATCH 62/71] serial: spl: Implement empty functions for SPL

Tom Rini
2012-09-18T17:53:20Z

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On 09/18/12 10:13, Marek Vasut wrote:
> Dear Tom Rini,
>
>> On Mon, Sep 17, 2012 at 01:21:27AM +0200, Marek Vasut wrote:
>>> Implement empty serial_* functions for SPL without serial
>>> support enabled. This is imperative to haave once serial multi
>>> is enabled unconditionally.
>>>
>>> Signed-off-by: Marek Vasut <marex@denx.de> Cc: Marek Vasut
>>> <marek.vasut@gmail.com> Cc: Tom Rini <trini@ti.com> ---
>>>
>>> common/serial.c | 12 ++++++++++++ 1 file changed, 12
>>> insertions(+)
>>>
>>> diff --git a/common/serial.c b/common/serial.c index
>>> 631af65..cef4ba8 100644 --- a/common/serial.c +++
>>> b/common/serial.c @@ -27,6 +27,16 @@
>>>
>>> #include <post.h> #include <linux/compiler.h>
>>>
>>> +/* Implement prototypes for SPL without serial support */
>>> +#if defined(CONFIG_SPL_BUILD) &&
>>> !defined(CONFIG_SPL_SERIAL_SUPPORT) +int serial_init(void) {
>>> return 0; } +void serial_setbrg(void) {} +int
>>> serial_getc(void) { return 0; } +int serial_tstc(void) { return
>>> 0; } +void serial_putc(const char c) {} +void serial_puts(const
>>> char *s) {}
>>
>> This isn't quite right. We need to allow for: - No output SPL,
>> strings collected (so #defined to do{} while (0))
>
> Which is not type-checked and will drag in bugs.

Scott has addressed this.

>> - puts + printf SPL (CONFIG_SPL_SERIAL_SUPPORT +
>> CONFIG_SPL_LIBCOMMON_SUPPORT) - puts only SPL
>> (CONFIG_SPL_SERIAL_SUPPORT + #define puts serial_puts/putc).
>>
>> I'm not asking you to do that, but you will have to adapt to it
>> once Jose is done with it. What that means, off the top of my
>> head, is we can just drop this patch as in the first and last
>> case serial.o will be garbage-collected (or not built) and in
>> the middle case, this will be fully used.
>
> I can't drop this patch as it will break all of SPL when
> CONFIG_SERIAL_MULTI is unconditionally enabled.

Why is it breaking _all_ of SPL? Have you run-tested this anywhere,
especially with SPL? In most cases it should be used and real
functions provided or garbage collected away.

- --
Tom
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.11 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://www.enigmail.net/

iQIcBAEBAgAGBQJQWLUQAAoJENk4IS6UOR1WxoAP/3Lto025hWPgi7obJR1nrl63
r84gfCPkVsjqWHmYJl+vFOlyTuEiXaW9K5PWNxRA7xXbm5GbBe90fZBdYVxCSh+f
7KuSJ5jBEItmma9eeva7Af8FRtoC487yM9MpAOUKQ2pKsOiPR7lbiGQamHvWUssA
1BQfALQSlWgdlsk93EHXwxRoQD97ojAfCWPybObpd0C3oYUHVPhOYHS9NtLiRr8e
L58e7XhPksxNEyx29qrbmSwFGE8a4zSeu9SHjCfVk9Z2j2cD0zXpgqbwTe8/U259
31KUoRoLpqbSfOl4jcmZ54lyWZNbh1p45cyZAtOy4JJE99YkE951p342wC7sseQM
AtGqWQidKvHszpiSFkhu2pbTHQbTZfnYA4cvKL4x5S6zXKLEk/Ybfn9RTXQpdnaQ
6yUeYLjHl3bXeVb/JhtD5oouzyCfQmDyVnS4CUTAD4rVBS1CNpjpLa/mDoAcZNJr
zFLtkBW/72toOV7Xy2YsLtiWvw3bL6gKeKueegX5vHRBIx9csHWB3SZc7qMCZyIW
xk3CIhJEru/RsWMAqynCX5lfRSuw2+Zflnq5YJnqeVRY2mdasXewLsvhW2iRRn7n
C/Wf43wU782RK/8KbBYlokiDjV5egipxccW3lOIAr1HtvSQNfQgUDrum4opx+Jrw
nbA1JTydUvu0YSzId43A
=Lc/6
-----END PGP SIGNATURE-----