linux-mips.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Antoine Tenart <antoine.tenart@bootlin.com>
To: Richard Cochran <richardcochran@gmail.com>
Cc: Antoine Tenart <antoine.tenart@bootlin.com>,
	davem@davemloft.net, alexandre.belloni@bootlin.com,
	UNGLinuxDriver@microchip.com, ralf@linux-mips.org,
	paul.burton@mips.com, jhogan@kernel.org, netdev@vger.kernel.org,
	linux-mips@vger.kernel.org, thomas.petazzoni@bootlin.com,
	allan.nielsen@microchip.com
Subject: Re: [PATCH net-next 8/8] net: mscc: PTP Hardware Clock (PHC) support
Date: Fri, 5 Jul 2019 19:16:40 +0200	[thread overview]
Message-ID: <20190705171640.GM3926@kwain> (raw)
In-Reply-To: <20190705164736.x6dy2oc6jo5db65v@localhost>

Hello Richard,

On Fri, Jul 05, 2019 at 09:47:36AM -0700, Richard Cochran wrote:
> On Mon, Jul 01, 2019 at 12:03:27PM +0200, Antoine Tenart wrote:
> 
> > +void ocelot_get_hwtimestamp(struct ocelot *ocelot, struct timespec64 *ts)
> > +{
> > +	/* Read current PTP time to get seconds */
> > +	u32 val = ocelot_read_rix(ocelot, PTP_PIN_CFG, TOD_ACC_PIN);
> 
> This register is protected by ocelot->ptp_clock_lock from other code
> paths, but not in this one!

Oops. I'll fix it.

> > +static int ocelot_init_timestamp(struct ocelot *ocelot)
> > +{
> > +	ocelot->ptp_info = ocelot_ptp_clock_info;
> > +
> > +	ocelot->ptp_clock = ptp_clock_register(&ocelot->ptp_info, ocelot->dev);
> > +	if (IS_ERR(ocelot->ptp_clock))
> > +		return PTR_ERR(ocelot->ptp_clock);
> 
> You need to handle the NULL case:

Will do.

> ptp_clock_register() - register a PTP hardware clock driver
> 
> @info:   Structure describing the new clock.
> @parent: Pointer to the parent device of the new clock.
> 
> Returns a valid pointer on success or PTR_ERR on failure.  If PHC
> support is missing at the configuration level, this function
> returns NULL, and drivers are expected to gracefully handle that
> case separately.

Thanks,
Antoine

-- 
Antoine Ténart, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com

  reply	other threads:[~2019-07-05 17:16 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-07-01 10:03 [PATCH net-next 0/8] net: mscc: PTP Hardware Clock (PHC) support Antoine Tenart
2019-07-01 10:03 ` [PATCH net-next 1/8] Documentation/bindings: net: ocelot: document the PTP bank Antoine Tenart
2019-07-01 13:52   ` Andrew Lunn
2019-07-05 13:30     ` Antoine Tenart
2019-07-05 14:45       ` Andrew Lunn
2019-07-05 16:39         ` Antoine Tenart
2019-07-01 10:03 ` [PATCH net-next 2/8] MIPS: dts: mscc: describe the PTP register range Antoine Tenart
2019-07-01 10:03 ` [PATCH net-next 3/8] Documentation/bindings: net: ocelot: document the PTP ready IRQ Antoine Tenart
2019-07-01 13:54   ` Andrew Lunn
2019-07-01 10:03 ` [PATCH net-next 4/8] MIPS: dts: mscc: describe the PTP ready interrupt Antoine Tenart
2019-07-01 10:03 ` [PATCH net-next 5/8] net: mscc: describe the PTP register range Antoine Tenart
2019-07-01 10:03 ` [PATCH net-next 6/8] net: mscc: improve the frame header parsing readability Antoine Tenart
2019-07-01 10:03 ` [PATCH net-next 7/8] net: mscc: remove the frame_info cpuq member Antoine Tenart
2019-07-01 10:03 ` [PATCH net-next 8/8] net: mscc: PTP Hardware Clock (PHC) support Antoine Tenart
2019-07-01 15:12   ` Willem de Bruijn
2019-07-01 15:54     ` Eric Dumazet
2019-07-05  7:49       ` Antoine Tenart
2019-07-05  7:47     ` Antoine Tenart
2019-07-04 12:48   ` kbuild test robot
2019-07-05 16:47   ` Richard Cochran
2019-07-05 17:16     ` Antoine Tenart [this message]
2019-07-05 21:58   ` Richard Cochran

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=20190705171640.GM3926@kwain \
    --to=antoine.tenart@bootlin.com \
    --cc=UNGLinuxDriver@microchip.com \
    --cc=alexandre.belloni@bootlin.com \
    --cc=allan.nielsen@microchip.com \
    --cc=davem@davemloft.net \
    --cc=jhogan@kernel.org \
    --cc=linux-mips@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=paul.burton@mips.com \
    --cc=ralf@linux-mips.org \
    --cc=richardcochran@gmail.com \
    --cc=thomas.petazzoni@bootlin.com \
    /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).