From patchwork Sun May 13 14:02:12 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Boris Brezillon X-Patchwork-Id: 912527 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=lists.infradead.org (client-ip=2607:7c80:54:e::133; helo=bombadil.infradead.org; envelope-from=linux-mtd-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=bootlin.com Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="N4aJ2cXz"; dkim-atps=neutral Received: from bombadil.infradead.org (bombadil.infradead.org [IPv6:2607:7c80:54:e::133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 40kQX05dCDz9s1w for ; Mon, 14 May 2018 00:02:56 +1000 (AEST) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:MIME-Version:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:Message-Id:Date: Subject:To:From:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To: References:List-Owner; bh=0J+AGSlgVyjhMn7GcYBLwn7/UhdVXQkkKu+GDhE7s2Y=; b=N4a J2cXzYPgwNxMHvquadSatg13Yf5aR3enrCeI/MITj0T3AopJBWvNbeyQVLlGmm9hJmR+XRxxIWDWy nrrwfQQMtwFsbHmGdd/PHdfCZiCR0iXAEEjNMrmOEfu/9lBxxhkFVViEfCPTYIx+HuhhysP1i5589 +YsY5Qk0TDK2WwoJPFyUJ7omhC4ZcqiDFAv57zOB0ChH6Kujwb5ByRveiLW0M2bAK/HgOOMLe2M+8 1V6uGu4KptGIepHyr6f19Zxp3QQyhr4GF3w2fbSl9toTJmpQYarz3DYxDpSg7sAxT5vGnCjwtXCko MOJ0vrwbgofZn40vYjyH6H0dFJaxNOg==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1fHraG-0000jq-68; Sun, 13 May 2018 14:02:44 +0000 Received: from mail.bootlin.com ([62.4.15.54]) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1fHraB-0000hg-QK for linux-mtd@lists.infradead.org; Sun, 13 May 2018 14:02:41 +0000 Received: by mail.bootlin.com (Postfix, from userid 110) id 964D520896; Sun, 13 May 2018 16:02:24 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on mail.bootlin.com X-Spam-Level: X-Spam-Status: No, score=-1.0 required=5.0 tests=ALL_TRUSTED,SHORTCIRCUIT, URIBL_BLOCKED shortcircuit=ham autolearn=disabled version=3.4.0 Received: from localhost.localdomain (91-160-177-164.subs.proxad.net [91.160.177.164]) by mail.bootlin.com (Postfix) with ESMTPSA id 07C9820756; Sun, 13 May 2018 16:02:14 +0200 (CEST) From: Boris Brezillon To: Geert Uytterhoeven , linux-m68k@lists.linux-m68k.org Subject: [PATCH] m68k: Implement ndelay() as an inline function to force type checking/casting Date: Sun, 13 May 2018 16:02:12 +0200 Message-Id: <20180513140212.3961-1-boris.brezillon@bootlin.com> X-Mailer: git-send-email 2.14.1 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20180513_070239_990982_7692A8CF X-CRM114-Status: GOOD ( 16.24 ) X-Spam-Score: -0.0 (/) X-Spam-Report: SpamAssassin version 3.4.1 on bombadil.infradead.org summary: Content analysis details: (-0.0 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at http://www.dnswl.org/, no trust [62.4.15.54 listed in list.dnswl.org] -0.0 SPF_PASS SPF: sender matches SPF record X-BeenThere: linux-mtd@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: Linux MTD discussion mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Marek Vasut , Richard Weinberger , linux-kernel@vger.kernel.org, Boris Brezillon , linux-mtd@lists.infradead.org, Miquel Raynal , Brian Norris , David Woodhouse MIME-Version: 1.0 Sender: "linux-mtd" Errors-To: linux-mtd-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org ndelay() is supposed to take an unsigned long, but if you define ndelay() as a macro and the caller pass an unsigned long long instead of an unsigned long, the unsigned long long to unsigned long cast is not done and we end up with an "undefined reference to `__udivdi3'" error at link time. Fix that by making ndelay() an inline function and then defining dummy ndelay() macro that redirects to the ndelay() function (it's how most archs do to implement ndelay()). Fixes: c8ee038bd148 ("m68k: Implement ndelay() based on the existing udelay() logic") Signed-off-by: Boris Brezillon Reviewed-by: Miquel Raynal Acked-by: Geert Uytterhoeven --- Hello Geert, This patch is fixing the bug reported by kbuild test robot here [1]. I could have patched the PSEC_TO_NSEC() macro to cast the result of the division on a u32, but I thought making m68k consistent with what other archs do would be preferable. Let me know if don't like the solution, and I'll patch the ndelay() caller instead. Regards, Boris [1]https://lkml.org/lkml/2018/5/13/72 --- arch/m68k/include/asm/delay.h | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/arch/m68k/include/asm/delay.h b/arch/m68k/include/asm/delay.h index 7f474121e4ca..66ba159002a3 100644 --- a/arch/m68k/include/asm/delay.h +++ b/arch/m68k/include/asm/delay.h @@ -115,6 +115,13 @@ static inline void __udelay(unsigned long usecs) */ #define HZSCALE (268435456 / (1000000 / HZ)) -#define ndelay(n) __delay(DIV_ROUND_UP((n) * ((((HZSCALE) >> 11) * (loops_per_jiffy >> 11)) >> 6), 1000)) +static inline void ndelay(unsigned long nsec) +{ + __delay(DIV_ROUND_UP(nsec * + ((((HZSCALE) >> 11) * + (loops_per_jiffy >> 11)) >> 6), + 1000)); +} +#define ndelay(n) ndelay(n) #endif /* defined(_M68K_DELAY_H) */