struct serial_card_info {
unsigned int num_ports;
int ports[MAX_PORTS];
+ void __iomem *vaddr;
};
static int __devinit
struct serial_card_type *type = id->data;
struct uart_port port;
unsigned long bus_addr;
- unsigned char __iomem *virt_addr;
unsigned int i;
info = kmalloc(sizeof(struct serial_card_info), GFP_KERNEL);
info->num_ports = type->num_ports;
bus_addr = ecard_resource_start(ec, type->type);
- virt_addr = ioremap(bus_addr, ecard_resource_len(ec, type->type));
- if (!virt_addr) {
+ info->vaddr = ioremap(bus_addr, ecard_resource_len(ec, type->type));
+ if (!info->vaddr) {
kfree(info);
return -ENOMEM;
}
port.dev = &ec->dev;
for (i = 0; i < info->num_ports; i ++) {
- port.membase = virt_addr + type->offset[i];
+ port.membase = info->vaddr + type->offset[i];
port.mapbase = bus_addr + type->offset[i];
info->ports[i] = serial8250_register_port(&port);
if (info->ports[i] > 0)
serial8250_unregister_port(info->ports[i]);
+ iounmap(info->vaddr);
kfree(info);
}