Skip to contentSkip to conversation

net: gianfar_ptp: move set_fipers() to spinlock protecting area

PATCH Superseded Yangbo Lu 3 participants 4 messages Jan 8, 2018 – Jan 9, 2018

Subsystems (3)

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore

Yangbo Lu

author
#0 lore raw

PATCH 1/1 net: gianfar_ptp: move set_fipers() to spinlock protecting area

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

---
 drivers/net/ethernet/freescale/gianfar_ptp.c |    3 +--
 1 files changed, 1 insertions(+), 2 deletions(-)
drivers/net/ethernet/freescale/gianfar_ptp.c +1 -2
index 5441142..9f8d4f8 100644
@@ -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;
 }
 
Signature · 1 line
1.7.1
#1 lore raw
Quoted 3 lines · Yangbo Lu

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

author
#2 lore raw
Quoted 12 lines

-----Original Message-----
From: Fabio Estevam [mailto:[email protected]]
Sent: 2018年1月8日 20:54
To: Y.b. Lu <[email protected]>
Cc: Claudiu Manoil <[email protected]>; Richard Cochran <[email protected]>; [email protected]; linux-kernel <[email protected]>
Subject: Re: [PATCH] net: gianfar_ptp: move set_fipers() to spinlock protecting area

Quoted 6 lines
Quoted 3 lines · Yangbo Lu

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.

Quoted 2 lines

Thanks

#3 lore raw
In reply to Fabio Estevam
Quoted 6 lines · Fabio Estevam
Quoted 3 lines · Yangbo Lu

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