From: Marek Vasut Date: Mon, 17 Sep 2012 01:21:36 +0200 Subject: [U-Boot] [PATCH 71/71] serial: Enhance the manual relocation In-Reply-To: <1347837696-3192-1-git-send-email-marex@denx.de> References: <1347837696-3192-1-git-send-email-marex@denx.de> Message-ID: <1347837696-3192-72-git-send-email-marex@denx.de> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de Enhance the manual relocation of drivers operations structure by checking if the entries are NULL and increment them only if they are not. This allows for setting any entry to NULL and it will survive the manual relocation. Signed-off-by: Marek Vasut Cc: Marek Vasut Cc: Tom Rini Cc: Anatolij Gustschin Cc: Stefan Roese --- common/serial.c | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) diff --git a/common/serial.c b/common/serial.c index 8e0d8a1..e287a5c 100644 --- a/common/serial.c +++ b/common/serial.c @@ -106,12 +106,20 @@ serial_initfunc(sh_serial_initialize); void serial_register(struct serial_device *dev) { #ifdef CONFIG_NEEDS_MANUAL_RELOC - dev->start += gd->reloc_off; - dev->setbrg += gd->reloc_off; - dev->getc += gd->reloc_off; - dev->tstc += gd->reloc_off; - dev->putc += gd->reloc_off; - dev->puts += gd->reloc_off; + if (dev->start) + dev->start += gd->reloc_off; + if (dev->stop) + dev->stop += gd->reloc_off; + if (dev->setbrg) + dev->setbrg += gd->reloc_off; + if (dev->getc) + dev->getc += gd->reloc_off; + if (dev->tstc) + dev->tstc += gd->reloc_off; + if (dev->putc) + dev->putc += gd->reloc_off; + if (dev->puts) + dev->puts += gd->reloc_off; #endif dev->next = serial_devices; -- 1.7.10.4