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

Tom Rini trini at ti.com
Tue Sep 18 20:34:56 CEST 2012


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

On 09/18/12 11:24, Marek Vasut wrote:
> Dear Tom Rini,
> 
>> On 09/18/12 11:01, Marek Vasut wrote:
>>> Dear Tom Rini,
>>> 
>>>> 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 at denx.de> Cc: Marek
>>>>>>> Vasut <marek.vasut at gmail.com> Cc: Tom Rini
>>>>>>> <trini at 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.
>>> 
>>> Yes, try compiling m28evk without this patch for example, it's 
>>> going to break it. Because CONFIG_SPL_SERIAL_SUPPORT is
>>> disabled, yet it uses code that contains references to puts()
>>> etc.
>> 
>> Progress!  Now, why isn't this file being garbage collected?
> 
> What file?

common/serial.o since as you point out, m28evk doesn't define any way
to do output.

>> m28evk is fitting into the first category I said (no output) but
>> now it's not discarding things that it should be discarding.
> 
> What is not discarding things and what things should be discarded?
> I believe if you're missing symbols, the compiler will error-out.
> Always.

Nope.  This is fine:
gc_this_function(void) {
  never_define_this_at_link();
  return;
}

And nothing calling gc_this_function means that it's fine that
never_define_this_at_link isn't seen by the linker.

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

iQIcBAEBAgAGBQJQWL7QAAoJENk4IS6UOR1W+KgP/jjDmO3c+WfYqEjuEjLMjSAW
qTLZOLdsmsU7HoFa+/fWNgmvvmcJlTgqzo0z5izku2d0xx8TO3R6rpZa9weHXhr1
yuKs+CzP/6A1Kntd8VC0SRUU+Rb4onPPoY0kw0QDL01zug5DBEu+saI08CJRrtki
DLzayRPNoTcppffp1r2nstyAJJWvuYcFO4A3wzR3h5U1lQNHK7Yt8KRtmCFQW1d1
Y98ikHi75PDcSZDjj60OHVhNtaDDcLUu2NWAXrf4gI13WLPxcNXHRTq1uufY38Pv
fNd5wqrC7qDq7I6uomwuy+b6aDYYPqsrh9T/h/tjWO235mA+7Dnkl2qvHrYOOcV6
1zBef8M+vuawVWYZnsJO4k1Cg2Ci9Gl4sPqJVYaSnhhXjQawZbztQpT1P4tN1DEG
8r7mpt6bWGG1nnEgiNWvFZvv798sj2Lh/T0yxAsnX9CgnlxZ7lh+uqirMmUJeUKB
aWiuDJIMqQORXcJIO1tDwtL+2EA5CxofLa11Y0tpT0r2G0cOsQQQfJTQ6K9p4KhB
gkOhRmlPQs12WV+9r6LWuUqDRuIbMjOUHfNOf9eZfKTvptMMRhwT1zCVBdMVwbwO
3e/WpNTDjRLpqj08bs6OHOVO7GvXXtZJGHJJGlJ3a49pHMnqNUjBGSajDYJyHL0O
/75PPDTIXSrUJw1anFC8
=yREs
-----END PGP SIGNATURE-----


More information about the U-Boot mailing list