Skip to content

Commit

Permalink
i2c: tegra: Only display error messages if DMA setup fails
Browse files Browse the repository at this point in the history
Commit 86c92b9 ("i2c: tegra: Add DMA support") added DMA support
to the Tegra I2C driver for Tegra devices that support the APB DMA
controller. One side-effect of this change is that even for Tegra
devices that do not have an APB DMA controller and hence, cannot
support DMA tranfers for I2C transactions, the following error messages
are still displayed ...

 ERR KERN tegra-i2c 31c0000.i2c: cannot use DMA: -19
 ERR KERN tegra-i2c 31c0000.i2c: falling back to PIO

There is no point displaying the above messages for devices that do not
have an APB DMA controller and so fix this by returning from the
tegra_i2c_init_dma() function if 'has_apb_dma' is not true.

Furthermore, if CONFIG_TEGRA20_APB_DMA is not set, then rather than
printing an error message, print an debug message as for whatever reason
this could be intentional.

Fixes: 86c92b9 ("i2c: tegra: Add DMA support")
Signed-off-by: Jonathan Hunter <[email protected]>
Reviewed-by: Dmitry Osipenko <[email protected]>
Acked-by: Thierry Reding <[email protected]>
Signed-off-by: Wolfram Sang <[email protected]>
  • Loading branch information
jonhunter authored and Wolfram Sang committed Feb 23, 2019
1 parent bb6bdd5 commit 89328b1
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions drivers/i2c/busses/i2c-tegra.c
Original file line number Diff line number Diff line change
Expand Up @@ -414,10 +414,12 @@ static int tegra_i2c_init_dma(struct tegra_i2c_dev *i2c_dev)
dma_addr_t dma_phys;
int err;

if (!IS_ENABLED(CONFIG_TEGRA20_APB_DMA) ||
!i2c_dev->hw->has_apb_dma) {
err = -ENODEV;
goto err_out;
if (!i2c_dev->hw->has_apb_dma)
return 0;

if (!IS_ENABLED(CONFIG_TEGRA20_APB_DMA)) {
dev_dbg(i2c_dev->dev, "Support for APB DMA not enabled!\n");
return 0;
}

chan = dma_request_slave_channel_reason(i2c_dev->dev, "rx");
Expand Down

0 comments on commit 89328b1

Please sign in to comment.