public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/6] m68k: math-emu: Miscellaneous esthetical improvements
@ 2023-08-17 14:44 Geert Uytterhoeven
  2023-08-17 14:44 ` [PATCH 1/6] m68k: math-emu: Fix incorrect file reference in fp_log.c Geert Uytterhoeven
                   ` (5 more replies)
  0 siblings, 6 replies; 7+ messages in thread
From: Geert Uytterhoeven @ 2023-08-17 14:44 UTC (permalink / raw)
  To: linux-m68k; +Cc: Arnd Bergmann, linux-kernel, Geert Uytterhoeven

	Hi all,

This patch series contains miscellaneous esthetical improvements for the
Linux/m68k floating point emulator.  They have no functional impact.
The main objective is to get rid of the compiler warnings when building
with W=1.

I plan to queue this in the m68k tree rather sooner than later.

Thanks for your comments!

Geert Uytterhoeven (6):
  m68k: math-emu: Fix incorrect file reference in fp_log.c
  m68k: math-emu: Sanitize include guards
  m68k: math-emu: Make multi_arith.h self-contained
  m68k: math-emu: Replace external declarations by header inclusion
  m68k: math-emu: Reformat function and variable headers
  m68k: math-emu: Add missing prototypes

 arch/m68k/math-emu/fp_arith.c    | 49 ++++++++++-------------------
 arch/m68k/math-emu/fp_arith.h    | 49 +++++++++++------------------
 arch/m68k/math-emu/fp_log.c      | 46 ++++++++++-----------------
 arch/m68k/math-emu/fp_log.h      | 44 ++++++++++++++++++++++++++
 arch/m68k/math-emu/fp_trig.c     | 54 +++++++++++---------------------
 arch/m68k/math-emu/fp_trig.h     | 25 +++++++++++++--
 arch/m68k/math-emu/multi_arith.h |  8 +++--
 7 files changed, 142 insertions(+), 133 deletions(-)
 create mode 100644 arch/m68k/math-emu/fp_log.h

-- 
2.34.1

Gr{oetje,eeting}s,

						Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
							    -- Linus Torvalds

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

* [PATCH 1/6] m68k: math-emu: Fix incorrect file reference in fp_log.c
  2023-08-17 14:44 [PATCH 0/6] m68k: math-emu: Miscellaneous esthetical improvements Geert Uytterhoeven
@ 2023-08-17 14:44 ` Geert Uytterhoeven
  2023-08-17 14:44 ` [PATCH 2/6] m68k: math-emu: Sanitize include guards Geert Uytterhoeven
                   ` (4 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: Geert Uytterhoeven @ 2023-08-17 14:44 UTC (permalink / raw)
  To: linux-m68k; +Cc: Arnd Bergmann, linux-kernel, Geert Uytterhoeven

The file comment header refers to the wrong file.

Signed-off-by: Geert Uytterhoeven <geert@linux-m68k.org>
---
 arch/m68k/math-emu/fp_log.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/m68k/math-emu/fp_log.c b/arch/m68k/math-emu/fp_log.c
index 0663067870f2a916..a8eac8c81757d22e 100644
--- a/arch/m68k/math-emu/fp_log.c
+++ b/arch/m68k/math-emu/fp_log.c
@@ -1,6 +1,6 @@
 /*
 
-  fp_trig.c: floating-point math routines for the Linux-m68k
+  fp_log.c: floating-point math routines for the Linux-m68k
   floating point emulator.
 
   Copyright (c) 1998-1999 David Huggins-Daines / Roman Zippel.
-- 
2.34.1


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

* [PATCH 2/6] m68k: math-emu: Sanitize include guards
  2023-08-17 14:44 [PATCH 0/6] m68k: math-emu: Miscellaneous esthetical improvements Geert Uytterhoeven
  2023-08-17 14:44 ` [PATCH 1/6] m68k: math-emu: Fix incorrect file reference in fp_log.c Geert Uytterhoeven
