mirror of
https://mirrors.bfsu.edu.cn/git/linux.git
synced 2024-12-01 08:04:22 +08:00
mfd: stm32-timers: Use dma_request_chan() instead dma_request_slave_channel()
dma_request_slave_channel() is a wrapper on top of dma_request_chan() eating up the error code. By using dma_request_chan() directly the driver can support deferred probing against DMA. Signed-off-by: Peter Ujfalusi <peter.ujfalusi@ti.com> Acked-by: Fabrice Gasnier <fabrice.gasnier@st.com> Signed-off-by: Lee Jones <lee.jones@linaro.org>
This commit is contained in:
parent
c085c66415
commit
8d7de07783
@ -167,10 +167,11 @@ static void stm32_timers_get_arr_size(struct stm32_timers *ddata)
|
||||
regmap_write(ddata->regmap, TIM_ARR, 0x0);
|
||||
}
|
||||
|
||||
static void stm32_timers_dma_probe(struct device *dev,
|
||||
static int stm32_timers_dma_probe(struct device *dev,
|
||||
struct stm32_timers *ddata)
|
||||
{
|
||||
int i;
|
||||
int ret = 0;
|
||||
char name[4];
|
||||
|
||||
init_completion(&ddata->dma.completion);
|
||||
@ -179,14 +180,23 @@ static void stm32_timers_dma_probe(struct device *dev,
|
||||
/* Optional DMA support: get valid DMA channel(s) or NULL */
|
||||
for (i = STM32_TIMERS_DMA_CH1; i <= STM32_TIMERS_DMA_CH4; i++) {
|
||||
snprintf(name, ARRAY_SIZE(name), "ch%1d", i + 1);
|
||||
ddata->dma.chans[i] = dma_request_slave_channel(dev, name);
|
||||
ddata->dma.chans[i] = dma_request_chan(dev, name);
|
||||
}
|
||||
ddata->dma.chans[STM32_TIMERS_DMA_UP] =
|
||||
dma_request_slave_channel(dev, "up");
|
||||
ddata->dma.chans[STM32_TIMERS_DMA_TRIG] =
|
||||
dma_request_slave_channel(dev, "trig");
|
||||
ddata->dma.chans[STM32_TIMERS_DMA_COM] =
|
||||
dma_request_slave_channel(dev, "com");
|
||||
ddata->dma.chans[STM32_TIMERS_DMA_UP] = dma_request_chan(dev, "up");
|
||||
ddata->dma.chans[STM32_TIMERS_DMA_TRIG] = dma_request_chan(dev, "trig");
|
||||
ddata->dma.chans[STM32_TIMERS_DMA_COM] = dma_request_chan(dev, "com");
|
||||
|
||||
for (i = STM32_TIMERS_DMA_CH1; i < STM32_TIMERS_MAX_DMAS; i++) {
|
||||
if (IS_ERR(ddata->dma.chans[i])) {
|
||||
/* Save the first error code to return */
|
||||
if (PTR_ERR(ddata->dma.chans[i]) != -ENODEV && !ret)
|
||||
ret = PTR_ERR(ddata->dma.chans[i]);
|
||||
|
||||
ddata->dma.chans[i] = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
static void stm32_timers_dma_remove(struct device *dev,
|
||||
@ -230,7 +240,11 @@ static int stm32_timers_probe(struct platform_device *pdev)
|
||||
|
||||
stm32_timers_get_arr_size(ddata);
|
||||
|
||||
stm32_timers_dma_probe(dev, ddata);
|
||||
ret = stm32_timers_dma_probe(dev, ddata);
|
||||
if (ret) {
|
||||
stm32_timers_dma_remove(dev, ddata);
|
||||
return ret;
|
||||
}
|
||||
|
||||
platform_set_drvdata(pdev, ddata);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user