netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [v2] net: gianfar_ptp: move set_fipers() to spinlock protecting area
@ 2018-01-09  3:02 Yangbo Lu
  2018-01-09  3:39 ` Richard Cochran
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Yangbo Lu @ 2018-01-09  3:02 UTC (permalink / raw)
  To: Fabio Estevam, Claudiu Manoil, Richard Cochran, netdev, linux-kernel
  Cc: 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().

Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com>
---
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(-)

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

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [v2] net: gianfar_ptp: move set_fipers() to spinlock protecting area
  2018-01-09  3:02 [v2] net: gianfar_ptp: move set_fipers() to spinlock protecting area Yangbo Lu
@ 2018-01-09  3:39 ` Richard Cochran
  2018-01-09  9:15 ` Fabio Estevam
  2018-01-10 19:54 ` David Miller
  2 siblings, 0 replies; 4+ messages in thread
From: Richard Cochran @ 2018-01-09  3:39 UTC (permalink / raw)
  To: Yangbo Lu; +Cc: Fabio Estevam, Claudiu Manoil, netdev, linux-kernel

On Tue, Jan 09, 2018 at 11:02:33AM +0800, Yangbo Lu wrote:
> 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().
> 
> Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com>

Acked-by: Richard Cochran <richardcochran@gmail.com>

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [v2] net: gianfar_ptp: move set_fipers() to spinlock protecting area
  2018-01-09  3:02 [v2] net: gianfar_ptp: move set_fipers() to spinlock protecting area Yangbo Lu
  2018-01-09  3:39 ` Richard Cochran
@ 2018-01-09  9:15 ` Fabio Estevam
  2018-01-10 19:54 ` David Miller
  2 siblings, 0 replies; 4+ messages in thread
From: Fabio Estevam @ 2018-01-09  9:15 UTC (permalink / raw)
  To: Yangbo Lu; +Cc: Claudiu Manoil, Richard Cochran, netdev, linux-kernel

On Tue, Jan 9, 2018 at 1:02 AM, Yangbo Lu <yangbo.lu@nxp.com> wrote:
> 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().
>
> Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com>
> ---
> Changes for v2:
>         - explained why spinlock was needed in commit message.

Thanks for improving the commit log:

Reviewed-by: Fabio Estevam <fabio.estevam@nxp.com>

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [v2] net: gianfar_ptp: move set_fipers() to spinlock protecting area
  2018-01-09  3:02 [v2] net: gianfar_ptp: move set_fipers() to spinlock protecting area Yangbo Lu
  2018-01-09  3:39 ` Richard Cochran
  2018-01-09  9:15 ` Fabio Estevam
@ 2018-01-10 19:54 ` David Miller
  2 siblings, 0 replies; 4+ messages in thread
From: David Miller @ 2018-01-10 19:54 UTC (permalink / raw)
  To: yangbo.lu; +Cc: festevam, claudiu.manoil, richardcochran, netdev, linux-kernel

From: Yangbo Lu <yangbo.lu@nxp.com>
Date: Tue, 9 Jan 2018 11:02:33 +0800

> 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().
> 
> Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com>
> ---
> Changes for v2:
> 	- explained why spinlock was needed in commit message.

Applied.

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2018-01-10 19:54 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-01-09  3:02 [v2] net: gianfar_ptp: move set_fipers() to spinlock protecting area Yangbo Lu
2018-01-09  3:39 ` Richard Cochran
2018-01-09  9:15 ` Fabio Estevam
2018-01-10 19:54 ` David Miller

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).