From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751282AbdAQTTM (ORCPT ); Tue, 17 Jan 2017 14:19:12 -0500 Received: from Galois.linutronix.de ([146.0.238.70]:46166 "EHLO Galois.linutronix.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750992AbdAQTSI (ORCPT ); Tue, 17 Jan 2017 14:18:08 -0500 Date: Tue, 17 Jan 2017 20:17:43 +0100 (CET) From: Thomas Gleixner To: Vitaly Kuznetsov cc: Stephen Hemminger , devel@linuxdriverproject.org, linux-kernel@vger.kernel.org, Haiyang Zhang , "K. Y. Srinivasan" , John Stultz , Alex Ng , Olaf Hering , Richard Cochran Subject: Re: [PATCH v3 2/2] hv_utils: implement Hyper-V PTP source In-Reply-To: <87o9z5zk5h.fsf@vitty.brq.redhat.com> Message-ID: References: <20170117152719.23618-1-vkuznets@redhat.com> <20170117152719.23618-3-vkuznets@redhat.com> <20170117083547.3c7d71a4@xeon-e3> <87o9z5zk5h.fsf@vitty.brq.redhat.com> User-Agent: Alpine 2.20 (DEB 67 2015-01-07) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, 17 Jan 2017, Vitaly Kuznetsov wrote: > Stephen Hemminger 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