From: Rodolfo Giometti <giometti@enneenne.com>
To: Tom Burkart <tom@aussec.com>,
Linux kernel mailing list <linux-kernel@vger.kernel.org>
Cc: Ricardo Martins <rasm@fe.up.pt>,
James Nuss <jamesnuss@nanometrics.ca>,
Lukas Senger <lukas@fridolin.com>
Subject: Re: [PATCH v14 3/3] pps: pps-gpio pps-echo implementation
Date: Fri, 4 Jan 2019 18:16:17 +0100 [thread overview]
Message-ID: <5eba2cc4-75fa-e1dc-8a86-68f1221d5e78@enneenne.com> (raw)
In-Reply-To: <20181230083333.27210-4-tom@aussec.com>
On 30/12/2018 09:33, Tom Burkart wrote:
> This patch implements the pps echo functionality for pps-gpio, that
> sysfs claims is available already.
>
> Configuration is done via device tree bindings.
>
> This patch was originally written by Lukas Senger as part of a masters
> thesis project and modified for inclusion into the linux kernel by Tom
> Burkart.
[snip]
> +static void pps_gpio_echo(struct pps_device *pps, int event, void *data)
> +{
> + /* add_timer() needs to write into info->echo_timer */
> + struct pps_gpio_device_data *info;
> +
> + info = data;
Maybe you can write as below and saving two lines and having better readability:
struct pps_gpio_device_data *info = data;
> + switch (event) {
> + case PPS_CAPTUREASSERT:
> + if (pps->params.mode & PPS_ECHOASSERT)
> + gpiod_set_value(info->echo_pin, 1);
> + break;
> +
> + case PPS_CAPTURECLEAR:
> + if (pps->params.mode & PPS_ECHOCLEAR)
> + gpiod_set_value(info->echo_pin, 1);
> + break;
> + }
> +
> + /* fire the timer */
> + if (info->pps->params.mode & (PPS_ECHOASSERT | PPS_ECHOCLEAR)) {
> + info->echo_timer.expires = jiffies + info->echo_timeout;
> + add_timer(&info->echo_timer);
> + }
> +}
I think is better firing the timer if and only if we set the echo GPIO otherwise
it's useless...
Ciao,
Rodolfo
--
GNU/Linux Solutions e-mail: giometti@enneenne.com
Linux Device Driver giometti@linux.it
Embedded Systems phone: +39 349 2432127
UNIX programming skype: rodolfo.giometti
next prev parent reply other threads:[~2019-01-04 17:16 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-12-30 8:33 [PATCH v14 0/3] PPS: pps-gpio PPS ECHO implementation Tom Burkart
2018-12-30 8:33 ` [PATCH v14 1/3] pps: descriptor-based gpio Tom Burkart
2018-12-30 8:33 ` [PATCH v14 2/3] dt-bindings: pps: pps-gpio PPS ECHO implementation Tom Burkart
2018-12-30 8:33 ` [PATCH v14 3/3] pps: pps-gpio pps-echo implementation Tom Burkart
2019-01-04 17:16 ` Rodolfo Giometti [this message]
2019-01-04 17:08 ` [PATCH v14 2/3] dt-bindings: pps: pps-gpio PPS ECHO implementation Rodolfo Giometti
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=5eba2cc4-75fa-e1dc-8a86-68f1221d5e78@enneenne.com \
--to=giometti@enneenne.com \
--cc=jamesnuss@nanometrics.ca \
--cc=linux-kernel@vger.kernel.org \
--cc=lukas@fridolin.com \
--cc=rasm@fe.up.pt \
--cc=tom@aussec.com \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox