[LinuxPPS] pps-gpio bugfix patch - RFC
tom burkart
tom at aussec.com
Wed Sep 19 08:34:57 CEST 2018
Hi all,
since digging in the code for pps-gpio, I found several issues. I
have attached a patch (yes, I need to fix the format for the final
version) to solicit comments.
Also the lack of a free() after the devm_kzalloc(): can I assume this
is deliberate and that the memory is free'd elsewhere (for error exits
and on remove)?
diff -uNrp
linux-4.16.7.orig/Documentation/devicetree/bindings/pps/pps-gpio.txt
linux-4.16.7/Documentation/devicetree/bindings/pps/pps-gpio.txt
---
linux-4.16.7.orig/Documentation/devicetree/bindings/pps/pps-gpio.txt
2018-05-02 05:47:31.000000000 +1000
+++ linux-4.16.7/Documentation/devicetree/bindings/pps/pps-gpio.txt
2018-09-19 16:09:20.812138417 +1000
@@ -10,6 +10,7 @@ Required properties:
Optional properties:
- assert-falling-edge: when present, assert is indicated by a falling edge
(instead of by a rising edge)
+- capture-clear: when present, also capture the clear event
Example:
pps {
diff -uNrp linux-4.16.7.orig/drivers/pps/clients/pps-gpio.c
linux-4.16.7/drivers/pps/clients/pps-gpio.c
--- linux-4.16.7.orig/drivers/pps/clients/pps-gpio.c 2018-05-02
05:47:31.000000000 +1000
+++ linux-4.16.7/drivers/pps/clients/pps-gpio.c 2018-09-19
16:29:36.224164252 +1000
@@ -119,6 +119,9 @@ static int pps_gpio_probe(struct platfor
if (of_get_property(np, "assert-falling-edge", NULL))
data->assert_falling_edge = true;
+
+ if (of_get_property(np, "capture-clear", NULL))
+ data->capture_clear = true;
}
/* GPIO setup */
@@ -131,7 +134,7 @@ static int pps_gpio_probe(struct platfor
ret = gpio_direction_input(data->gpio_pin);
if (ret) {
- dev_err(&pdev->dev, "failed to set pin direction\n");
+ dev_err(&pdev->dev, "failed to set pin as input\n");
return -EINVAL;
}
Kind regards,
Tom Burkart
Consultant
AUSSEC Mob: 04 1768 2202 Fax: 02 9526 1230
30 Waterside Crs, Carramar NSW 2163
More information about the discussions
mailing list