From: arnd@arndb.de (Arnd Bergmann)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH] drivers/tty: amba-pl011: defer driver probing if external dma is not ready.
Date: Tue, 24 Feb 2015 09:29:54 +0100 [thread overview]
Message-ID: <17223432.USFTMF6ThS@wuerfel> (raw)
In-Reply-To: <1424749613-24765-2-git-send-email-jorge.ramirez-ortiz@linaro.org>
On Monday 23 February 2015 22:46:53 Jorge Ramirez-Ortiz wrote:
> This patch addresses 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 an hisi_6220 SoC (HiKey board from Linaro).
How do you want to handle the case where there is a DMA channel in DT, but
no driver for it built into the kernel?
> @@ -275,15 +277,23 @@ static void pl011_dma_probe_initcall(struct device *dev, struct uart_amba_port *
> struct dma_chan *chan;
> dma_cap_mask_t mask;
>
> - chan = dma_request_slave_channel(dev, "tx");
> + if (queue_dma_probe && plat && plat->dma_filter) {
> + (*queue_dma_probe)(dev, uap);
> + return 0;
> + }
> +
> + chan = dma_request_slave_channel_reason(dev, "tx");
> + if (IS_ERR(chan)) {
> +
> + /* the dma driver has not been initialized yet */
> + if (PTR_ERR(chan) == -EPROBE_DEFER)
> + return -EPROBE_DEFER;
>
> - if (!chan) {
> /* We need platform data */
> if (!plat || !plat->dma_filter) {
> dev_info(uap->port.dev, "no DMA platform data\n");
> - return;
> + return 0;
> }
It would be nice to print the error code here now that you know it
and can tell the difference between no DMA channel being supplied
and the DMA channel from the DT properties being unavailable.
> /* Try to acquire a generic DMA engine slave TX channel */
> dma_cap_zero(mask);
> dma_cap_set(DMA_SLAVE, mask);
> @@ -292,7 +302,7 @@ static void pl011_dma_probe_initcall(struct device *dev, struct uart_amba_port *
> plat->dma_tx_param);
> if (!chan) {
> dev_err(uap->port.dev, "no TX DMA channel!\n");
> - return;
> + return 0;
> }
> }
>
> @@ -310,7 +320,7 @@ static void pl011_dma_probe_initcall(struct device *dev, struct uart_amba_port *
>
> if (!chan) {
> dev_err(uap->port.dev, "no RX DMA channel!\n");
> - return;
> + return 0;
> }
> }
I think the condition is wrong now that 'chan' contains a ERR_PTR
value in case of failure.
Arnd
next prev parent reply other threads:[~2015-02-24 8:29 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <Re: [PATCH] drivers/tty: amba-pl011: defer driver probing if external dma is not ready.>
2015-02-24 3:46 ` [PATCH v2] drivers/tty: amba-pl011: defer driver probing if external dma is not ready Jorge Ramirez-Ortiz
2015-02-24 3:46 ` [PATCH] " Jorge Ramirez-Ortiz
2015-02-24 8:29 ` Arnd Bergmann [this message]
2015-02-24 19:32 ` Jorge Ramirez-Ortiz
2015-02-24 22:02 ` Jorge Ramirez-Ortiz
2015-02-25 10:22 ` Arnd Bergmann
2015-02-25 21:02 ` Jorge Ramirez-Ortiz
2015-02-23 20:16 Jorge Ramirez-Ortiz
2015-02-23 20:58 ` Rob Herring
2015-02-24 3:33 ` Jorge Ramirez-Ortiz
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=17223432.USFTMF6ThS@wuerfel \
--to=arnd@arndb.de \
--cc=linux-arm-kernel@lists.infradead.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).