mirror of
https://github.com/torvalds/linux.git
synced 2024-09-23 08:23:44 +00:00
serial: samsung: Simplify DMA engine initialization code
dma_request_slave_channel_compat() requires filter function and mask, which are not needed on device tree based platforms, so simplify the code by calling the more appropriate dma_request_chan() function. This additionally gives us proper error handling, because the new function returns error codes instead of NULL on failure. Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com> Reviewed-by: Sylwester Nawrocki <s.nawrocki@samsung.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
parent
f87fa71e6f
commit
ba3d6f8f10
|
@ -859,7 +859,6 @@ static void s3c24xx_serial_break_ctl(struct uart_port *port, int break_state)
|
||||||
static int s3c24xx_serial_request_dma(struct s3c24xx_uart_port *p)
|
static int s3c24xx_serial_request_dma(struct s3c24xx_uart_port *p)
|
||||||
{
|
{
|
||||||
struct s3c24xx_uart_dma *dma = p->dma;
|
struct s3c24xx_uart_dma *dma = p->dma;
|
||||||
dma_cap_mask_t mask;
|
|
||||||
unsigned long flags;
|
unsigned long flags;
|
||||||
|
|
||||||
/* Default slave configuration parameters */
|
/* Default slave configuration parameters */
|
||||||
|
@ -876,21 +875,17 @@ static int s3c24xx_serial_request_dma(struct s3c24xx_uart_port *p)
|
||||||
else
|
else
|
||||||
dma->tx_conf.dst_maxburst = 1;
|
dma->tx_conf.dst_maxburst = 1;
|
||||||
|
|
||||||
dma_cap_zero(mask);
|
dma->rx_chan = dma_request_chan(p->port.dev, "rx");
|
||||||
dma_cap_set(DMA_SLAVE, mask);
|
|
||||||
|
|
||||||
dma->rx_chan = dma_request_slave_channel_compat(mask, dma->fn,
|
if (IS_ERR(dma->rx_chan))
|
||||||
dma->rx_param, p->port.dev, "rx");
|
return PTR_ERR(dma->rx_chan);
|
||||||
if (!dma->rx_chan)
|
|
||||||
return -ENODEV;
|
|
||||||
|
|
||||||
dmaengine_slave_config(dma->rx_chan, &dma->rx_conf);
|
dmaengine_slave_config(dma->rx_chan, &dma->rx_conf);
|
||||||
|
|
||||||
dma->tx_chan = dma_request_slave_channel_compat(mask, dma->fn,
|
dma->tx_chan = dma_request_chan(p->port.dev, "tx");
|
||||||
dma->tx_param, p->port.dev, "tx");
|
if (IS_ERR(dma->tx_chan)) {
|
||||||
if (!dma->tx_chan) {
|
|
||||||
dma_release_channel(dma->rx_chan);
|
dma_release_channel(dma->rx_chan);
|
||||||
return -ENODEV;
|
return PTR_ERR(dma->tx_chan);
|
||||||
}
|
}
|
||||||
|
|
||||||
dmaengine_slave_config(dma->tx_chan, &dma->tx_conf);
|
dmaengine_slave_config(dma->tx_chan, &dma->tx_conf);
|
||||||
|
|
|
@ -44,10 +44,6 @@ struct s3c24xx_serial_drv_data {
|
||||||
};
|
};
|
||||||
|
|
||||||
struct s3c24xx_uart_dma {
|
struct s3c24xx_uart_dma {
|
||||||
dma_filter_fn fn;
|
|
||||||
void *rx_param;
|
|
||||||
void *tx_param;
|
|
||||||
|
|
||||||
unsigned int rx_chan_id;
|
unsigned int rx_chan_id;
|
||||||
unsigned int tx_chan_id;
|
unsigned int tx_chan_id;
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user