Re: [PATCH v1 1/7] pps: clients: gpio: Bail out on error when requesting GPIO echo line

2021-03-09 Thread Rodolfo Giometti
On 09/03/21 12:28, Andy Shevchenko wrote:
> On Tue, Mar 09, 2021 at 11:51:58AM +0100, Rodolfo Giometti wrote:
>> On 09/03/21 11:47, Andy Shevchenko wrote:
>>> +Cc: Greg
>>>
>>> On Fri, Feb 26, 2021 at 07:03:32PM +0200, Andy Shevchenko wrote:
>>>> On Tue, Feb 16, 2021 at 01:31:48PM +0200, Andy Shevchenko wrote:
>>>>> When requesting optional GPIO echo line, bail out on error,
>>>>> so user will know that something wrong with the existing property.
>>>>
>>>> Guys, any comments on this series?
>>>
>>> Greg, seems PPS maintainer keeps silent, can I route this series thru one of
>>> yours tree (resend implied)?
>>
>> I'm sorry but I suppose I missed this patch... -_-'
> 
> Entire series (7 patches) has been Cc'ed to you :-)
> 
>> Can you please resend it to me?
> 
> Okay, I will resend with Greg included just in case.
> 
> Done!

Thanks! Got them and acked. :-)

Sorry for delay.

> For the future, I recommend to switch to b4 tool (most likely already in your
> Linux distribution), so
> 
> 0/ Install b4 tool (if not yet in distro: `pip install b4` should work)
> 1/ Find message ID for the thread, for example,
>   20210216113154.70852-1-andriy.shevche...@linux.intel.com (v1)
>   20210309112403.36633-1-andriy.shevche...@linux.intel.com (v1 resend)
> 
> 2/ `b4 am -s $MESSAGE_ID`, replace $MESSAGE_ID with one of the above
> 3/ it will download a mailbox that you may apply with `git am ...`

Uao! I'm going to use it for sure! Thanks.

Ciao,

Rodolfo

-- 
GNU/Linux Solutions  e-mail: giome...@enneenne.com
Linux Device Driver  giome...@linux.it
Embedded Systems phone:  +39 349 2432127
UNIX programming skype:  rodolfo.giometti


Re: [PATCH resend v1 7/7] pps: clients: gpio: Rearrange optional stuff in pps_gpio_setup()

2021-03-09 Thread Rodolfo Giometti
On 09/03/21 12:24, Andy Shevchenko wrote:
> Rearrange optional stuff in pps_gpio_setup() so it will go after mandatory one
> and with reduced indentation. This will increase readability of the sources.
> 
> Signed-off-by: Andy Shevchenko 
> ---
>  drivers/pps/clients/pps-gpio.c | 33 ++---
>  1 file changed, 18 insertions(+), 15 deletions(-)
> 
> diff --git a/drivers/pps/clients/pps-gpio.c b/drivers/pps/clients/pps-gpio.c
> index b097da5a659a..35799e6401c9 100644
> --- a/drivers/pps/clients/pps-gpio.c
> +++ b/drivers/pps/clients/pps-gpio.c
> @@ -110,28 +110,31 @@ static int pps_gpio_setup(struct device *dev)
>   return dev_err_probe(dev, PTR_ERR(data->gpio_pin),
>"failed to request PPS GPIO\n");
>  
> + data->assert_falling_edge =
> + device_property_read_bool(dev, "assert-falling-edge");
> +
>   data->echo_pin = devm_gpiod_get_optional(dev, "echo", GPIOD_OUT_LOW);
>   if (IS_ERR(data->echo_pin))
>   return dev_err_probe(dev, PTR_ERR(data->echo_pin),
>"failed to request ECHO GPIO\n");
>  
> - if (data->echo_pin) {
> - ret = device_property_read_u32(dev, "echo-active-ms", );
> - if (ret) {
> - dev_err(dev, "failed to get echo-active-ms from FW\n");
> - return ret;
> - }
> - data->echo_active_ms = value;
> - /* sanity check on echo_active_ms */
> - if (!data->echo_active_ms || data->echo_active_ms > 999) {
> - dev_err(dev, "echo-active-ms: %u - bad value from FW\n",
> - data->echo_active_ms);
> - return -EINVAL;
> - }
> + if (!data->echo_pin)
> + return 0;
> +
> + ret = device_property_read_u32(dev, "echo-active-ms", );
> + if (ret) {
> + dev_err(dev, "failed to get echo-active-ms from FW\n");
> + return ret;
>   }
>  
> - data->assert_falling_edge =
> - device_property_read_bool(dev, "assert-falling-edge");
> +     /* sanity check on echo_active_ms */
> + if (!value || value > 999) {
> + dev_err(dev, "echo-active-ms: %u - bad value from FW\n", value);
> + return -EINVAL;
> + }
> +
> + data->echo_active_ms = value;
> +
>   return 0;
>  }
>  
> 

Acked-by: Rodolfo Giometti 

-- 
GNU/Linux Solutions  e-mail: giome...@enneenne.com
Linux Device Driver  giome...@linux.it
Embedded Systems phone:  +39 349 2432127
UNIX programming skype:  rodolfo.giometti


Re: [PATCH resend v1 6/7] pps: clients: gpio: Use struct device pointer directly

2021-03-09 Thread Rodolfo Giometti
+ dev_err(dev, "failed to register IRQ %d as PPS source\n",
>   data->irq);
>   return PTR_ERR(data->pps);
>   }
>  
>   /* register IRQ interrupt handler */
> - ret = devm_request_irq(>dev, data->irq, pps_gpio_irq_handler,
> + ret = devm_request_irq(dev, data->irq, pps_gpio_irq_handler,
>   get_irqf_trigger_flags(data), data->info.name, data);
>   if (ret) {
>   pps_unregister_source(data->pps);
> - dev_err(>dev, "failed to acquire IRQ %d\n", data->irq);
> + dev_err(dev, "failed to acquire IRQ %d\n", data->irq);
>   return -EINVAL;
>   }
>  
> 

Acked-by: Rodolfo Giometti 

-- 
GNU/Linux Solutions  e-mail: giome...@enneenne.com
Linux Device Driver  giome...@linux.it
Embedded Systems phone:  +39 349 2432127
UNIX programming skype:  rodolfo.giometti


Re: [PATCH resend v1 5/7] pps: clients: gpio: Make use of device properties

2021-03-09 Thread Rodolfo Giometti
On 09/03/21 12:24, Andy Shevchenko wrote:
> Device property API allows to gather device resources from different sources,
> such as ACPI. Convert the drivers to unleash the power of device property API.
> 
> Signed-off-by: Andy Shevchenko 
> ---
>  drivers/pps/clients/pps-gpio.c | 17 +++--
>  1 file changed, 7 insertions(+), 10 deletions(-)
> 
> diff --git a/drivers/pps/clients/pps-gpio.c b/drivers/pps/clients/pps-gpio.c
> index 291240dce79e..c6db3a3b257b 100644
> --- a/drivers/pps/clients/pps-gpio.c
> +++ b/drivers/pps/clients/pps-gpio.c
> @@ -12,14 +12,14 @@
>  #include 
>  #include 
>  #include 
> +#include 
>  #include 
>  #include 
>  #include 
>  #include 
>  #include 
>  #include 
> -#include 
> -#include 
> +#include 
>  #include 
>  #include 
>  
> @@ -102,7 +102,6 @@ static void pps_gpio_echo_timer_callback(struct 
> timer_list *t)
>  static int pps_gpio_setup(struct platform_device *pdev)
>  {
>   struct pps_gpio_device_data *data = platform_get_drvdata(pdev);
> - struct device_node *np = pdev->dev.of_node;
>   int ret;
>   u32 value;
>  
> @@ -121,26 +120,24 @@ static int pps_gpio_setup(struct platform_device *pdev)
>"failed to request ECHO GPIO\n");
>  
>   if (data->echo_pin) {
> - ret = of_property_read_u32(np,
> - "echo-active-ms",
> - );
> + ret = device_property_read_u32(>dev, "echo-active-ms", 
> );
>   if (ret) {
>   dev_err(>dev,
> - "failed to get echo-active-ms from OF\n");
> + "failed to get echo-active-ms from FW\n");
>   return ret;
>   }
>   data->echo_active_ms = value;
>   /* sanity check on echo_active_ms */
>   if (!data->echo_active_ms || data->echo_active_ms > 999) {
>   dev_err(>dev,
> - "echo-active-ms: %u - bad value from OF\n",
> + "echo-active-ms: %u - bad value from FW\n",
>   data->echo_active_ms);
>   return -EINVAL;
>       }
>   }
>  
> - if (of_property_read_bool(np, "assert-falling-edge"))
> - data->assert_falling_edge = true;
> + data->assert_falling_edge =
> + device_property_read_bool(>dev, "assert-falling-edge");
>   return 0;
>  }
>  
> 

Acked-by: Rodolfo Giometti 

-- 
GNU/Linux Solutions  e-mail: giome...@enneenne.com
Linux Device Driver  giome...@linux.it
Embedded Systems phone:  +39 349 2432127
UNIX programming skype:  rodolfo.giometti


Re: [PATCH resend v1 4/7] pps: clients: gpio: Get rid of legacy platform data

2021-03-09 Thread Rodolfo Giometti
On 09/03/21 12:24, Andy Shevchenko wrote:
> Platform data is a legacy interface to supply device properties
> to the driver. In this case we even don't have in-kernel users
> for it. Just remove it for good.
> 
> Signed-off-by: Andy Shevchenko 
> ---
>  drivers/pps/clients/pps-gpio.c | 17 +++--
>  include/linux/pps-gpio.h   | 19 ---
>  2 files changed, 3 insertions(+), 33 deletions(-)
>  delete mode 100644 include/linux/pps-gpio.h
> 
> diff --git a/drivers/pps/clients/pps-gpio.c b/drivers/pps/clients/pps-gpio.c
> index dc9ed6fc3dae..291240dce79e 100644
> --- a/drivers/pps/clients/pps-gpio.c
> +++ b/drivers/pps/clients/pps-gpio.c
> @@ -16,7 +16,6 @@
>  #include 
>  #include 
>  #include 
> -#include 
>  #include 
>  #include 
>  #include 
> @@ -164,7 +163,6 @@ static int pps_gpio_probe(struct platform_device *pdev)
>   struct pps_gpio_device_data *data;
>   int ret;
>   int pps_default_params;
> - const struct pps_gpio_platform_data *pdata = pdev->dev.platform_data;
>  
>   /* allocate space for device info */
>   data = devm_kzalloc(>dev, sizeof(*data), GFP_KERNEL);
> @@ -173,18 +171,9 @@ static int pps_gpio_probe(struct platform_device *pdev)
>   platform_set_drvdata(pdev, data);
>  
>   /* GPIO setup */
> - if (pdata) {
> - data->gpio_pin = pdata->gpio_pin;
> - data->echo_pin = pdata->echo_pin;
> -
> - data->assert_falling_edge = pdata->assert_falling_edge;
> - data->capture_clear = pdata->capture_clear;
> - data->echo_active_ms = pdata->echo_active_ms;
> - } else {
> - ret = pps_gpio_setup(pdev);
> - if (ret)
> - return -EINVAL;
> - }
> + ret = pps_gpio_setup(pdev);
> + if (ret)
> + return -EINVAL;
>  
>   /* IRQ setup */
>   ret = gpiod_to_irq(data->gpio_pin);
> diff --git a/include/linux/pps-gpio.h b/include/linux/pps-gpio.h
> deleted file mode 100644
> index 7bf49908be06..
> --- a/include/linux/pps-gpio.h
> +++ /dev/null
> @@ -1,19 +0,0 @@
> -/* SPDX-License-Identifier: GPL-2.0-or-later */
> -/*
> - * pps-gpio.h -- PPS client for GPIOs
> - *
> - * Copyright (C) 2011 James Nuss 
> - */
> -
> -#ifndef _PPS_GPIO_H
> -#define _PPS_GPIO_H
> -
> -struct pps_gpio_platform_data {
> - struct gpio_desc *gpio_pin;
> - struct gpio_desc *echo_pin;
> - bool assert_falling_edge;
> - bool capture_clear;
> - unsigned int echo_active_ms;
> -};
> -
> -#endif /* _PPS_GPIO_H */
> 

Acked-by: Rodolfo Giometti 

-- 
GNU/Linux Solutions  e-mail: giome...@enneenne.com
Linux Device Driver  giome...@linux.it
Embedded Systems phone:  +39 349 2432127
UNIX programming skype:  rodolfo.giometti


Re: [PATCH resend v1 3/7] pps: clients: gpio: Remove redundant condition in ->remove()

2021-03-09 Thread Rodolfo Giometti
On 09/03/21 12:23, Andy Shevchenko wrote:
> The timer along with GPIO API are NULL-aware, there is no need to test
> against existing GPIO echo line.
> 
> Signed-off-by: Andy Shevchenko 
> ---
>  drivers/pps/clients/pps-gpio.c | 8 +++-
>  1 file changed, 3 insertions(+), 5 deletions(-)
> 
> diff --git a/drivers/pps/clients/pps-gpio.c b/drivers/pps/clients/pps-gpio.c
> index 78c9680e8063..dc9ed6fc3dae 100644
> --- a/drivers/pps/clients/pps-gpio.c
> +++ b/drivers/pps/clients/pps-gpio.c
> @@ -240,11 +240,9 @@ static int pps_gpio_remove(struct platform_device *pdev)
>   struct pps_gpio_device_data *data = platform_get_drvdata(pdev);
>  
>   pps_unregister_source(data->pps);
> - if (data->echo_pin) {
> - del_timer_sync(>echo_timer);
> - /* reset echo pin in any case */
> - gpiod_set_value(data->echo_pin, 0);
> - }
> + del_timer_sync(>echo_timer);
> + /* reset echo pin in any case */
> + gpiod_set_value(data->echo_pin, 0);
>   dev_info(>dev, "removed IRQ %d as PPS source\n", data->irq);
>   return 0;
>  }
> 

Acked-by: Rodolfo Giometti 

-- 
GNU/Linux Solutions  e-mail: giome...@enneenne.com
Linux Device Driver  giome...@linux.it
Embedded Systems phone:  +39 349 2432127
UNIX programming skype:  rodolfo.giometti


Re: [PATCH resend v1 2/7] pps: clients: gpio: Use dev_err_probe() to avoid log noise

