From: Johan Hovold <johan@kernel.org>
To: Andreas Kemnade <andreas@kemnade.info>
Cc: letux-kernel@openphoenux.org, johan@kernel.org,
robh+dt@kernel.org, mark.rutland@arm.com,
devicetree@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH v4 2/5] gnss: sirf: add support for configurations without wakeup signal
Date: Fri, 25 Jan 2019 15:31:53 +0100 [thread overview]
Message-ID: <20190125143153.GF3691@localhost> (raw)
In-Reply-To: <20190124063439.29897-3-andreas@kemnade.info>
On Thu, Jan 24, 2019 at 07:34:36AM +0100, Andreas Kemnade wrote:
> Some Wi2Wi devices do not have a wakeup output, so device state can
> only be indirectly detected by looking whether there is communication
> over the serial lines.
> This approach requires a report cycle set to a value less than 2 seconds
> to be reliable.
>
> Signed-off-by: Andreas Kemnade <andreas@kemnade.info>
> ---
> Changes in v4:
> - was 3/6 earlier
> - more cleanup
> - separate no wakeup version for sirf_wait_for_power_state
> - cleaned up optimisation for initial power off
>
> Changes in v3:
> - was 2/5 earlier
> - changed commit headline
> - more style cleanup
> - split out initial power off as 2/6
> - introduced SIRF_REPORT_CYCLE constant
> - added documentation about limitations
> - ignore first data after power state on so no
> shutdown meassages are treated as power on success
> - clearer logic in sirf_wait_for_power_state
>
> Changes in v2:
> - style cleanup
> - do not keep serdev open just because runtime is active,
> only when needed (gnss device is opened or state is changed)
> - clearer timeout semantics
>
> drivers/gnss/sirf.c | 124 ++++++++++++++++++++++++++++++++++++++++++++--------
> 1 file changed, 105 insertions(+), 19 deletions(-)
> static int sirf_wait_for_power_state(struct sirf_data *data, bool active,
> unsigned long timeout)
> {
> int ret;
>
> + if (!data->wakeup)
> + return sirf_wait_for_power_state_nowakeup(data, active,
> + timeout);
> +
> ret = wait_event_interruptible_timeout(data->power_wait,
> data->active == active, msecs_to_jiffies(timeout));
> if (ret < 0)
> @@ -195,6 +267,12 @@ static int sirf_set_active(struct sirf_data *data, bool active)
> else
> timeout = SIRF_HIBERNATE_TIMEOUT;
>
> + if (!data->wakeup) {
> + ret = sirf_serdev_open(data);
> + if (ret)
> + return ret;
> + }
> +
> do {
> sirf_pulse_on_off(data);
> ret = sirf_wait_for_power_state(data, active, timeout);
> @@ -202,12 +280,17 @@ static int sirf_set_active(struct sirf_data *data, bool active)
> if (ret == -ETIMEDOUT)
> continue;
>
> - return ret;
> }
> -
> break;
> +
> } while (retries--);
I noticed there were some odd white-space changes here after you
reverted the modified error handling from v3 which initially looked a
little out of place to me.
I decided to add those changed back in instead after looking at the end
result and noticing that the (retries < 0) check below also becomes
superfluous.
> + if (!data->wakeup)
> + sirf_serdev_close(data);
> +
> + if (ret)
> + return ret;
> +
> if (retries < 0)
> return -ETIMEDOUT;
Series now applied, good job!
Johan
next prev parent reply other threads:[~2019-01-25 14:31 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-01-24 6:34 [PATCH v4 0/5] gnss: sirf: add support for w2sg0004 + lna Andreas Kemnade
2019-01-24 6:34 ` [PATCH v4 1/5] gnss: sirf: write data to gnss only when the gnss device is open Andreas Kemnade
2019-01-24 6:34 ` [PATCH v4 2/5] gnss: sirf: add support for configurations without wakeup signal Andreas Kemnade
2019-01-25 14:31 ` Johan Hovold [this message]
2019-01-24 6:34 ` [PATCH v4 3/5] dt-bindings: gnss: add w2sg0004 compatible string Andreas Kemnade
2019-01-24 6:34 ` [PATCH v4 4/5] gnss: sirf: add a separate supply for a lna Andreas Kemnade
2019-01-24 6:34 ` [PATCH v4 5/5] dt-bindings: gnss: add lna-supply property Andreas Kemnade
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20190125143153.GF3691@localhost \
--to=johan@kernel.org \
--cc=andreas@kemnade.info \
--cc=devicetree@vger.kernel.org \
--cc=letux-kernel@openphoenux.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mark.rutland@arm.com \
--cc=robh+dt@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.