From: Vladimir Oltean <olteanv@gmail.com>
To: Richard Cochran <richardcochran@gmail.com>,
Jonathan Lemon <jonathan.lemon@gmail.com>
Cc: netdev@vger.kernel.org, kernel-team@fb.com
Subject: Re: [PATCH] ptp: Set lookup cookie when creating a PTP PPS source.
Date: Fri, 2 Jul 2021 03:39:36 +0300 [thread overview]
Message-ID: <20210702003936.22m2rz7sajkwusaa@skbuf> (raw)
In-Reply-To: <20210628233835.GB766@hoboy.vegasvil.org>
On Mon, Jun 28, 2021 at 04:38:35PM -0700, Richard Cochran wrote:
> On Mon, Jun 28, 2021 at 11:25:33AM -0700, Jonathan Lemon wrote:
> > When creating a PTP device, the configuration block allows
> > creation of an associated PPS device. However, there isn't
> > any way to associate the two devices after creation.
> >
> > Set the PPS cookie, so pps_lookup_dev(ptp) performs correctly.
>
> Setting lookup_cookie is harmless, AFAICT, but I wonder about the use
> case. The doc for pps_lookup_dev() says,
Harmless you say?
Let's look at the code in a larger context:
struct ptp_clock *ptp_clock_register(struct ptp_clock_info *info,
struct device *parent)
{
struct ptp_clock *ptp;
...
ptp = kzalloc(...);
...
ptp->info = info;
...
if (ptp->info->do_aux_work) {
...
+ ptp->pps_source->lookup_cookie = ptp;
}
/* Register a new PPS source. */
if (info->pps) {
struct pps_source_info pps;
...
ptp->pps_source = pps_register_source(&pps, PTP_PPS_DEFAULTS);
...
}
Notice anything out of the ordinary?
Like perhaps the fact that ptp->pps_source is an arbitrary NULL pointer
at the time the assignment to ->lookup_cookie is being made, because it
is being created later?
How on earth is this patch supposed to work?
next prev parent reply other threads:[~2021-07-02 0:39 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-06-28 18:25 [PATCH] ptp: Set lookup cookie when creating a PTP PPS source Jonathan Lemon
2021-06-28 23:38 ` Richard Cochran
2021-06-29 0:08 ` Jonathan Lemon
2021-07-02 0:39 ` Vladimir Oltean [this message]
2021-07-02 1:28 ` Richard Cochran
2021-07-07 0:26 ` Jonathan Lemon
2021-06-29 18:40 ` patchwork-bot+netdevbpf
2021-06-30 0:11 ` 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=20210702003936.22m2rz7sajkwusaa@skbuf \
--to=olteanv@gmail.com \
--cc=jonathan.lemon@gmail.com \
--cc=kernel-team@fb.com \
--cc=netdev@vger.kernel.org \
--cc=richardcochran@gmail.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