2021-03-09 Thread Rodolfo Giometti
On 09/03/21 12:23, Andy Shevchenko wrote:
> When GPIO APIs return -EPROBE_DEFER there is no need to print the message,
> especially taking into consideration that it may repeat several times.
> Use dev_err_probe() to avoid log noise in such cases.
> 
> Signed-off-by: Andy Shevchenko 
> ---
>  drivers/pps/clients/pps-gpio.c | 15 ++-
>  1 file changed, 6 insertions(+), 9 deletions(-)
> 
> diff --git a/drivers/pps/clients/pps-gpio.c b/drivers/pps/clients/pps-gpio.c
> index f89c31aa66f1..78c9680e8063 100644
> --- a/drivers/pps/clients/pps-gpio.c
> +++ b/drivers/pps/clients/pps-gpio.c
> @@ -110,19 +110,16 @@ static int pps_gpio_setup(struct platform_device *pdev)
>   data->gpio_pin = devm_gpiod_get(>dev,
>   NULL,   /* request "gpios" */
>   GPIOD_IN);
> - if (IS_ERR(data->gpio_pin)) {
> - dev_err(>dev,
> - "failed to request PPS GPIO\n");
> - return PTR_ERR(data->gpio_pin);
> - }
> + if (IS_ERR(data->gpio_pin))
> + return dev_err_probe(>dev, PTR_ERR(data->gpio_pin),
> +  "failed to request PPS GPIO\n");
>  
>   data->echo_pin = devm_gpiod_get_optional(>dev,
>   "echo",
>   GPIOD_OUT_LOW);
> - if (IS_ERR(data->echo_pin)) {
> - dev_err(>dev, "failed to request ECHO GPIO\n");
> - return PTR_ERR(data->echo_pin);
> - }
> + if (IS_ERR(data->echo_pin))
> + return dev_err_probe(>dev, PTR_ERR(data->echo_pin),
> +  "failed to request ECHO GPIO\n");
>  
>   if (data->echo_pin) {
>   ret = of_property_read_u32(np,
> 

Acked-by: Rodolfo Giometti 

-- 
GNU/Linux Solutions  e-mail: giome...@enneenne.com
Linux Device Driver  giome...@linux.it
Embedded Systems phone:  +39 349 2432127
UNIX programming skype:  rodolfo.giometti


Re: [PATCH resend v1 1/7] pps: clients: gpio: Bail out on error when requesting GPIO echo line

2021-03-09 Thread Rodolfo Giometti
On 09/03/21 12:23, Andy Shevchenko wrote:
> When requesting optional GPIO echo line, bail out on error,
> so user will know that something wrong with the existing property.
> 
> Signed-off-by: Andy Shevchenko 
> ---
>  drivers/pps/clients/pps-gpio.c | 10 +-
>  1 file changed, 5 insertions(+), 5 deletions(-)
> 
> diff --git a/drivers/pps/clients/pps-gpio.c b/drivers/pps/clients/pps-gpio.c
> index e0de1df2ede0..f89c31aa66f1 100644
> --- a/drivers/pps/clients/pps-gpio.c
> +++ b/drivers/pps/clients/pps-gpio.c
> @@ -119,12 +119,12 @@ static int pps_gpio_setup(struct platform_device *pdev)
>   data->echo_pin = devm_gpiod_get_optional(>dev,
>   "echo",
>   GPIOD_OUT_LOW);
> - if (data->echo_pin) {
> - if (IS_ERR(data->echo_pin)) {
> - dev_err(>dev, "failed to request ECHO GPIO\n");
> - return PTR_ERR(data->echo_pin);
> - }
> + if (IS_ERR(data->echo_pin)) {
> + dev_err(>dev, "failed to request ECHO GPIO\n");
> + return PTR_ERR(data->echo_pin);
> + }
>  
> + if (data->echo_pin) {
>   ret = of_property_read_u32(np,
>   "echo-active-ms",
>   );
> 

Acked-by: Rodolfo Giometti 

-- 
GNU/Linux Solutions  e-mail: giome...@enneenne.com
Linux Device Driver  giome...@linux.it
Embedded Systems phone:  +39 349 2432127
UNIX programming skype:  rodolfo.giometti


Re: [PATCH v1 1/7] pps: clients: gpio: Bail out on error when requesting GPIO echo line

2021-03-09 Thread Rodolfo Giometti
On 09/03/21 11:47, Andy Shevchenko wrote:
> +Cc: Greg
> 
> On Fri, Feb 26, 2021 at 07:03:32PM +0200, Andy Shevchenko wrote:
>> On Tue, Feb 16, 2021 at 01:31:48PM +0200, Andy Shevchenko wrote:
>>> When requesting optional GPIO echo line, bail out on error,
>>> so user will know that something wrong with the existing property.
>>
>> Guys, any comments on this series?
> 
> Greg, seems PPS maintainer keeps silent, can I route this series thru one of
> yours tree (resend implied)?

I'm sorry but I suppose I missed this patch... -_-'

Can you please resend it to me?

Ciao,

Rodolfo

-- 
GNU/Linux Solutions  e-mail: giome...@enneenne.com
Linux Device Driver  giome...@linux.it
Embedded Systems phone:  +39 349 2432127
UNIX programming skype:  rodolfo.giometti


Re: [PATCH v2 3/4] pps: Use subdir-ccflags-* to inherit debug flag

2021-02-09 Thread Rodolfo Giometti
On 09/02/21 12:08, Yicong Yang wrote:
> From: Junhao He 
> 
> We use ccflags-$(CONFIG_PPS_DEBUG) for the debug
> message in drivers/pps, but the DEBUG flag will not pass to
> the subdirectory.
> 
> Considering CONFIG_HWMON_DEBUG_CHIP intends to turn on debug
> recursively under driver/pps, so it will be clearer to use
> subdir-ccflags-* instead of ccflags-* to inherit
> the debug settings from Kconfig when traversing subdirectories.
> 
> Suggested-by: Bjorn Helgaas 
> Signed-off-by: Junhao He 
> Signed-off-by: Yicong Yang 
> ---
>  drivers/pps/Makefile | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/pps/Makefile b/drivers/pps/Makefile
> index ceaf65c..7a2d3f7 100644
> --- a/drivers/pps/Makefile
> +++ b/drivers/pps/Makefile
> @@ -8,4 +8,4 @@ pps_core-$(CONFIG_NTP_PPS)+= kc.o
>  obj-$(CONFIG_PPS):= pps_core.o
>  obj-y+= clients/ generators/
>  
> -ccflags-$(CONFIG_PPS_DEBUG) := -DDEBUG
> +subdir-ccflags-$(CONFIG_PPS_DEBUG) := -DDEBUG
> 

Acked-by: Rodolfo Giometti 

-- 
GNU/Linux Solutions  e-mail: giome...@enneenne.com
Linux Device Driver  giome...@linux.it
Embedded Systems phone:  +39 349 2432127
UNIX programming skype:  rodolfo.giometti


Re: [PATCH 1/2] misc: c2port: core: Make copying name from userspace more secure

2020-11-03 Thread Rodolfo Giometti
On 03/11/2020 09:57, Lee Jones wrote:
> On Mon, 02 Nov 2020, Rodolfo Giometti wrote:
> 
>> On 02/11/2020 14:47, Lee Jones wrote:
>>> On Mon, 02 Nov 2020, gre...@linuxfoundation.org wrote:
>>>
>>>> On Mon, Nov 02, 2020 at 12:43:01PM +, Lee Jones wrote:
>>>>> On Mon, 02 Nov 2020, gre...@linuxfoundation.org wrote:
>>>>>
>>>>>> On Mon, Nov 02, 2020 at 11:49:03AM +, Lee Jones wrote:
>>>>>>> On Mon, 02 Nov 2020, David Laight wrote:
>>>>>>>
>>>>>>>> From: Lee Jones
>>>>>>>>> Sent: 02 November 2020 11:12
>>>>>>>>>
>>>>>>>>> strncpy() may not provide a NUL terminator, which means that a 1-byte
>>>>>>>>> leak would be possible *if* this was ever copied to userspace.  Ensure
>>>>>>>>> the buffer will always be NUL terminated by using the kernel's
>>>>>>>>> strscpy() which a) uses the destination (instead of the source) size
>>>>>>>>> as the bytes to copy and b) is *always* NUL terminated.
>>>>>>>>>
>>>>>>>>> Cc: Rodolfo Giometti 
>>>>>>>>> Cc: "Eurotech S.p.A" 
>>>>>>>>> Reported-by: Geert Uytterhoeven 
>>>>>>>>> Acked-by: Arnd Bergmann 
>>>>>>>>> Signed-off-by: Lee Jones 
>>>>>>>>> ---
>>>>>>>>>  drivers/misc/c2port/core.c | 2 +-
>>>>>>>>>  1 file changed, 1 insertion(+), 1 deletion(-)
>>>>>>>>>
>>>>>>>>> diff --git a/drivers/misc/c2port/core.c b/drivers/misc/c2port/core.c
>>>>>>>>> index 80d87e8a0bea9..b96444ec94c7e 100644
>>>>>>>>> --- a/drivers/misc/c2port/core.c
>>>>>>>>> +++ b/drivers/misc/c2port/core.c
>>>>>>>>> @@ -923,7 +923,7 @@ struct c2port_device *c2port_device_register(char 
>>>>>>>>> *name,
>>>>>>>>>   }
>>>>>>>>>   dev_set_drvdata(c2dev->dev, c2dev);
>>>>>>>>>
>>>>>>>>> - strncpy(c2dev->name, name, C2PORT_NAME_LEN - 1);
>>>>>>>>> + strscpy(c2dev->name, name, sizeof(c2dev->name));
>>>>>>>>
>>>>>>>> strscpy() doesn't zero fill so if the memory isn't zeroed
>>>>>>>> and a 'blind' copy to user of the structure is done
>>>>>>>> then more data is leaked.
>>>>>>>>
>>>>>>>> strscpy() may be better, but rational isn't right.
>>>>>>>
>>>>>>> The original patch zeroed the data too, but I was asked to remove that
>>>>>>> part [0].  In your opinion, should it be reinstated?
>>>>>>>
>>>>>>> [0] https://lore.kernel.org/patchwork/patch/1272290/
>>>>>>
>>>>>> Just keep the kzalloc() part of the patch, this portion makes no sense
>>>>>> to me.
>>>>>
>>>>> Can do.
>>>>>
>>>>>> But if you REALLY want to get it correct, call dev_set_name()
>>>>>> instead please, as that is what it is there for.
>>>>>
>>>>> The line above isn't setting the 'struct device' name.  It looks as
>>>>> though 'struct c2port' has it's own member, also called 'name'.  As to
>>>>> how they differ, I'm not currently aware.  Nor do I wish to mess
>>>>> around with the semantics all that much.
>>>>>
>>>>> Going with suggestion #1.
>>>>
>>>> As the "device" already has a name, I suggest just getting rid of this
>>>> name field anyway, no need for duplicates.
>>>
>>> That definitely goes against the point I made above:
>>>
>>>  "Nor do I wish to mess around with the semantics all that much."
>>>
>>> It looks as though the device name 'c2port%d' varies greatly to the
>>> requested name 'uc'.  I don't have enough knowledge of how user-
>>> space expects to use the provided sysfs entries to be able to
>>> competently merge/decide which of these should be kept and which to
>>> discard.
>>>
>>> Hopefully one of the authors/maintainers are reading this and can come
>>> up with an acceptable solution.
>>
>> User-space usage can change its behavior so, please, consider the best 
>> solution
>> from the kernel space point-of-view. :)
> 
> If you're sure, I can add it to my TODO.

Yes, no problem!

Ciao,

Rodolfo

-- 
GNU/Linux Solutions  e-mail: giome...@enneenne.com
Linux Device Driver  giome...@linux.it
Embedded Systems phone:  +39 349 2432127
UNIX programming skype:  rodolfo.giometti


Re: [PATCH 1/2] misc: c2port: core: Make copying name from userspace more secure

2020-11-02 Thread Rodolfo Giometti
On 02/11/2020 14:47, Lee Jones wrote:
> On Mon, 02 Nov 2020, gre...@linuxfoundation.org wrote:
> 
>> On Mon, Nov 02, 2020 at 12:43:01PM +, Lee Jones wrote:
>>> On Mon, 02 Nov 2020, gre...@linuxfoundation.org wrote:
>>>
>>>> On Mon, Nov 02, 2020 at 11:49:03AM +, Lee Jones wrote:
>>>>> On Mon, 02 Nov 2020, David Laight wrote:
>>>>>
>>>>>> From: Lee Jones
>>>>>>> Sent: 02 November 2020 11:12
>>>>>>>
>>>>>>> strncpy() may not provide a NUL terminator, which means that a 1-byte
>>>>>>> leak would be possible *if* this was ever copied to userspace.  Ensure
>>>>>>> the buffer will always be NUL terminated by using the kernel's
>>>>>>> strscpy() which a) uses the destination (instead of the source) size
>>>>>>> as the bytes to copy and b) is *always* NUL terminated.
>>>>>>>
>>>>>>> Cc: Rodolfo Giometti 
>>>>>>> Cc: "Eurotech S.p.A" 
>>>>>>> Reported-by: Geert Uytterhoeven 
>>>>>>> Acked-by: Arnd Bergmann 
>>>>>>> Signed-off-by: Lee Jones 
>>>>>>> ---
>>>>>>>  drivers/misc/c2port/core.c | 2 +-
>>>>>>>  1 file changed, 1 insertion(+), 1 deletion(-)
>>>>>>>
>>>>>>> diff --git a/drivers/misc/c2port/core.c b/drivers/misc/c2port/core.c
>>>>>>> index 80d87e8a0bea9..b96444ec94c7e 100644
>>>>>>> --- a/drivers/misc/c2port/core.c
>>>>>>> +++ b/drivers/misc/c2port/core.c
>>>>>>> @@ -923,7 +923,7 @@ struct c2port_device *c2port_device_register(char 
>>>>>>> *name,
>>>>>>> }
>>>>>>> dev_set_drvdata(c2dev->dev, c2dev);
>>>>>>>
>>>>>>> -   strncpy(c2dev->name, name, C2PORT_NAME_LEN - 1);
>>>>>>> +   strscpy(c2dev->name, name, sizeof(c2dev->name));
>>>>>>
>>>>>> strscpy() doesn't zero fill so if the memory isn't zeroed
>>>>>> and a 'blind' copy to user of the structure is done
>>>>>> then more data is leaked.
>>>>>>
>>>>>> strscpy() may be better, but rational isn't right.
>>>>>
>>>>> The original patch zeroed the data too, but I was asked to remove that
>>>>> part [0].  In your opinion, should it be reinstated?
>>>>>
>>>>> [0] https://lore.kernel.org/patchwork/patch/1272290/
>>>>
>>>> Just keep the kzalloc() part of the patch, this portion makes no sense
>>>> to me.
>>>
>>> Can do.
>>>
>>>> But if you REALLY want to get it correct, call dev_set_name()
>>>> instead please, as that is what it is there for.
>>>
>>> The line above isn't setting the 'struct device' name.  It looks as
>>> though 'struct c2port' has it's own member, also called 'name'.  As to
>>> how they differ, I'm not currently aware.  Nor do I wish to mess
>>> around with the semantics all that much.
>>>
>>> Going with suggestion #1.
>>
>> As the "device" already has a name, I suggest just getting rid of this
>> name field anyway, no need for duplicates.
> 
> That definitely goes against the point I made above:
> 
>  "Nor do I wish to mess around with the semantics all that much."
> 
> It looks as though the device name 'c2port%d' varies greatly to the
> requested name 'uc'.  I don't have enough knowledge of how user-
> space expects to use the provided sysfs entries to be able to
> competently merge/decide which of these should be kept and which to
> discard.
> 
> Hopefully one of the authors/maintainers are reading this and can come
> up with an acceptable solution.

User-space usage can change its behavior so, please, consider the best solution
from the kernel space point-of-view. :)

Ciao,

Rodolfo

-- 
GNU/Linux Solutions  e-mail: giome...@enneenne.com
Linux Device Driver  giome...@linux.it
Embedded Systems phone:  +39 349 2432127
UNIX programming skype:  rodolfo.giometti


Re: [PATCH 01/10] misc: c2port: core: Ensure source size does not equal destination size in strncpy()

2020-06-26 Thread Rodolfo Giometti
On 26/06/2020 15:05, Lee Jones wrote:
> We need to ensure there's a place for the NULL terminator.
> 
> Fixes the following W=1 warning(s):
> 
>  In file included from include/linux/bitmap.h:9,
>  from include/linux/nodemask.h:95,
>  from include/linux/mmzone.h:17,
>  from include/linux/gfp.h:6,
>  from include/linux/umh.h:4,
>  from include/linux/kmod.h:9,
>  from include/linux/module.h:16,
>  from drivers/misc/c2port/core.c:9:
>  In function ‘strncpy’,
>  inlined from ‘c2port_device_register’ at drivers/misc/c2port/core.c:926:2:
>  include/linux/string.h:297:30: warning: ‘__builtin_strncpy’ specified bound 
> 32 equals destination size [-Wstringop-truncation]
>  297 | #define __underlying_strncpy __builtin_strncpy
>  | ^
>  include/linux/string.h:307:9: note: in expansion of macro 
> ‘__underlying_strncpy’
>  307 | return __underlying_strncpy(p, q, size);
>  | ^~~~
> 
> Cc: Rodolfo Giometti 
> Cc: "Eurotech S.p.A" 
> Signed-off-by: Lee Jones 
> ---
>  drivers/misc/c2port/core.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/misc/c2port/core.c b/drivers/misc/c2port/core.c
> index 33bba18022892..80d87e8a0bea9 100644
> --- a/drivers/misc/c2port/core.c
> +++ b/drivers/misc/c2port/core.c
> @@ -923,7 +923,7 @@ struct c2port_device *c2port_device_register(char *name,
>   }
>   dev_set_drvdata(c2dev->dev, c2dev);
>  
> - strncpy(c2dev->name, name, C2PORT_NAME_LEN);
> +     strncpy(c2dev->name, name, C2PORT_NAME_LEN - 1);
>   c2dev->ops = ops;
>   mutex_init(>mutex);
>  

Acked-by: Rodolfo Giometti 

Note that giome...@linux.it is just an alias. My main e-mail address is
giome...@enneenne.com

Rodolfo Giometti

-- 
GNU/Linux Solutions  e-mail: giome...@enneenne.com
Linux Device Driver  giome...@linux.it
Embedded Systems phone:  +39 349 2432127
UNIX programming skype:  rodolfo.giometti


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

2019-02-04 Thread Rodolfo Giometti

On 02/02/2019 11:57, 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.

Signed-off-by: Lukas Senger 
Signed-off-by: Tom Burkart 


Acked-by: Rodolfo Giometti 

--
GNU/Linux Solutions  e-mail: giome...@enneenne.com
Linux Device Driver  giome...@linux.it
Embedded Systems phone:  +39 349 2432127
UNIX programming skype:  rodolfo.giometti


Re: [PATCH v15 1/3] pps: descriptor-based gpio

2019-02-04 Thread Rodolfo Giometti

On 02/02/2019 11:57, Tom Burkart wrote:

This patch changes the GPIO access for the pps-gpio driver from the
integer based API to the descriptor based API.

Reviewed-by: Philipp Zabel 
Signed-off-by: Tom Burkart 


Acked-by: Rodolfo Giometti 

--
GNU/Linux Solutions  e-mail: giome...@enneenne.com
Linux Device Driver  giome...@linux.it
Embedded Systems phone:  +39 349 2432127
UNIX programming skype:  rodolfo.giometti


Re: UBSAN: Undefined behaviour in drivers/pps/pps.c

2019-01-09 Thread Rodolfo Giometti

On 08/01/2019 21:24, Kyungtae Kim wrote:

We report a bug in linux-4.20: "UBSAN: Undefined behaviour in drivers/pps/pps.c"

kernel config: https://kt0755.github.io/etc/config_v4.20_stable
repro: https://kt0755.github.io/etc/repro.a6372.c

pps_cdev_pps_fetch() lacks the bounds checking for computing
fdata->timeout.sec * HZ, that causes such integer overflow when the result
is larger than the boundary.
The  patch below checks the possibility of overflow right before the
multiplication.

