Re: Fwd: [PATCH v14 0/3] PPS: pps-gpio PPS ECHO implementation

From: tom burkart
Date: Wed Jan 30 2019 - 20:40:32 EST


Quoting Rodolfo Giometti <giometti@xxxxxxxxxxxx>:

I answered to your message, see here:
Whoops. I missed it because I am not on the list, sorry.

https://lkml.org/lkml/2019/1/4/399
------
Subject Re: [PATCH v14 3/3] pps: pps-gpio pps-echo implementation

+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;

-----
Done. Easy fix.
------

+ /* 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...
------
Later in the patch:
@@ -152,6 +219,11 @@ static int pps_gpio_probe(struct platform_device *pdev)
data->info.owner = THIS_MODULE;
snprintf(data->info.name, PPS_MAX_NAME_LEN - 1, "%s.%d",
pdev->name, pdev->id);
+ if (data->echo_pin) {
+ data->info.echo = pps_gpio_echo;
+ data->echo_timeout = msecs_to_jiffies(data->echo_active_ms);
+ timer_setup(&data->echo_timer, pps_gpio_echo_timer_callback, 0);
+ }

/* register PPS source */
pps_default_params = PPS_CAPTUREASSERT | PPS_OFFSETASSERT;

The pps-gpio-echo function only becomes callable when the echo GPIO is set hence I felt that the additional check here was superfluous. Does my reasoning make sense?

and here:
https://lkml.org/lkml/2019/1/4/398
--------
Subject Re: [PATCH v14 2/3] dt-bindings: pps: pps-gpio PPS ECHO implementation

I think this patch it's OK but I'm asking to myself if it should be merged with
next one... logically it describes what patch 3/3 does so why do we keep them
separated?
-------
I have separated it because scripts/checkpatch.pl insists it needs to be separated.

Tom