Append cmd_resume to be clear what capabilities are actually being supported. Introduce is_slave_stream_supported() macro to check for all three, cmd_pause, cmd_resume, and cmd_terminate, to be present. Signed-off-by: Andy Shevchenko <andriy.shevchenko@xxxxxxxxxxxxxxx> --- In v2: - introduce cmd_resume instead of renaming cmd_pause drivers/dma/dmaengine.c | 5 +++-- drivers/tty/serial/8250/8250_dma.c | 2 +- include/linux/dmaengine.h | 7 ++++++- sound/soc/soc-generic-dmaengine-pcm.c | 2 +- 4 files changed, 11 insertions(+), 5 deletions(-) diff --git a/drivers/dma/dmaengine.c b/drivers/dma/dmaengine.c index 59eb4fa..b5f7f72 100644 --- a/drivers/dma/dmaengine.c +++ b/drivers/dma/dmaengine.c @@ -503,9 +503,10 @@ int dma_get_slave_caps(struct dma_chan *chan, struct dma_slave_caps *caps) /* * Some devices implement only pause (e.g. to get residuum) but no - * resume. However cmd_pause is advertised as pause AND resume. + * resume. Setting corresponding bits. */ - caps->cmd_pause = !!(device->device_pause && device->device_resume); + caps->cmd_pause = !!device->device_pause; + caps->cmd_resume = !!device->device_resume; caps->cmd_terminate = !!device->device_terminate_all; return 0; diff --git a/drivers/tty/serial/8250/8250_dma.c b/drivers/tty/serial/8250/8250_dma.c index 7f33d1c..7bb14a3 100644 --- a/drivers/tty/serial/8250/8250_dma.c +++ b/drivers/tty/serial/8250/8250_dma.c @@ -176,7 +176,7 @@ int serial8250_request_dma(struct uart_8250_port *p) ret = dma_get_slave_caps(dma->rxchan, &caps); if (ret) goto release_rx; - if (!caps.cmd_pause || !caps.cmd_terminate || + if (!is_slave_stream_supported(&caps) || caps.residue_granularity == DMA_RESIDUE_GRANULARITY_DESCRIPTOR) { ret = -EINVAL; goto release_rx; diff --git a/include/linux/dmaengine.h b/include/linux/dmaengine.h index 30de019..7b98a27 100644 --- a/include/linux/dmaengine.h +++ b/include/linux/dmaengine.h @@ -402,7 +402,8 @@ enum dma_residue_granularity { * type of direction, the dma controller should fill (1 << <TYPE>) and same * should be checked by controller as well * @max_burst: max burst capability per-transfer - * @cmd_pause: true, if pause and thereby resume is supported + * @cmd_pause: true, if pause is supported + * @cmd_resume: true, if resume is supported * @cmd_terminate: true, if terminate cmd is supported * @residue_granularity: granularity of the reported transfer residue * @descriptor_reuse: if a descriptor can be reused by client and @@ -414,11 +415,15 @@ struct dma_slave_caps { u32 directions; u32 max_burst; bool cmd_pause; + bool cmd_resume; bool cmd_terminate; enum dma_residue_granularity residue_granularity; bool descriptor_reuse; }; +#define is_slave_stream_supported(caps) \ + (caps->cmd_pause && caps->cmd_resume && caps->cmd_terminate) + static inline const char *dma_chan_name(struct dma_chan *chan) { return dev_name(&chan->dev->device); diff --git a/sound/soc/soc-generic-dmaengine-pcm.c b/sound/soc/soc-generic-dmaengine-pcm.c index 6cef397..a75ed33 100644 --- a/sound/soc/soc-generic-dmaengine-pcm.c +++ b/sound/soc/soc-generic-dmaengine-pcm.c @@ -151,7 +151,7 @@ static int dmaengine_pcm_set_runtime_hwparams(struct snd_pcm_substream *substrea ret = dma_get_slave_caps(chan, &dma_caps); if (ret == 0) { - if (dma_caps.cmd_pause) + if (is_slave_stream_supported(&dma_caps)) hw.info |= SNDRV_PCM_INFO_PAUSE | SNDRV_PCM_INFO_RESUME; if (dma_caps.residue_granularity <= DMA_RESIDUE_GRANULARITY_SEGMENT) hw.info |= SNDRV_PCM_INFO_BATCH; -- 2.8.1 -- To unsubscribe from this list: send the line "unsubscribe dmaengine" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html