=
UBSAN: Undefined behaviour in drivers/pps/pps.c:82:30
signed integer overflow:
-7557201428062104791 * 100 cannot be represented in type 'long long int'
CPU: 0 PID: 10159 Comm: syz-executor6 Not tainted 4.20.0 #1
Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS Bochs 01/01/2011
Call Trace:
  __dump_stack lib/dump_stack.c:77 [inline]
  dump_stack+0xb1/0x118 lib/dump_stack.c:113
  ubsan_epilogue+0x12/0x94 lib/ubsan.c:159
  handle_overflow+0x1cf/0x21a lib/ubsan.c:190
  __ubsan_handle_mul_overflow+0x2a/0x35 lib/ubsan.c:214
  pps_cdev_pps_fetch+0x575/0x5b0 drivers/pps/pps.c:82
  pps_cdev_ioctl+0x567/0x910 drivers/pps/pps.c:191
  vfs_ioctl fs/ioctl.c:46 [inline]
  do_vfs_ioctl+0x1aa/0x1160 fs/ioctl.c:698
  ksys_ioctl+0x9e/0xb0 fs/ioctl.c:713
  __do_sys_ioctl fs/ioctl.c:720 [inline]
  __se_sys_ioctl fs/ioctl.c:718 [inline]
  __x64_sys_ioctl+0x7e/0xc0 fs/ioctl.c:718
  do_syscall_64+0xbe/0x4f0 arch/x86/entry/common.c:290
  entry_SYSCALL_64_after_hwframe+0x49/0xbe
RIP: 0033:0x4497b9
Code: e8 8c 9f 02 00 48 83 c4 18 c3 0f 1f 80 00 00 00 00 48 89 f8 48
89 f7 48 89 d6 48 89 ca 4d 89 c2 4d 89 c8 4c 8b 4c 24 08 0f 05 <48> 3d
01 f0 ff ff 0f 83 9b 6b fc ff c3 66 2e 0f 1f 84 00 00 00 00
RSP: 002b:7f8cf875bc68 EFLAGS: 0246 ORIG_RAX: 0010
RAX: ffda RBX: 7f8cf875c6cc RCX: 004497b9
RDX: 2240 RSI: c00870a4 RDI: 0014
RBP: 0071bea0 R08:  R09: 
R10:  R11: 0246 R12: 
R13: 5c10 R14: 006eecb0 R15: 7f8cf875c700
=

---
  drivers/pps/pps.c | 2 ++
  1 file changed, 2 insertions(+)

diff --git a/drivers/pps/pps.c b/drivers/pps/pps.c
index 8febacb..66002e1 100644
--- a/drivers/pps/pps.c
+++ b/drivers/pps/pps.c
@@ -79,6 +79,8 @@ static int pps_cdev_pps_fetch(struct pps_device
*pps, struct pps_fdata *fdata)
 dev_dbg(pps->dev, "timeout %lld.%09d\n",
 (long long) fdata->timeout.sec,
 fdata->timeout.nsec);
+   if (fdata->timeout.sec > S64_MAX / HZ)
+   return -EINVAL;
 ticks = fdata->timeout.sec * HZ;
 ticks += fdata->timeout.nsec / (NSEC_PER_SEC / HZ);


It looks good to me. Do you think is better adding a check for timeout.nsec 
also?

Now you have to produce a patch according to 
linux/Documentation/process/submitting-patches.rst and then submitting it! :-)


Ciao,

Rodolfo

--
GNU/Linux Solutions  e-mail: giome...@enneenne.com
Linux Device Driver  giome...@linux.it
Embedded Systems phone:  +39 349 2432127
UNIX programming skype:  rodolfo.giometti


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

2019-01-04 Thread Rodolfo Giometti

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(>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: giome...@enneenne.com
Linux Device Driver  giome...@linux.it
Embedded Systems phone:  +39 349 2432127
UNIX programming skype:  rodolfo.giometti


Re: [PATCH v14 2/3] dt-bindings: pps: pps-gpio PPS ECHO implementation

2019-01-04 Thread Rodolfo Giometti

On 30/12/2018 09:33, Tom Burkart wrote:

This patch implements the device tree binding changes required for the
pps echo functionality for pps-gpio, that sysfs claims is available
already.

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.


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?


Ciao,

Rodolfo

--
GNU/Linux Solutions  e-mail: giome...@enneenne.com
Linux Device Driver  giome...@linux.it
Embedded Systems phone:  +39 349 2432127
UNIX programming skype:  rodolfo.giometti


Re: [PATCH -next] pps: using ERR_PTR instead of NULL while pps_register_source fails

2018-11-27 Thread Rodolfo Giometti

On 27/11/2018 08:34, Greg KH wrote:

On Mon, Nov 26, 2018 at 11:43:06AM +0100, Rodolfo Giometti wrote:

On 26/11/2018 11:24, YueHaibing wrote:

pps_register_source() has keeps error codes in a local variable,
but it does not make use of the code. This patch let it return
the errcode in case of failure.

Suggested-by: Richard Cochran 
Signed-off-by: YueHaibing 


Acked-by: Rodolfo Giometti 


You are the maintainer of this file, shouldn't you be the one sending it
off to Linus or putting it in your tree somewhere?


This subsystem never had an official tree and in the past I simply acked the 
code and patches was taken by you (or other maintainers) for inclusion... I know 
it's not usual by it worked as is since right now!


However if you prefer having an official tree even for LinuxPPS I can do it and 
then sending my pull requests to Linus! Just let me know what is better for you! :-)


Ciao,

Rodolfo

--
GNU/Linux Solutions  e-mail: giome...@enneenne.com
Linux Device Driver  giome...@linux.it
Embedded Systems phone:  +39 349 2432127
UNIX programming skype:  rodolfo.giometti


Re: [PATCH -next] pps: using ERR_PTR instead of NULL while pps_register_source fails

2018-11-27 Thread Rodolfo Giometti

On 27/11/2018 08:34, Greg KH wrote:

On Mon, Nov 26, 2018 at 11:43:06AM +0100, Rodolfo Giometti wrote:

On 26/11/2018 11:24, YueHaibing wrote:

pps_register_source() has keeps error codes in a local variable,
but it does not make use of the code. This patch let it return
the errcode in case of failure.

Suggested-by: Richard Cochran 
Signed-off-by: YueHaibing 


Acked-by: Rodolfo Giometti 


You are the maintainer of this file, shouldn't you be the one sending it
off to Linus or putting it in your tree somewhere?


This subsystem never had an official tree and in the past I simply acked the 
code and patches was taken by you (or other maintainers) for inclusion... I know 
it's not usual by it worked as is since right now!


However if you prefer having an official tree even for LinuxPPS I can do it and 
then sending my pull requests to Linus! Just let me know what is better for you! :-)


Ciao,

Rodolfo

--
GNU/Linux Solutions  e-mail: giome...@enneenne.com
Linux Device Driver  giome...@linux.it
Embedded Systems phone:  +39 349 2432127
UNIX programming skype:  rodolfo.giometti


Re: [PATCH 2/2] pps-gpio: Set echo GPIO pin via devicetree

2018-02-15 Thread Rodolfo Giometti

On 15/02/18 16:08, Lukas Senger wrote:

@@ -20,18 +21,20 @@
target = <>;
__overlay__ {
pps_pins: pps_pins@12 {
-   brcm,pins = <18>;
-   brcm,function = <0>;// in
-   brcm,pull = <0>;// off
+   brcm,pins = <18 17>;
+   brcm,function = <0 1>;// in
out
+   brcm,pull = <0 0>;// off
off


These modifications are not PPS related.


};
};
};
   
   	__overrides__ {

-   gpiopin = <>,"gpios:4",
+   gpiopin = <>,"in-gpios:4",
  <>,"reg:0",
  <_pins>,"brcm,pins:0",
  <_pins>,"reg:0";
+   echopin = <>,"out-gpios:4",
+ <_pins>,"brcm,pins:4";


Ditto.


I don't understand why these modifications are unrelated. Especially
the echopin-option should exist, shouldn't it?


These modifications are needed to define a custom instance of a PPS device which 
is not part of the PPS subtree, that's why they should be put into another patch.


Ciao,

Rodolfo

--

HCE Engineering  e-mail: giome...@hce-engineering.it
GNU/Linux Solutions  giome...@enneenne.com
Linux Device Driver  giome...@linux.it
Embedded Systems phone:  +39 349 2432127
UNIX programming skype:  rodolfo.giometti
Cosino Project - the quick prototyping embedded system - www.cosino.it
Freelance ICT Italia - Consulente ICT Italia - www.consulenti-ict.it


Re: [PATCH 2/2] pps-gpio: Set echo GPIO pin via devicetree

2018-02-15 Thread Rodolfo Giometti

On 15/02/18 16:08, Lukas Senger wrote:

@@ -20,18 +21,20 @@
target = <>;
__overlay__ {
pps_pins: pps_pins@12 {
-   brcm,pins = <18>;
-   brcm,function = <0>;// in
-   brcm,pull = <0>;// off
+   brcm,pins = <18 17>;
+   brcm,function = <0 1>;// in
out
+   brcm,pull = <0 0>;// off
off


These modifications are not PPS related.


};
};
};
   
   	__overrides__ {

-   gpiopin = <>,"gpios:4",
+   gpiopin = <>,"in-gpios:4",
  <>,"reg:0",
  <_pins>,"brcm,pins:0",
  <_pins>,"reg:0";
+   echopin = <>,"out-gpios:4",
+ <_pins>,"brcm,pins:4";


Ditto.


I don't understand why these modifications are unrelated. Especially
the echopin-option should exist, shouldn't it?


These modifications are needed to define a custom instance of a PPS device which 
is not part of the PPS subtree, that's why they should be put into another patch.


Ciao,

Rodolfo

--

HCE Engineering  e-mail: giome...@hce-engineering.it
GNU/Linux Solutions  giome...@enneenne.com
Linux Device Driver  giome...@linux.it
Embedded Systems phone:  +39 349 2432127
UNIX programming skype:  rodolfo.giometti
Cosino Project - the quick prototyping embedded system - www.cosino.it
Freelance ICT Italia - Consulente ICT Italia - www.consulenti-ict.it


Re: [PATCH 1/2] pps-gpio: Avoid flooding syslog

2018-02-15 Thread Rodolfo Giometti

On 15/02/18 16:12, Lukas Senger wrote:



Why a void function? You should use it to toggle echoing GPIO... =8-o


RFC 2783 says to generate the echo pulse "as rapidly as possible" which
is why I do the toggling in the irq handler. However this leaves the
default echo function installed which just floods syslog.


The pps_event() function does it for you in a beauty-and-clear way by using the 
info.echo() function. :-D



Another problem with this patch is that it also is against my old one
and not against current kernel code.


Yes, correct it please.

Ciao,

Rodolfo

--

HCE Engineering  e-mail: giome...@hce-engineering.it
GNU/Linux Solutions  giome...@enneenne.com
Linux Device Driver  giome...@linux.it
Embedded Systems phone:  +39 349 2432127
UNIX programming skype:  rodolfo.giometti
Cosino Project - the quick prototyping embedded system - www.cosino.it
Freelance ICT Italia - Consulente ICT Italia - www.consulenti-ict.it


Re: [PATCH 1/2] pps-gpio: Avoid flooding syslog

2018-02-15 Thread Rodolfo Giometti

On 15/02/18 16:12, Lukas Senger wrote:



Why a void function? You should use it to toggle echoing GPIO... =8-o


RFC 2783 says to generate the echo pulse "as rapidly as possible" which
is why I do the toggling in the irq handler. However this leaves the
default echo function installed which just floods syslog.


The pps_event() function does it for you in a beauty-and-clear way by using the 
info.echo() function. :-D



Another problem with this patch is that it also is against my old one
and not against current kernel code.


Yes, correct it please.

Ciao,

Rodolfo

--

HCE Engineering  e-mail: giome...@hce-engineering.it
GNU/Linux Solutions  giome...@enneenne.com
Linux Device Driver  giome...@linux.it
Embedded Systems phone:  +39 349 2432127
UNIX programming skype:  rodolfo.giometti
Cosino Project - the quick prototyping embedded system - www.cosino.it
Freelance ICT Italia - Consulente ICT Italia - www.consulenti-ict.it


Re: [PATCH 2/2] pps-gpio: Set echo GPIO pin via devicetree

2018-02-15 Thread Rodolfo Giometti

On 15/02/18 13:59, Lukas Senger wrote:

---
  arch/arm/boot/dts/overlays/pps-gpio-overlay.dts | 13 -
  drivers/pps/clients/pps-gpio.c  | 26 ++---
  include/linux/pps-gpio.h|  1 +
  3 files changed, 24 insertions(+), 16 deletions(-)

diff --git a/arch/arm/boot/dts/overlays/pps-gpio-overlay.dts 
b/arch/arm/boot/dts/overlays/pps-gpio-overlay.dts
index 9ee4bdfa6167..06e6cf5fc6ea 100644
--- a/arch/arm/boot/dts/overlays/pps-gpio-overlay.dts
+++ b/arch/arm/boot/dts/overlays/pps-gpio-overlay.dts
@@ -10,7 +10,8 @@
compatible = "pps-gpio";
pinctrl-names = "default";
pinctrl-0 = <_pins>;
-   gpios = < 18 0>;
+   in-gpios = < 18 0>;


Please, don't break backward compatibility! You can leave "gpios" as is and 
using, for instance, "echo-gpios" for echoing purposes. -+

 |
++
|
v

+   out-gpios = < 17 0>;
status = "okay";
};
};
@@ -20,18 +21,20 @@
target = <>;
__overlay__ {
pps_pins: pps_pins@12 {
-   brcm,pins = <18>;
-   brcm,function = <0>;// in
-   brcm,pull = <0>;// off
+   brcm,pins = <18 17>;
+   brcm,function = <0 1>;// in  out
+   brcm,pull = <0 0>;// off off


These modifications are not PPS related.


};
};
};
  
  	__overrides__ {

-   gpiopin = <>,"gpios:4",
+   gpiopin = <>,"in-gpios:4",
  <>,"reg:0",
  <_pins>,"brcm,pins:0",
  <_pins>,"reg:0";
+   echopin = <>,"out-gpios:4",
+ <_pins>,"brcm,pins:4";


Ditto.


assert_falling_edge = <>,"assert-falling-edge?";
};
  };
diff --git a/drivers/pps/clients/pps-gpio.c b/drivers/pps/clients/pps-gpio.c
index 35c3b14fc9b9..ce3065889a7e 100644
--- a/drivers/pps/clients/pps-gpio.c
+++ b/drivers/pps/clients/pps-gpio.c
@@ -37,10 +37,6 @@
  #include 
  #include 
  
-/* TODO: this should work like gpio_pin below but I don't know how to work with

- * devicetree overlays.
- */
-#define PPS_GPIO_ECHO_PIN 17


Please provide patches against current kernel code and not against your old 
patches.

I stop reviewing here since following modifications are similar to just reviewed 
and not acceptable. I'm sorry.


Ciao,

Rodolfo

--

HCE Engineering  e-mail: giome...@hce-engineering.it
GNU/Linux Solutions  giome...@enneenne.com
Linux Device Driver  giome...@linux.it
Embedded Systems phone:  +39 349 2432127
UNIX programming skype:  rodolfo.giometti
Cosino Project - the quick prototyping embedded system - www.cosino.it
Freelance ICT Italia - Consulente ICT Italia - www.consulenti-ict.it


Re: [PATCH 2/2] pps-gpio: Set echo GPIO pin via devicetree

2018-02-15 Thread Rodolfo Giometti

On 15/02/18 13:59, Lukas Senger wrote:

---
  arch/arm/boot/dts/overlays/pps-gpio-overlay.dts | 13 -
  drivers/pps/clients/pps-gpio.c  | 26 ++---
  include/linux/pps-gpio.h|  1 +
  3 files changed, 24 insertions(+), 16 deletions(-)

diff --git a/arch/arm/boot/dts/overlays/pps-gpio-overlay.dts 
b/arch/arm/boot/dts/overlays/pps-gpio-overlay.dts
index 9ee4bdfa6167..06e6cf5fc6ea 100644
--- a/arch/arm/boot/dts/overlays/pps-gpio-overlay.dts
+++ b/arch/arm/boot/dts/overlays/pps-gpio-overlay.dts
@@ -10,7 +10,8 @@
compatible = "pps-gpio";
pinctrl-names = "default";
pinctrl-0 = <_pins>;
-   gpios = < 18 0>;
+   in-gpios = < 18 0>;


Please, don't break backward compatibility! You can leave "gpios" as is and 
using, for instance, "echo-gpios" for echoing purposes. -+

 |
++
|
v

+   out-gpios = < 17 0>;
status = "okay";
};
};
@@ -20,18 +21,20 @@
target = <>;
__overlay__ {
pps_pins: pps_pins@12 {
-   brcm,pins = <18>;
-   brcm,function = <0>;// in
-   brcm,pull = <0>;// off
+   brcm,pins = <18 17>;
+   brcm,function = <0 1>;// in  out
+   brcm,pull = <0 0>;// off off


These modifications are not PPS related.


};
};
};
  
  	__overrides__ {

-   gpiopin = <>,"gpios:4",
+   gpiopin = <>,"in-gpios:4",
  <>,"reg:0",
  <_pins>,"brcm,pins:0",
  <_pins>,"reg:0";
+   echopin = <>,"out-gpios:4",
+ <_pins>,"brcm,pins:4";


Ditto.


assert_falling_edge = <>,"assert-falling-edge?";
};
  };
diff --git a/drivers/pps/clients/pps-gpio.c b/drivers/pps/clients/pps-gpio.c
index 35c3b14fc9b9..ce3065889a7e 100644
--- a/drivers/pps/clients/pps-gpio.c
+++ b/drivers/pps/clients/pps-gpio.c
@@ -37,10 +37,6 @@
  #include 
  #include 
  
-/* TODO: this should work like gpio_pin below but I don't know how to work with

- * devicetree overlays.
- */
-#define PPS_GPIO_ECHO_PIN 17


