Received: by 2002:a25:d7c1:0:0:0:0:0 with SMTP id o184csp4098268ybg; Fri, 25 Oct 2019 13:17:43 -0700 (PDT) X-Google-Smtp-Source: APXvYqz1rsm8DWmSQigzOyfka3w2wkl36m9joGol8B0bvIHun9vP6LZAAvGidfuSSVad3A/R5C9A X-Received: by 2002:a17:906:31c1:: with SMTP id f1mr5131878ejf.242.1572034663228; Fri, 25 Oct 2019 13:17:43 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1572034663; cv=none; d=google.com; s=arc-20160816; b=Taa/jHvIBzDPhbO2syZbxKczekfWRdsTfJYRaDWZFirZb+QiqEEjDqQ12e5l0e4tOA YAWnlzmpmubN9Vq9PpcPnr9nPeM9l4AlWDxkcRQvpvEN3mbUKazgHGPzCJvDOtWvIQrU y3AbNZMop9jh11Sfuyu9Auva19NusbMM1XntB9TmMBGrjJJ3PayA6wZYS2grFpVtYhcd o7prYLI37PiKMGyn9688P6x4NWvA5rXe8ugN/NJvsF6vBv/6PRuqowuDn6/SRYH2DT4E ZFFKLC03gkonQwaWYm0nje6oSXLMu3JR3khNmSnXc8g5mvncO8WtXXju37iJvX0aHfN3 o9hA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:message-id:date:subject:cc :to:from; bh=qgk5sjgXD7yNkO7fGk7A4CkJb7aaQqORtvmOH4QH8Qg=; b=vOs98zofVSzqtICJaZXWmUpIQd5Vk62lfKINIPvnbp6I37zDKCxDy0yQH3T6MFd/yG ysgdTig6IM5hjji91C42NjPv22zI+t3/QccGrusdwoRgcdqUKOnmzQY/s2j/Q8Z0WNyT wNb2EbY5z1u64/T3AjQsjMzrVbb4weH0kEZ1YnTXaL8ftnGZy9nTm3hkGQ7SoAC8u3GE oxvU2y36uA6zRNZloFdD5xI1scLOcUBL9u/FDA6o2ATFl3hNVKnPfBSIKTUTvhNaVukm 8LY6iAKyZcKy62wT8SFjQYzSA4Bq7uPkip0enxiHKNtWZntyb3CVrN5eulMC+bUwzwfz Je7g== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id b28si2079008edc.400.2019.10.25.13.17.17; Fri, 25 Oct 2019 13:17:43 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2504803AbfJYNiN (ORCPT + 99 others); Fri, 25 Oct 2019 09:38:13 -0400 Received: from szxga04-in.huawei.com ([45.249.212.190]:5187 "EHLO huawei.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726285AbfJYNiM (ORCPT ); Fri, 25 Oct 2019 09:38:12 -0400 Received: from DGGEMS412-HUB.china.huawei.com (unknown [172.30.72.58]) by Forcepoint Email with ESMTP id 32A4A9A46F113C00024D; Fri, 25 Oct 2019 21:38:07 +0800 (CST) Received: from localhost (10.133.213.239) by DGGEMS412-HUB.china.huawei.com (10.3.19.212) with Microsoft SMTP Server id 14.3.439.0; Fri, 25 Oct 2019 21:37:56 +0800 From: YueHaibing To: , , , , CC: , , YueHaibing Subject: [PATCH net-next] net: aquantia: Fix build error wihtout CONFIG_PTP_1588_CLOCK Date: Fri, 25 Oct 2019 21:37:26 +0800 Message-ID: <20191025133726.31796-1-yuehaibing@huawei.com> X-Mailer: git-send-email 2.10.2.windows.1 MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [10.133.213.239] X-CFilter-Loop: Reflected Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org If PTP_1588_CLOCK is n, building fails: drivers/net/ethernet/aquantia/atlantic/aq_ptp.c: In function aq_ptp_adjfine: drivers/net/ethernet/aquantia/atlantic/aq_ptp.c:279:11: error: implicit declaration of function scaled_ppm_to_ppb [-Werror=implicit-function-declaration] scaled_ppm_to_ppb(scaled_ppm)); Just cp scaled_ppm_to_ppb() from ptp_clock.c to fix this. Fixes: 910479a9f793 ("net: aquantia: add basic ptp_clock callbacks") Signed-off-by: YueHaibing --- drivers/net/ethernet/aquantia/atlantic/aq_ptp.c | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/drivers/net/ethernet/aquantia/atlantic/aq_ptp.c b/drivers/net/ethernet/aquantia/atlantic/aq_ptp.c index 3ec0841..80c001d 100644 --- a/drivers/net/ethernet/aquantia/atlantic/aq_ptp.c +++ b/drivers/net/ethernet/aquantia/atlantic/aq_ptp.c @@ -262,6 +262,26 @@ static void aq_ptp_tx_timeout_check(struct aq_ptp_s *aq_ptp) } } +static s32 scaled_ppm_to_ppb(long ppm) +{ + /* + * The 'freq' field in the 'struct timex' is in parts per + * million, but with a 16 bit binary fractional field. + * + * We want to calculate + * + * ppb = scaled_ppm * 1000 / 2^16 + * + * which simplifies to + * + * ppb = scaled_ppm * 125 / 2^13 + */ + s64 ppb = 1 + ppm; + ppb *= 125; + ppb >>= 13; + return (s32) ppb; +} + /* aq_ptp_adjfine * @ptp: the ptp clock structure * @ppb: parts per billion adjustment from base -- 2.7.4