On Tue, 17 Jan 2017, Vitaly Kuznetsov wrote: > Stephen Hemminger <stephen@xxxxxxxxxxxxxxxxxx> 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 _______________________________________________ devel mailing list devel@xxxxxxxxxxxxxxxxxxxxxx http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel