Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

Revert "i2c: tegra: Better handle case where CPU0 is busy for a long time"

This reverts commit a900aeac253729411cf33c6cb598c152e9e4137f because
regressions were showing up.

Suggested-by: Thierry Reding <treding@nvidia.com>
Link: https://lore.kernel.org/dmaengine/20200319201140.17451-1-digetx@gmail.com/
Signed-off-by: Wolfram Sang <wsa@the-dreams.de>

+12 -15
+12 -15
drivers/i2c/busses/i2c-tegra.c
··· 996 996 do { 997 997 u32 status = i2c_readl(i2c_dev, I2C_INT_STATUS); 998 998 999 - if (status) 999 + if (status) { 1000 1000 tegra_i2c_isr(i2c_dev->irq, i2c_dev); 1001 1001 1002 - if (completion_done(complete)) { 1003 - s64 delta = ktime_ms_delta(ktimeout, ktime); 1002 + if (completion_done(complete)) { 1003 + s64 delta = ktime_ms_delta(ktimeout, ktime); 1004 1004 1005 - return msecs_to_jiffies(delta) ?: 1; 1005 + return msecs_to_jiffies(delta) ?: 1; 1006 + } 1006 1007 } 1007 1008 1008 1009 ktime = ktime_get(); ··· 1030 1029 disable_irq(i2c_dev->irq); 1031 1030 1032 1031 /* 1033 - * Under some rare circumstances (like running KASAN + 1034 - * NFS root) CPU, which handles interrupt, may stuck in 1035 - * uninterruptible state for a significant time. In this 1036 - * case we will get timeout if I2C transfer is running on 1037 - * a sibling CPU, despite of IRQ being raised. 1038 - * 1039 - * In order to handle this rare condition, the IRQ status 1040 - * needs to be checked after timeout. 1032 + * There is a chance that completion may happen after IRQ 1033 + * synchronization, which is done by disable_irq(). 1041 1034 */ 1042 - if (ret == 0) 1043 - ret = tegra_i2c_poll_completion_timeout(i2c_dev, 1044 - complete, 0); 1035 + if (ret == 0 && completion_done(complete)) { 1036 + dev_warn(i2c_dev->dev, 1037 + "completion done after timeout\n"); 1038 + ret = 1; 1039 + } 1045 1040 } 1046 1041 1047 1042 return ret;