i2c: stm32: do not display error when DMA is not requested
Subsystems (3)
PATCH 1/1 i2c: stm32: do not display error when DMA is not requested
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.
---
This patch should be applied on top of the patch [i2c: stm32: Simplify with dev_err_probe()]
--- drivers/i2c/busses/i2c-stm32.c | 16 ++++++++++------ drivers/i2c/busses/i2c-stm32f7.c | 5 +++++ 2 files changed, 15 insertions(+), 6 deletions(-)
drivers/i2c/busses/i2c-stm32.c +10 -6
@@ -25,8 +25,11 @@ struct stm32_i2c_dma *stm32_i2c_dma_request(struct device *dev,/* Request and configure I2C TX dma channel */ dma->chan_tx =dma_request_chan (dev,"tx" );if (IS_ERR (dma->chan_tx)) { - ret =dev_err_probe (dev,PTR_ERR (dma->chan_tx), -"can't request DMA tx channel\n" ); +if (PTR_ERR (dma->chan_tx) == -ENODEV ) + ret =PTR_ERR (dma->chan_tx); +else + ret =dev_err_probe (dev,PTR_ERR (dma->chan_tx), +"can't request DMA tx channel\n" ); goto fail_al; }
@@ -44,8 +47,11 @@ struct stm32_i2c_dma *stm32_i2c_dma_request(struct device *dev,/* Request and configure I2C RX dma channel */ dma->chan_rx =dma_request_chan (dev,"rx" );if (IS_ERR (dma->chan_rx)) { - ret =dev_err_probe (dev,PTR_ERR (dma->chan_rx), -"can't request DMA rx channel\n" ); +if (PTR_ERR (dma->chan_tx) == -ENODEV ) + ret =PTR_ERR (dma->chan_tx); +else + ret =dev_err_probe (dev,PTR_ERR (dma->chan_rx), +"can't request DMA rx channel\n" ); goto fail_tx; }
@@ -73,8 +79,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); }
drivers/i2c/busses/i2c-stm32f7.c +5 -0
@@ -2049,6 +2049,11 @@ static int stm32f7_i2c_probe(struct platform_device *pdev)STM32F7_I2C_TXDR , STM32F7_I2C_RXDR);if (PTR_ERR (i2c_dev->dma) == -ENODEV ) { +/* +* DMA usage is not mandatory for the I2C, it is not an error +* to receive -ENODEV +*/ +dev_dbg (i2c_dev->dev,"not using DMA\n" ); i2c_dev->dma =NULL ; }else if (IS_ERR (i2c_dev->dma)) { ret = dev_err_probe(&pdev->dev, PTR_ERR(i2c_dev->dma),
Signature · 1 line
2.7.4
Quoted 7 lines · Alain Volmat
DMA usage is optional for the I2C driver. check for the
-ENODEVerror in order to avoid displaying an error when no DMA has been requested.Signed-off-by Alain Volmat <[email protected]>---
This patch should be applied on top of the patch [i2c: stm32: Simplify withdev_err_probe()]
We can do it in this order, it just makes backporting to stable kernels (if that is desired) a bit harder than a self-contained patch. I am fine with both approaches, but just wanted to point it out.
Quoted 5 lines · Wolfram Sang
Quoted 4 lines · Alain Volmat
DMA usage is optional for the I2C driver. check for the
-ENODEVerror in order to avoid displaying an error when no DMA has been requested.
Quoted 7 lines
Quoted 3 lines
Signed-off-by Alain Volmat <[email protected]>---
This patch should be applied on top of the patch [i2c: stm32: Simplify withdev_err_probe()]We can do it in this order, it just makes backporting to stable kernels (if that is desired) a bit harder than a self-contained patch. I am fine with both approaches, but just wanted to point it out.
Indeed, that's a good point. I'll rework it then, to avoid the dependency on dev_err_probe change. If that is ok, I propose to push a two patches serie with both this fix (updated) followed by a rebased version of the dev_err_probe patch from Krzysztof for dev_err_probe change.
_______________________________________________
linux-arm-kernel mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
Quoted 5 lines
Indeed, that's a good point. I'll rework it then, to avoid the dependency on
dev_err_probechange. If that is ok, I propose to push a two patches serie with both this fix (updated) followed by a rebased version of thedev_err_probepatch from Krzysztof fordev_err_probechange.
Perfect!
_______________________________________________
linux-arm-kernel mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
Quoted 11 lines · Alain Volmat
Quoted 9 lines · Wolfram Sang
Quoted 7 lines · Alain Volmat
DMA usage is optional for the I2C driver. check for the
-ENODEVerror in order to avoid displaying an error when no DMA has been requested.Signed-off-by Alain Volmat <[email protected]>---
This patch should be applied on top of the patch [i2c: stm32: Simplify withdev_err_probe()]
Quoted 8 lines
Quoted 3 lines
We can do it in this order, it just makes backporting to stable kernels (if that is desired) a bit harder than a self-contained patch. I am fine with both approaches, but just wanted to point it out.
Indeed, that's a good point. I'll rework it then, to avoid the dependency on
dev_err_probechange. If that is ok, I propose to push a two patches serie with both this fix (updated) followed by a rebased version of thedev_err_probepatch from Krzysztof fordev_err_probechange.
I can rebase mine on top of yours. Indeed such cleanups as mine should be rather later in the queue.
Best regards,
Krzysztof
_______________________________________________
linux-arm-kernel mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel