Skip to contentSkip to conversation

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

PATCH Applied Yangbo Lu 4 participants 4 messages Jan 9, 2018 – Jan 10, 2018

Subsystems (3)
lore
Share & tools
lore

Yangbo Lu

author
#0 lore raw

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

set_fipers() calling should be protected by spinlock in case that any interrupt breaks related registers setting and the function we expect. This patch is to move set_fipers() to spinlock protecting area in ptp_gianfar_adjtime().

---
Changes for v2:
- explained why spinlock was needed in commit message.

---
 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
Reviewed-by on v2 1/1
#2 lore raw
In reply to Yangbo Lu
Quoted 9 lines · Yangbo Lu

set_fipers() calling should be protected by spinlock in case that any interrupt breaks related registers setting and the function we expect. This patch is to move set_fipers() to spinlock protecting area in ptp_gianfar_adjtime().

---
Changes for v2:
- explained why spinlock was needed in commit message.

Thanks for improving the commit log:

maintainer Applied
#3 lore raw
In reply to Yangbo Lu

From: Yangbo Lu <[email protected]>
Date: Tue, 9 Jan 2018 11:02:33 +0800

Quoted 9 lines

set_fipers() calling should be protected by spinlock in case that any interrupt breaks related registers setting and the function we expect. This patch is to move set_fipers() to spinlock protecting area in ptp_gianfar_adjtime().

---
Changes for v2:
- explained why spinlock was needed in commit message.

Applied.