Please provide patches against current kernel code and not against your old 
patches.

I stop reviewing here since following modifications are similar to just reviewed 
and not acceptable. I'm sorry.


Ciao,

Rodolfo

--

HCE Engineering  e-mail: giome...@hce-engineering.it
GNU/Linux Solutions  giome...@enneenne.com
Linux Device Driver  giome...@linux.it
Embedded Systems phone:  +39 349 2432127
UNIX programming skype:  rodolfo.giometti
Cosino Project - the quick prototyping embedded system - www.cosino.it
Freelance ICT Italia - Consulente ICT Italia - www.consulenti-ict.it


Re: [PATCH 1/2] pps-gpio: Avoid flooding syslog

2018-02-15 Thread Rodolfo Giometti

On 15/02/18 13:59, Lukas Senger wrote:

^^^
Missing description and signatures...


---
  drivers/pps/clients/pps-gpio.c | 1 +
  include/linux/pps-gpio.h   | 2 ++
  2 files changed, 3 insertions(+)

diff --git a/drivers/pps/clients/pps-gpio.c b/drivers/pps/clients/pps-gpio.c
index dd7624f1d23f..35c3b14fc9b9 100644
--- a/drivers/pps/clients/pps-gpio.c
+++ b/drivers/pps/clients/pps-gpio.c
@@ -196,6 +196,7 @@ 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);
+   data->info.echo = pps_gpio_echo;
  
  	/* register PPS source */

pps_default_params = PPS_CAPTUREASSERT | PPS_OFFSETASSERT;
diff --git a/include/linux/pps-gpio.h b/include/linux/pps-gpio.h
index 0035abe41b9a..67f50e8dcd11 100644
--- a/include/linux/pps-gpio.h
+++ b/include/linux/pps-gpio.h
@@ -29,4 +29,6 @@ struct pps_gpio_platform_data {
const char *gpio_label;
  };
  
+static void pps_gpio_echo(struct pps_device *pps, int event, void *data){}

+
  #endif


Why a void function? You should use it to toggle echoing GPIO... =8-o

Ciao,

Rodolfo

--

HCE Engineering  e-mail: giome...@hce-engineering.it
GNU/Linux Solutions  giome...@enneenne.com
Linux Device Driver  giome...@linux.it
Embedded Systems phone:  +39 349 2432127
UNIX programming skype:  rodolfo.giometti
Cosino Project - the quick prototyping embedded system - www.cosino.it
Freelance ICT Italia - Consulente ICT Italia - www.consulenti-ict.it


Re: [PATCH 1/2] pps-gpio: Avoid flooding syslog

2018-02-15 Thread Rodolfo Giometti

On 15/02/18 13:59, Lukas Senger wrote:

^^^
Missing description and signatures...


---
  drivers/pps/clients/pps-gpio.c | 1 +
  include/linux/pps-gpio.h   | 2 ++
  2 files changed, 3 insertions(+)

diff --git a/drivers/pps/clients/pps-gpio.c b/drivers/pps/clients/pps-gpio.c
index dd7624f1d23f..35c3b14fc9b9 100644
--- a/drivers/pps/clients/pps-gpio.c
+++ b/drivers/pps/clients/pps-gpio.c
@@ -196,6 +196,7 @@ 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);
+   data->info.echo = pps_gpio_echo;
  
  	/* register PPS source */

pps_default_params = PPS_CAPTUREASSERT | PPS_OFFSETASSERT;
diff --git a/include/linux/pps-gpio.h b/include/linux/pps-gpio.h
index 0035abe41b9a..67f50e8dcd11 100644
--- a/include/linux/pps-gpio.h
+++ b/include/linux/pps-gpio.h
@@ -29,4 +29,6 @@ struct pps_gpio_platform_data {
const char *gpio_label;
  };
  
+static void pps_gpio_echo(struct pps_device *pps, int event, void *data){}

+
  #endif


Why a void function? You should use it to toggle echoing GPIO... =8-o

Ciao,

Rodolfo

--

HCE Engineering  e-mail: giome...@hce-engineering.it
GNU/Linux Solutions  giome...@enneenne.com
Linux Device Driver  giome...@linux.it
Embedded Systems phone:  +39 349 2432127
UNIX programming skype:  rodolfo.giometti
Cosino Project - the quick prototyping embedded system - www.cosino.it
Freelance ICT Italia - Consulente ICT Italia - www.consulenti-ict.it


Re: [PATCH] pps-gpio: implement echo pulses

2018-02-07 Thread Rodolfo Giometti

On 06/02/18 16:58, Lukas Senger wrote:

pps-gpio reports as having echo capability via sysfs, which is not
actually the case. This patch implements it.

The output pin is hardcoded as 17. This should probably be configurable
via the dtoverlay in the same way as the input pin.


No hardcoded stuff please! :-D

However thank you for your tutorial code, maybe someone will find it very 
useful.

Ciao,

Rodolfo

--

HCE Engineering  e-mail: giome...@hce-engineering.it
GNU/Linux Solutions  giome...@enneenne.com
Linux Device Driver  giome...@linux.it
Embedded Systems phone:  +39 349 2432127
UNIX programming skype:  rodolfo.giometti
Cosino Project - the quick prototyping embedded system - www.cosino.it
Freelance ICT Italia - Consulente ICT Italia - www.consulenti-ict.it


Re: [PATCH] pps-gpio: implement echo pulses

2018-02-07 Thread Rodolfo Giometti

On 06/02/18 16:58, Lukas Senger wrote:

pps-gpio reports as having echo capability via sysfs, which is not
actually the case. This patch implements it.

The output pin is hardcoded as 17. This should probably be configurable
via the dtoverlay in the same way as the input pin.


No hardcoded stuff please! :-D

However thank you for your tutorial code, maybe someone will find it very 
useful.

Ciao,

Rodolfo

--

HCE Engineering  e-mail: giome...@hce-engineering.it
GNU/Linux Solutions  giome...@enneenne.com
Linux Device Driver  giome...@linux.it
Embedded Systems phone:  +39 349 2432127
UNIX programming skype:  rodolfo.giometti
Cosino Project - the quick prototyping embedded system - www.cosino.it
Freelance ICT Italia - Consulente ICT Italia - www.consulenti-ict.it


Re: [PATCH 2/2] pps: generator: use new parport device model

2018-01-29 Thread Rodolfo Giometti

On 29/01/18 00:22, Sudip Mukherjee wrote:

Modify pps generator driver to use the new parallel port device model.

Signed-off-by: Sudip Mukherjee <sudipm.mukher...@gmail.com>


Acked-by: Rodolfo Giometti <giome...@enneenne.com>

--

HCE Engineering  e-mail: giome...@hce-engineering.it
GNU/Linux Solutions  giome...@enneenne.com
Linux Device Driver  giome...@linux.it
Embedded Systems phone:  +39 349 2432127
UNIX programming skype:  rodolfo.giometti
Cosino Project - the quick prototyping embedded system - www.cosino.it
Freelance ICT Italia - Consulente ICT Italia - www.consulenti-ict.it


Re: [PATCH 2/2] pps: generator: use new parport device model

2018-01-29 Thread Rodolfo Giometti

On 29/01/18 00:22, Sudip Mukherjee wrote:

Modify pps generator driver to use the new parallel port device model.

Signed-off-by: Sudip Mukherjee 


Acked-by: Rodolfo Giometti 

--

HCE Engineering  e-mail: giome...@hce-engineering.it
GNU/Linux Solutions  giome...@enneenne.com
Linux Device Driver  giome...@linux.it
Embedded Systems phone:  +39 349 2432127
UNIX programming skype:  rodolfo.giometti
Cosino Project - the quick prototyping embedded system - www.cosino.it
Freelance ICT Italia - Consulente ICT Italia - www.consulenti-ict.it


Re: [PATCH 1/2] pps: client: use new parport device model

2018-01-29 Thread Rodolfo Giometti

On 29/01/18 00:22, Sudip Mukherjee wrote:

Modify pps client driver to use the new parallel port device model.
In that process, added an index to mention the device number when we
have more than one parallel port.

Signed-off-by: Sudip Mukherjee <sudipm.mukher...@gmail.com>


Acked-by: Rodolfo Giometti <giome...@enneenne.com>

--

HCE Engineering  e-mail: giome...@hce-engineering.it
GNU/Linux Solutions  giome...@enneenne.com
Linux Device Driver  giome...@linux.it
Embedded Systems phone:  +39 349 2432127
UNIX programming skype:  rodolfo.giometti
Cosino Project - the quick prototyping embedded system - www.cosino.it
Freelance ICT Italia - Consulente ICT Italia - www.consulenti-ict.it


Re: [PATCH 1/2] pps: client: use new parport device model

2018-01-29 Thread Rodolfo Giometti

On 29/01/18 00:22, Sudip Mukherjee wrote:

Modify pps client driver to use the new parallel port device model.
In that process, added an index to mention the device number when we
have more than one parallel port.

Signed-off-by: Sudip Mukherjee 


Acked-by: Rodolfo Giometti 

--

HCE Engineering  e-mail: giome...@hce-engineering.it
GNU/Linux Solutions  giome...@enneenne.com
Linux Device Driver  giome...@linux.it
Embedded Systems phone:  +39 349 2432127
UNIX programming skype:  rodolfo.giometti
Cosino Project - the quick prototyping embedded system - www.cosino.it
Freelance ICT Italia - Consulente ICT Italia - www.consulenti-ict.it


Re: [PATCH] pps: parport: use timespec64 instead of timespec

2017-11-28 Thread Rodolfo Giometti

On 27/11/17 12:43, Arnd Bergmann wrote:

getnstimeofday() is deprecated, so I'm converting this to use
ktime_get_real_ts64() as a safe replacement. I considered using
ktime_get_real() instead, but since the algorithm here depends
on the exact timing, I decided to introduce fewer changes
and leave the code that determines the nanoseconds since the
last seconds wrap untouched.

It's not entirely clear to me whether we should also change the
time base to CLOCK_BOOTTIME or CLOCK_TAI. With boottime, we
would be independent of changes due to settimeofday() and only
see the speed adjustment from the upstream clock source, with
the downside of having the signal be at an arbirary offset
from the start of the UTC second signal. With CLOCK_TAI, we
would use the same offset from the UTC second as before and
still suffer from settimeofday() adjustments, but would be
less confused during leap seconds.

Both boottime and tai only offer usable (i.e. avoiding ktime_t
to timespec64 conversion) interfaces for ktime_t though, so
either way, changing it wouldn't take significantly more work.
CLOCK_MONOTONIC could be used with ktime_get_ts64(), but would
lose synchronization across a suspend/resume cycle, which seems
worse.

Signed-off-by: Arnd Bergmann <a...@arndb.de>


Acked-by: Rodolfo Giometti <giome...@enneenne.com>

--

HCE Engineering  e-mail: giome...@hce-engineering.it
GNU/Linux Solutions  giome...@enneenne.com
Linux Device Driver  giome...@linux.it
Embedded Systems phone:  +39 349 2432127
UNIX programming skype:  rodolfo.giometti
Cosino Project - the quick prototyping embedded system - www.cosino.it
Freelance ICT Italia - Consulente ICT Italia - www.consulenti-ict.it


Re: [PATCH] pps: parport: use timespec64 instead of timespec

2017-11-28 Thread Rodolfo Giometti

On 27/11/17 12:43, Arnd Bergmann wrote:

getnstimeofday() is deprecated, so I'm converting this to use
ktime_get_real_ts64() as a safe replacement. I considered using
ktime_get_real() instead, but since the algorithm here depends
on the exact timing, I decided to introduce fewer changes
and leave the code that determines the nanoseconds since the
last seconds wrap untouched.

It's not entirely clear to me whether we should also change the
time base to CLOCK_BOOTTIME or CLOCK_TAI. With boottime, we
would be independent of changes due to settimeofday() and only
see the speed adjustment from the upstream clock source, with
the downside of having the signal be at an arbirary offset
from the start of the UTC second signal. With CLOCK_TAI, we
would use the same offset from the UTC second as before and
still suffer from settimeofday() adjustments, but would be
less confused during leap seconds.

Both boottime and tai only offer usable (i.e. avoiding ktime_t
to timespec64 conversion) interfaces for ktime_t though, so
either way, changing it wouldn't take significantly more work.
CLOCK_MONOTONIC could be used with ktime_get_ts64(), but would
lose synchronization across a suspend/resume cycle, which seems
worse.

Signed-off-by: Arnd Bergmann 


Acked-by: Rodolfo Giometti 

--

HCE Engineering  e-mail: giome...@hce-engineering.it
GNU/Linux Solutions  giome...@enneenne.com
Linux Device Driver  giome...@linux.it
Embedded Systems phone:  +39 349 2432127
UNIX programming skype:  rodolfo.giometti
Cosino Project - the quick prototyping embedded system - www.cosino.it
Freelance ICT Italia - Consulente ICT Italia - www.consulenti-ict.it


Re: [PATCH] pps-gpio: use IRQ edge config when not capturing both edges

2017-09-12 Thread Rodolfo Giometti

On 12/09/2017 17:54, Tim Harvey wrote:

On Sun, Sep 10, 2017 at 3:43 AM, Rodolfo Giometti <giome...@enneenne.com> wrote:

On 08/09/2017 21:53, Tim Harvey wrote:


PPS signals with very short pulse-widths can be missed if their state
changes by the time the interrupt handler reads the GPIO pin state.

To avoid this in the case where we are only looking for one edge we can
use the edge configuration for the pin state but fall back to reading the
pin if both edges are being watched.



I disagree. The "rising_edge" status should be get from the hardware and not
derived by an empirical computation. Or, at least, it should be specifically
activated by setting something like this:

 pps {
 pinctrl-names = "default";
 pinctrl-0 = <_pps>;

 gpios = < 26 GPIO_ACTIVE_HIGH>;
 Yes-I-want-get-signal-status-in-an-epirical-way;

 compatible = "pps-gpio";
 status = "okay";
 };

This setting should also print a warning in order to be clear for the user
that he/she should know what he/she is doing.

Then the code should check also the compatibility with property
"assert-falling-edge"...



Hi Rodolfo,

Do you agree with using the irq edge in general if/when it is
available to resolve the case where small pulse-widths can be caught?

I assumed because pps-gpio is the one configuring the irq based on
info->capture_clear and info->assert_falling_edge that that it made
sense to use that logic again when handling the interrupt but there is
likely a call I can make to determine the irq (edge) type based on the
irq.


If you get the information from the hardware it's OK for me, otherwise you 
should enable this behavior by using proper DT property.


Ciao,

Rodolfo

--

HCE Engineering  e-mail: giome...@hce-engineering.it
GNU/Linux Solutions  giome...@enneenne.com
Linux Device Driver  giome...@linux.it
Embedded Systems phone:  +39 349 2432127
UNIX programming skype:  rodolfo.giometti
Cosino Project - the quick prototyping embedded system - www.cosino.it
Freelance ICT Italia - Consulente ICT Italia - www.consulenti-ict.it


Re: [PATCH] pps-gpio: use IRQ edge config when not capturing both edges

2017-09-12 Thread Rodolfo Giometti

On 12/09/2017 17:54, Tim Harvey wrote:

On Sun, Sep 10, 2017 at 3:43 AM, Rodolfo Giometti  wrote:

On 08/09/2017 21:53, Tim Harvey wrote:


PPS signals with very short pulse-widths can be missed if their state
changes by the time the interrupt handler reads the GPIO pin state.

To avoid this in the case where we are only looking for one edge we can
use the edge configuration for the pin state but fall back to reading the
pin if both edges are being watched.



I disagree. The "rising_edge" status should be get from the hardware and not
derived by an empirical computation. Or, at least, it should be specifically
activated by setting something like this:

 pps {
 pinctrl-names = "default";
 pinctrl-0 = <_pps>;

 gpios = < 26 GPIO_ACTIVE_HIGH>;
 Yes-I-want-get-signal-status-in-an-epirical-way;

 compatible = "pps-gpio";
 status = "okay";
 };

This setting should also print a warning in order to be clear for the user
that he/she should know what he/she is doing.

Then the code should check also the compatibility with property
"assert-falling-edge"...



Hi Rodolfo,

Do you agree with using the irq edge in general if/when it is
available to resolve the case where small pulse-widths can be caught?

I assumed because pps-gpio is the one configuring the irq based on
info->capture_clear and info->assert_falling_edge that that it made
sense to use that logic again when handling the interrupt but there is
likely a call I can make to determine the irq (edge) type based on the
irq.


If you get the information from the hardware it's OK for me, otherwise you 
should enable this behavior by using proper DT property.


Ciao,

Rodolfo

--

HCE Engineering  e-mail: giome...@hce-engineering.it
GNU/Linux Solutions  giome...@enneenne.com
Linux Device Driver  giome...@linux.it
Embedded Systems phone:  +39 349 2432127
UNIX programming skype:  rodolfo.giometti
Cosino Project - the quick prototyping embedded system - www.cosino.it
Freelance ICT Italia - Consulente ICT Italia - www.consulenti-ict.it


Re: [PATCH] MAINTAINERS: update linuxpps mailing list

2017-09-10 Thread Rodolfo Giometti

On 08/09/2017 21:58, Tim Harvey wrote:

Signed-off-by: Tim Harvey <thar...@gateworks.com>
---
  MAINTAINERS | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/MAINTAINERS b/MAINTAINERS
index 1c3feff..2f797bf 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -10576,7 +10576,7 @@ F:  drivers/net/ppp/ppp_*
  PPS SUPPORT
  M:Rodolfo Giometti <giome...@enneenne.com>
  W:http://wiki.enneenne.com/index.php/LinuxPPS_support
