/* This function fixes up the interrupt value for platform ports as it couldn't be done earlier before interrupt maps have been parsed. It also "corrects" the IO address for PIO ports for the same reason, since earlier, the PHBs virtual IO space wasn't assigned yet. It then registers all those platform ports for use by the 8250 driver when it finally loads.  */
static int __init serial_dev_init(void)
/* This function fixes up the interrupt value for platform ports as it couldn't be done earlier before interrupt maps have been parsed. It also "corrects" the IO address for PIO ports for the same reason, since earlier, the PHBs virtual IO space wasn't assigned yet. It then registers all those platform ports for use by the 8250 driver when it finally loads.  */
static int __init serial_dev_init(void)
{
	int i;
	if (legacy_serial_count == 0)
		return -ENODEV;
	DBG("Fixing serial ports interrupts and IO ports ...\n");
	for (i = 0; i < legacy_serial_count; i++) {
		struct plat_serial8250_port *port = &legacy_serial_ports[i];
		struct device_node *np = legacy_serial_infos[i].np;
		if (port->irq == NO_IRQ)
			fixup_port_irq(i, np, port);
		if (port->iotype == UPIO_PORT)
			fixup_port_pio(i, np, port);
		if ((port->iotype == UPIO_MEM) || (port->iotype == UPIO_TSI))
			fixup_port_mmio(i, np, port);
	}
	DBG("Registering platform serial ports\n");
	return platform_device_register(&serial_device);
}