Skip to contentSkip to conversation

gnss: sirf: fix activation retry handling

PATCH In review Johan Hovold 2 participants 3 messages Dec 5, 2018 – Dec 13, 2018

Subsystems (2)
lore
Share & tools
lore

Johan Hovold

author maintainer
#0 lore raw

PATCH 1/1 gnss: sirf: fix activation retry handling

Fix activation helper which would return -ETIMEDOUT even if the last retry attempt was successful.

Also change the semantics of the retries variable so that it actually holds the number of retries (rather than tries).

Fixes d2efbbd18b1e ("gnss: add driver for sirfstar-based receivers")
Cc stable <[email protected]> # 4.19
---
 drivers/gnss/sirf.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/gnss/sirf.c +3 -3
index 71d014edd167..2c22836d3ffd 100644
@@ -168,7 +168,7 @@ static int sirf_set_active(struct sirf_data *data, bool active)
 	else
 		timeout = SIRF_HIBERNATE_TIMEOUT;
 
-	while (retries-- > 0) {
+	do {
 		sirf_pulse_on_off(data);
 		ret = sirf_wait_for_power_state(data, active, timeout);
 		if (ret < 0) {
@@ -179,9 +179,9 @@ static int sirf_set_active(struct sirf_data *data, bool active)
 		}
 
 		break;
-	}
+	} while (retries--);
 
-	if (retries == 0)
+	if (retries < 0)
 		return -ETIMEDOUT;
 
 	return 0;
Signature · 1 line
2.19.2
#1 lore raw

Hi,

Quoted 6 lines · On Wed, 5 Dec 2018 11:21:49 +0100 Johan Hovold <[email protected]> wrote:

Fix activation helper which would return -ETIMEDOUT even if the last retry attempt was successful.

Also change the semantics of the retries variable so that it actually holds the number of retries (rather than tries).

Sounds sane. I rebased my patch series on top of it and improved my testing script (the manual on/off toggle in between was not working properly)

Regards,
Andreas

author maintainer
#2 lore raw
Quoted 8 lines · Andreas Kemnade

Hi,

Quoted 3 lines · On Wed, 5 Dec 2018 11:21:49 +0100 Johan Hovold <[email protected]> wrote:

Fix activation helper which would return -ETIMEDOUT even if the last retry attempt was successful.

Quoted 6 lines
Quoted 2 lines

Also change the semantics of the retries variable so that it actually holds the number of retries (rather than tries).

Sounds sane. I rebased my patch series on top of it and improved my testing script (the manual on/off toggle in between was not working properly)

That's great. And thanks for testing. I'm a bit short on time at the moment, but will try to take at least a quick look at your v2 today.

Johan