-L: linux...@ml.enneenne.com (subscribers-only)
+L: discussi...@linuxpps.org
  S:Maintained
  F:Documentation/pps/
  F:drivers/pps/



The list is discussi...@linuxpps.org but it's for subscribers-only... please 
fix it.

Ciao,

Rodolfo

--

HCE Engineering  e-mail: giome...@hce-engineering.it
GNU/Linux Solutions  giome...@enneenne.com
Linux Device Driver  giome...@linux.it
Embedded Systems phone:  +39 349 2432127
UNIX programming skype:  rodolfo.giometti
Cosino Project - the quick prototyping embedded system - www.cosino.it
Freelance ICT Italia - Consulente ICT Italia - www.consulenti-ict.it


Re: [PATCH] MAINTAINERS: update linuxpps mailing list

2017-09-10 Thread Rodolfo Giometti

On 08/09/2017 21:58, Tim Harvey wrote:

Signed-off-by: Tim Harvey 
---
  MAINTAINERS | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/MAINTAINERS b/MAINTAINERS
index 1c3feff..2f797bf 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -10576,7 +10576,7 @@ F:  drivers/net/ppp/ppp_*
  PPS SUPPORT
  M:Rodolfo Giometti 
  W:http://wiki.enneenne.com/index.php/LinuxPPS_support
-L: linux...@ml.enneenne.com (subscribers-only)
+L: discussi...@linuxpps.org
  S:Maintained
  F:Documentation/pps/
  F:drivers/pps/



The list is discussi...@linuxpps.org but it's for subscribers-only... please 
fix it.

Ciao,

Rodolfo

--

HCE Engineering  e-mail: giome...@hce-engineering.it
GNU/Linux Solutions  giome...@enneenne.com
Linux Device Driver  giome...@linux.it
Embedded Systems phone:  +39 349 2432127
UNIX programming skype:  rodolfo.giometti
Cosino Project - the quick prototyping embedded system - www.cosino.it
Freelance ICT Italia - Consulente ICT Italia - www.consulenti-ict.it


Re: [PATCH] pps-gpio: use IRQ edge config when not capturing both edges

2017-09-10 Thread Rodolfo Giometti

On 08/09/2017 21:53, Tim Harvey wrote:

PPS signals with very short pulse-widths can be missed if their state
changes by the time the interrupt handler reads the GPIO pin state.

To avoid this in the case where we are only looking for one edge we can
use the edge configuration for the pin state but fall back to reading the
pin if both edges are being watched.


I disagree. The "rising_edge" status should be get from the hardware and not 
derived by an empirical computation. Or, at least, it should be specifically 
activated by setting something like this:


pps {
pinctrl-names = "default";
pinctrl-0 = <_pps>;

gpios = < 26 GPIO_ACTIVE_HIGH>;
Yes-I-want-get-signal-status-in-an-epirical-way;

compatible = "pps-gpio";
status = "okay";
};

This setting should also print a warning in order to be clear for the user that 
he/she should know what he/she is doing.


Then the code should check also the compatibility with property 
"assert-falling-edge"...


Ciao,

Rodolfo

--

HCE Engineering  e-mail: giome...@hce-engineering.it
GNU/Linux Solutions  giome...@enneenne.com
Linux Device Driver  giome...@linux.it
Embedded Systems phone:  +39 349 2432127
UNIX programming skype:  rodolfo.giometti
Cosino Project - the quick prototyping embedded system - www.cosino.it
Freelance ICT Italia - Consulente ICT Italia - www.consulenti-ict.it


Re: [PATCH] pps-gpio: use IRQ edge config when not capturing both edges

2017-09-10 Thread Rodolfo Giometti

On 08/09/2017 21:53, Tim Harvey wrote:

PPS signals with very short pulse-widths can be missed if their state
changes by the time the interrupt handler reads the GPIO pin state.

To avoid this in the case where we are only looking for one edge we can
use the edge configuration for the pin state but fall back to reading the
pin if both edges are being watched.


I disagree. The "rising_edge" status should be get from the hardware and not 
derived by an empirical computation. Or, at least, it should be specifically 
activated by setting something like this:


pps {
pinctrl-names = "default";
pinctrl-0 = <_pps>;

gpios = < 26 GPIO_ACTIVE_HIGH>;
Yes-I-want-get-signal-status-in-an-epirical-way;

compatible = "pps-gpio";
status = "okay";
};

This setting should also print a warning in order to be clear for the user that 
he/she should know what he/she is doing.


Then the code should check also the compatibility with property 
"assert-falling-edge"...


Ciao,

Rodolfo

--

HCE Engineering  e-mail: giome...@hce-engineering.it
GNU/Linux Solutions  giome...@enneenne.com
Linux Device Driver  giome...@linux.it
Embedded Systems phone:  +39 349 2432127
UNIX programming skype:  rodolfo.giometti
Cosino Project - the quick prototyping embedded system - www.cosino.it
Freelance ICT Italia - Consulente ICT Italia - www.consulenti-ict.it


Re: Support for BQ28Z610 Battery Monitor IC

2017-09-05 Thread Rodolfo Giometti

On 04/09/2017 15:53, rajender.re...@stesalit.in wrote:

Dear Rodolfo Giometti,

As discussed please find attached patch.
Please let me know if you need more details.


It looks OK to me... however:

- rewrite the patch's title as "power bq27xxx_battery: add support for BQ28Z610 
battery monitor IC"


- align the "=" characters as follow:

+   [BQ28Z610] = {
+   [BQ27XXX_REG_CTRL] = 0x00,
+   [BQ27XXX_REG_TEMP] = 0x06,
+   [BQ27XXX_REG_INT_TEMP] = INVALID_REG_ADDR,
+   [BQ27XXX_REG_VOLT] = 0x08,
...

Then send the patch to the mail list or maintainers ad described into the 
MAINTAINERS file and adding me in Cc.


Good job! :-)

Ciao,

Rodolfo

--

HCE Engineering  e-mail: giome...@hce-engineering.it
GNU/Linux Solutions  giome...@enneenne.com
Linux Device Driver  giome...@linux.it
Embedded Systems phone:  +39 349 2432127
UNIX programming skype:  rodolfo.giometti
Cosino Project - the quick prototyping embedded system - www.cosino.it
Freelance ICT Italia - Consulente ICT Italia - www.consulenti-ict.it


Re: Support for BQ28Z610 Battery Monitor IC

2017-09-05 Thread Rodolfo Giometti

On 04/09/2017 15:53, rajender.re...@stesalit.in wrote:

Dear Rodolfo Giometti,

As discussed please find attached patch.
Please let me know if you need more details.


It looks OK to me... however:

- rewrite the patch's title as "power bq27xxx_battery: add support for BQ28Z610 
battery monitor IC"


- align the "=" characters as follow:

+   [BQ28Z610] = {
+   [BQ27XXX_REG_CTRL] = 0x00,
+   [BQ27XXX_REG_TEMP] = 0x06,
+   [BQ27XXX_REG_INT_TEMP] = INVALID_REG_ADDR,
+   [BQ27XXX_REG_VOLT] = 0x08,
...

Then send the patch to the mail list or maintainers ad described into the 
MAINTAINERS file and adding me in Cc.


Good job! :-)

Ciao,

Rodolfo

--

HCE Engineering  e-mail: giome...@hce-engineering.it
GNU/Linux Solutions  giome...@enneenne.com
Linux Device Driver  giome...@linux.it
Embedded Systems phone:  +39 349 2432127
UNIX programming skype:  rodolfo.giometti
Cosino Project - the quick prototyping embedded system - www.cosino.it
Freelance ICT Italia - Consulente ICT Italia - www.consulenti-ict.it


Re: [PATCH] PPS: Use surrounding "if PPS" to remove numerous dependency checks

2017-08-28 Thread Rodolfo Giometti

On 26/08/2017 16:55, Robert P. J. Day wrote:


Adding high-level "if PPS" makes lower-level dependency tests
superfluous.

Signed-off-by: Robert P. J. Day <rpj...@crashcourse.ca>


Acked-by: Rodolfo Giometti <giome...@enneenne.com>

--

HCE Engineering  e-mail: giome...@hce-engineering.it
GNU/Linux Solutions  giome...@enneenne.com
Linux Device Driver  giome...@linux.it
Embedded Systems phone:  +39 349 2432127
UNIX programming skype:  rodolfo.giometti
Cosino Project - the quick prototyping embedded system - www.cosino.it
Freelance ICT Italia - Consulente ICT Italia - www.consulenti-ict.it


Re: [PATCH] PPS: Use surrounding "if PPS" to remove numerous dependency checks

2017-08-28 Thread Rodolfo Giometti

On 26/08/2017 16:55, Robert P. J. Day wrote:


Adding high-level "if PPS" makes lower-level dependency tests
superfluous.

Signed-off-by: Robert P. J. Day 


Acked-by: Rodolfo Giometti 

--

HCE Engineering  e-mail: giome...@hce-engineering.it
GNU/Linux Solutions  giome...@enneenne.com
Linux Device Driver  giome...@linux.it
Embedded Systems phone:  +39 349 2432127
UNIX programming skype:  rodolfo.giometti
Cosino Project - the quick prototyping embedded system - www.cosino.it
Freelance ICT Italia - Consulente ICT Italia - www.consulenti-ict.it


Re: [PATCH v2] PPS: Aesthetic tweaks to PPS-related content

2017-08-28 Thread Rodolfo Giometti

On 26/08/2017 16:49, Robert P. J. Day wrote:


Collection of aesthetic adjustments to various PPS-related files,
directories and Documentation, some quite minor just for the sake of
consistency, including:

  * Updated example of pps device tree node (courtesy Rodolfo G.)
  * "PPS-API" -> "PPS API"
  * "pps_source_info_s" -> "pps_source_info"
  * "ktimer driver" -> "pps-ktimer driver"
  * "ppstest /dev/pps0" -> "ppstest /dev/pps1" to match example
  * Add missing PPS-related entries to MAINTAINERS file
  * Other trivialities

Diff stat:

  Documentation/devicetree/bindings/pps/pps-gpio.txt |  8 ++--
  Documentation/pps/pps.txt  | 44 
+++-
  MAINTAINERS|  3 +++
  include/linux/pps-gpio.h   |  2 +-
  include/linux/pps_kernel.h | 16 +++-
  include/uapi/linux/pps.h   |  4 ++--
  kernel/time/timekeeping.c  |  2 +-
  7 files changed, 43 insertions(+), 36 deletions(-)

Signed-off-by: Robert P. J. Day <rpj...@crashcourse.ca>


Acked-by: Rodolfo Giometti <giome...@enneenne.com>


--

HCE Engineering  e-mail: giome...@hce-engineering.it
GNU/Linux Solutions  giome...@enneenne.com
Linux Device Driver  giome...@linux.it
Embedded Systems phone:  +39 349 2432127
UNIX programming skype:  rodolfo.giometti
Cosino Project - the quick prototyping embedded system - www.cosino.it
Freelance ICT Italia - Consulente ICT Italia - www.consulenti-ict.it


Re: [PATCH v2] PPS: Aesthetic tweaks to PPS-related content

2017-08-28 Thread Rodolfo Giometti

On 26/08/2017 16:49, Robert P. J. Day wrote:


Collection of aesthetic adjustments to various PPS-related files,
directories and Documentation, some quite minor just for the sake of
consistency, including:

  * Updated example of pps device tree node (courtesy Rodolfo G.)
  * "PPS-API" -> "PPS API"
  * "pps_source_info_s" -> "pps_source_info"
  * "ktimer driver" -> "pps-ktimer driver"
  * "ppstest /dev/pps0" -> "ppstest /dev/pps1" to match example
  * Add missing PPS-related entries to MAINTAINERS file
  * Other trivialities

Diff stat:

  Documentation/devicetree/bindings/pps/pps-gpio.txt |  8 ++--
  Documentation/pps/pps.txt  | 44 
+++-
  MAINTAINERS|  3 +++
  include/linux/pps-gpio.h   |  2 +-
  include/linux/pps_kernel.h | 16 +++-
  include/uapi/linux/pps.h   |  4 ++--
  kernel/time/timekeeping.c  |  2 +-
  7 files changed, 43 insertions(+), 36 deletions(-)

Signed-off-by: Robert P. J. Day 


Acked-by: Rodolfo Giometti 


--

HCE Engineering  e-mail: giome...@hce-engineering.it
GNU/Linux Solutions  giome...@enneenne.com
Linux Device Driver  giome...@linux.it
Embedded Systems phone:  +39 349 2432127
UNIX programming skype:  rodolfo.giometti
Cosino Project - the quick prototyping embedded system - www.cosino.it
Freelance ICT Italia - Consulente ICT Italia - www.consulenti-ict.it


Re: [PATCH] Make PPS into a menuconfig to ease disabling

2017-05-09 Thread Rodolfo Giometti

On 04/11/17 16:26, Vincent Legoll wrote:

So that there's no need to get into the submenu to disable all related config
entries.

The BROKEN PPS_GENERATOR_PARPORT now also depends on PPS

Signed-off-by: Vincent Legoll <vincent.leg...@gmail.com>


Acked-by: Rodolfo Giometti <giome...@enneenne.com>

--

HCE Engineering  e-mail: giome...@hce-engineering.com
GNU/Linux Solutions  giome...@enneenne.com
Linux Device Driver  giome...@linux.it
Embedded Systems phone:  +39 349 2432127
UNIX programming skype:  rodolfo.giometti
Cosino Project - the quick prototyping embedded system - www.cosino.io
Freelance ICT Italia - Consulente ICT Italia - www.consulenti-ict.it


Re: [PATCH] Make PPS into a menuconfig to ease disabling

2017-05-09 Thread Rodolfo Giometti

On 04/11/17 16:26, Vincent Legoll wrote:

So that there's no need to get into the submenu to disable all related config
entries.

The BROKEN PPS_GENERATOR_PARPORT now also depends on PPS

Signed-off-by: Vincent Legoll 


Acked-by: Rodolfo Giometti 

--

HCE Engineering  e-mail: giome...@hce-engineering.com
GNU/Linux Solutions  giome...@enneenne.com
Linux Device Driver  giome...@linux.it
Embedded Systems phone:  +39 349 2432127
UNIX programming skype:  rodolfo.giometti
Cosino Project - the quick prototyping embedded system - www.cosino.io
Freelance ICT Italia - Consulente ICT Italia - www.consulenti-ict.it


Re: [PATCH] c2port: checking for NULL instead of IS_ERR()

2017-04-12 Thread Rodolfo Giometti

On 04/12/17 10:33, Dan Carpenter wrote:

c2port_device_register() never returns NULL, it uses error pointers.

Fixes: 65131cd52b9e ("c2port: add c2port support for Eurotech Duramar 2150")
Signed-off-by: Dan Carpenter <dan.carpen...@oracle.com>


Acked-by: Rodolfo Giometti <giome...@linux.it>


diff --git a/drivers/misc/c2port/c2port-duramar2150.c 
b/drivers/misc/c2port/c2port-duramar2150.c
index 5484301d57d9..3dc61ea7dc64 100644
--- a/drivers/misc/c2port/c2port-duramar2150.c
+++ b/drivers/misc/c2port/c2port-duramar2150.c
@@ -129,8 +129,8 @@ static int __init duramar2150_c2port_init(void)

