summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarek Vasut <[email protected]>2012-09-16 18:54:22 +0200
committerTom Rini <[email protected]>2012-10-15 11:53:59 -0700
commitf2760c4acd5b7a198632d002528ec7c227ea27b8 (patch)
tree87e122e52241ab8f3d3e999caad780f2d8883894
parentc1f5805a9dd5ea50b108e1d39a16edf710ea17e6 (diff)
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 <[email protected]> Cc: Marek Vasut <[email protected]> Cc: Tom Rini <[email protected]> Cc: Anatolij Gustschin <[email protected]> Cc: Stefan Roese <[email protected]>
-rw-r--r--drivers/serial/serial.c20
1 files changed, 14 insertions, 6 deletions
diff --git a/drivers/serial/serial.c b/drivers/serial/serial.c
index acb74af963b..5bbf3aeb445 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;