[2/4] serial: 8250_lpss: Configure DMA also w/o DMA filter
Commit Message
If the platform doesn't use DMA device filter (as is the case with
Elkhart Lake), whole lpss8250_dma_setup() setup is skipped. This
results in skipping also *_maxburst setup which is undesirable.
Refactor lpss8250_dma_setup() to configure DMA even if filter is not
setup.
Cc: stable <stable@kernel.org>
Signed-off-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
---
drivers/tty/serial/8250/8250_lpss.c | 16 +++++++++++-----
1 file changed, 11 insertions(+), 5 deletions(-)
Comments
On Mon, Nov 07, 2022 at 01:07:06PM +0200, Ilpo Järvinen wrote:
> If the platform doesn't use DMA device filter (as is the case with
> Elkhart Lake), whole lpss8250_dma_setup() setup is skipped. This
> results in skipping also *_maxburst setup which is undesirable.
> Refactor lpss8250_dma_setup() to configure DMA even if filter is not
> setup.
...
> + if (!lpss->dma_param.dma_dev) {
> + dma = port->dma;
> + goto confonly;
Perhaps
if (dma)
goto out_configuration_only;
return 0;
(note the label naming as well).
> + }
...
> +confonly:
> + if (dma) {
But you know that previous code has dma != NULL. See above.
> + dma->rxconf.src_maxburst = lpss->dma_maxburst;
> + dma->txconf.dst_maxburst = lpss->dma_maxburst;
> + }
@@ -277,8 +277,10 @@ static int lpss8250_dma_setup(struct lpss8250 *lpss, struct uart_8250_port *port
struct dw_dma_slave *rx_param, *tx_param;
struct device *dev = port->port.dev;
- if (!lpss->dma_param.dma_dev)
- return 0;
+ if (!lpss->dma_param.dma_dev) {
+ dma = port->dma;
+ goto confonly;
+ }
rx_param = devm_kzalloc(dev, sizeof(*rx_param), GFP_KERNEL);
if (!rx_param)
@@ -289,16 +291,20 @@ static int lpss8250_dma_setup(struct lpss8250 *lpss, struct uart_8250_port *port
return -ENOMEM;
*rx_param = lpss->dma_param;
- dma->rxconf.src_maxburst = lpss->dma_maxburst;
-
*tx_param = lpss->dma_param;
- dma->txconf.dst_maxburst = lpss->dma_maxburst;
dma->fn = lpss8250_dma_filter;
dma->rx_param = rx_param;
dma->tx_param = tx_param;
port->dma = dma;
+
+confonly:
+ if (dma) {
+ dma->rxconf.src_maxburst = lpss->dma_maxburst;
+ dma->txconf.dst_maxburst = lpss->dma_maxburst;
+ }
+
return 0;
}