duramar2150_c2port_dev = c2port_device_register("uc",
_c2port_ops, NULL);
-   if (!duramar2150_c2port_dev) {
-   ret = -ENODEV;
+   if (IS_ERR(duramar2150_c2port_dev)) {
+   ret = PTR_ERR(duramar2150_c2port_dev);
goto free_region;
}




--

HCE Engineering  e-mail: giome...@hce-engineering.com
GNU/Linux Solutions  giome...@enneenne.com
Linux Device Driver  giome...@linux.it
Embedded Systems phone:  +39 349 2432127
UNIX programming skype:  rodolfo.giometti
Cosino Project - the quick prototyping embedded system - www.cosino.io
Freelance ICT Italia - Consulente ICT Italia - www.consulenti-ict.it


Re: [PATCH] c2port: checking for NULL instead of IS_ERR()

2017-04-12 Thread Rodolfo Giometti

On 04/12/17 10:33, Dan Carpenter wrote:

c2port_device_register() never returns NULL, it uses error pointers.

Fixes: 65131cd52b9e ("c2port: add c2port support for Eurotech Duramar 2150")
Signed-off-by: Dan Carpenter 


Acked-by: Rodolfo Giometti 


diff --git a/drivers/misc/c2port/c2port-duramar2150.c 
b/drivers/misc/c2port/c2port-duramar2150.c
index 5484301d57d9..3dc61ea7dc64 100644
--- a/drivers/misc/c2port/c2port-duramar2150.c
+++ b/drivers/misc/c2port/c2port-duramar2150.c
@@ -129,8 +129,8 @@ static int __init duramar2150_c2port_init(void)

duramar2150_c2port_dev = c2port_device_register("uc",
_c2port_ops, NULL);
-   if (!duramar2150_c2port_dev) {
-   ret = -ENODEV;
+   if (IS_ERR(duramar2150_c2port_dev)) {
+   ret = PTR_ERR(duramar2150_c2port_dev);
goto free_region;
}




--

HCE Engineering  e-mail: giome...@hce-engineering.com
GNU/Linux Solutions  giome...@enneenne.com
Linux Device Driver  giome...@linux.it
Embedded Systems phone:  +39 349 2432127
UNIX programming skype:  rodolfo.giometti
Cosino Project - the quick prototyping embedded system - www.cosino.io
Freelance ICT Italia - Consulente ICT Italia - www.consulenti-ict.it


Re: [PATCH 8/8] LinuxPPS: pps_gen_parport: Add check for bad clocksource.

2017-03-04 Thread Rodolfo Giometti

On 03/04/17 10:19, Alexander Gerasiov wrote:

Hello Rodolfo,

I should say, that I found this solution is not the best. For example on
high speed PCs (I think over 3GHz) 5 iteration is not enough and module
stops working after several hours. That makes it not user-friendly,
cause user had to calibrate and set failure_iterations manually.

It would be better to use pre-measured loops_per_jiffy (from delay.h)
some way.


I see... however I cannot test the patch so if you tried it and you noticed 
these issues we should consider to add it but with the experimental warning?


Ciao,

Rodolfo

--

HCE Engineering  e-mail: giome...@hce-engineering.com
GNU/Linux Solutions  giome...@enneenne.com
Linux Device Driver  giome...@linux.it
Embedded Systems phone:  +39 349 2432127
UNIX programming skype:  rodolfo.giometti
Cosino Project - the quick prototyping embedded system - www.cosino.io
Freelance ICT Italia - Consulente ICT Italia - www.consulenti-ict.it


Re: [PATCH 8/8] LinuxPPS: pps_gen_parport: Add check for bad clocksource.

2017-03-04 Thread Rodolfo Giometti

On 03/04/17 10:19, Alexander Gerasiov wrote:

Hello Rodolfo,

I should say, that I found this solution is not the best. For example on
high speed PCs (I think over 3GHz) 5 iteration is not enough and module
stops working after several hours. That makes it not user-friendly,
cause user had to calibrate and set failure_iterations manually.

It would be better to use pre-measured loops_per_jiffy (from delay.h)
some way.


I see... however I cannot test the patch so if you tried it and you noticed 
these issues we should consider to add it but with the experimental warning?


Ciao,

Rodolfo

--

HCE Engineering  e-mail: giome...@hce-engineering.com
GNU/Linux Solutions  giome...@enneenne.com
Linux Device Driver  giome...@linux.it
Embedded Systems phone:  +39 349 2432127
UNIX programming skype:  rodolfo.giometti
Cosino Project - the quick prototyping embedded system - www.cosino.io
Freelance ICT Italia - Consulente ICT Italia - www.consulenti-ict.it


Re: [PATCH 2/2] pps: fix padding issue with PPS_FETCH for ioctl_compat

2017-03-04 Thread Rodolfo Giometti

On 02/24/17 21:23, Matt Ranostay wrote:

Issue is that x86 32-bit aligns to 4-bytes instead of 8-bytes
so this patchset works around the issue and corrects the data
returned in pps_fdata_compat.

Cc: Rodolfo Giometti <giome...@enneenne.com>
Cc: Moritz Fischer <m...@kernel.org>
Cc: George McCollister <george.mccollis...@gmail.com>
Signed-off-by: Matt Ranostay <matt.ranos...@konsulko.com>
---
 drivers/pps/pps.c| 110 ++-
 include/uapi/linux/pps.h |  19 
 2 files changed, 98 insertions(+), 31 deletions(-)


Acked-by: Rodolfo Giometti <giome...@enneenne.com>

--

HCE Engineering  e-mail: giome...@hce-engineering.com
GNU/Linux Solutions  giome...@enneenne.com
Linux Device Driver  giome...@linux.it
Embedded Systems phone:  +39 349 2432127
UNIX programming skype:  rodolfo.giometti
Cosino Project - the quick prototyping embedded system - www.cosino.io
Freelance ICT Italia - Consulente ICT Italia - www.consulenti-ict.it


Re: [PATCH 2/2] pps: fix padding issue with PPS_FETCH for ioctl_compat

2017-03-04 Thread Rodolfo Giometti

On 02/24/17 21:23, Matt Ranostay wrote:

Issue is that x86 32-bit aligns to 4-bytes instead of 8-bytes
so this patchset works around the issue and corrects the data
returned in pps_fdata_compat.

Cc: Rodolfo Giometti 
Cc: Moritz Fischer 
Cc: George McCollister 
Signed-off-by: Matt Ranostay 
---
 drivers/pps/pps.c| 110 ++-
 include/uapi/linux/pps.h |  19 
 2 files changed, 98 insertions(+), 31 deletions(-)


Acked-by: Rodolfo Giometti 

--

HCE Engineering  e-mail: giome...@hce-engineering.com
GNU/Linux Solutions  giome...@enneenne.com
Linux Device Driver  giome...@linux.it
Embedded Systems phone:  +39 349 2432127
UNIX programming skype:  rodolfo.giometti
Cosino Project - the quick prototyping embedded system - www.cosino.io
Freelance ICT Italia - Consulente ICT Italia - www.consulenti-ict.it


Re: [PATCH 8/8] LinuxPPS: pps_gen_parport: Add check for bad clocksource.

2017-03-04 Thread Rodolfo Giometti

On 02/15/17 15:31, Andrey Drobyshev wrote:

From: Nikita Edward Baruzdin <nebaruz...@gmail.com>

This commit is supposed to resolve the issue with hard lockups on systems using
jiffies as their clock source. Namely, it sets limits on number of iterations
clock source may remain unchanged (i. e. not being updated for one reason or
another, as it is with jiffies clock source), and on unsuccessful
getnstimeofday() polls as well. In case limit is reached, we consider clock
source incompatible with this driver or unstable.

Considering this issue to be fixed, un-BROKEN pps_gen_parport.

For explanation of the problem see this thread on lkml:
https://lkml.org/lkml/2011/2/18/310

Signed-off-by: Nikita Edward Baruzdin <nebaruz...@lvk.cs.msu.su>
Signed-off-by: Alexander GQ Gerasiov <g...@cs.msu.su>


Acked-by: Rodolfo Giometti <giome...@enneenne.com>


Re: [PATCH 8/8] LinuxPPS: pps_gen_parport: Add check for bad clocksource.

2017-03-04 Thread Rodolfo Giometti

On 02/15/17 15:31, Andrey Drobyshev wrote:

From: Nikita Edward Baruzdin 

This commit is supposed to resolve the issue with hard lockups on systems using
jiffies as their clock source. Namely, it sets limits on number of iterations
clock source may remain unchanged (i. e. not being updated for one reason or
another, as it is with jiffies clock source), and on unsuccessful
getnstimeofday() polls as well. In case limit is reached, we consider clock
source incompatible with this driver or unstable.

Considering this issue to be fixed, un-BROKEN pps_gen_parport.

For explanation of the problem see this thread on lkml:
https://lkml.org/lkml/2011/2/18/310

Signed-off-by: Nikita Edward Baruzdin 
Signed-off-by: Alexander GQ Gerasiov 


Acked-by: Rodolfo Giometti 


Re: [PATCH 2/8] ntp/pps: ignore pps_valid decreasing if there is no pps signal.

2017-03-04 Thread Rodolfo Giometti

On 02/15/17 15:31, Andrey Drobyshev wrote:

From: Alexander GQ Gerasiov <g...@cs.msu.su>

In case pps_dec_valid() is called from second_overflow() in the
absence of pps signal, there is no need to decrease pps_valid.

Signed-off-by: Alexander GQ Gerasiov <g...@cs.msu.su>


Acked-by: Rodolfo Giometti <giome...@enneenne.com>


Re: [PATCH 2/8] ntp/pps: ignore pps_valid decreasing if there is no pps signal.

2017-03-04 Thread Rodolfo Giometti

On 02/15/17 15:31, Andrey Drobyshev wrote:

From: Alexander GQ Gerasiov 

In case pps_dec_valid() is called from second_overflow() in the
absence of pps signal, there is no need to decrease pps_valid.

Signed-off-by: Alexander GQ Gerasiov 


Acked-by: Rodolfo Giometti 


Re: [PATCH 7/8] LinuxPPS: pps_gen_parport: Add polarity parameter for inverted signal.

2017-03-03 Thread Rodolfo Giometti

On 02/15/17 15:31, Andrey Drobyshev wrote:

From: Alexander GQ Gerasiov <g...@cs.msu.su>

On some devices it may be necessary to transmit inverted data. This commit
simply adds polarity parameter to define which state represents presence of
signal: it equals 0 if signal is on the low level (default), or 1 if signal
is on the high level (inverted signal).

Signed-off-by: Alexander GQ Gerasiov <g...@cs.msu.su>
---
 drivers/pps/generators/pps_gen_parport.c | 8 ++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/drivers/pps/generators/pps_gen_parport.c 
b/drivers/pps/generators/pps_gen_parport.c
index dcd39fb..7739301 100644
--- a/drivers/pps/generators/pps_gen_parport.c
+++ b/drivers/pps/generators/pps_gen_parport.c
@@ -36,8 +36,8 @@

 #define DRVDESC "parallel port PPS signal generator"

-#define SIGNAL 0
-#define NO_SIGNAL  PARPORT_CONTROL_STROBE
+#define SIGNAL (polarity?PARPORT_CONTROL_STROBE:0)
+#define NO_SIGNAL  (polarity?0:PARPORT_CONTROL_STROBE)


Add spaces:


+#define SIGNAL (polarity ? PARPORT_CONTROL_STROBE : 0)
+#define NO_SIGNAL  (polarity ? 0 : PARPORT_CONTROL_STROBE)



 /* module parameters */

@@ -48,6 +48,10 @@ MODULE_PARM_DESC(delay,
"Delay between setting and dropping the signal (ns)");
 module_param_named(delay, send_delay, uint, 0);

+static unsigned int polarity;
+MODULE_PARM_DESC(polarity,
+   "Signal is on the low level (0 - default) or on the high level (1).");
+module_param(polarity, uint, 0);

 #define SAFETY_INTERVAL3000/* set the hrtimer earlier for safety 
(ns) */


Acked-by: Rodolfo Giometti <giome...@enneenne.com>


Re: [PATCH 7/8] LinuxPPS: pps_gen_parport: Add polarity parameter for inverted signal.

2017-03-03 Thread Rodolfo Giometti

On 02/15/17 15:31, Andrey Drobyshev wrote:

From: Alexander GQ Gerasiov 

On some devices it may be necessary to transmit inverted data. This commit
simply adds polarity parameter to define which state represents presence of
signal: it equals 0 if signal is on the low level (default), or 1 if signal
is on the high level (inverted signal).

Signed-off-by: Alexander GQ Gerasiov 
---
 drivers/pps/generators/pps_gen_parport.c | 8 ++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/drivers/pps/generators/pps_gen_parport.c 
b/drivers/pps/generators/pps_gen_parport.c
index dcd39fb..7739301 100644
--- a/drivers/pps/generators/pps_gen_parport.c
+++ b/drivers/pps/generators/pps_gen_parport.c
@@ -36,8 +36,8 @@

 #define DRVDESC "parallel port PPS signal generator"

-#define SIGNAL 0
-#define NO_SIGNAL  PARPORT_CONTROL_STROBE
+#define SIGNAL (polarity?PARPORT_CONTROL_STROBE:0)
+#define NO_SIGNAL  (polarity?0:PARPORT_CONTROL_STROBE)


Add spaces:


+#define SIGNAL (polarity ? PARPORT_CONTROL_STROBE : 0)
+#define NO_SIGNAL  (polarity ? 0 : PARPORT_CONTROL_STROBE)



 /* module parameters */

@@ -48,6 +48,10 @@ MODULE_PARM_DESC(delay,
"Delay between setting and dropping the signal (ns)");
 module_param_named(delay, send_delay, uint, 0);

+static unsigned int polarity;
+MODULE_PARM_DESC(polarity,
+   "Signal is on the low level (0 - default) or on the high level (1).");
+module_param(polarity, uint, 0);

 #define SAFETY_INTERVAL3000/* set the hrtimer earlier for safety 
(ns) */


Acked-by: Rodolfo Giometti 


Re: [PATCH 6/8] LinuxPPS: pps_parport: Ignore interrupt invoked less than 0.5sec after previous.

2017-03-03 Thread Rodolfo Giometti

On 02/15/17 15:31, Andrey Drobyshev wrote:

From: Alexander GQ Gerasiov <g...@cs.msu.su>

On some devices interrupt may be invoked by parasitic assert event produced
while switching from high to low. Such interrupt should be ignored.

Signed-off-by: Alexander GQ Gerasiov <g...@cs.msu.su>


Acked-by: Rodolfo Giometti <giome...@enneenne.com>


Re: [PATCH 1/2] pps: add ioctl_compat function to correct ioctl definitions

2017-03-03 Thread Rodolfo Giometti

On 02/24/17 21:23, Matt Ranostay wrote:

ioctl definitions use the pointer size of the architecture which
is fine when userspace and kernel are the same bitsize. This
patchset workarounds an issue with mixed bitsize kernel + userspace
by rewriting the cmd to the kernelspace architecture pointer size.

Cc: Rodolfo Giometti <giome...@enneenne.com>
Cc: Moritz Fischer <m...@kernel.org>
Cc: George McCollister <george.mccollis...@gmail.com>
Signed-off-by: Matt Ranostay <matt.ranos...@konsulko.com>
---
 drivers/pps/pps.c | 13 +
 1 file changed, 13 insertions(+)


Acked-by: Rodolfo Giometti <giome...@enneenne.com>

--

HCE Engineering  e-mail: giome...@hce-engineering.com
GNU/Linux Solutions  giome...@enneenne.com
Linux Device Driver  giome...@linux.it
Embedded Systems phone:  +39 349 2432127
UNIX programming skype:  rodolfo.giometti
Cosino Project - the quick prototyping embedded system - www.cosino.io
Freelance ICT Italia - Consulente ICT Italia - www.consulenti-ict.it


Re: [PATCH 6/8] LinuxPPS: pps_parport: Ignore interrupt invoked less than 0.5sec after previous.

2017-03-03 Thread Rodolfo Giometti

On 02/15/17 15:31, Andrey Drobyshev wrote:

From: Alexander GQ Gerasiov 

On some devices interrupt may be invoked by parasitic assert event produced
while switching from high to low. Such interrupt should be ignored.

Signed-off-by: Alexander GQ Gerasiov 


Acked-by: Rodolfo Giometti 


Re: [PATCH 1/2] pps: add ioctl_compat function to correct ioctl definitions

2017-03-03 Thread Rodolfo Giometti

On 02/24/17 21:23, Matt Ranostay wrote:

ioctl definitions use the pointer size of the architecture which
is fine when userspace and kernel are the same bitsize. This
patchset workarounds an issue with mixed bitsize kernel + userspace
by rewriting the cmd to the kernelspace architecture pointer size.

Cc: Rodolfo Giometti 
Cc: Moritz Fischer 
Cc: George McCollister 
Signed-off-by: Matt Ranostay 
---
 drivers/pps/pps.c | 13 +
 1 file changed, 13 insertions(+)


Acked-by: Rodolfo Giometti 

--

HCE Engineering  e-mail: giome...@hce-engineering.com
GNU/Linux Solutions  giome...@enneenne.com
Linux Device Driver  giome...@linux.it
Embedded Systems phone:  +39 349 2432127
UNIX programming skype:  rodolfo.giometti
Cosino Project - the quick prototyping embedded system - www.cosino.io
Freelance ICT Italia - Consulente ICT Italia - www.consulenti-ict.it


Re: [PATCH 5/8] LinuxPPS: pps_parport: Do not generate assert in case of lost signal.

2017-03-03 Thread Rodolfo Giometti

On 02/15/17 15:31, Andrey Drobyshev wrote:

From: Alexander GQ Gerasiov <g...@cs.msu.su>

Since clear timeout is non-zero, some clear event capture is requested.
Therefore, if signal is lost we shouldn't generate assert event alone.

Signed-off-by: Alexander GQ Gerasiov <g...@cs.msu.su>


Acked-by: Rodolfo Giometti <giome...@enneenne.com>


Re: [PATCH 5/8] LinuxPPS: pps_parport: Do not generate assert in case of lost signal.

2017-03-03 Thread Rodolfo Giometti

On 02/15/17 15:31, Andrey Drobyshev wrote:

From: Alexander GQ Gerasiov 

Since clear timeout is non-zero, some clear event capture is requested.
Therefore, if signal is lost we shouldn't generate assert event alone.

Signed-off-by: Alexander GQ Gerasiov 


Acked-by: Rodolfo Giometti 


Re: [PATCH 4/8] LinuxPPS: kapi: Unlock before waking up events queue in pps_event().

2017-03-03 Thread Rodolfo Giometti

On 02/15/17 15:31, Andrey Drobyshev wrote:

From: Alexander GQ Gerasiov <g...@redlab-i.ru>

Otherwise we get "scheduling while atomic" problem.

Signed-off-by: Alexander GQ Gerasiov <g...@redlab-i.ru>


Acked-by: Rodolfo Giometti <giome...@enneenne.com>


Re: [PATCH 4/8] LinuxPPS: kapi: Unlock before waking up events queue in pps_event().

2017-03-03 Thread Rodolfo Giometti

On 02/15/17 15:31, Andrey Drobyshev wrote:

From: Alexander GQ Gerasiov 

Otherwise we get "scheduling while atomic" problem.

Signed-off-by: Alexander GQ Gerasiov 


Acked-by: Rodolfo Giometti 


Re: [PATCH 3/8] hardpps: fix some pps_jitter issues.

2017-03-03 Thread Rodolfo Giometti

On 02/15/17 15:31, Andrey Drobyshev wrote:

Handle possible overflow, implementation-defined result of signed right shift
and replace unsuitable constant.

Signed-off-by: Andrey Drobyshev <immortalguardi...@gmail.com>
Signed-off-by: Alexander GQ Gerasiov <g...@cs.msu.su>


Acked-by: Rodolfo Giometti <giome...@enneenne.com>


Re: [PATCH 3/8] hardpps: fix some pps_jitter issues.

2017-03-03 Thread Rodolfo Giometti

On 02/15/17 15:31, Andrey Drobyshev wrote:

Handle possible overflow, implementation-defined result of signed right shift
and replace unsuitable constant.

Signed-off-by: Andrey Drobyshev 
Signed-off-by: Alexander GQ Gerasiov 


Acked-by: Rodolfo Giometti 


Re: [PATCH 1/8] hardpps: simple fixes replacing clumsy code with abs() macro.

2017-03-03 Thread Rodolfo Giometti

On 02/15/17 15:31, Andrey Drobyshev wrote:

From: Alexander GQ Gerasiov <g...@cs.msu.su>

Here are some trivial fixes, including:
  * simplify comparisons by using abs() macro
  * remove unnecessary variables
  * remove duplicate headers
  * fix typos

Signed-off-by: Alexander GQ Gerasiov <g...@cs.msu.su>


Acked-by: Rodolfo Giometti <giome...@enneenne.com>


Re: [PATCH 1/8] hardpps: simple fixes replacing clumsy code with abs() macro.

2017-03-03 Thread Rodolfo Giometti

On 02/15/17 15:31, Andrey Drobyshev wrote:

From: Alexander GQ Gerasiov 

Here are some trivial fixes, including:
  * simplify comparisons by using abs() macro
  * remove unnecessary variables
  * remove duplicate headers
  * fix typos

Signed-off-by: Alexander GQ Gerasiov 


Acked-by: Rodolfo Giometti 


Re: [RFC] pps: fixing CONFIG_COMPAT issues

2016-12-23 Thread Rodolfo Giometti

On 12/22/16 21:39, Matt Ranostay wrote:


What would be the best way to fix the padding issue without breaking
userspace applications? Just fixing the alignment with explicit
padding is of course the clean easy way, but bashing the data in
compat_ioctl would avoid breakage.


Hi Matt,

I've no experience in this topic... I'm sorry! :(

Maybe is better waiting for David's advices? In the meantime I'm going to study 
the problem a bit better.


Ciao,

Rodolfo

--

HCE Engineering  e-mail: giome...@hce-engineering.com
GNU/Linux Solutions  giome...@enneenne.com
Linux Device Driver  giome...@linux.it
Embedded Systems phone:  +39 349 2432127
UNIX programming skype:  rodolfo.giometti
Cosino Project - the quick prototyping embedded system - www.cosino.io
Freelance ICT Italia - Consulente ICT Italia - www.consulenti-ict.it


Re: [RFC] pps: fixing CONFIG_COMPAT issues

2016-12-23 Thread Rodolfo Giometti

On 12/22/16 21:39, Matt Ranostay wrote:


What would be the best way to fix the padding issue without breaking
userspace applications? Just fixing the alignment with explicit
padding is of course the clean easy way, but bashing the data in
compat_ioctl would avoid breakage.


Hi Matt,

I've no experience in this topic... I'm sorry! :(

Maybe is better waiting for David's advices? In the meantime I'm going to study 
the problem a bit better.


Ciao,

Rodolfo

--

HCE Engineering  e-mail: giome...@hce-engineering.com
GNU/Linux Solutions  giome...@enneenne.com
Linux Device Driver  giome...@linux.it
Embedded Systems phone:  +39 349 2432127
UNIX programming skype:  rodolfo.giometti
Cosino Project - the quick prototyping embedded system - www.cosino.io
Freelance ICT Italia - Consulente ICT Italia - www.consulenti-ict.it


Re: [PATCH][RESEND] pps: kc: fix non-tickless system config dependency

2016-09-21 Thread Rodolfo Giometti

On 09/21/16 18:38, Maciej S. Szmigiero wrote:

CONFIG_NO_HZ currently only sets the default value
of dynticks config so if PPS kernel consumer needs
periodic timer ticks it should depend on
!CONFIG_NO_HZ_COMMON instead of !CONFIG_NO_HZ.

Otherwise it is possible to enable it even on
tickless system which has CONFIG_NO_HZ not set and
CONFIG_NO_HZ_IDLE (or CONFIG_NO_HZ_FULL) set.

Signed-off-by: Maciej S. Szmigiero <m...@maciej.szmigiero.name>
---
This is a resend without functional changes since previous
submission and resubmission weren't picked up.

@Rodolfo: Could you ack this, please?


Acked-by: Rodolfo Giometti <giome...@enneenne.com>

--

HCE Engineering  e-mail: giome...@hce-engineering.com
GNU/Linux Solutions  giome...@enneenne.com
Linux Device Driver  giome...@linux.it
Embedded Systems phone:  +39 349 2432127
UNIX programming skype:  rodolfo.giometti
Cosino Project - the quick prototyping embedded system - www.cosino.io
Freelance ICT Italia - Consulente ICT Italia - www.consulenti-ict.it


Re: [PATCH][RESEND] pps: kc: fix non-tickless system config dependency

2016-09-21 Thread Rodolfo Giometti

On 09/21/16 18:38, Maciej S. Szmigiero wrote:

CONFIG_NO_HZ currently only sets the default value
of dynticks config so if PPS kernel consumer needs
periodic timer ticks it should depend on
!CONFIG_NO_HZ_COMMON instead of !CONFIG_NO_HZ.

Otherwise it is possible to enable it even on
tickless system which has CONFIG_NO_HZ not set and
CONFIG_NO_HZ_IDLE (or CONFIG_NO_HZ_FULL) set.

Signed-off-by: Maciej S. Szmigiero 
---
This is a resend without functional changes since previous
submission and resubmission weren't picked up.

@Rodolfo: Could you ack this, please?


Acked-by: Rodolfo Giometti 

--

HCE Engineering  e-mail: giome...@hce-engineering.com
GNU/Linux Solutions  giome...@enneenne.com
Linux Device Driver  giome...@linux.it
Embedded Systems phone:  +39 349 2432127
UNIX programming skype:  rodolfo.giometti
Cosino Project - the quick prototyping embedded system - www.cosino.io
Freelance ICT Italia - Consulente ICT Italia - www.consulenti-ict.it


Re: [PATCH -resend] pps: do not crash when failed to register

2016-07-14 Thread Rodolfo Giometti

On 07/14/16 13:52, Jiri Slaby wrote:

With this command sequence:
  modprobe plip
  modprobe pps_parport
  rmmod pps_parport
the partport_pps modules causes this crash:

===

BUG: unable to handle kernel NULL pointer dereference at   (null)
IP: [] parport_detach+0x1d/0x60 [pps_parport]
Oops:  [#1] SMP
...
Call Trace:
  [] parport_unregister_driver+0x65/0xc0 [parport]
  [] SyS_delete_module+0x187/0x210

===

1) plip is loaded and takes the parport device for exclusive use:
   plip0: Parallel port at 0x378, using IRQ 7.

2) pps_parport then fails to grab the device:
   pps_parport: parallel port PPS client
   parport0: cannot grant exclusive access for device pps_parport
   pps_parport: couldn't register with parport0

3) rmmod of pps_parport is then killed because it tries to access
pardev->name, but pardev (taken from port->cad) is NULL.

So add a check for NULL in the test there too.

Signed-off-by: Jiri Slaby <jsl...@suse.cz>
Cc: Rodolfo Giometti <giome...@enneenne.com>
---
  drivers/pps/clients/pps_parport.c | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/pps/clients/pps_parport.c 
b/drivers/pps/clients/pps_parport.c
index 38a8bbe74810..83797d89c30f 100644
--- a/drivers/pps/clients/pps_parport.c
+++ b/drivers/pps/clients/pps_parport.c
@@ -195,7 +195,7 @@ static void parport_detach(struct parport *port)
struct pps_client_pp *device;

/* FIXME: oooh, this is ugly! */
-   if (strcmp(pardev->name, KBUILD_MODNAME))
+   if (!pardev || strcmp(pardev->name, KBUILD_MODNAME))
/* not our port */
    return;




Acked-by: Rodolfo Giometti <giome...@enneenne.com>

--

HCE Engineering  e-mail: giome...@hce-engineering.com
GNU/Linux Solutions  giome...@enneenne.com
Linux Device Driver  giome...@linux.it
Embedded Systems phone:  +39 349 2432127
UNIX programming skype:  rodolfo.giometti
Cosino Project - the quick prototyping embedded system - www.cosino.io
Freelance ICT Italia - Consulente ICT Italia - www.consulenti-ict.it


Re: [PATCH -resend] pps: do not crash when failed to register

2016-07-14 Thread Rodolfo Giometti

On 07/14/16 13:52, Jiri Slaby wrote:

With this command sequence:
  modprobe plip
  modprobe pps_parport
  rmmod pps_parport
the partport_pps modules causes this crash:

===

BUG: unable to handle kernel NULL pointer dereference at   (null)
IP: [] parport_detach+0x1d/0x60 [pps_parport]
Oops:  [#1] SMP
...
Call Trace:
  [] parport_unregister_driver+0x65/0xc0 [parport]
  [] SyS_delete_module+0x187/0x210

===

1) plip is loaded and takes the parport device for exclusive use:
   plip0: Parallel port at 0x378, using IRQ 7.

2) pps_parport then fails to grab the device:
   pps_parport: parallel port PPS client
   parport0: cannot grant exclusive access for device pps_parport
   pps_parport: couldn't register with parport0

3) rmmod of pps_parport is then killed because it tries to access
pardev->name, but pardev (taken from port->cad) is NULL.

