blob: db7a856ae9c6bbe0ddcaee1db2d40fdda0cc718d [file] [log] [blame]
From 6789ebcebce0a8eb71b279625acb3dd2c5aa31e7 Mon Sep 17 00:00:00 2001
From: Wolfram Sang <wsa+renesas@sang-engineering.com>
Date: Wed, 11 Jul 2018 00:27:22 +0200
Subject: [PATCH 1626/1795] i2c: recovery: rename variable for easier
understanding
While refactoring the routine before, it occurred to me that this will
make the code much easier to understand.
Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
Acked-by: Peter Rosin <peda@axentia.se>
Signed-off-by: Wolfram Sang <wsa@the-dreams.de>
(cherry picked from commit f7ff75e2a88f9246dace2195e9dedd98df41d416)
Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
---
drivers/i2c/i2c-core-base.c | 14 +++++++-------
1 file changed, 7 insertions(+), 7 deletions(-)
diff --git a/drivers/i2c/i2c-core-base.c b/drivers/i2c/i2c-core-base.c
index e48dae0dea7d..bd8e9ef048e1 100644
--- a/drivers/i2c/i2c-core-base.c
+++ b/drivers/i2c/i2c-core-base.c
@@ -219,12 +219,12 @@ static int i2c_generic_bus_free(struct i2c_adapter *adap)
static int i2c_generic_recovery(struct i2c_adapter *adap)
{
struct i2c_bus_recovery_info *bri = adap->bus_recovery_info;
- int i = 0, val = 1, ret;
+ int i = 0, scl = 1, ret;
if (bri->prepare_recovery)
bri->prepare_recovery(adap);
- bri->set_scl(adap, val);
+ bri->set_scl(adap, scl);
if (bri->set_sda)
bri->set_sda(adap, 1);
ndelay(RECOVERY_NDELAY);
@@ -233,7 +233,7 @@ static int i2c_generic_recovery(struct i2c_adapter *adap)
* By this time SCL is high, as we need to give 9 falling-rising edges
*/
while (i++ < RECOVERY_CLK_CNT * 2) {
- if (val) {
+ if (scl) {
/* SCL shouldn't be low here */
if (!bri->get_scl(adap)) {
dev_err(&adap->dev,
@@ -243,8 +243,8 @@ static int i2c_generic_recovery(struct i2c_adapter *adap)
}
}
- val = !val;
- bri->set_scl(adap, val);
+ scl = !scl;
+ bri->set_scl(adap, scl);
/*
* If we can set SDA, we will always create STOP here to ensure
@@ -254,10 +254,10 @@ static int i2c_generic_recovery(struct i2c_adapter *adap)
*/
ndelay(RECOVERY_NDELAY / 2);
if (bri->set_sda)
- bri->set_sda(adap, val);
+ bri->set_sda(adap, scl);
ndelay(RECOVERY_NDELAY / 2);
- if (val) {
+ if (scl) {
ret = i2c_generic_bus_free(adap);
if (ret == 0)
break;
--
2.19.0