Skip to contentSkip to conversation

PPS: pps-gpio PPS ECHO implementation

PATCH tom burkart 2 participants 3 messages Jan 31, 2019 – Feb 1, 2019 2 messages not in the archive

lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): [email protected]

A message that is not in the archive (sent off-list or not yet received): [email protected]

#2 lore raw

Quoting Rodolfo Giometti <[email protected]>:

Quoted 1 line

I answered to your message, see here:

Whoops. I missed it because I am not on the list, sorry.

Quoted 1 line

https://lkml.org/lkml/2019/1/4/399

------
Subject Re: [PATCH v14 3/3] pps: pps-gpio pps-echo implementation

Review

Quoted 6 lines
(quoted diff) +6 -0
+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.
------

Review

Quoted 6 lines
(quoted diff) +6 -0
+	/* 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?

Quoted 2 lines

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

#3 lore raw
Quoted 11 lines · tom burkart

Quoting Rodolfo Giometti <[email protected]>:
--------
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.

checkpatch doesn't insist on anything. It's a stupid script.

Always prefer your best judgment over a stupid script.

#4 lore raw

Quoting Joe Perches <[email protected]>:

Quoted 13 lines · tom burkart
Quoted 11 lines

Quoting Rodolfo Giometti <[email protected]>:
--------
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.

Quoted 3 lines

checkpatch doesn't insist on anything. It's a stupid script.

Always prefer your best judgment over a stupid script.

Further references:

From Documentation/devicetree/bindings/submitting-patches.txt:

1) The Documentation/ and include/dt-bindings/ portion of the patch should be a separate patch. The preferred subject prefix for binding patches is:

"dt-bindings: <binding dir>: ..."

Tom