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] [thread-next>] [day] [month] [year] [list]
Message-ID: <81e43c3f-a10e-3167-a868-61794bd66466@gmail.com>
Date:   Tue, 14 Jun 2022 09:25:38 -0700
From:   Florian Fainelli <f.fainelli@...il.com>
To:     Jonathan Lemon <jonathan.lemon@...il.com>, netdev@...r.kernel.org
Cc:     kernel-team@...com, Andrew Lunn <andrew@...n.ch>,
        Florian Fainelli <f.fainelli@...il.com>,
        Richard Cochran <richardcochran@...il.com>,
        Lasse Johnsen <l@...johnsen.me>,
        Heiner Kallweit <hkallweit1@...il.com>,
        Russell King <linux@...linux.org.uk>,
        "David S. Miller" <davem@...emloft.net>,
        Eric Dumazet <edumazet@...gle.com>,
        Jakub Kicinski <kuba@...nel.org>,
        Paolo Abeni <pabeni@...hat.com>,
        Broadcom internal kernel review list 
        <bcm-kernel-feedback-list@...adcom.com>
Subject: Re: [PATCH net-next v7 3/3] net: phy: Add support for 1PPS out and
 external timestamps

On 6/13/22 22:08, Jonathan Lemon wrote:
> The perout function is used to generate a 1PPS signal, synchronized
> to the PHC.  This is accomplished by a using the hardware oneshot
> functionality, which is reset by a timer.
> 
> The external timestamp function is set up for a 1PPS input pulse,
> and uses a timer to poll for temestamps.
> 
> Both functions use the SYNC_OUT/SYNC_IN1 pin, so cannot run
> simultaneously.
> 
> Co-developed-by: Lasse Johnsen <l@...johnsen.me>
> Signed-off-by: Lasse Johnsen <l@...johnsen.me>
> Signed-off-by: Jonathan Lemon <jonathan.lemon@...il.com>
> Acked-by: Richard Cochran <richardcochran@...il.com>

Not sure whether we could apply just patch 1 and 2 and leave this one 
aside as I do see a few things that IMHO would be worth updating before 
merging this one, more on the stylistic aspect though, so you be the judge.

> ---

[snip]


> +static int bcm_ptp_cancel_func(struct bcm_ptp_private *priv)
> +{
> +	if (priv->pin_active) {
> +		priv->pin_active = false;
> +		priv->nse_ctrl &= ~(NSE_SYNC_OUT_MASK | NSE_SYNC1_FRAMESYNC |
> +				    NSE_CAPTURE_EN);
> +		bcm_phy_write_exp(priv->phydev, NSE_CTRL, priv->nse_ctrl);
> +		cancel_delayed_work_sync(&priv->pin_work);
> +	}

Missing newline and you should consider reducing the indentation.

> +	return 0;
> +}
> +
> +static void bcm_ptp_perout_work(struct work_struct *pin_work)
> +{
> +	struct bcm_ptp_private *priv =
> +		container_of(pin_work, struct bcm_ptp_private, pin_work.work);
> +	struct phy_device *phydev = priv->phydev;
> +	struct timespec64 ts;
> +	u64 ns, next;
> +	u16 ctrl;
> +
> +	mutex_lock(&priv->mutex);
> +
> +	/* no longer running */
> +	if (!priv->pin_active) {
> +		mutex_unlock(&priv->mutex);
> +		return;
> +	}

[snip]

> +	if (!pulse)
> +		return -EINVAL;
> +
> +	if (pulse > period)
> +		return -EINVAL;
> +
> +	if (pulse > BCM_MAX_PULSE_8NS)
> +		return -EINVAL;

Consider combining all of these into a single line?
-- 
Florian

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