From patchwork Mon Nov 2 22:33:29 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nicolas Pitre X-Patchwork-Id: 55914 Delivered-To: patch@linaro.org Received: by 10.112.61.134 with SMTP id p6csp1525246lbr; Mon, 2 Nov 2015 14:48:47 -0800 (PST) X-Received: by 10.68.69.72 with SMTP id c8mr29220098pbu.2.1446504527156; Mon, 02 Nov 2015 14:48:47 -0800 (PST) Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id zq1si38193943pbc.38.2015.11.02.14.48.46; Mon, 02 Nov 2015 14:48:47 -0800 (PST) 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 S1753199AbbKBWsm (ORCPT + 28 others); Mon, 2 Nov 2015 17:48:42 -0500 Received: from relais.videotron.ca ([24.201.245.36]:64165 "EHLO relais.videotron.ca" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752307AbbKBWsi (ORCPT ); Mon, 2 Nov 2015 17:48:38 -0500 Content-transfer-encoding: 7BIT Received: from yoda.home ([96.23.157.65]) by VL-VM-MR002.ip.videotron.ca (Oracle Communications Messaging Exchange Server 7u4-22.01 64bit (built Apr 21 2011)) with ESMTP id <0NX7001Z3LBYKM00@VL-VM-MR002.ip.videotron.ca>; Mon, 02 Nov 2015 17:33:36 -0500 (EST) Received: from xanadu.home (xanadu.home [192.168.2.2]) by yoda.home (Postfix) with ESMTP id 4A2312DA056A; Mon, 02 Nov 2015 17:33:34 -0500 (EST) From: Nicolas Pitre To: Alexey Brodkin , =?UTF-8?q?M=C3=A5ns=20Rullg=C3=A5rd?= Cc: Arnd Bergmann , rmk+kernel@arm.linux.org.uk, linux-arch@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH 4/5] __div64_32(): make it overridable at compile time Date: Mon, 02 Nov 2015 17:33:29 -0500 Message-id: <1446503610-6942-5-git-send-email-nicolas.pitre@linaro.org> X-Mailer: git-send-email 2.4.3 In-reply-to: <1446503610-6942-1-git-send-email-nicolas.pitre@linaro.org> References: <1446503610-6942-1-git-send-email-nicolas.pitre@linaro.org> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Some architectures may want to override the default implementation at compile time to do things inline. For example, ARM uses a non-standard calling convention for better efficiency in this case. Signed-off-by: Nicolas Pitre --- include/asm-generic/div64.h | 2 ++ lib/div64.c | 6 ++++-- 2 files changed, 6 insertions(+), 2 deletions(-) -- 2.4.3 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/ diff --git a/include/asm-generic/div64.h b/include/asm-generic/div64.h index 34722c5a80..6daad94055 100644 --- a/include/asm-generic/div64.h +++ b/include/asm-generic/div64.h @@ -204,7 +204,9 @@ static inline uint64_t __arch_xprod_64(const uint64_t m, uint64_t n, bool bias) } #endif +#ifndef __div64_32 extern uint32_t __div64_32(uint64_t *dividend, uint32_t divisor); +#endif /* The unnecessary pointer compare is there * to check for type safety (n must be 64bit) diff --git a/lib/div64.c b/lib/div64.c index 19ea7ed4b9..69df4f6d52 100644 --- a/lib/div64.c +++ b/lib/div64.c @@ -13,7 +13,8 @@ * * Code generated for this function might be very inefficient * for some CPUs. __div64_32() can be overridden by linking arch-specific - * assembly versions such as arch/ppc/lib/div64.S and arch/sh/lib/div64.S. + * assembly versions such as arch/ppc/lib/div64.S and arch/sh/lib/div64.S + * or by defining a preprocessor macro in arch/include/asm/div64.h. */ #include @@ -23,6 +24,7 @@ /* Not needed on 64bit architectures */ #if BITS_PER_LONG == 32 +#ifndef __div64_32 uint32_t __attribute__((weak)) __div64_32(uint64_t *n, uint32_t base) { uint64_t rem = *n; @@ -55,8 +57,8 @@ uint32_t __attribute__((weak)) __div64_32(uint64_t *n, uint32_t base) *n = res; return rem; } - EXPORT_SYMBOL(__div64_32); +#endif #ifndef div_s64_rem s64 div_s64_rem(s64 dividend, s32 divisor, s32 *remainder)