lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <5eba2cc4-75fa-e1dc-8a86-68f1221d5e78@enneenne.com>
Date:   Fri, 4 Jan 2019 18:16:17 +0100
From:   Rodolfo Giometti <giometti@...eenne.com>
To:     Tom Burkart <tom@...sec.com>,
        Linux kernel mailing list <linux-kernel@...r.kernel.org>
Cc:     Ricardo Martins <rasm@...up.pt>,
        James Nuss <jamesnuss@...ometrics.ca>,
        Lukas Senger <lukas@...dolin.com>
Subject: Re: [PATCH v14 3/3] pps: pps-gpio pps-echo implementation

On 30/12/2018 09:33, Tom Burkart wrote:
> This patch implements the pps echo functionality for pps-gpio, that
> sysfs claims is available already.
> 
> Configuration is done via device tree bindings.
> 
> This patch was originally written by Lukas Senger as part of a masters
> thesis project and modified for inclusion into the linux kernel by Tom
> Burkart.

[snip]

> +static void pps_gpio_echo(struct pps_device *pps, int event, void *data)
> +{
> +	/* add_timer() needs to write into info->echo_timer */
> +	struct pps_gpio_device_data *info;
> +
> +	info = data;

Maybe you can write as below and saving two lines and having better readability:

struct pps_gpio_device_data *info = data;

> +	switch (event) {
> +	case PPS_CAPTUREASSERT:
> +		if (pps->params.mode & PPS_ECHOASSERT)
> +			gpiod_set_value(info->echo_pin, 1);
> +		break;
> +
> +	case PPS_CAPTURECLEAR:
> +		if (pps->params.mode & PPS_ECHOCLEAR)
> +			gpiod_set_value(info->echo_pin, 1);
> +		break;
> +	}
> +
> +	/* fire the timer */
> +	if (info->pps->params.mode & (PPS_ECHOASSERT | PPS_ECHOCLEAR)) {
> +		info->echo_timer.expires = jiffies + info->echo_timeout;
> +		add_timer(&info->echo_timer);
> +	}
> +}

I think is better firing the timer if and only if we set the echo GPIO otherwise 
it's useless...

Ciao,

Rodolfo

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

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