linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] net: gianfar_ptp: move set_fipers() to spinlock protecting area
@ 2018-01-08 10:13 Yangbo Lu
  2018-01-08 12:53 ` Fabio Estevam
  0 siblings, 1 reply; 4+ messages in thread
From: Yangbo Lu @ 2018-01-08 10:13 UTC (permalink / raw)
  To: Claudiu Manoil, Richard Cochran, netdev, linux-kernel; +Cc: 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.

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

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

* Re: [PATCH] net: gianfar_ptp: move set_fipers() to spinlock protecting area
  2018-01-08 10:13 [PATCH] net: gianfar_ptp: move set_fipers() to spinlock protecting area Yangbo Lu
@ 2018-01-08 12:53 ` Fabio Estevam
  2018-01-09  3:23   ` Y.b. Lu
  2018-01-09  3:39   ` Richard Cochran
  0 siblings, 2 replies; 4+ messages in thread
From: Fabio Estevam @ 2018-01-08 12:53 UTC (permalink / raw)
  To: Yangbo Lu; +Cc: Claudiu Manoil, Richard Cochran, netdev, linux-kernel

On Mon, Jan 8, 2018 at 8:13 AM, Yangbo Lu <yangbo.lu@nxp.com> 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

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

* RE: [PATCH] net: gianfar_ptp: move set_fipers() to spinlock protecting area
  2018-01-08 12:53 ` Fabio Estevam
@ 2018-01-09  3:23   ` Y.b. Lu
  2018-01-09  3:39   ` Richard Cochran
  1 sibling, 0 replies; 4+ messages in thread
From: Y.b. Lu @ 2018-01-09  3:23 UTC (permalink / raw)
  To: Fabio Estevam; +Cc: Claudiu Manoil, Richard Cochran, netdev, linux-kernel



> -----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
> <richardcochran@gmail.com>; netdev@vger.kernel.org; linux-kernel
> <linux-kernel@vger.kernel.org>
> Subject: Re: [PATCH] net: gianfar_ptp: move set_fipers() to spinlock protecting
> area
> 
> On Mon, Jan 8, 2018 at 8:13 AM, Yangbo Lu <yangbo.lu@nxp.com> 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.

[Y.b. Lu] Sent out v2 patch and explained in commit message :)
Thanks.

> 
> Thanks

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

* Re: [PATCH] net: gianfar_ptp: move set_fipers() to spinlock protecting area
  2018-01-08 12:53 ` Fabio Estevam
  2018-01-09  3:23   ` Y.b. Lu
@ 2018-01-09  3:39   ` Richard Cochran
  1 sibling, 0 replies; 4+ messages in thread
From: Richard Cochran @ 2018-01-09  3:39 UTC (permalink / raw)
  To: Fabio Estevam; +Cc: Yangbo Lu, Claudiu Manoil, netdev, linux-kernel

On Mon, Jan 08, 2018 at 10:53:40AM -0200, Fabio Estevam wrote:
> On Mon, Jan 8, 2018 at 8:13 AM, Yangbo Lu <yangbo.lu@nxp.com> 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.

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

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

end of thread, other threads:[~2018-01-09  3:39 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-01-08 10:13 [PATCH] net: gianfar_ptp: move set_fipers() to spinlock protecting area Yangbo Lu
2018-01-08 12:53 ` Fabio Estevam
2018-01-09  3:23   ` Y.b. Lu
2018-01-09  3:39   ` Richard Cochran

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).