So add a check for NULL in the test there too.

Signed-off-by: Jiri Slaby 
Cc: Rodolfo Giometti 
---
  drivers/pps/clients/pps_parport.c | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/pps/clients/pps_parport.c 
b/drivers/pps/clients/pps_parport.c
index 38a8bbe74810..83797d89c30f 100644
--- a/drivers/pps/clients/pps_parport.c
+++ b/drivers/pps/clients/pps_parport.c
@@ -195,7 +195,7 @@ static void parport_detach(struct parport *port)
struct pps_client_pp *device;

/* FIXME: oooh, this is ugly! */
-   if (strcmp(pardev->name, KBUILD_MODNAME))
+   if (!pardev || strcmp(pardev->name, KBUILD_MODNAME))
/* not our port */
return;




Acked-by: Rodolfo Giometti 

--

HCE Engineering  e-mail: giome...@hce-engineering.com
GNU/Linux Solutions  giome...@enneenne.com
Linux Device Driver  giome...@linux.it
Embedded Systems phone:  +39 349 2432127
UNIX programming skype:  rodolfo.giometti
Cosino Project - the quick prototyping embedded system - www.cosino.io
Freelance ICT Italia - Consulente ICT Italia - www.consulenti-ict.it


Re: [PATCH] pps: kc: fix non-tickless system config dependency

2016-03-21 Thread Rodolfo Giometti
On Mon, Mar 21, 2016 at 03:28:26PM +0100, Maciej S. Szmigiero wrote:
> Hi Rodolfo,
> 
> On 06.03.2016 20:13, Rodolfo Giometti wrote:
> > On Sat, Mar 05, 2016 at 06:37:39PM +0100, Maciej S. Szmigiero wrote:
> >> CONFIG_NO_HZ currently only sets the default value
> >> of dynticks config so if PPS kernel consumer needs
> >> periodic timer ticks it should depend on
> >> !CONFIG_NO_HZ_COMMON instead of !CONFIG_NO_HZ.
> >>
> >> Otherwise it is possible to enable it even on
> >> tickless system which has CONFIG_NO_HZ not set and
> >> CONFIG_NO_HZ_IDLE (or CONFIG_NO_HZ_FULL) set.
> >>
> >> Signed-off-by: Maciej S. Szmigiero <m...@maciej.szmigiero.name>
> > 
> > It's ok for me.
> 
> Thanks for review, do you know who should merge it then?

Usually I ask to Andrew Morton <a...@linux-foundation.org>

Ciao,

Rodolfo

-- 

HCE Engineering  e-mail: giome...@hce-engineering.com
GNU/Linux Solutions  giome...@enneenne.com
Linux Device Driver  giome...@linux.it
Embedded Systems phone:  +39 349 2432127
UNIX programming skype:  rodolfo.giometti
Cosino Project - the quick prototyping embedded system - www.cosino.io
Freelance ICT Italia - Consulente ICT Italia - www.consulenti-ict.it


Re: [PATCH] pps: kc: fix non-tickless system config dependency

2016-03-21 Thread Rodolfo Giometti
On Mon, Mar 21, 2016 at 03:28:26PM +0100, Maciej S. Szmigiero wrote:
> Hi Rodolfo,
> 
> On 06.03.2016 20:13, Rodolfo Giometti wrote:
> > On Sat, Mar 05, 2016 at 06:37:39PM +0100, Maciej S. Szmigiero wrote:
> >> CONFIG_NO_HZ currently only sets the default value
> >> of dynticks config so if PPS kernel consumer needs
> >> periodic timer ticks it should depend on
> >> !CONFIG_NO_HZ_COMMON instead of !CONFIG_NO_HZ.
> >>
> >> Otherwise it is possible to enable it even on
> >> tickless system which has CONFIG_NO_HZ not set and
> >> CONFIG_NO_HZ_IDLE (or CONFIG_NO_HZ_FULL) set.
> >>
> >> Signed-off-by: Maciej S. Szmigiero 
> > 
> > It's ok for me.
> 
> Thanks for review, do you know who should merge it then?

Usually I ask to Andrew Morton 

Ciao,

Rodolfo

-- 

HCE Engineering  e-mail: giome...@hce-engineering.com
GNU/Linux Solutions  giome...@enneenne.com
Linux Device Driver  giome...@linux.it
Embedded Systems phone:  +39 349 2432127
UNIX programming skype:  rodolfo.giometti
Cosino Project - the quick prototyping embedded system - www.cosino.io
Freelance ICT Italia - Consulente ICT Italia - www.consulenti-ict.it


Re: [PATCH] pps: kc: fix non-tickless system config dependency

2016-03-06 Thread Rodolfo Giometti
On Sat, Mar 05, 2016 at 06:37:39PM +0100, Maciej S. Szmigiero wrote:
> CONFIG_NO_HZ currently only sets the default value
> of dynticks config so if PPS kernel consumer needs
> periodic timer ticks it should depend on
> !CONFIG_NO_HZ_COMMON instead of !CONFIG_NO_HZ.
> 
> Otherwise it is possible to enable it even on
> tickless system which has CONFIG_NO_HZ not set and
> CONFIG_NO_HZ_IDLE (or CONFIG_NO_HZ_FULL) set.
> 
> Signed-off-by: Maciej S. Szmigiero 

It's ok for me.

Ciao,

Rodolfo

-- 

HCE Engineering  e-mail: giome...@hce-engineering.com
GNU/Linux Solutions  giome...@enneenne.com
Linux Device Driver  giome...@linux.it
Embedded Systems phone:  +39 349 2432127
UNIX programming skype:  rodolfo.giometti
Cosino Project - the quick prototyping embedded system - www.cosino.io
Freelance ICT Italia - Consulente ICT Italia - www.consulenti-ict.it


Re: [PATCH] pps: kc: fix non-tickless system config dependency

2016-03-06 Thread Rodolfo Giometti
On Sat, Mar 05, 2016 at 06:37:39PM +0100, Maciej S. Szmigiero wrote:
> CONFIG_NO_HZ currently only sets the default value
> of dynticks config so if PPS kernel consumer needs
> periodic timer ticks it should depend on
> !CONFIG_NO_HZ_COMMON instead of !CONFIG_NO_HZ.
> 
> Otherwise it is possible to enable it even on
> tickless system which has CONFIG_NO_HZ not set and
> CONFIG_NO_HZ_IDLE (or CONFIG_NO_HZ_FULL) set.
> 
> Signed-off-by: Maciej S. Szmigiero 

It's ok for me.

Ciao,

Rodolfo

-- 

HCE Engineering  e-mail: giome...@hce-engineering.com
GNU/Linux Solutions  giome...@enneenne.com
Linux Device Driver  giome...@linux.it
Embedded Systems phone:  +39 349 2432127
UNIX programming skype:  rodolfo.giometti
Cosino Project - the quick prototyping embedded system - www.cosino.io
Freelance ICT Italia - Consulente ICT Italia - www.consulenti-ict.it


Re: [PATCH] Doc: pps: Fix file name in pps.txt

2015-07-13 Thread Rodolfo Giometti
On Mon, Jul 13, 2015 at 07:21:50AM -0600, Jonathan Corbet wrote:
> On Mon, 13 Jul 2015 08:23:15 +0200
> Rodolfo Giometti  wrote:
> 
> > On Mon, Jul 13, 2015 at 12:29:11PM +0900, Masanari Iida wrote:
> > > This patch fix a file name of example code.
> > > 
> > > Signed-off-by: Masanari Iida   
> > 
> > Signed-off-by: Rodolfo Giometti 
> 
> Why Signed-off-by?  Did you maybe mean Acked-by here?

Yes, you're right... I'm sorry! :(

Acked-by: Rodolfo Giometti 

-- 

HCE Engineering  e-mail: giome...@hce-engineering.com
GNU/Linux Solutions  giome...@enneenne.com
Linux Device Driver  giome...@linux.it
Embedded Systems phone:  +39 349 2432127
UNIX programming skype:  rodolfo.giometti
Cosino Project - the quick prototyping embedded system - www.cosino.io
Freelance ICT Italia - Consulente ICT Italia - www.consulenti-ict.it
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH] Doc: pps: Fix file name in pps.txt

