[PATCH] net: gianfar_ptp: move set_fipers() to spinlock protecting area

Subsystems: freescale etsec ethernet driver (gianfar), networking drivers, the rest

STALE3158d

4 messages, 3 authors, 2018-01-09 · open the first message on its own page

[PATCH] net: gianfar_ptp: move set_fipers() to spinlock protecting area

From: Yangbo Lu <yangbo.lu@nxp.com>
Date: 2018-01-08 10:32:33

set_fipers() calling should be protected by spinlock.
This patch is to move set_fipers() to spinlock protecting
area in ptp_gianfar_adjtime() function.

Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com>
---
 drivers/net/ethernet/freescale/gianfar_ptp.c |    3 +--
 1 files changed, 1 insertions(+), 2 deletions(-)
diff --git a/drivers/net/ethernet/freescale/gianfar_ptp.c b/drivers/net/ethernet/freescale/gianfar_ptp.c
index 5441142..9f8d4f8 100644
--- a/drivers/net/ethernet/freescale/gianfar_ptp.c
+++ b/drivers/net/ethernet/freescale/gianfar_ptp.c
@@ -319,11 +319,10 @@ static int ptp_gianfar_adjtime(struct ptp_clock_info *ptp, s64 delta)
 	now = tmr_cnt_read(etsects);
 	now += delta;
 	tmr_cnt_write(etsects, now);
+	set_fipers(etsects);
 
 	spin_unlock_irqrestore(&etsects->lock, flags);
 
-	set_fipers(etsects);
-
 	return 0;
 }
 
-- 
1.7.1

Re: [PATCH] net: gianfar_ptp: move set_fipers() to spinlock protecting area

From: Fabio Estevam <festevam@gmail.com>
Date: 2018-01-08 12:53:45

On Mon, Jan 8, 2018 at 8:13 AM, Yangbo Lu [off-list ref] wrote:
set_fipers() calling should be protected by spinlock.
This patch is to move set_fipers() to spinlock protecting
area in ptp_gianfar_adjtime() function.
It would be nice to explay why.

Thanks

RE: [PATCH] net: gianfar_ptp: move set_fipers() to spinlock protecting area

From: "Y.b. Lu" <yangbo.lu@nxp.com>
Date: 2018-01-09 03:23:46

-----Original Message-----
From: Fabio Estevam [mailto:festevam@gmail.com]
Sent: 2018年1月8日 20:54
To: Y.b. Lu <yangbo.lu@nxp.com>
Cc: Claudiu Manoil <claudiu.manoil@nxp.com>; Richard Cochran
[off-list ref]; netdev@vger.kernel.org; linux-kernel
[off-list ref]
Subject: Re: [PATCH] net: gianfar_ptp: move set_fipers() to spinlock protecting
area

On Mon, Jan 8, 2018 at 8:13 AM, Yangbo Lu [off-list ref] wrote:
quoted
set_fipers() calling should be protected by spinlock.
This patch is to move set_fipers() to spinlock protecting area in
ptp_gianfar_adjtime() function.
It would be nice to explay why.
[Y.b. Lu] Sent out v2 patch and explained in commit message :)
Thanks.
Thanks

Re: [PATCH] net: gianfar_ptp: move set_fipers() to spinlock protecting area

From: Richard Cochran <richardcochran@gmail.com>
Date: 2018-01-09 03:39:23

On Mon, Jan 08, 2018 at 10:53:40AM -0200, Fabio Estevam wrote:
On Mon, Jan 8, 2018 at 8:13 AM, Yangbo Lu [off-list ref] wrote:
quoted
set_fipers() calling should be protected by spinlock.
This patch is to move set_fipers() to spinlock protecting
area in ptp_gianfar_adjtime() function.
It would be nice to explay why.
Maybe this is important?

/* Caller must hold etsects->lock. */
static void set_fipers(struct etsects *etsects)
{
	set_alarm(etsects);
	gfar_write(&etsects->regs->tmr_fiper1, etsects->tmr_fiper1);
	gfar_write(&etsects->regs->tmr_fiper2, etsects->tmr_fiper2);
}

Thanks,
Richard
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help