From patchwork Thu Sep 29 07:39:57 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tiezhu Yang X-Patchwork-Id: 12993641 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 1DAEDC07E9D for ; Thu, 29 Sep 2022 07:40:11 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235349AbiI2HkJ (ORCPT ); Thu, 29 Sep 2022 03:40:09 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46244 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235350AbiI2HkH (ORCPT ); Thu, 29 Sep 2022 03:40:07 -0400 Received: from loongson.cn (mail.loongson.cn [114.242.206.163]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id EC10F41D22; Thu, 29 Sep 2022 00:40:05 -0700 (PDT) Received: from linux.localdomain (unknown [113.200.148.30]) by localhost.localdomain (Coremail) with SMTP id AQAAf8AxTWvOSzVjdKwjAA--.5668S3; Thu, 29 Sep 2022 15:39:59 +0800 (CST) From: Tiezhu Yang To: Thomas Bogendoerfer Cc: linux-mips@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH 1/2] MIPS: Silence missing prototype warning Date: Thu, 29 Sep 2022 15:39:57 +0800 Message-Id: <1664437198-31260-2-git-send-email-yangtiezhu@loongson.cn> X-Mailer: git-send-email 2.1.0 In-Reply-To: <1664437198-31260-1-git-send-email-yangtiezhu@loongson.cn> References: <1664437198-31260-1-git-send-email-yangtiezhu@loongson.cn> X-CM-TRANSID: AQAAf8AxTWvOSzVjdKwjAA--.5668S3 X-Coremail-Antispam: 1UD129KBjvJXoW7Kw45Ar4ktF4kCF47Ary3twb_yoW8Z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w2lrqou0/ Precedence: bulk List-ID: X-Mailing-List: linux-mips@vger.kernel.org Silence the following two warnings when make W=1: CC arch/mips/lib/bswapsi.o arch/mips/lib/bswapsi.c:5:22: warning: no previous prototype for '__bswapsi2' [-Wmissing-prototypes] unsigned int notrace __bswapsi2(unsigned int u) ^~~~~~~~~~ CC arch/mips/lib/bswapdi.o arch/mips/lib/bswapdi.c:5:28: warning: no previous prototype for '__bswapdi2' [-Wmissing-prototypes] unsigned long long notrace __bswapdi2(unsigned long long u) ^~~~~~~~~~ AR arch/mips/lib/built-in.a Reported-by: kernel test robot Signed-off-by: Tiezhu Yang --- arch/mips/lib/bswapdi.c | 4 +++- arch/mips/lib/bswapsi.c | 4 +++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/arch/mips/lib/bswapdi.c b/arch/mips/lib/bswapdi.c index fcef7408..1d020e1 100644 --- a/arch/mips/lib/bswapdi.c +++ b/arch/mips/lib/bswapdi.c @@ -2,6 +2,9 @@ #include #include +/* To silence -Wmissing-prototypes. */ +unsigned long long __bswapdi2(unsigned long long u); + unsigned long long notrace __bswapdi2(unsigned long long u) { return (((u) & 0xff00000000000000ull) >> 56) | @@ -13,5 +16,4 @@ unsigned long long notrace __bswapdi2(unsigned long long u) (((u) & 0x000000000000ff00ull) << 40) | (((u) & 0x00000000000000ffull) << 56); } - EXPORT_SYMBOL(__bswapdi2); diff --git a/arch/mips/lib/bswapsi.c b/arch/mips/lib/bswapsi.c index 22d8e4f..02d9df4 100644 --- a/arch/mips/lib/bswapsi.c +++ b/arch/mips/lib/bswapsi.c @@ -2,6 +2,9 @@ #include #include +/* To silence -Wmissing-prototypes. */ +unsigned int __bswapsi2(unsigned int u); + unsigned int notrace __bswapsi2(unsigned int u) { return (((u) & 0xff000000) >> 24) | @@ -9,5 +12,4 @@ unsigned int notrace __bswapsi2(unsigned int u) (((u) & 0x0000ff00) << 8) | (((u) & 0x000000ff) << 24); } - EXPORT_SYMBOL(__bswapsi2); From patchwork Thu Sep 29 07:39:58 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tiezhu Yang X-Patchwork-Id: 12993642 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 2DA31C6FA82 for ; Thu, 29 Sep 2022 07:40:14 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235361AbiI2HkN (ORCPT ); Thu, 29 Sep 2022 03:40:13 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46654 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235360AbiI2HkL (ORCPT ); Thu, 29 Sep 2022 03:40:11 -0400 Received: from loongson.cn (mail.loongson.cn [114.242.206.163]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 34EB05A2D5; Thu, 29 Sep 2022 00:40:08 -0700 (PDT) Received: from linux.localdomain (unknown [113.200.148.30]) by localhost.localdomain (Coremail) with SMTP id AQAAf8AxTWvOSzVjdKwjAA--.5668S4; Thu, 29 Sep 2022 15:40:00 +0800 (CST) From: Tiezhu Yang To: Thomas Bogendoerfer Cc: linux-mips@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH 2/2] MIPS: Simplify __bswapdi2() and __bswapsi2() Date: Thu, 29 Sep 2022 15:39:58 +0800 Message-Id: <1664437198-31260-3-git-send-email-yangtiezhu@loongson.cn> X-Mailer: git-send-email 2.1.0 In-Reply-To: <1664437198-31260-1-git-send-email-yangtiezhu@loongson.cn> References: <1664437198-31260-1-git-send-email-yangtiezhu@loongson.cn> X-CM-TRANSID: AQAAf8AxTWvOSzVjdKwjAA--.5668S4 X-Coremail-Antispam: 1UD129KBjvJXoWxJr43JryfWFyUKF1fCFy3Jwb_yoW8C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qw2lrqou0/ Precedence: bulk List-ID: X-Mailing-List: linux-mips@vger.kernel.org Use macro definitions ___constant_swab64 and ___constant_swab32 to simplify __bswapdi2() and __bswapsi2(). Signed-off-by: Tiezhu Yang --- arch/mips/lib/bswapdi.c | 10 ++-------- arch/mips/lib/bswapsi.c | 6 ++---- 2 files changed, 4 insertions(+), 12 deletions(-) diff --git a/arch/mips/lib/bswapdi.c b/arch/mips/lib/bswapdi.c index 1d020e1..88242dc 100644 --- a/arch/mips/lib/bswapdi.c +++ b/arch/mips/lib/bswapdi.c @@ -1,19 +1,13 @@ // SPDX-License-Identifier: GPL-2.0 #include #include +#include /* To silence -Wmissing-prototypes. */ unsigned long long __bswapdi2(unsigned long long u); unsigned long long notrace __bswapdi2(unsigned long long u) { - return (((u) & 0xff00000000000000ull) >> 56) | - (((u) & 0x00ff000000000000ull) >> 40) | - (((u) & 0x0000ff0000000000ull) >> 24) | - (((u) & 0x000000ff00000000ull) >> 8) | - (((u) & 0x00000000ff000000ull) << 8) | - (((u) & 0x0000000000ff0000ull) << 24) | - (((u) & 0x000000000000ff00ull) << 40) | - (((u) & 0x00000000000000ffull) << 56); + return ___constant_swab64(u); } EXPORT_SYMBOL(__bswapdi2); diff --git a/arch/mips/lib/bswapsi.c b/arch/mips/lib/bswapsi.c index 02d9df4..2ed6554 100644 --- a/arch/mips/lib/bswapsi.c +++ b/arch/mips/lib/bswapsi.c @@ -1,15 +1,13 @@ // SPDX-License-Identifier: GPL-2.0 #include #include +#include /* To silence -Wmissing-prototypes. */ unsigned int __bswapsi2(unsigned int u); unsigned int notrace __bswapsi2(unsigned int u) { - return (((u) & 0xff000000) >> 24) | - (((u) & 0x00ff0000) >> 8) | - (((u) & 0x0000ff00) << 8) | - (((u) & 0x000000ff) << 24); + return ___constant_swab32(u); } EXPORT_SYMBOL(__bswapsi2);