Small refactor to remove duplicate serial code
PATCH v2 1/1 Small refactor to remove duplicate serial code
This tidies up duplicate code, and checks that default_serial_console() does in fact produce a device.
---
Changes in v2:
- Rebase to master
common/serial.c | 61 +++++++++++++++++------------------------------------- 1 files changed, 19 insertions(+), 42 deletions(-)
common/serial.c +19 -42
@@ -158,73 +158,50 @@ void serial_reinit_all (void) } } -int serial_init (void ) +static struct serial_device *get_current (void ) { +struct serial_device *dev; +if (!(gd->flags &GD_FLG_RELOC ) || !serial_current) { -struct serial_device *dev =default_serial_console (); + dev =default_serial_console (); -return dev->init (); +/* We must have a console device */ +if (!dev) +panic ("Cannot find console" ); + }else { + dev = serial_current; } +return dev; +} -return serial_current->init (); +int serial_init (void ) +{ +return get_current ()->init (); }void serial_setbrg (void ) { -if (!(gd->flags &GD_FLG_RELOC ) || !serial_current) { -struct serial_device *dev =default_serial_console (); - - dev->setbrg (); -return ; - } - - serial_current->setbrg (); +get_current ()->setbrg (); }int serial_getc (void ) { -if (!(gd->flags &GD_FLG_RELOC ) || !serial_current) { -struct serial_device *dev =default_serial_console (); - -return dev->getc (); - } - -return serial_current->getc (); +return get_current ()->getc (); }int serial_tstc (void ) { -if (!(gd->flags &GD_FLG_RELOC ) || !serial_current) { -struct serial_device *dev =default_serial_console (); - -return dev->tstc (); - } - -return serial_current->tstc (); +return get_current ()->tstc (); }void serial_putc (const char c) { -if (!(gd->flags &GD_FLG_RELOC ) || !serial_current) { -struct serial_device *dev =default_serial_console (); - - dev->putc (c); -return ; - } - - serial_current->putc (c); +get_current ()->putc (c); }void serial_puts (const char *s) { -if (!(gd->flags &GD_FLG_RELOC ) || !serial_current) { -struct serial_device *dev =default_serial_console (); - - dev->puts (s); -return ; - } - - serial_current->puts (s); +get_current ()->puts (s); }#if CONFIG_POST &CONFIG_SYS_POST_UART
Signature · 1 line
1.7.3.1
PATCH v2 1/1 Small refactor to remove duplicate serial code
Quoted 3 lines · On Tuesday, September 13, 2011 18:32:41 Simon Glass wrote:
Acked-by Mike Frysinger <[email protected]>Signed-off-by Simon Glass <[email protected]>
generally speaking there's no newlines in between any of the tags
-mike
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 836 bytes
Desc: This is a digitally signed message part.
Url : http://lists.denx.de/pipermail/u-boot/attachments/20110913/a65217bd/attachment.pgp
PATCH v2 1/1 Small refactor to remove duplicate serial code
In reply to Simon GlassDear Simon Glass,
Quoted 5 lines · In message <[email protected]> you wrote:
This tidies up duplicate code, and checks that
default_serial_console()does in fact produce a device.Acked-by Mike Frysinger <[email protected]>
Quoted 7 lines
Signed-off-by Simon Glass <[email protected]>---
Changes in v2:
- Rebase to mastercommon/serial.c | 61 +++++++++++++++++------------------------------------- 1 files changed, 19 insertions(+), 42 deletions(-)
Doesn't apply - please rebase and resubmit.
Best regards,
Wolfgang Denk
Signature · 4 lines
DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de "Don't think; let the machine do it for you!" - E. C. Berkeley
PATCH v2 1/1 Small refactor to remove duplicate serial code
Hi Wolfgang,
Quoted 13 lines · Wolfgang Denk
Dear Simon Glass,
Quoted 10 lines · In message <[email protected]> you wrote:
This tidies up duplicate code, and checks that
default_serial_console()does in fact produce a device.Acked-by Mike Frysinger <[email protected]>Signed-off-by Simon Glass <[email protected]>---
Changes in v2:
- Rebase to master
Quoted 4 lines
Quoted 2 lines
?common/serial.c | ? 61 +++++++++++++++++------------------------------------- ?1 files changed, 19 insertions(+), 42 deletions(-)
Doesn't apply - please rebase and resubmit.
It is ok - it is already applied.
I really should update some patches in patchwork, as that might be causing you some difficulty. But I have lost my password. Do you know of any way to recover it?
Regards,
Simon
Quoted 11 lines
Best regards,
Wolfgang Denk
--
DENX Software Engineering GmbH, ? ? MD: Wolfgang Denk & Detlev Zundel HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de "Don't think; let the machine do it for you!" ? ? ? ?- E. C. Berkeley
PATCH v2 1/1 Small refactor to remove duplicate serial code
Le 22/10/2011 00:30, Simon Glass a ?crit :
Quoted 3 lines
I really should update some patches in patchwork, as that might be causing you some difficulty. But I have lost my password. Do you know of any way to recover it?
There is none, but ask on the patchwork mailing list for it to be changed (state that you're on the ozlabs server), and the server maintainer will send you a new one.
Personally, I have .pwclientrc filled in with my login and pwd... after my first loss of patchwork passwd. :)
Quoted 2 lines
Regards,
Simon
Amicalement,
Signature · 1 line
Albert.
PATCH v2 1/1 Small refactor to remove duplicate serial code
In reply to Simon GlassDear Simon Glass,
Quoted 4 lines · In message <CAPnjgZ1QQMrp88B_iX-YewsqG6B+v2t3KGkyWg3X4sfFcw592w@mail.gmail.com>…
I really should update some patches in patchwork, as that might be causing you some difficulty. But I have lost my password. Do you know of any way to recover it?
Send email to JK and ask him to change / reset it.
Best regards,
Wolfgang Denk
Signature · 7 lines
DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
He had been eight years upon a project for extracting sunbeams out of
cucumbers, which were to be put in vials hermetically sealed, and let
out to warm the air in raw inclement summers. - Jonathan Swift
_Gulliver's Travels_ ``A Voyage to Laputa, etc.'' ch. 5