[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <6ce5c17b-7af3-4844-8373-85b363387a53@machnikowski.net>
Date: Thu, 15 Aug 2024 11:32:22 +0200
From: Maciek Machnikowski <maciek@...hnikowski.net>
To: Simon Horman <horms@...nel.org>
Cc: netdev@...r.kernel.org, richardcochran@...il.com,
jacob.e.keller@...el.com, vadfed@...a.com, darinzon@...zon.com,
kuba@...nel.org
Subject: Re: [RFC 1/3] ptp: Implement timex esterror support
On 14/08/2024 13:46, Simon Horman wrote:
> On Tue, Aug 13, 2024 at 12:56:00PM +0000, Maciek Machnikowski wrote:
>> The Timex structure returned by the clock_adjtime() POSIX API allows
>> the clock to return the estimated error. Implement getesterror
>> and setesterror functions in the ptp_clock_info to enable drivers
>> to interact with the hardware to get the error information.
>>
>> getesterror additionally implements returning hw_ts and sys_ts
>> to enable upper layers to estimate the maximum error of the clock
>> based on the last time of correction. This functionality is not
>> directly implemented in the clock_adjtime and will require
>> a separate interface in the future.
>>
>> Signed-off-by: Maciek Machnikowski <maciek@...hnikowski.net>
>> ---
>> drivers/ptp/ptp_clock.c | 18 +++++++++++++++++-
>> include/linux/ptp_clock_kernel.h | 11 +++++++++++
>> 2 files changed, 28 insertions(+), 1 deletion(-)
>>
>> diff --git a/drivers/ptp/ptp_clock.c b/drivers/ptp/ptp_clock.c
>> index c56cd0f63909..2cb1f6af60ea 100644
>> --- a/drivers/ptp/ptp_clock.c
>> +++ b/drivers/ptp/ptp_clock.c
>> @@ -164,9 +164,25 @@ static int ptp_clock_adjtime(struct posix_clock *pc, struct __kernel_timex *tx)
>>
>> err = ops->adjphase(ops, offset);
>> }
>> + } else if (tx->modes & ADJ_ESTERROR) {
>> + if (ops->setesterror)
>> + if (tx->modes & ADJ_NANO)
>> + err = ops->setesterror(ops, tx->esterror * 1000);
>> + else
>> + err = ops->setesterror(ops, tx->esterror);
>
> Both GCC-14 and Clang-18 complain when compiling with W=1 that the relation
> of the else to the two if's is ambiguous. Based on indentation I suggest
> adding a { } to the outer-if.
Thanks for catching this one - will fix in upcoming release!
Powered by blists - more mailing lists