drivers/tty: amba: defer DMA probe until the DMA channel is required.
commit1c9be31015747b0a981804438b269cfb0f49aa8a
authorJorge Ramirez-Ortiz <jorge.ramirez-ortiz@linaro.org>
Fri, 6 Mar 2015 18:05:40 +0000 (6 13:05 -0500)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sat, 7 Mar 2015 02:50:30 +0000 (7 03:50 +0100)
tree0b1beaa0949392969287ced39cc1f7925e981faa
parentf2ee6dfa0e8597eea8b98d240b0033994e20d215
drivers/tty: amba: defer DMA probe until the DMA channel is required.

Fix a race condition that happens when device_initcall(pl011_dma_initicall)
is executed before all the devices have been probed - this issue was observed on
a hisi_6220 SoC (HiKey board from Linaro).

The deferred driver probing framework relies on late_initcall to trigger
deferred probes so it is just possible that, even with a valid DMA driver ready
to be loaded, we fail to synchronize with it.

The proposed implementation delays probing the DMA until dma_startup.

As this is invoked on port startup and port resume - but DMA probing is only
required once - we avoid calling multiple times using a new field in
uart_amba_port to track this scenario.

This commit allows for subsequent attempts to associate an external DMA if the
DMA driver itself is not available (but present in the deferred probe pending
list).

Signed-off-by: Jorge Ramirez-Ortiz <jorge.ramirez-ortiz@linaro.org>
Reviewed-by: Rob Herring <robh@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/tty/serial/amba-pl011.c