2015-07-13 Thread Rodolfo Giometti
On Mon, Jul 13, 2015 at 12:29:11PM +0900, Masanari Iida wrote:
> This patch fix a file name of example code.
> 
> Signed-off-by: Masanari Iida 

Signed-off-by: Rodolfo Giometti 

-- 

HCE Engineering  e-mail: giome...@hce-engineering.com
GNU/Linux Solutions  giome...@enneenne.com
Linux Device Driver  giome...@linux.it
Embedded Systems phone:  +39 349 2432127
UNIX programming skype:  rodolfo.giometti
Cosino Project - the quick prototyping embedded system - www.cosino.io
Freelance ICT Italia - Consulente ICT Italia - www.consulenti-ict.it
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH] Doc: pps: Fix file name in pps.txt

2015-07-13 Thread Rodolfo Giometti
On Mon, Jul 13, 2015 at 07:21:50AM -0600, Jonathan Corbet wrote:
 On Mon, 13 Jul 2015 08:23:15 +0200
 Rodolfo Giometti giome...@enneenne.com wrote:
 
  On Mon, Jul 13, 2015 at 12:29:11PM +0900, Masanari Iida wrote:
   This patch fix a file name of example code.
   
   Signed-off-by: Masanari Iida standby2...@gmail.com  
  
  Signed-off-by: Rodolfo Giometti giome...@enneenne.com
 
 Why Signed-off-by?  Did you maybe mean Acked-by here?

Yes, you're right... I'm sorry! :(

Acked-by: Rodolfo Giometti giome...@enneenne.com

-- 

HCE Engineering  e-mail: giome...@hce-engineering.com
GNU/Linux Solutions  giome...@enneenne.com
Linux Device Driver  giome...@linux.it
Embedded Systems phone:  +39 349 2432127
UNIX programming skype:  rodolfo.giometti
Cosino Project - the quick prototyping embedded system - www.cosino.io
Freelance ICT Italia - Consulente ICT Italia - www.consulenti-ict.it
--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH] Doc: pps: Fix file name in pps.txt

2015-07-13 Thread Rodolfo Giometti
On Mon, Jul 13, 2015 at 12:29:11PM +0900, Masanari Iida wrote:
 This patch fix a file name of example code.
 
 Signed-off-by: Masanari Iida standby2...@gmail.com

Signed-off-by: Rodolfo Giometti giome...@enneenne.com

-- 

HCE Engineering  e-mail: giome...@hce-engineering.com
GNU/Linux Solutions  giome...@enneenne.com
Linux Device Driver  giome...@linux.it
Embedded Systems phone:  +39 349 2432127
UNIX programming skype:  rodolfo.giometti
Cosino Project - the quick prototyping embedded system - www.cosino.io
Freelance ICT Italia - Consulente ICT Italia - www.consulenti-ict.it
--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH] Doc:pps: Fix typo in pps.txt

2015-06-10 Thread Rodolfo Giometti
On Wed, Jun 10, 2015 at 12:53:47PM +0900, Masanari Iida wrote:
> This patch fix a spelling typo in Documentation/pps/pps.txt
> 
> Signed-off-by: Masanari Iida 

Acked-by: Rodolfo Giometti 

-- 

HCE Engineering  e-mail: giome...@hce-engineering.com
GNU/Linux Solutions  giome...@enneenne.com
Linux Device Driver  giome...@linux.it
Embedded Systems phone:  +39 349 2432127
UNIX programming skype:  rodolfo.giometti
Cosino Project - the quick prototyping embedded system - www.cosino.io
Freelance ICT Italia - Consulente ICT Italia - www.consulenti-ict.it
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH] Doc:pps: Fix typo in pps.txt

2015-06-10 Thread Rodolfo Giometti
On Wed, Jun 10, 2015 at 12:53:47PM +0900, Masanari Iida wrote:
 This patch fix a spelling typo in Documentation/pps/pps.txt
 
 Signed-off-by: Masanari Iida standby2...@gmail.com

Acked-by: Rodolfo Giometti giome...@enneenne.com

-- 

HCE Engineering  e-mail: giome...@hce-engineering.com
GNU/Linux Solutions  giome...@enneenne.com
Linux Device Driver  giome...@linux.it
Embedded Systems phone:  +39 349 2432127
UNIX programming skype:  rodolfo.giometti
Cosino Project - the quick prototyping embedded system - www.cosino.io
Freelance ICT Italia - Consulente ICT Italia - www.consulenti-ict.it
--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH] pps: Add support for read operations and return a useful value in poll

2015-04-01 Thread Rodolfo Giometti
On Tue, Mar 31, 2015 at 11:31:22PM +0200, Christian Riesch wrote:
> The PPS_FETCH ioctl in drivers/pps/pps.c blocks until a new PPS event
> occurs, then returns the time stamp data. While this is fine for
> lots of applications, sometimes it would be nice if the poll system
> call and a subsequent read could be used to obtain the pps data.

Nak. The read syscall can't be forced to return fix amount of
data.

Use a dedicated ioctl instead.

Ciao,

Rodolfo

-- 

HCE Engineering  e-mail: giome...@hce-engineering.com
GNU/Linux Solutions  giome...@enneenne.com
Linux Device Driver  giome...@linux.it
Embedded Systems phone:  +39 349 2432127
UNIX programming skype:  rodolfo.giometti
Cosino Project - the quick prototyping embedded system - www.cosino.io
Freelance ICT Italia - Consulente ICT Italia - www.consulenti-ict.it
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH] pps: Add support for read operations and return a useful value in poll

2015-04-01 Thread Rodolfo Giometti
On Tue, Mar 31, 2015 at 11:31:22PM +0200, Christian Riesch wrote:
 The PPS_FETCH ioctl in drivers/pps/pps.c blocks until a new PPS event
 occurs, then returns the time stamp data. While this is fine for
 lots of applications, sometimes it would be nice if the poll system
 call and a subsequent read could be used to obtain the pps data.

Nak. The read syscall can't be forced to return fix amount of
data.

Use a dedicated ioctl instead.

Ciao,

Rodolfo

-- 

HCE Engineering  e-mail: giome...@hce-engineering.com
GNU/Linux Solutions  giome...@enneenne.com
Linux Device Driver  giome...@linux.it
Embedded Systems phone:  +39 349 2432127
UNIX programming skype:  rodolfo.giometti
Cosino Project - the quick prototyping embedded system - www.cosino.io
Freelance ICT Italia - Consulente ICT Italia - www.consulenti-ict.it
--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH v2 15/15] ARM: at91/dt: at91-cosino_mega2560 remove useless tsadcc node

2014-03-17 Thread Rodolfo Giometti
On Mon, Mar 17, 2014 at 02:57:08PM +0100, Alexandre Belloni wrote:
> The tsadcc node is useless as it doesn't refer to anything and the touchscreen
> is handled by the adc0 node.
> 
> Signed-off-by: Alexandre Belloni 
> Cc: Rodolfo Giometti 

Acked.

Rodolfo

-- 

GNU/Linux Solutions  e-mail: giome...@enneenne.com
Linux Device Driver  giome...@linux.it
Embedded Systems phone:  +39 349 2432127
UNIX programming skype:  rodolfo.giometti
Freelance ICT Italia - Consulente ICT Italia - www.consulenti-ict.it
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH v2 15/15] ARM: at91/dt: at91-cosino_mega2560 remove useless tsadcc node

2014-03-17 Thread Rodolfo Giometti
On Mon, Mar 17, 2014 at 02:57:08PM +0100, Alexandre Belloni wrote:
 The tsadcc node is useless as it doesn't refer to anything and the touchscreen
 is handled by the adc0 node.
 
 Signed-off-by: Alexandre Belloni alexandre.bell...@free-electrons.com
 Cc: Rodolfo Giometti giome...@linux.it

Acked.

Rodolfo

-- 

GNU/Linux Solutions  e-mail: giome...@enneenne.com
Linux Device Driver  giome...@linux.it
Embedded Systems phone:  +39 349 2432127
UNIX programming skype:  rodolfo.giometti
Freelance ICT Italia - Consulente ICT Italia - www.consulenti-ict.it
--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH] pps : add non blocking option to PPS_FETCH ioctl.

2013-10-16 Thread Rodolfo Giometti
On Wed, Oct 16, 2013 at 08:52:47AM +0200, Paul Chavent wrote:
> 
> I would also prefer the separate ioctl. As you said it, it's a bit
> annoying to switch from blocking mode to non blocking mode if we
> need both mode. But i was not sure about the preferences of the
> maintainer : (i) change the api, or (ii) change the behavior with a
> widely supported interface (O_NONBLOCK).

As already stated the PPS RFC doesn't use ioctls to manage PPS data so
we can modify ioctls according our needs!

In fact we can modify the LinuxPPS wrapper functions to still remain
RFC compliant. :)

> I'm certainly not the best person to make the final decision, but i
> would like to help you if you need me (write doc, or change this
> patch).

In this scenario I think we can do as Andrew suggests modifying
LinuxPPS docs accordingly... maybe we can add a new file into
linux/Documentation/pps directory describing Linux PPS ioctls and how
they interact with PPS RFC functions.

Andrew, could this be an acceptable solution?

Ciao,

Rodolfo

-- 

GNU/Linux Solutions  e-mail: giome...@enneenne.com
Linux Device Driver  giome...@linux.it
Embedded Systems phone:  +39 349 2432127
UNIX programming skype:  rodolfo.giometti
Freelance ICT Italia - Consulente ICT Italia - www.consulenti-ict.it
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH] pps : add non blocking option to PPS_FETCH ioctl.

2013-10-16 Thread Rodolfo Giometti
On Wed, Oct 16, 2013 at 08:52:47AM +0200, Paul Chavent wrote:
 
 I would also prefer the separate ioctl. As you said it, it's a bit
 annoying to switch from blocking mode to non blocking mode if we
 need both mode. But i was not sure about the preferences of the
 maintainer : (i) change the api, or (ii) change the behavior with a
 widely supported interface (O_NONBLOCK).

As already stated the PPS RFC doesn't use ioctls to manage PPS data so
we can modify ioctls according our needs!

In fact we can modify the LinuxPPS wrapper functions to still remain
RFC compliant. :)

 I'm certainly not the best person to make the final decision, but i
 would like to help you if you need me (write doc, or change this
 patch).

In this scenario I think we can do as Andrew suggests modifying
LinuxPPS docs accordingly... maybe we can add a new file into
linux/Documentation/pps directory describing Linux PPS ioctls and how
they interact with PPS RFC functions.

Andrew, could this be an acceptable solution?

Ciao,

Rodolfo

-- 

GNU/Linux Solutions  e-mail: giome...@enneenne.com
Linux Device Driver  giome...@linux.it
Embedded Systems phone:  +39 349 2432127
UNIX programming skype:  rodolfo.giometti
Freelance ICT Italia - Consulente ICT Italia - www.consulenti-ict.it
--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH] pps : add non blocking option to PPS_FETCH ioctl.

2013-10-15 Thread Rodolfo Giometti
On Fri, Oct 11, 2013 at 12:47:20PM -0700, Andrew Morton wrote:
> On Fri, 11 Oct 2013 14:40:32 +0200 Paul Chavent  wrote:
> 
> > The PPS_FETCH ioctl is blocking still the reception of a PPS
> > event. But, in some case, one may immediately need the last event
> > date. This patch allow to get the result of PPS_FETCH if the device
> > has the O_NONBLOCK flag set.
> 
> Are the PPS ioctls actually documented anywhere? 
> Documentation/pps/pps.txt is silent.
> 
> That's a shame, because it would be nice to have a formal description
> of the the PPS_FETCH semantics which leads to an understanding of why
> things are the way they are, how PPS_FETCH is supposed to be used, etc.
> 
> Also, the presence of such documentation would permit me to bug you for
> not having updated it!  We need *some* channel for telling people about
> the driver, and updates to it.  Maybe linuxpps.org has it somewhere,
> but I couldn't immediately find it.

Hi Andrew! Actually RFC 2783 doesn't use ioctls to get access to PPS
data but it defines some functions. LinuxPPS, that is the Linux PPS
implementation, uses ioctls to implement these functions.

If you like having an idea about how these functions are implemented
into LinuxPPS, you can see here:

   
http://www.linuxpps.org/gitweb/?p=pps-tools;a=blob;f=timepps.h;h=d2628d2d061ea2a3623e57990d9ada62623773cf;hb=5980a044bcdb4c1d1a8b1ecff986fa63719519b3

> Your implementation requires that the file be opened non-blocking.  But
> I'd have thought that adding a new and separate ioctl mode would be a
> cleaner and more flexible implementation - that way an app which wants
> both blocking and non-blocking behaviour doesn't need to open the file
> twice.
> 
> Also, this is actually a non-backward-compatible change for any
> application which happened to be opening the file with O_NONBLOCK! 
> Hopefully there aren't any such applications...

The major application that I know using these layer is NTPD... however
all RFC compliant applications should not use ioctls to get access the
PPS data and this patch should be a "special" case.

Thanks for your time,

Rodolfo

-- 

GNU/Linux Solutions  e-mail: giome...@enneenne.com
Linux Device Driver  giome...@linux.it
Embedded Systems phone:  +39 349 2432127
UNIX programming skype:  rodolfo.giometti
Freelance ICT Italia - Consulente ICT Italia - www.consulenti-ict.it
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH] pps : add non blocking option to PPS_FETCH ioctl.

2013-10-15 Thread Rodolfo Giometti
On Fri, Oct 11, 2013 at 12:47:20PM -0700, Andrew Morton wrote:
 On Fri, 11 Oct 2013 14:40:32 +0200 Paul Chavent paul.chav...@onera.fr wrote:
 
  The PPS_FETCH ioctl is blocking still the reception of a PPS
  event. But, in some case, one may immediately need the last event
  date. This patch allow to get the result of PPS_FETCH if the device
  has the O_NONBLOCK flag set.
 
 Are the PPS ioctls actually documented anywhere? 
 Documentation/pps/pps.txt is silent.
 
 That's a shame, because it would be nice to have a formal description
 of the the PPS_FETCH semantics which leads to an understanding of why
 things are the way they are, how PPS_FETCH is supposed to be used, etc.
 
 Also, the presence of such documentation would permit me to bug you for
 not having updated it!  We need *some* channel for telling people about
 the driver, and updates to it.  Maybe linuxpps.org has it somewhere,
 but I couldn't immediately find it.

Hi Andrew! Actually RFC 2783 doesn't use ioctls to get access to PPS
data but it defines some functions. LinuxPPS, that is the Linux PPS
implementation, uses ioctls to implement these functions.

If you like having an idea about how these functions are implemented
into LinuxPPS, you can see here:

   
http://www.linuxpps.org/gitweb/?p=pps-tools;a=blob;f=timepps.h;h=d2628d2d061ea2a3623e57990d9ada62623773cf;hb=5980a044bcdb4c1d1a8b1ecff986fa63719519b3

 Your implementation requires that the file be opened non-blocking.  But
 I'd have thought that adding a new and separate ioctl mode would be a
 cleaner and more flexible implementation - that way an app which wants
 both blocking and non-blocking behaviour doesn't need to open the file
 twice.
 
 Also, this is actually a non-backward-compatible change for any
 application which happened to be opening the file with O_NONBLOCK! 
 Hopefully there aren't any such applications...

The major application that I know using these layer is NTPD... however
all RFC compliant applications should not use ioctls to get access the
PPS data and this patch should be a special case.

Thanks for your time,

Rodolfo

-- 

GNU/Linux Solutions  e-mail: giome...@enneenne.com
Linux Device Driver  giome...@linux.it
Embedded Systems phone:  +39 349 2432127
UNIX programming skype:  rodolfo.giometti
Freelance ICT Italia - Consulente ICT Italia - www.consulenti-ict.it
--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH] pps : add non blocking option to PPS_FETCH ioctl.

2013-10-11 Thread Rodolfo Giometti
On Fri, Oct 11, 2013 at 10:42:56AM +0200, Paul Chavent wrote:
> Hi.
> 
> I haven't had any feedback for weeks. I join a patch with more
> details in the commit message if needed.

If I well remember I already acked this patch. So please add my
Acked-by line to the patch.

> Do you know someone responsible to apply PPS patches ?

Andrew Morton

Ciao,

Rodolfo

-- 

GNU/Linux Solutions  e-mail: giome...@enneenne.com
Linux Device Driver  giome...@linux.it
Embedded Systems phone:  +39 349 2432127
UNIX programming skype:  rodolfo.giometti
Freelance ICT Italia - Consulente ICT Italia - www.consulenti-ict.it
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH] pps : add non blocking option to PPS_FETCH ioctl.

2013-10-11 Thread Rodolfo Giometti
On Fri, Oct 11, 2013 at 10:42:56AM +0200, Paul Chavent wrote:
 Hi.
 
 I haven't had any feedback for weeks. I join a patch with more
 details in the commit message if needed.

If I well remember I already acked this patch. So please add my
Acked-by line to the patch.

 Do you know someone responsible to apply PPS patches ?

Andrew Morton

Ciao,

Rodolfo

-- 

GNU/Linux Solutions  e-mail: giome...@enneenne.com
Linux Device Driver  giome...@linux.it
Embedded Systems phone:  +39 349 2432127
UNIX programming skype:  rodolfo.giometti
Freelance ICT Italia - Consulente ICT Italia - www.consulenti-ict.it
--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


  1   2   3   4   5   >