@@ -996,13 +996,14 @@ tegra_i2c_poll_completion_timeout(struct tegra_i2c_dev *i2c_dev,
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 ();
@@ -1029,18 +1030,14 @@ tegra_i2c_wait_completion_timeout(struct tegra_i2c_dev *i2c_dev,
1029
1030
disable_irq (i2c_dev -> irq );
1030
1031
1031
1032
/*
1032
- * Under some rare circumstances (like running KASAN +
1033
- * NFS root) CPU, which handles interrupt, may stuck in
1034
- * uninterruptible state for a significant time. In this
1035
- * case we will get timeout if I2C transfer is running on
1036
- * a sibling CPU, despite of IRQ being raised.
1037
- *
1038
- * In order to handle this rare condition, the IRQ status
1039
- * needs to be checked after timeout.
1033
+ * There is a chance that completion may happen after IRQ
1034
+ * synchronization, which is done by disable_irq().
1040
1035
*/
1041
- if (ret == 0 )
1042
- ret = tegra_i2c_poll_completion_timeout (i2c_dev ,
1043
- complete , 0 );
1036
+ if (ret == 0 && completion_done (complete )) {
1037
+ dev_warn (i2c_dev -> dev ,
1038
+ "completion done after timeout\n" );
1039
+ ret = 1 ;
1040
+ }
1044
1041
}
1045
1042
1046
1043
return ret ;
0 commit comments