I am adding some hardware handshaking via GPIO lines to the mxs-auart driver. So I am compiling it as a module. I can insert the module fine:
# modprobe mxs_auart
mxs-auart.0: ttySP0 at MMIO 0x8006a000 (irq = 112) is a mxs-auart.0
Found APPUART 3.1.0
mxs-auart.1: ttySP1 at MMIO 0x8006c000 (irq = 113) is a mxs-auart.1
Found APPUART 3.1.0
mxs-auart.2: ttySP2 at MMIO 0x8006e000 (irq = 114) is a mxs-auart.2
Found APPUART 3.1.0
But if I try to remove the module, it gives an error, and also locks up the debug serial port.
# modprobe -r mxs_auart
Trying to free nonexistent resource <000000008006e000-000000008006efff>
Trying to free nonexistent resource <000000008006c000-000000008006cfff>
Any pointers on this? I'm guessing those messages are something to do with the following code:
static void mxs_auart_release_port(struct uart_port *u)
{
release_mem_region(u->mapbase, SZ_4K);
}
But I don't know if that's the root cause of the lock-up. I'm fairly new to Linux kernel device driver programming, and I haven't tried debugging this.