[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <alpine.DEB.2.20.1701172016190.3645@nanos>
Date: Tue, 17 Jan 2017 20:17:43 +0100 (CET)
From: Thomas Gleixner <tglx@...utronix.de>
To: Vitaly Kuznetsov <vkuznets@...hat.com>
cc: Stephen Hemminger <stephen@...workplumber.org>,
devel@...uxdriverproject.org, linux-kernel@...r.kernel.org,
Haiyang Zhang <haiyangz@...rosoft.com>,
"K. Y. Srinivasan" <kys@...rosoft.com>,
John Stultz <john.stultz@...aro.org>,
Alex Ng <alexng@...rosoft.com>, Olaf Hering <olaf@...fle.de>,
Richard Cochran <richardcochran@...il.com>
Subject: Re: [PATCH v3 2/2] hv_utils: implement Hyper-V PTP source
On Tue, 17 Jan 2017, Vitaly Kuznetsov wrote:
> Stephen Hemminger <stephen@...workplumber.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
Powered by blists - more mailing lists