linux-mips.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/2] Silence warning and simplify code
@ 2022-09-29  7:39 Tiezhu Yang
  2022-09-29  7:39 ` [PATCH 1/2] MIPS: Silence missing prototype warning Tiezhu Yang
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Tiezhu Yang @ 2022-09-29  7:39 UTC (permalink / raw)
  To: Thomas Bogendoerfer; +Cc: linux-mips, linux-kernel

Tiezhu Yang (2):
  MIPS: Silence missing prototype warning
  MIPS: Simplify __bswapdi2() and __bswapsi2()

 arch/mips/lib/bswapdi.c | 14 +++++---------
 arch/mips/lib/bswapsi.c | 10 +++++-----
 2 files changed, 10 insertions(+), 14 deletions(-)

-- 
2.1.0


^ permalink raw reply	[flat|nested] 4+ messages in thread

* [PATCH 1/2] MIPS: Silence missing prototype warning
  2022-09-29  7:39 [PATCH 0/2] Silence warning and simplify code Tiezhu Yang
@ 2022-09-29  7:39 ` Tiezhu Yang
  2022-09-29  7:39 ` [PATCH 2/2] MIPS: Simplify __bswapdi2() and __bswapsi2() Tiezhu Yang
  2022-09-30 14:59 ` [PATCH 0/2] Silence warning and simplify code Thomas Bogendoerfer
  2 siblings, 0 replies; 4+ messages in thread
From: Tiezhu Yang @ 2022-09-29  7:39 UTC (permalink / raw)
  To: Thomas Bogendoerfer; +Cc: linux-mips, linux-kernel

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 <lkp@intel.com>
Signed-off-by: Tiezhu Yang <yangtiezhu@loongson.cn>
---
 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 <linux/export.h>
 #include <linux/compiler.h>
 
+/* 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 <linux/export.h>
 #include <linux/compiler.h>
 
+/* 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);
-- 
2.1.0


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [PATCH 2/2] MIPS: Simplify __bswapdi2() and __bswapsi2()
  2022-09-29  7:39 [PATCH 0/2] Silence warning and simplify code Tiezhu Yang
  2022-09-29  7:39 ` [PATCH 1/2] MIPS: Silence missing prototype warning Tiezhu Yang
@ 2022-09-29  7:39 ` Tiezhu Yang
  2022-09-30 14:59 ` [PATCH 0/2] Silence warning and simplify code Thomas Bogendoerfer
  2 siblings, 0 replies; 4+ messages in thread
From: Tiezhu Yang @ 2022-09-29  7:39 UTC (permalink / raw)
  To: Thomas Bogendoerfer; +Cc: linux-mips, linux-kernel

Use macro definitions ___constant_swab64 and ___constant_swab32
to simplify __bswapdi2() and __bswapsi2().

Signed-off-by: Tiezhu Yang <yangtiezhu@loongson.cn>
---
 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 <linux/export.h>
 #include <linux/compiler.h>
+#include <uapi/linux/swab.h>
 
 /* 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 <linux/export.h>
 #include <linux/compiler.h>
+#include <uapi/linux/swab.h>
 
 /* 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);
-- 
2.1.0


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH 0/2] Silence warning and simplify code
  2022-09-29  7:39 [PATCH 0/2] Silence warning and simplify code Tiezhu Yang
  2022-09-29  7:39 ` [PATCH 1/2] MIPS: Silence missing prototype warning Tiezhu Yang
  2022-09-29  7:39 ` [PATCH 2/2] MIPS: Simplify __bswapdi2() and __bswapsi2() Tiezhu Yang
@ 2022-09-30 14:59 ` Thomas Bogendoerfer
  2 siblings, 0 replies; 4+ messages in thread
From: Thomas Bogendoerfer @ 2022-09-30 14:59 UTC (permalink / raw)
  To: Tiezhu Yang; +Cc: linux-mips, linux-kernel

On Thu, Sep 29, 2022 at 03:39:56PM +0800, Tiezhu Yang wrote:
> Tiezhu Yang (2):
>   MIPS: Silence missing prototype warning
>   MIPS: Simplify __bswapdi2() and __bswapsi2()
> 
>  arch/mips/lib/bswapdi.c | 14 +++++---------
>  arch/mips/lib/bswapsi.c | 10 +++++-----
>  2 files changed, 10 insertions(+), 14 deletions(-)

series applied to mips-next.

Thomas.

-- 
Crap can work. Given enough thrust pigs will fly, but it's not necessarily a
good idea.                                                [ RFC1925, 2.3 ]

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2022-09-30 15:16 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-09-29  7:39 [PATCH 0/2] Silence warning and simplify code Tiezhu Yang
2022-09-29  7:39 ` [PATCH 1/2] MIPS: Silence missing prototype warning Tiezhu Yang
2022-09-29  7:39 ` [PATCH 2/2] MIPS: Simplify __bswapdi2() and __bswapsi2() Tiezhu Yang
2022-09-30 14:59 ` [PATCH 0/2] Silence warning and simplify code Thomas Bogendoerfer

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).