[PATCH] i2c-algo-bit: cpu_relax/ yield replaced with cond_resched

Anindya Sundar Gayen posted 1 patch 11 months, 2 weeks ago
drivers/i2c/algos/i2c-algo-bit.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
[PATCH] i2c-algo-bit: cpu_relax/ yield replaced with cond_resched
Posted by Anindya Sundar Gayen 11 months, 2 weeks ago
cpu_relax/ yield replaced with better flexible approach in kernel
with cond_resched.

Signed-off-by: Anindya Sundar Gayen <anindya.sg@samsung.com>
---
 drivers/i2c/algos/i2c-algo-bit.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/i2c/algos/i2c-algo-bit.c b/drivers/i2c/algos/i2c-algo-bit.c
index eddf25b90ca8..4168fd901957 100644
--- a/drivers/i2c/algos/i2c-algo-bit.c
+++ b/drivers/i2c/algos/i2c-algo-bit.c
@@ -97,7 +97,7 @@ static int sclhi(struct i2c_algo_bit_data *adap)
 				break;
 			return -ETIMEDOUT;
 		}
-		cpu_relax();
+		cond_resched();
 	}
 #ifdef DEBUG
 	if (jiffies != start && i2c_debug >= 3)
@@ -329,7 +329,7 @@ static int try_address(struct i2c_adapter *i2c_adap,
 		bit_dbg(3, &i2c_adap->dev, "emitting stop condition\n");
 		i2c_stop(adap);
 		udelay(adap->udelay);
-		yield();
+		cond_resched();
 		bit_dbg(3, &i2c_adap->dev, "emitting start condition\n");
 		i2c_start(adap);
 	}
-- 
2.17.1
Re: [PATCH] i2c-algo-bit: cpu_relax/ yield replaced with cond_resched
Posted by Andi Shyti 11 months, 2 weeks ago
On Tue, Feb 25, 2025 at 05:07:24PM +0530, Anindya Sundar Gayen wrote:
> cpu_relax/ yield replaced with better flexible approach in kernel
> with cond_resched.

they are three different functions normally used in different
contexts, I would need a better justification for this patch.

Andi