From: Richard Cochran <richardcochran@gmail.com>
To: Fugang Duan <b38611@freescale.com>
Cc: davem@davemloft.net, netdev@vger.kernel.org
Subject: Re: [PATCH v5 1/1] net: fec: ptp: avoid register access when ipg clock is disabled
Date: Sat, 23 Aug 2014 21:52:34 +0200 [thread overview]
Message-ID: <20140823195234.GA3878@localhost.localdomain> (raw)
In-Reply-To: <1408612178-13906-2-git-send-email-b38611@freescale.com>
On Thu, Aug 21, 2014 at 05:09:38PM +0800, Fugang Duan wrote:
> diff --git a/drivers/net/ethernet/freescale/fec_ptp.c b/drivers/net/ethernet/freescale/fec_ptp.c
> index 82386b2..cca3617 100644
> --- a/drivers/net/ethernet/freescale/fec_ptp.c
> +++ b/drivers/net/ethernet/freescale/fec_ptp.c
> @@ -245,12 +245,20 @@ static int fec_ptp_settime(struct ptp_clock_info *ptp,
> u64 ns;
> unsigned long flags;
>
> + mutex_lock(&fep->ptp_clk_mutex);
> + /* Check the ptp clock */
> + if (!fep->ptp_clk_on) {
> + mutex_unlock(&fep->ptp_clk_mutex);
> + return -EINVAL;
> + }
> +
Don't you need the same kind of check in fec_ptp_gettime, too?
> ns = ts->tv_sec * 1000000000ULL;
> ns += ts->tv_nsec;
>
> spin_lock_irqsave(&fep->tmreg_lock, flags);
> timecounter_init(&fep->tc, &fep->cc, ns);
> spin_unlock_irqrestore(&fep->tmreg_lock, flags);
> + mutex_unlock(&fep->ptp_clk_mutex);
> return 0;
> }
>
Thanks,
Richard
prev parent reply other threads:[~2014-08-23 19:52 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-08-21 9:09 [PATCH v5 0/1] net: fec: ptp: avoid register access when ipg clock is disabled Fugang Duan
2014-08-21 9:09 ` [PATCH v5 1/1] " Fugang Duan
2014-08-22 17:46 ` David Miller
2014-08-23 19:52 ` Richard Cochran [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20140823195234.GA3878@localhost.localdomain \
--to=richardcochran@gmail.com \
--cc=b38611@freescale.com \
--cc=davem@davemloft.net \
--cc=netdev@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).