Re: [PATCH] MIPS: Fix a longstanding error in div64.h

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi Nikolaus,

On 2021/4/6 下午8:42, H. Nikolaus Schaller wrote:
Am 06.04.2021 um 13:24 schrieb Huacai Chen <chenhuacai@xxxxxxxxxx>:

Only 32bit kernel need __div64_32(), but commit c21004cd5b4cb7d479514d4
("MIPS: Rewrite <asm/div64.h> to work with gcc 4.4.0.") makes it depend
on 64bit kernel by mistake. This patch fix this longstanding error.

Fixes: c21004cd5b4cb7d479514d4 ("MIPS: Rewrite <asm/div64.h> to work with gcc 4.4.0.")
Cc: stable@xxxxxxxxxxxxxxx
Signed-off-by: Huacai Chen <chenhuacai@xxxxxxxxxxx>
---
arch/mips/include/asm/div64.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/mips/include/asm/div64.h b/arch/mips/include/asm/div64.h
index dc5ea5736440..d199fe36eb46 100644
--- a/arch/mips/include/asm/div64.h
+++ b/arch/mips/include/asm/div64.h
@@ -11,7 +11,7 @@

#include <asm-generic/div64.h>

-#if BITS_PER_LONG == 64
+#if BITS_PER_LONG == 32

#include <linux/types.h>
Hm.

Ingenic jz4780/CI20 build attempt on top ov v5.12-rc6:

In file included from ./include/linux/math64.h:7:0,
                  from ./include/linux/time.h:6,
                  from ./include/linux/compat.h:10,
                  from arch/mips/kernel/asm-offsets.c:12:
./include/linux/math64.h: In function 'div_u64_rem':
./arch/mips/include/asm/div64.h:29:11: error: invalid type argument of unary '*' (have 'long long unsigned int')
   __high = *__n >> 32;      \
            ^
./include/asm-generic/div64.h:243:11: note: in expansion of macro '__div64_32'
    __rem = __div64_32(&(n), __base); \
            ^
./include/linux/math64.h:91:15: note: in expansion of macro 'do_div'
   *remainder = do_div(dividend, divisor);
                ^

Or does it just reveal an unknown bug in my compiler?


I also get these:


In file included from ./include/linux/math64.h:7:0,
                 from ./include/linux/time.h:6,
                 from ./include/linux/compat.h:10,
                 from arch/mips/kernel/asm-offsets.c:12:
./include/linux/math64.h: In function 'div_u64_rem':
./arch/mips/include/asm/div64.h:29:11: error: invalid type argument of unary '*' (have 'long long unsigned int')
  __high = *__n >> 32;      \
           ^
./include/asm-generic/div64.h:243:11: note: in expansion of macro '__div64_32'
   __rem = __div64_32(&(n), __base); \
           ^
./include/linux/math64.h:91:15: note: in expansion of macro 'do_div'
  *remainder = do_div(dividend, divisor);
               ^
./include/linux/math64.h: In function 'mul_u64_u32_div':
./arch/mips/include/asm/div64.h:29:11: error: invalid type argument of unary '*' (have 'long long unsigned int')
  __high = *__n >> 32;      \
           ^
./include/asm-generic/div64.h:243:11: note: in expansion of macro '__div64_32'
   __rem = __div64_32(&(n), __base); \
           ^
./include/linux/math64.h:256:14: note: in expansion of macro 'do_div'
  rl.l.high = do_div(rh.ll, divisor);
              ^
./arch/mips/include/asm/div64.h:29:11: error: invalid type argument of unary '*' (have 'long long unsigned int')
  __high = *__n >> 32;      \

...


So it seems not a compiler problem.




[Index of Archives]     [LKML Archive]     [Linux ARM Kernel]     [Linux ARM]     [Git]     [Yosemite News]     [Linux SCSI]     [Linux Hams]

  Powered by Linux