lkml.org 
[lkml]   [2017]   [Jan]   [17]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH v3 2/2] hv_utils: implement Hyper-V PTP source
On Tue, 17 Jan 2017, Vitaly Kuznetsov wrote:
> Stephen Hemminger <stephen@networkplumber.org> writes:
> >> static int hv_timesync_init(struct hv_util_service *srv)
> >> {
> >> INIT_WORK(&wrk.work, hv_set_host_time);
> >> +
> >> + hv_ptp_clock = ptp_clock_register(&ptp_hyperv_info, NULL);
> >> + if (IS_ERR_OR_NULL(hv_ptp_clock)) {
> >> + pr_err("cannot register PTP clock: %ld\n",
> >> + PTR_ERR(hv_ptp_clock));
> >
> > Why not return error to init routine in case of failure.
> >
> >> + hv_ptp_clock = NULL;
> >
> > Why not return error to init routine? Rather than having user
> > scan log.
> >
>
> The idea here was to not depend on CONFIG_PTP_1588_CLOCK. In case
> CONFIG_PTP_1588_CLOCK is disabled ptp_clock_register() will return NULL
> but the Hyper-V timesync driver remains functional - it still handles
> the ICTIMESYNCFLAG_SYNC case, just the ptp device will be missing.
> We can:
> 1) Put PTP-related code under #ifdef CONFIG_PTP_1588_CLOCK
> 2) Handle errors and NULL returned from ptp_clock_register() differently,
> fail init in case we get an error and continue in case we see NULL.
> 3) Leave things as they are.
> 4) Always require CONFIG_PTP_1588_CLOCK.
>
> My personal preference would be 2 or 3. What do you think?

Keep the current implementation and add a comment explaining the logic of
keeping the driver functional for the the ICTIMESYNC case.

Thanks,

tglx

\
 
 \ /
  Last update: 2017-01-17 20:19    [W:0.094 / U:0.076 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site