From: Marek Vasut Date: Sun, 16 Sep 2012 16:54:22 +0000 (+0200) Subject: serial: Enhance the manual relocation X-Git-Tag: v2013.01-rc1~277 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=f2760c4acd5b7a198632d002528ec7c227ea27b8;p=u-boot serial: Enhance the manual relocation 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 --- diff --git a/drivers/serial/serial.c b/drivers/serial/serial.c index acb74af963..5bbf3aeb44 100644 --- a/drivers/serial/serial.c +++ b/drivers/serial/serial.c @@ -97,12 +97,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;