From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1757573AbcIUPKp (ORCPT ); Wed, 21 Sep 2016 11:10:45 -0400 Received: from nbfkord-smmo04.seg.att.com ([209.65.160.86]:15276 "EHLO nbfkord-smmo04.seg.att.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755814AbcIUPKn (ORCPT ); Wed, 21 Sep 2016 11:10:43 -0400 X-MXL-Hash: 57e2a2f301ee7d21-06b225eddd3909eca1d0c055d47e0bd001ecb782 X-MXL-Hash: 57e2a2f119deda5d-e09f400923125fb348f96a8f71ed3a1b911330ed Subject: Re: [PATCH] ptp_clock: future-proofing drivers against PTP subsystem becoming optional To: Nicolas Pitre , Richard Cochran , "David S. Miller" References: CC: John Stultz , Thomas Gleixner , Josh Triplett , , From: Edward Cree Message-ID: Date: Wed, 21 Sep 2016 16:10:29 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.1.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit X-Originating-IP: [10.17.20.45] X-ClientProxiedBy: ocex03.SolarFlarecom.com (10.20.40.36) To ukex01.SolarFlarecom.com (10.17.10.4) X-TM-AS-Product-Ver: SMEX-11.0.0.1191-8.000.1202-22590.003 X-TM-AS-Result: No--4.493400-8.000000-31 X-TM-AS-User-Approved-Sender: No X-TM-AS-User-Blocked-Sender: No X-AnalysisOut: [v=2.1 cv=Ue1XPfmN c=1 sm=1 tr=0 a=8P+NB+fYZDP74ap4g4d9Kw==] X-AnalysisOut: [:17 a=fVG4DLb5TBsA:10 a=IkcTkHD0fZMA:10 a=GW1xBdLrtEIA:10 ] X-AnalysisOut: [a=KKAkSRfTAAAA:8 a=CbDCq_QkAAAA:8 a=zRKbQ67AAAAA:8 a=5NGC5] X-AnalysisOut: [7j4_AGLCizhnPwA:9 a=QEXdDO2ut3YA:10 a=cvBusfyB2V15izCimMoJ] X-AnalysisOut: [:22 a=1qrBK16LubpBFNPVNq2M:22 a=PA03WX8tBzeizutn5_OT:22] X-Spam: [F=0.2000000000; CM=0.500; S=0.200(2015072901)] X-MAIL-FROM: X-SOURCE-IP: [193.34.186.16] Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 21/09/16 00:25, Nicolas Pitre wrote: > Drivers must be ready to accept NULL from ptp_clock_register() if the > PTP clock subsystem is configured out. > > This patch documents that and ensures that all drivers cope well > with a NULL return. > > Signed-off-by: Nicolas Pitre > Reviewed-by: Eugenia Emantayev [...] > diff --git a/drivers/net/ethernet/sfc/ptp.c b/drivers/net/ethernet/sfc/ptp.c > index c771e0af4e..f105a170b4 100644 > --- a/drivers/net/ethernet/sfc/ptp.c > +++ b/drivers/net/ethernet/sfc/ptp.c > @@ -1269,13 +1269,13 @@ int efx_ptp_probe(struct efx_nic *efx, struct efx_channel *channel) > if (IS_ERR(ptp->phc_clock)) { > rc = PTR_ERR(ptp->phc_clock); > goto fail3; > - } > - > - INIT_WORK(&ptp->pps_work, efx_ptp_pps_worker); > - ptp->pps_workwq = create_singlethread_workqueue("sfc_pps"); > - if (!ptp->pps_workwq) { > - rc = -ENOMEM; > - goto fail4; > + } else if (ptp->phc_clock) { > + INIT_WORK(&ptp->pps_work, efx_ptp_pps_worker); > + ptp->pps_workwq = create_singlethread_workqueue("sfc_pps"); > + if (!ptp->pps_workwq) { > + rc = -ENOMEM; > + goto fail4; > + } > } > } > ptp->nic_ts_enabled = false; For the sfc change: Acked-by: Edward Cree