diff options
Diffstat (limited to 'drivers/gnss/sirf.c')
-rw-r--r-- | drivers/gnss/sirf.c | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/drivers/gnss/sirf.c b/drivers/gnss/sirf.c index 79cb98950013..226f6e6fe01b 100644 --- a/drivers/gnss/sirf.c +++ b/drivers/gnss/sirf.c @@ -16,6 +16,7 @@ #include <linux/pm.h> #include <linux/pm_runtime.h> #include <linux/regulator/consumer.h> +#include <linux/sched.h> #include <linux/serdev.h> #include <linux/slab.h> #include <linux/wait.h> @@ -83,8 +84,8 @@ static int sirf_write_raw(struct gnss_device *gdev, const unsigned char *buf, int ret; /* write is only buffered synchronously */ - ret = serdev_device_write(serdev, buf, count, 0); - if (ret < 0) + ret = serdev_device_write(serdev, buf, count, MAX_SCHEDULE_TIMEOUT); + if (ret < 0 || ret < count) return ret; /* FIXME: determine if interrupted? */ @@ -167,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) { @@ -178,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; |