[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20210409175004.2fceacdd@kicinski-fedora-pc1c0hjn.dhcp.thefacebook.com>
Date: Fri, 9 Apr 2021 17:50:04 -0700
From: Jakub Kicinski <kuba@...nel.org>
To: Wong Vee Khee <vee.khee.wong@...ux.intel.com>
Cc: Giuseppe Cavallaro <peppe.cavallaro@...com>,
Alexandre Torgue <alexandre.torgue@...com>,
Jose Abreu <joabreu@...opsys.com>,
"David S . Miller" <davem@...emloft.net>,
Maxime Coquelin <mcoquelin.stm32@...il.com>,
Voon Weifeng <weifeng.voon@...el.com>,
Ong Boon Leong <boon.leong.ong@...el.com>,
netdev@...r.kernel.org, linux-stm32@...md-mailman.stormreply.com,
linux-arm-kernel@...ts.infradead.org,
Richard Cochran <richardcochran@...il.com>,
linux-kernel@...r.kernel.org
Subject: Re: [PATCH net-next v2 1/1] net: stmmac: Add support for external
trigger timestamping
Other than the minor nit below LGTM. Let's give Richard one more day.
On Thu, 8 Apr 2021 01:04:42 +0800 Wong Vee Khee wrote:
> +static void timestamp_interrupt(struct stmmac_priv *priv)
> +{
> + struct ptp_clock_event event;
> + unsigned long flags;
> + u32 num_snapshot;
> + u32 ts_status;
> + u32 tsync_int;
> + u64 ptp_time;
> + int i;
> +
> + tsync_int = readl(priv->ioaddr + GMAC_INT_STATUS) & GMAC_INT_TSIE;
> +
> + if (!tsync_int)
> + return;
> +
> + /* Read timestamp status to clear interrupt from either external
> + * timestamp or start/end of PPS.
> + */
> + ts_status = readl(priv->ioaddr + GMAC_TIMESTAMP_STATUS);
> +
> + if (priv->plat->ext_snapshot_en) {
Are you intending to add more code after this if? Otherwise you could
flip the condition and return early instead of having the extra level
of indentation.
> + num_snapshot = (ts_status & GMAC_TIMESTAMP_ATSNS_MASK) >>
> + GMAC_TIMESTAMP_ATSNS_SHIFT;
> +
> + for (i = 0; i < num_snapshot; i++) {
> + spin_lock_irqsave(&priv->ptp_lock, flags);
> + get_ptptime(priv->ptpaddr, &ptp_time);
> + spin_unlock_irqrestore(&priv->ptp_lock, flags);
> + event.type = PTP_CLOCK_EXTTS;
> + event.index = 0;
> + event.timestamp = ptp_time;
> + ptp_clock_event(priv->ptp_clock, &event);
> + }
> + }
> +}
Not really related to this patch but how does stmmac set IRQF_SHARED
and yet not track if it indeed generated the interrupt? Isn't that
against the rules?
Powered by blists - more mailing lists