[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <87366jaagv.fsf@kurt>
Date: Thu, 25 Jun 2020 09:08:48 +0200
From: Kurt Kanzenbach <kurt@...utronix.de>
To: Richard Cochran <richardcochran@...il.com>
Cc: Andrew Lunn <andrew@...n.ch>,
Vivien Didelot <vivien.didelot@...il.com>,
Florian Fainelli <f.fainelli@...il.com>,
"David S. Miller" <davem@...emloft.net>,
Jakub Kicinski <kuba@...nel.org>, netdev@...r.kernel.org,
Rob Herring <robh+dt@...nel.org>, devicetree@...r.kernel.org,
Sebastian Andrzej Siewior <bigeasy@...utronix.de>,
Kamil Alkhouri <kamil.alkhouri@...offenburg.de>,
ilias.apalodimas@...aro.org
Subject: Re: [RFC PATCH 3/9] net: dsa: hellcreek: Add PTP clock support
Hi Richard,
On Wed Jun 24 2020, Richard Cochran wrote:
> On Thu, Jun 18, 2020 at 08:40:23AM +0200, Kurt Kanzenbach wrote:
>
>> diff --git a/drivers/net/dsa/hirschmann/hellcreek.h b/drivers/net/dsa/hirschmann/hellcreek.h
>> index a08a10cb5ab7..2d4422fd2567 100644
>> --- a/drivers/net/dsa/hirschmann/hellcreek.h
>> +++ b/drivers/net/dsa/hirschmann/hellcreek.h
>> @@ -234,10 +234,17 @@ struct hellcreek_fdb_entry {
>> struct hellcreek {
>> struct device *dev;
>> struct dsa_switch *ds;
>> + struct ptp_clock *ptp_clock;
>> + struct ptp_clock_info ptp_clock_info;
>> struct hellcreek_port ports[4];
>> + struct delayed_work overflow_work;
>> spinlock_t reg_lock; /* Switch IP register lock */
>> + spinlock_t ptp_lock; /* PTP IP register lock */
>
> Why use a spin lock and not a mutex?
No particular reason. Mutex will also work.
>> + hellcreek->ptp_clock = ptp_clock_register(&hellcreek->ptp_clock_info,
>> + hellcreek->dev);
>> + if (IS_ERR(hellcreek->ptp_clock))
>> + return PTR_ERR(hellcreek->ptp_clock);
>
> The ptp_clock_register() can also return NULL:
>
> * 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.
>
I see, thanks. I guess we could add the missing NULL checks to remove()
and get_ts_info() to handle that case gracefully.
Thanks,
Kurt
Download attachment "signature.asc" of type "application/pgp-signature" (833 bytes)
Powered by blists - more mailing lists