@ 2023-08-17 14:44 ` Geert Uytterhoeven
  2023-08-17 14:44 ` [PATCH 3/6] m68k: math-emu: Make multi_arith.h self-contained Geert Uytterhoeven
                   ` (3 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: Geert Uytterhoeven @ 2023-08-17 14:44 UTC (permalink / raw)
  To: linux-m68k; +Cc: Arnd Bergmann, linux-kernel, Geert Uytterhoeven

Some include guards start with an underscore, others don't.
Some comments do not match the actual include guard.

Make them uniform, adhering to the "FP_<FOO>_H" format.

Signed-off-by: Geert Uytterhoeven <geert@linux-m68k.org>
---
 arch/m68k/math-emu/fp_arith.h    | 6 +++---
 arch/m68k/math-emu/fp_trig.h     | 6 +++---
 arch/m68k/math-emu/multi_arith.h | 6 +++---
 3 files changed, 9 insertions(+), 9 deletions(-)

diff --git a/arch/m68k/math-emu/fp_arith.h b/arch/m68k/math-emu/fp_arith.h
index 0fd3ed217f668652..85bdd83b9dd667a8 100644
--- a/arch/m68k/math-emu/fp_arith.h
+++ b/arch/m68k/math-emu/fp_arith.h
@@ -12,8 +12,8 @@
 
  */
 
-#ifndef FP_ARITH_H
-#define FP_ARITH_H
+#ifndef _FP_ARITH_H
+#define _FP_ARITH_H
 
 /* easy ones */
 struct fp_ext *
@@ -47,4 +47,4 @@ fp_fintrz(struct fp_ext *dest, struct fp_ext *src);
 struct fp_ext *
 fp_fscale(struct fp_ext *dest, struct fp_ext *src);
 
-#endif	/* FP_ARITH__H */
+#endif	/* _FP_ARITH_H */
diff --git a/arch/m68k/math-emu/fp_trig.h b/arch/m68k/math-emu/fp_trig.h
index af8b247e9c982874..52f0cc31cfe49cb7 100644
--- a/arch/m68k/math-emu/fp_trig.h
+++ b/arch/m68k/math-emu/fp_trig.h
@@ -15,8 +15,8 @@
 
 */
 
-#ifndef FP_TRIG_H
-#define FP_TRIG_H
+#ifndef _FP_TRIG_H
+#define _FP_TRIG_H
 
 #include "fp_emu.h"
 
@@ -29,4 +29,4 @@
    they return a status code, which should end up in %d0, if all goes
    well.  */
 
-#endif /* FP_TRIG__H */
+#endif /* _FP_TRIG_H */
diff --git a/arch/m68k/math-emu/multi_arith.h b/arch/m68k/math-emu/multi_arith.h
index 232f58fe3483d2be..ed2434fcfb1ef46e 100644
--- a/arch/m68k/math-emu/multi_arith.h
+++ b/arch/m68k/math-emu/multi_arith.h
@@ -15,8 +15,8 @@
    implement the subset of integer arithmetic that we need in order to
    multiply, divide, and normalize 128-bit unsigned mantissae.  */
 
-#ifndef MULTI_ARITH_H
-#define MULTI_ARITH_H
+#ifndef _MULTI_ARITH_H
+#define _MULTI_ARITH_H
 
 static inline void fp_denormalize(struct fp_ext *reg, unsigned int cnt)
 {
@@ -285,4 +285,4 @@ static inline void fp_putmant128(struct fp_ext *dest, union fp_mant128 *src,
 	}
 }
 
-#endif	/* MULTI_ARITH_H */
+#endif	/* _MULTI_ARITH_H */
-- 
2.34.1


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

* [PATCH 3/6] m68k: math-emu: Make multi_arith.h self-contained
  2023-08-17 14:44 [PATCH 0/6] m68k: math-emu: Miscellaneous esthetical improvements Geert Uytterhoeven
  2023-08-17 14:44 ` [PATCH 1/6] m68k: math-emu: Fix incorrect file reference in fp_log.c Geert Uytterhoeven
  2023-08-17 14:44 ` [PATCH 2/6] m68k: math-emu: Sanitize include guards Geert Uytterhoeven
@ 2023-08-17 14:44 ` Geert Uytterhoeven
  2023-08-17 14:44 ` [PATCH 4/6] m68k: math-emu: Replace external declarations by header inclusion Geert Uytterhoeven
                   ` (2 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: Geert Uytterhoeven @ 2023-08-17 14:44 UTC (permalink / raw)
  To: linux-m68k; +Cc: Arnd Bergmann, linux-kernel, Geert Uytterhoeven

Add the missing #include "fp_emu.h".

Signed-off-by: Geert Uytterhoeven <geert@linux-m68k.org>
---
 arch/m68k/math-emu/multi_arith.h | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/arch/m68k/math-emu/multi_arith.h b/arch/m68k/math-emu/multi_arith.h
index ed2434fcfb1ef46e..f7d9e49fe259d8c9 100644
--- a/arch/m68k/math-emu/multi_arith.h
+++ b/arch/m68k/math-emu/multi_arith.h
@@ -18,6 +18,8 @@
 #ifndef _MULTI_ARITH_H
 #define _MULTI_ARITH_H
 
+#include "fp_emu.h"
+
 static inline void fp_denormalize(struct fp_ext *reg, unsigned int cnt)
 {
 	reg->exp += cnt;
-- 
2.34.1


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

* [PATCH 4/6] m68k: math-emu: Replace external declarations by header inclusion
  2023-08-17 14:44 [PATCH 0/6] m68k: math-emu: Miscellaneous esthetical improvements Geert Uytterhoeven
                   ` (2 preceding siblings ...)
  2023-08-17 14:44 ` [PATCH 3/6] m68k: math-emu: Make multi_arith.h self-contained Geert Uytterhoeven
@ 2023-08-17 14:44 ` Geert Uytterhoeven
  2023-08-17 14:44 ` [PATCH 5/6] m68k: math-emu: Reformat function and variable headers Geert Uytterhoeven
  2023-08-17 14:44 ` [PATCH 6/6] m68k: math-emu: Add missing prototypes Geert Uytterhoeven
  5 siblings, 0 replies; 7+ messages in thread
From: Geert Uytterhoeven @ 2023-08-17 14:44 UTC (permalink / raw)
  To: linux-m68k; +Cc: Arnd Bergmann, linux-kernel, Geert Uytterhoeven

Replace the (incorrect) external declarations by an inclusion of the
appropriate header file.

Semantically, the "src" parameters of the various fp_*() functions are
constant.  However, they cannot actually be const as most of these
functions perform a normalization step first.  As the fp_one constant
passed to fp_add() is already normalized, it is safe to cast away its
constness when making the function call.

Signed-off-by: Geert Uytterhoeven <geert@linux-m68k.org>
---
 arch/m68k/math-emu/fp_log.c | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)

diff --git a/arch/m68k/math-emu/fp_log.c b/arch/m68k/math-emu/fp_log.c
index a8eac8c81757d22e..2426634c4ba74377 100644
--- a/arch/m68k/math-emu/fp_log.c
+++ b/arch/m68k/math-emu/fp_log.c
@@ -15,6 +15,7 @@
 
 */
 
+#include "fp_arith.h"
 #include "fp_emu.h"
 
 static const struct fp_ext fp_one =
@@ -22,9 +23,6 @@ static const struct fp_ext fp_one =
 	.exp = 0x3fff,
 };
 
-extern struct fp_ext *fp_fadd(struct fp_ext *dest, const struct fp_ext *src);
-extern struct fp_ext *fp_fdiv(struct fp_ext *dest, const struct fp_ext *src);
-
 struct fp_ext *
 fp_fsqrt(struct fp_ext *dest, struct fp_ext *src)
 {
@@ -70,7 +68,8 @@ fp_fsqrt(struct fp_ext *dest, struct fp_ext *src)
 	 *	sqrt(x) = 1 + 1/2*(x-1)
 	 *		= 1/2*(1+x)
 	 */
-	fp_fadd(dest, &fp_one);
+	/* It is safe to cast away the constness, as fp_one is normalized */
+	fp_fadd(dest, (struct fp_ext *)&fp_one);
 	dest->exp--;		/* * 1/2 */
 
 	/*
-- 
2.34.1


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

* [PATCH 5/6] m68k: math-emu: Reformat function and variable headers
  2023-08-17 14:44 [PATCH 0/6] m68k: math-emu: Miscellaneous esthetical improvements Geert Uytterhoeven
                   ` (3 preceding siblings ...)
  2023-08-17 14:44 ` [PATCH 4/6] m68k: math-emu: Replace external declarations by header inclusion Geert Uytterhoeven
@ 2023-08-17 14:44 ` Geert Uytterhoeven
  2023-08-17 14:44 ` [PATCH 6/6] m68k: math-emu: Add missing prototypes Geert Uytterhoeven
  5 siblings, 0 replies; 7+ messages in thread
From: Geert Uytterhoeven @ 2023-08-17 14:44 UTC (permalink / raw)
  To: linux-m68k; +Cc: Arnd Bergmann, linux-kernel, Geert Uytterhoeven

Make the code shorter and easier to read.

Signed-off-by: Geert Uytterhoeven <geert@linux-m68k.org>
---
 arch/m68k/math-emu/fp_arith.c | 49 +++++++++++--------------------
 arch/m68k/math-emu/fp_arith.h | 39 +++++++++----------------
 arch/m68k/math-emu/fp_log.c   | 36 ++++++++---------------
 arch/m68k/math-emu/fp_trig.c  | 54 ++++++++++++-----------------------
 4 files changed, 60 insertions(+), 118 deletions(-)

diff --git a/arch/m68k/math-emu/fp_arith.c b/arch/m68k/math-emu/fp_arith.c
index f4a06492cd7a118a..799c450fe3223955 100644
--- a/arch/m68k/math-emu/fp_arith.c
+++ b/arch/m68k/math-emu/fp_arith.c
@@ -28,8 +28,7 @@ const struct fp_ext fp_Inf =
 
 /* let's start with the easy ones */
 
-struct fp_ext *
-fp_fabs(struct fp_ext *dest, struct fp_ext *src)
+struct fp_ext *fp_fabs(struct fp_ext *dest, struct fp_ext *src)
 {
 	dprint(PINSTR, "fabs\n");
 
@@ -40,8 +39,7 @@ fp_fabs(struct fp_ext *dest, struct fp_ext *src)
 	return dest;
 }
 
-struct fp_ext *
-fp_fneg(struct fp_ext *dest, struct fp_ext *src)
+struct fp_ext *fp_fneg(struct fp_ext *dest, struct fp_ext *src)
 {
 	dprint(PINSTR, "fneg\n");
 
@@ -57,8 +55,7 @@ fp_fneg(struct fp_ext *dest, struct fp_ext *src)
 /* fp_fadd: Implements the kernel of the FADD, FSADD, FDADD, FSUB,
    FDSUB, and FCMP instructions. */
 
-struct fp_ext *
-fp_fadd(struct fp_ext *dest, struct fp_ext *src)
+struct fp_ext *fp_fadd(struct fp_ext *dest, struct fp_ext *src)
 {
 	int diff;
 
@@ -117,8 +114,7 @@ fp_fadd(struct fp_ext *dest, struct fp_ext *src)
 
    Remember that the arguments are in assembler-syntax order! */
 
-struct fp_ext *
-fp_fsub(struct fp_ext *dest, struct fp_ext *src)
+struct fp_ext *fp_fsub(struct fp_ext *dest, struct fp_ext *src)
 {
 	dprint(PINSTR, "fsub ");
 
@@ -127,8 +123,7 @@ fp_fsub(struct fp_ext *dest, struct fp_ext *src)
 }
 
 
-struct fp_ext *
-fp_fcmp(struct fp_ext *dest, struct fp_ext *src)
+struct fp_ext *fp_fcmp(struct fp_ext *dest, struct fp_ext *src)
 {
 	dprint(PINSTR, "fcmp ");
 
@@ -137,8 +132,7 @@ fp_fcmp(struct fp_ext *dest, struct fp_ext *src)
 	return fp_fadd(&FPDATA->temp[1], src);
 }
 
-struct fp_ext *
-fp_ftst(struct fp_ext *dest, struct fp_ext *src)
+struct fp_ext *fp_ftst(struct fp_ext *dest, struct fp_ext *src)
 {
 	dprint(PINSTR, "ftst\n");
 
@@ -147,8 +141,7 @@ fp_ftst(struct fp_ext *dest, struct fp_ext *src)
 	return src;
 }
 
-struct fp_ext *
-fp_fmul(struct fp_ext *dest, struct fp_ext *src)
+struct fp_ext *fp_fmul(struct fp_ext *dest, struct fp_ext *src)
 {
 	union fp_mant128 temp;
 	int exp;
@@ -225,8 +218,7 @@ fp_fmul(struct fp_ext *dest, struct fp_ext *src)
    Note that the order of the operands is counter-intuitive: instead
    of src / dest, the result is actually dest / src. */
 
-struct fp_ext *
-fp_fdiv(struct fp_ext *dest, struct fp_ext *src)
+struct fp_ext *fp_fdiv(struct fp_ext *dest, struct fp_ext *src)
 {
 	union fp_mant128 temp;
 	int exp;
@@ -306,8 +298,7 @@ fp_fdiv(struct fp_ext *dest, struct fp_ext *src)
 	return dest;
 }
 
-struct fp_ext *
-fp_fsglmul(struct fp_ext *dest, struct fp_ext *src)
+struct fp_ext *fp_fsglmul(struct fp_ext *dest, struct fp_ext *src)
 {
 	int exp;
 
@@ -363,8 +354,7 @@ fp_fsglmul(struct fp_ext *dest, struct fp_ext *src)
 	return dest;
 }
 
-struct fp_ext *
-fp_fsgldiv(struct fp_ext *dest, struct fp_ext *src)
+struct fp_ext *fp_fsgldiv(struct fp_ext *dest, struct fp_ext *src)
 {
 	int exp;
 	unsigned long quot, rem;
@@ -573,8 +563,8 @@ static void fp_roundint(struct fp_ext *dest, int mode)
    (which are exactly the same, except for the rounding used on the
    intermediate value) */
 
-static struct fp_ext *
-modrem_kernel(struct fp_ext *dest, struct fp_ext *src, int mode)
+static struct fp_ext *modrem_kernel(struct fp_ext *dest, struct fp_ext *src,
+				    int mode)
 {
 	struct fp_ext tmp;
 
@@ -607,8 +597,7 @@ modrem_kernel(struct fp_ext *dest, struct fp_ext *src, int mode)
 
    fmod(src,dest) = (dest - (src * floor(dest / src))) */
 
-struct fp_ext *
-fp_fmod(struct fp_ext *dest, struct fp_ext *src)
+struct fp_ext *fp_fmod(struct fp_ext *dest, struct fp_ext *src)
 {
 	dprint(PINSTR, "fmod\n");
 	return modrem_kernel(dest, src, FPCR_ROUND_RZ);
@@ -619,15 +608,13 @@ fp_fmod(struct fp_ext *dest, struct fp_ext *src)
    frem(src,dest) = (dest - (src * round(dest / src)))
  */
 
-struct fp_ext *
-fp_frem(struct fp_ext *dest, struct fp_ext *src)
+struct fp_ext *fp_frem(struct fp_ext *dest, struct fp_ext *src)
 {
 	dprint(PINSTR, "frem\n");
 	return modrem_kernel(dest, src, FPCR_ROUND_RN);
 }
 
-struct fp_ext *
-fp_fint(struct fp_ext *dest, struct fp_ext *src)
+struct fp_ext *fp_fint(struct fp_ext *dest, struct fp_ext *src)
 {
 	dprint(PINSTR, "fint\n");
 
@@ -638,8 +625,7 @@ fp_fint(struct fp_ext *dest, struct fp_ext *src)
 	return dest;
 }
 
-struct fp_ext *
-fp_fintrz(struct fp_ext *dest, struct fp_ext *src)
+struct fp_ext *fp_fintrz(struct fp_ext *dest, struct fp_ext *src)
 {
 	dprint(PINSTR, "fintrz\n");
 
@@ -650,8 +636,7 @@ fp_fintrz(struct fp_ext *dest, struct fp_ext *src)
 	return dest;
 }
 
-struct fp_ext *
-fp_fscale(struct fp_ext *dest, struct fp_ext *src)
+struct fp_ext *fp_fscale(struct fp_ext *dest, struct fp_ext *src)
 {
 	int scale, oldround;
 
diff --git a/arch/m68k/math-emu/fp_arith.h b/arch/m68k/math-emu/fp_arith.h
index 85bdd83b9dd667a8..65b11e3f452db9d6 100644
--- a/arch/m68k/math-emu/fp_arith.h
+++ b/arch/m68k/math-emu/fp_arith.h
@@ -16,35 +16,22 @@
 #define _FP_ARITH_H
 
 /* easy ones */
-struct fp_ext *
-fp_fabs(struct fp_ext *dest, struct fp_ext *src);
-struct fp_ext *
-fp_fneg(struct fp_ext *dest, struct fp_ext *src);
+struct fp_ext *fp_fabs(struct fp_ext *dest, struct fp_ext *src);
+struct fp_ext *fp_fneg(struct fp_ext *dest, struct fp_ext *src);
 
 /* straightforward arithmetic */
-struct fp_ext *
-fp_fadd(struct fp_ext *dest, struct fp_ext *src);
-struct fp_ext *
-fp_fsub(struct fp_ext *dest, struct fp_ext *src);
-struct fp_ext *
-fp_fcmp(struct fp_ext *dest, struct fp_ext *src);
-struct fp_ext *
-fp_ftst(struct fp_ext *dest, struct fp_ext *src);
-struct fp_ext *
-fp_fmul(struct fp_ext *dest, struct fp_ext *src);
-struct fp_ext *
-fp_fdiv(struct fp_ext *dest, struct fp_ext *src);
+struct fp_ext *fp_fadd(struct fp_ext *dest, struct fp_ext *src);
+struct fp_ext *fp_fsub(struct fp_ext *dest, struct fp_ext *src);
+struct fp_ext *fp_fcmp(struct fp_ext *dest, struct fp_ext *src);
+struct fp_ext *fp_ftst(struct fp_ext *dest, struct fp_ext *src);
+struct fp_ext *fp_fmul(struct fp_ext *dest, struct fp_ext *src);
+struct fp_ext *fp_fdiv(struct fp_ext *dest, struct fp_ext *src);
 
 /* ones that do rounding and integer conversions */
-struct fp_ext *
-fp_fmod(struct fp_ext *dest, struct fp_ext *src);
-struct fp_ext *
-fp_frem(struct fp_ext *dest, struct fp_ext *src);
-struct fp_ext *
-fp_fint(struct fp_ext *dest, struct fp_ext *src);
-struct fp_ext *
-fp_fintrz(struct fp_ext *dest, struct fp_ext *src);
-struct fp_ext *
-fp_fscale(struct fp_ext *dest, struct fp_ext *src);
+struct fp_ext *fp_fmod(struct fp_ext *dest, struct fp_ext *src);
+struct fp_ext *fp_frem(struct fp_ext *dest, struct fp_ext *src);
+struct fp_ext *fp_fint(struct fp_ext *dest, struct fp_ext *src);
+struct fp_ext *fp_fintrz(struct fp_ext *dest, struct fp_ext *src);
+struct fp_ext *fp_fscale(struct fp_ext *dest, struct fp_ext *src);
 
 #endif	/* _FP_ARITH_H */
diff --git a/arch/m68k/math-emu/fp_log.c b/arch/m68k/math-emu/fp_log.c
index 2426634c4ba74377..9f93efd5ef496770 100644
--- a/arch/m68k/math-emu/fp_log.c
+++ b/arch/m68k/math-emu/fp_log.c
@@ -18,13 +18,11 @@
 #include "fp_arith.h"
 #include "fp_emu.h"
 
-static const struct fp_ext fp_one =
-{
+static const struct fp_ext fp_one = {
 	.exp = 0x3fff,
 };
 
-struct fp_ext *
-fp_fsqrt(struct fp_ext *dest, struct fp_ext *src)
+struct fp_ext *fp_fsqrt(struct fp_ext *dest, struct fp_ext *src)
 {
 	struct fp_ext tmp, src2;
 	int i, exp;
@@ -97,8 +95,7 @@ fp_fsqrt(struct fp_ext *dest, struct fp_ext *src)
 	return dest;
 }
 
-struct fp_ext *
-fp_fetoxm1(struct fp_ext *dest, struct fp_ext *src)
+struct fp_ext *fp_fetoxm1(struct fp_ext *dest, struct fp_ext *src)
 {
 	uprint("fetoxm1\n");
 
@@ -107,8 +104,7 @@ fp_fetoxm1(struct fp_ext *dest, struct fp_ext *src)
 	return dest;
 }
 
-struct fp_ext *
-fp_fetox(struct fp_ext *dest, struct fp_ext *src)
+struct fp_ext *fp_fetox(struct fp_ext *dest, struct fp_ext *src)
 {
 	uprint("fetox\n");
 
@@ -117,8 +113,7 @@ fp_fetox(struct fp_ext *dest, struct fp_ext *src)
 	return dest;
 }
 
-struct fp_ext *
-fp_ftwotox(struct fp_ext *dest, struct fp_ext *src)
+struct fp_ext *fp_ftwotox(struct fp_ext *dest, struct fp_ext *src)
 {
 	uprint("ftwotox\n");
 
@@ -127,8 +122,7 @@ fp_ftwotox(struct fp_ext *dest, struct fp_ext *src)
 	return dest;
 }
 
-struct fp_ext *
-fp_ftentox(struct fp_ext *dest, struct fp_ext *src)
+struct fp_ext *fp_ftentox(struct fp_ext *dest, struct fp_ext *src)
 {
 	uprint("ftentox\n");
 
@@ -137,8 +131,7 @@ fp_ftentox(struct fp_ext *dest, struct fp_ext *src)
 	return dest;
 }
 
-struct fp_ext *
-fp_flogn(struct fp_ext *dest, struct fp_ext *src)
+struct fp_ext *fp_flogn(struct fp_ext *dest, struct fp_ext *src)
 {
 	uprint("flogn\n");
 
@@ -147,8 +140,7 @@ fp_flogn(struct fp_ext *dest, struct fp_ext *src)
 	return dest;
 }
 
-struct fp_ext *
-fp_flognp1(struct fp_ext *dest, struct fp_ext *src)
+struct fp_ext *fp_flognp1(struct fp_ext *dest, struct fp_ext *src)
 {
 	uprint("flognp1\n");
 
@@ -157,8 +149,7 @@ fp_flognp1(struct fp_ext *dest, struct fp_ext *src)
 	return dest;
 }
 
-struct fp_ext *
-fp_flog10(struct fp_ext *dest, struct fp_ext *src)
+struct fp_ext *fp_flog10(struct fp_ext *dest, struct fp_ext *src)
 {
 	uprint("flog10\n");
 
@@ -167,8 +158,7 @@ fp_flog10(struct fp_ext *dest, struct fp_ext *src)
 	return dest;
 }
 
-struct fp_ext *
-fp_flog2(struct fp_ext *dest, struct fp_ext *src)
+struct fp_ext *fp_flog2(struct fp_ext *dest, struct fp_ext *src)
 {
 	uprint("flog2\n");
 
@@ -177,8 +167,7 @@ fp_flog2(struct fp_ext *dest, struct fp_ext *src)
 	return dest;
 }
 
-struct fp_ext *
-fp_fgetexp(struct fp_ext *dest, struct fp_ext *src)
+struct fp_ext *fp_fgetexp(struct fp_ext *dest, struct fp_ext *src)
 {
 	dprint(PINSTR, "fgetexp\n");
 
@@ -198,8 +187,7 @@ fp_fgetexp(struct fp_ext *dest, struct fp_ext *src)
 	return dest;
 }
 
-struct fp_ext *
-fp_fgetman(struct fp_ext *dest, struct fp_ext *src)
+struct fp_ext *fp_fgetman(struct fp_ext *dest, struct fp_ext *src)
 {
 	dprint(PINSTR, "fgetman\n");
 
diff --git a/arch/m68k/math-emu/fp_trig.c b/arch/m68k/math-emu/fp_trig.c
index 6361d0784df2aa0e..5f49de3737536af3 100644
--- a/arch/m68k/math-emu/fp_trig.c
+++ b/arch/m68k/math-emu/fp_trig.c
@@ -18,8 +18,7 @@
 #include "fp_emu.h"
 #include "fp_trig.h"
 
-struct fp_ext *
-fp_fsin(struct fp_ext *dest, struct fp_ext *src)
+struct fp_ext *fp_fsin(struct fp_ext *dest, struct fp_ext *src)
 {
 	uprint("fsin\n");
 
@@ -28,8 +27,7 @@ fp_fsin(struct fp_ext *dest, struct fp_ext *src)
 	return dest;
 }
 
-struct fp_ext *
-fp_fcos(struct fp_ext *dest, struct fp_ext *src)
+struct fp_ext *fp_fcos(struct fp_ext *dest, struct fp_ext *src)
 {
 	uprint("fcos\n");
 
@@ -38,8 +36,7 @@ fp_fcos(struct fp_ext *dest, struct fp_ext *src)
 	return dest;
 }
 
-struct fp_ext *
-fp_ftan(struct fp_ext *dest, struct fp_ext *src)
+struct fp_ext *fp_ftan(struct fp_ext *dest, struct fp_ext *src)
 {
 	uprint("ftan\n");
 
@@ -48,8 +45,7 @@ fp_ftan(struct fp_ext *dest, struct fp_ext *src)
 	return dest;
 }
 
-struct fp_ext *
-fp_fasin(struct fp_ext *dest, struct fp_ext *src)
+struct fp_ext *fp_fasin(struct fp_ext *dest, struct fp_ext *src)
 {
 	uprint("fasin\n");
 
@@ -58,8 +54,7 @@ fp_fasin(struct fp_ext *dest, struct fp_ext *src)
 	return dest;
 }
 
-struct fp_ext *
-fp_facos(struct fp_ext *dest, struct fp_ext *src)
+struct fp_ext *fp_facos(struct fp_ext *dest, struct fp_ext *src)
 {
 	uprint("facos\n");
 
@@ -68,8 +63,7 @@ fp_facos(struct fp_ext *dest, struct fp_ext *src)
 	return dest;
 }
 
-struct fp_ext *
-fp_fatan(struct fp_ext *dest, struct fp_ext *src)
+struct fp_ext *fp_fatan(struct fp_ext *dest, struct fp_ext *src)
 {
 	uprint("fatan\n");
 
@@ -78,8 +72,7 @@ fp_fatan(struct fp_ext *dest, struct fp_ext *src)
 	return dest;
 }
 
-struct fp_ext *
-fp_fsinh(struct fp_ext *dest, struct fp_ext *src)
+struct fp_ext *fp_fsinh(struct fp_ext *dest, struct fp_ext *src)
 {
 	uprint("fsinh\n");
 
@@ -88,8 +81,7 @@ fp_fsinh(struct fp_ext *dest, struct fp_ext *src)
 	return dest;
 }
 
-struct fp_ext *
-fp_fcosh(struct fp_ext *dest, struct fp_ext *src)
+struct fp_ext *fp_fcosh(struct fp_ext *dest, struct fp_ext *src)
 {
 	uprint("fcosh\n");
 
@@ -98,8 +90,7 @@ fp_fcosh(struct fp_ext *dest, struct fp_ext *src)
 	return dest;
 }
 
-struct fp_ext *
-fp_ftanh(struct fp_ext *dest, struct fp_ext *src)
+struct fp_ext *fp_ftanh(struct fp_ext *dest, struct fp_ext *src)
 {
 	uprint("ftanh\n");
 
@@ -108,8 +99,7 @@ fp_ftanh(struct fp_ext *dest, struct fp_ext *src)
 	return dest;
 }
 
-struct fp_ext *
-fp_fatanh(struct fp_ext *dest, struct fp_ext *src)
+struct fp_ext *fp_fatanh(struct fp_ext *dest, struct fp_ext *src)
 {
 	uprint("fatanh\n");
 
@@ -118,64 +108,56 @@ fp_fatanh(struct fp_ext *dest, struct fp_ext *src)
 	return dest;
 }
 
-struct fp_ext *
-fp_fsincos0(struct fp_ext *dest, struct fp_ext *src)
+struct fp_ext *fp_fsincos0(struct fp_ext *dest, struct fp_ext *src)
 {
 	uprint("fsincos0\n");
 
 	return dest;
 }
 
-struct fp_ext *
-fp_fsincos1(struct fp_ext *dest, struct fp_ext *src)
+struct fp_ext *fp_fsincos1(struct fp_ext *dest, struct fp_ext *src)
 {
 	uprint("fsincos1\n");
 
 	return dest;
 }
 
-struct fp_ext *
-fp_fsincos2(struct fp_ext *dest, struct fp_ext *src)
+struct fp_ext *fp_fsincos2(struct fp_ext *dest, struct fp_ext *src)
 {
 	uprint("fsincos2\n");
 
 	return dest;
 }
 
-struct fp_ext *
-fp_fsincos3(struct fp_ext *dest, struct fp_ext *src)
+struct fp_ext *fp_fsincos3(struct fp_ext *dest, struct fp_ext *src)
 {
 	uprint("fsincos3\n");
 
 	return dest;
 }
 
-struct fp_ext *
-fp_fsincos4(struct fp_ext *dest, struct fp_ext *src)
+struct fp_ext *fp_fsincos4(struct fp_ext *dest, struct fp_ext *src)
 {
 	uprint("fsincos4\n");
 
 	return dest;
 }
 
-struct fp_ext *
-fp_fsincos5(struct fp_ext *dest, struct fp_ext *src)
+struct fp_ext *fp_fsincos5(struct fp_ext *dest, struct fp_ext *src)
 {
 	uprint("fsincos5\n");
 
 	return dest;
 }
 
-struct fp_ext *
-fp_fsincos6(struct fp_ext *dest, struct fp_ext *src)
+struct fp_ext *fp_fsincos6(struct fp_ext *dest, struct fp_ext *src)
 {
 	uprint("fsincos6\n");
 
 	return dest;
 }
 
-struct fp_ext *
-fp_fsincos7(struct fp_ext *dest, struct fp_ext *src)
+struct fp_ext *fp_fsincos7(struct fp_ext *dest, struct fp_ext *src)
 {
 	uprint("fsincos7\n");
 
-- 
2.34.1


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

* [PATCH 6/6] m68k: math-emu: Add missing prototypes
  2023-08-17 14:44 [PATCH 0/6] m68k: math-emu: Miscellaneous esthetical improvements Geert Uytterhoeven
                   ` (4 preceding siblings ...)
  2023-08-17 14:44 ` [PATCH 5/6] m68k: math-emu: Reformat function and variable headers Geert Uytterhoeven
@ 2023-08-17 14:44 ` Geert Uytterhoeven
  5 siblings, 0 replies; 7+ messages in thread
From: Geert Uytterhoeven @ 2023-08-17 14:44 UTC (permalink / raw)
  To: linux-m68k; +Cc: Arnd Bergmann, linux-kernel, Geert Uytterhoeven

When building with W=1:

    arch/m68k/math-emu/fp_arith.c:301:16: warning: no previous prototype for ‘fp_fsglmul’ [-Wmissing-prototypes]
      301 | struct fp_ext *fp_fsglmul(struct fp_ext *dest, struct fp_ext *src)
	  |                ^~~~~~~~~~
    arch/m68k/math-emu/fp_arith.c:357:16: warning: no previous prototype for ‘fp_fsgldiv’ [-Wmissing-prototypes]
      357 | struct fp_ext *fp_fsgldiv(struct fp_ext *dest, struct fp_ext *src)
	  |                ^~~~~~~~~~
      CC      arch/m68k/math-emu/fp_log.o
    ...

Fix this by adding the missing prototypes to header files.

Reported-by: Arnd Bergmann <arnd@arndb.de>
Link: https://lore.kernel.org/r/20230810141947.1236730-17-arnd@kernel.org/
Signed-off-by: Geert Uytterhoeven <geert@linux-m68k.org>
---
 arch/m68k/math-emu/fp_arith.h |  2 ++
 arch/m68k/math-emu/fp_log.c   |  1 +
 arch/m68k/math-emu/fp_log.h   | 44 +++++++++++++++++++++++++++++++++++
 arch/m68k/math-emu/fp_trig.h  | 19 +++++++++++++++
 4 files changed, 66 insertions(+)
 create mode 100644 arch/m68k/math-emu/fp_log.h

diff --git a/arch/m68k/math-emu/fp_arith.h b/arch/m68k/math-emu/fp_arith.h
index 65b11e3f452db9d6..3f9c58b6d504f590 100644
--- a/arch/m68k/math-emu/fp_arith.h
+++ b/arch/m68k/math-emu/fp_arith.h
@@ -26,6 +26,8 @@ struct fp_ext *fp_fcmp(struct fp_ext *dest, struct fp_ext *src);
 struct fp_ext *fp_ftst(struct fp_ext *dest, struct fp_ext *src);
 struct fp_ext *fp_fmul(struct fp_ext *dest, struct fp_ext *src);
 struct fp_ext *fp_fdiv(struct fp_ext *dest, struct fp_ext *src);
+struct fp_ext *fp_fsglmul(struct fp_ext *dest, struct fp_ext *src);
+struct fp_ext *fp_fsgldiv(struct fp_ext *dest, struct fp_ext *src);
 
 /* ones that do rounding and integer conversions */
 struct fp_ext *fp_fmod(struct fp_ext *dest, struct fp_ext *src);
diff --git a/arch/m68k/math-emu/fp_log.c b/arch/m68k/math-emu/fp_log.c
index 9f93efd5ef496770..71a8fc25575af810 100644
--- a/arch/m68k/math-emu/fp_log.c
+++ b/arch/m68k/math-emu/fp_log.c
@@ -17,6 +17,7 @@
 
 #include "fp_arith.h"
 #include "fp_emu.h"
+#include "fp_log.h"
 
 static const struct fp_ext fp_one = {
 	.exp = 0x3fff,
diff --git a/arch/m68k/math-emu/fp_log.h b/arch/m68k/math-emu/fp_log.h
new file mode 100644
index 0000000000000000..c2bcfff11994cfb5
--- /dev/null
+++ b/arch/m68k/math-emu/fp_log.h
@@ -0,0 +1,44 @@
+/*
+
+  fp_log.h: floating-point math routines for the Linux-m68k
+  floating point emulator.
+
+  Copyright (c) 1998-1999 David Huggins-Daines / Roman Zippel.
+
+  I hereby give permission, free of charge, to copy, modify, and
+  redistribute this software, in source or binary form, provided that
+  the above copyright notice and the following disclaimer are included
+  in all such copies.
+
+  THIS SOFTWARE IS PROVIDED "AS IS", WITH ABSOLUTELY NO WARRANTY, REAL
+  OR IMPLIED.
+
+*/
+
+#ifndef _FP_LOG_H
+#define _FP_LOG_H
+
+#include "fp_emu.h"
+
+/* floating point logarithmic instructions:
+
+   the arguments to these are in the "internal" extended format, that
+   is, an "exploded" version of the 96-bit extended fp format used by
+   the 68881.
+
+   they return a status code, which should end up in %d0, if all goes
+   well.  */
+
+struct fp_ext *fp_fsqrt(struct fp_ext *dest, struct fp_ext *src);
+struct fp_ext *fp_fetoxm1(struct fp_ext *dest, struct fp_ext *src);
+struct fp_ext *fp_fetox(struct fp_ext *dest, struct fp_ext *src);
+struct fp_ext *fp_ftwotox(struct fp_ext *dest, struct fp_ext *src);
+struct fp_ext *fp_ftentox(struct fp_ext *dest, struct fp_ext *src);
+struct fp_ext *fp_flogn(struct fp_ext *dest, struct fp_ext *src);
+struct fp_ext *fp_flognp1(struct fp_ext *dest, struct fp_ext *src);
+struct fp_ext *fp_flog10(struct fp_ext *dest, struct fp_ext *src);
+struct fp_ext *fp_flog2(struct fp_ext *dest, struct fp_ext *src);
+struct fp_ext *fp_fgetexp(struct fp_ext *dest, struct fp_ext *src);
+struct fp_ext *fp_fgetman(struct fp_ext *dest, struct fp_ext *src);
+
+#endif /* _FP_LOG_H */
diff --git a/arch/m68k/math-emu/fp_trig.h b/arch/m68k/math-emu/fp_trig.h
index 52f0cc31cfe49cb7..1aae8ab1d41b15f2 100644
--- a/arch/m68k/math-emu/fp_trig.h
+++ b/arch/m68k/math-emu/fp_trig.h
@@ -29,4 +29,23 @@
    they return a status code, which should end up in %d0, if all goes
    well.  */
 
+struct fp_ext *fp_fsin(struct fp_ext *dest, struct fp_ext *src);
+struct fp_ext *fp_fcos(struct fp_ext *dest, struct fp_ext *src);
+struct fp_ext *fp_ftan(struct fp_ext *dest, struct fp_ext *src);
+struct fp_ext *fp_fasin(struct fp_ext *dest, struct fp_ext *src);
+struct fp_ext *fp_facos(struct fp_ext *dest, struct fp_ext *src);
+struct fp_ext *fp_fatan(struct fp_ext *dest, struct fp_ext *src);
+struct fp_ext *fp_fsinh(struct fp_ext *dest, struct fp_ext *src);
+struct fp_ext *fp_fcosh(struct fp_ext *dest, struct fp_ext *src);
+struct fp_ext *fp_ftanh(struct fp_ext *dest, struct fp_ext *src);
+struct fp_ext *fp_fatanh(struct fp_ext *dest, struct fp_ext *src);
+struct fp_ext *fp_fsincos0(struct fp_ext *dest, struct fp_ext *src);
+struct fp_ext *fp_fsincos1(struct fp_ext *dest, struct fp_ext *src);
+struct fp_ext *fp_fsincos2(struct fp_ext *dest, struct fp_ext *src);
+struct fp_ext *fp_fsincos3(struct fp_ext *dest, struct fp_ext *src);
+struct fp_ext *fp_fsincos4(struct fp_ext *dest, struct fp_ext *src);
+struct fp_ext *fp_fsincos5(struct fp_ext *dest, struct fp_ext *src);
+struct fp_ext *fp_fsincos6(struct fp_ext *dest, struct fp_ext *src);
+struct fp_ext *fp_fsincos7(struct fp_ext *dest, struct fp_ext *src);
+
 #endif /* _FP_TRIG_H */
-- 
2.34.1


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

end of thread, other threads:[~2023-08-17 14:46 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-08-17 14:44 [PATCH 0/6] m68k: math-emu: Miscellaneous esthetical improvements Geert Uytterhoeven
2023-08-17 14:44 ` [PATCH 1/6] m68k: math-emu: Fix incorrect file reference in fp_log.c Geert Uytterhoeven
2023-08-17 14:44 ` [PATCH 2/6] m68k: math-emu: Sanitize include guards Geert Uytterhoeven
2023-08-17 14:44 ` [PATCH 3/6] m68k: math-emu: Make multi_arith.h self-contained Geert Uytterhoeven
2023-08-17 14:44 ` [PATCH 4/6] m68k: math-emu: Replace external declarations by header inclusion Geert Uytterhoeven
2023-08-17 14:44 ` [PATCH 5/6] m68k: math-emu: Reformat function and variable headers Geert Uytterhoeven
2023-08-17 14:44 ` [PATCH 6/6] m68k: math-emu: Add missing prototypes Geert Uytterhoeven

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox