mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-08-26 10:49:33 +00:00
i2c: stm32: fix error message on upon dma_request_chan & defer handling
DMA usage is optional for the I2C driver. check for the -ENODEV error in order to avoid displaying an error when no DMA has been requested. Cleaning up the error messages during probe, remove the additional -EPROBE_DEFER within probe function since additional error message doesn't give much more information than what is already reported within the stm32_i2c_dma_request function. Signed-off-by: Alain Volmat <alain.volmat@st.com> Signed-off-by: Wolfram Sang <wsa@kernel.org>
This commit is contained in:
parent
8ce98dd21f
commit
27c90870e7
2 changed files with 8 additions and 11 deletions
|
@ -26,7 +26,7 @@ struct stm32_i2c_dma *stm32_i2c_dma_request(struct device *dev,
|
|||
dma->chan_tx = dma_request_chan(dev, "tx");
|
||||
if (IS_ERR(dma->chan_tx)) {
|
||||
ret = PTR_ERR(dma->chan_tx);
|
||||
if (ret != -EPROBE_DEFER)
|
||||
if ((ret != -ENODEV) && (ret != -EPROBE_DEFER))
|
||||
dev_err(dev, "can't request DMA tx channel\n");
|
||||
goto fail_al;
|
||||
}
|
||||
|
@ -46,7 +46,7 @@ struct stm32_i2c_dma *stm32_i2c_dma_request(struct device *dev,
|
|||
dma->chan_rx = dma_request_chan(dev, "rx");
|
||||
if (IS_ERR(dma->chan_rx)) {
|
||||
ret = PTR_ERR(dma->chan_rx);
|
||||
if (ret != -EPROBE_DEFER)
|
||||
if ((ret != -ENODEV) && (ret != -EPROBE_DEFER))
|
||||
dev_err(dev, "can't request DMA rx channel\n");
|
||||
|
||||
goto fail_tx;
|
||||
|
@ -76,8 +76,6 @@ struct stm32_i2c_dma *stm32_i2c_dma_request(struct device *dev,
|
|||
dma_release_channel(dma->chan_tx);
|
||||
fail_al:
|
||||
devm_kfree(dev, dma);
|
||||
if (ret != -EPROBE_DEFER)
|
||||
dev_info(dev, "can't use DMA\n");
|
||||
|
||||
return ERR_PTR(ret);
|
||||
}
|
||||
|
|
|
@ -2121,14 +2121,13 @@ static int stm32f7_i2c_probe(struct platform_device *pdev)
|
|||
i2c_dev->dma = stm32_i2c_dma_request(i2c_dev->dev, phy_addr,
|
||||
STM32F7_I2C_TXDR,
|
||||
STM32F7_I2C_RXDR);
|
||||
if (PTR_ERR(i2c_dev->dma) == -ENODEV)
|
||||
i2c_dev->dma = NULL;
|
||||
else if (IS_ERR(i2c_dev->dma)) {
|
||||
if (IS_ERR(i2c_dev->dma)) {
|
||||
ret = PTR_ERR(i2c_dev->dma);
|
||||
if (ret != -EPROBE_DEFER)
|
||||
dev_err(&pdev->dev,
|
||||
"Failed to request dma error %i\n", ret);
|
||||
goto fmp_clear;
|
||||
/* DMA support is optional, only report other errors */
|
||||
if (ret != -ENODEV)
|
||||
goto fmp_clear;
|
||||
dev_dbg(i2c_dev->dev, "No DMA option: fallback using interrupts\n");
|
||||
i2c_dev->dma = NULL;
|
||||
}
|
||||
|
||||
if (i2c_dev->wakeup_src) {
|
||||
|
|
Loading…
Reference in a new issue