linux/include/asm-generic
Qian Cai cbedfe1134 asm-generic: fix -Wtype-limits compiler warnings
Commit d66acc39c7 ("bitops: Optimise get_order()") introduced a
compilation warning because "rx_frag_size" is an "ushort" while
PAGE_SHIFT here is 16.

The commit changed the get_order() to be a multi-line macro where
compilers insist to check all statements in the macro even when
__builtin_constant_p(rx_frag_size) will return false as "rx_frag_size"
is a module parameter.

In file included from ./arch/powerpc/include/asm/page_64.h:107,
                 from ./arch/powerpc/include/asm/page.h:242,
                 from ./arch/powerpc/include/asm/mmu.h:132,
                 from ./arch/powerpc/include/asm/lppaca.h:47,
                 from ./arch/powerpc/include/asm/paca.h:17,
                 from ./arch/powerpc/include/asm/current.h:13,
                 from ./include/linux/thread_info.h:21,
                 from ./arch/powerpc/include/asm/processor.h:39,
                 from ./include/linux/prefetch.h:15,
                 from drivers/net/ethernet/emulex/benet/be_main.c:14:
drivers/net/ethernet/emulex/benet/be_main.c: In function 'be_rx_cqs_create':
./include/asm-generic/getorder.h:54:9: warning: comparison is always
true due to limited range of data type [-Wtype-limits]
   (((n) < (1UL << PAGE_SHIFT)) ? 0 :  \
         ^
drivers/net/ethernet/emulex/benet/be_main.c:3138:33: note: in expansion
of macro 'get_order'
  adapter->big_page_size = (1 << get_order(rx_frag_size)) * PAGE_SIZE;
                                 ^~~~~~~~~

Fix it by moving all of this multi-line macro into a proper function,
and killing __get_order() off.

[akpm@linux-foundation.org: remove __get_order() altogether]
[cai@lca.pw: v2]
  Link: http://lkml.kernel.org/r/1564000166-31428-1-git-send-email-cai@lca.pw
Link: http://lkml.kernel.org/r/1563914986-26502-1-git-send-email-cai@lca.pw
Fixes: d66acc39c7 ("bitops: Optimise get_order()")
Signed-off-by: Qian Cai <cai@lca.pw>
Reviewed-by: Nathan Chancellor <natechancellor@gmail.com>
Cc: David S. Miller <davem@davemloft.net>
Cc: Arnd Bergmann <arnd@arndb.de>
Cc: David Howells <dhowells@redhat.com>
Cc: Jakub Jelinek <jakub@redhat.com>
Cc: Nick Desaulniers <ndesaulniers@google.com>
Cc: Bill Wendling <morbo@google.com>
Cc: James Y Knight <jyknight@google.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2019-08-03 07:02:01 -07:00
..
bitops
vdso timekeeping: Provide a generic update_vsyscall() implementation 2019-06-22 21:21:06 +02:00
4level-fixup.h
5level-fixup.h
asm-offsets.h
asm-prototypes.h
atomic64.h locking/atomic: Use s64 for atomic64 2019-06-03 12:32:56 +02:00
atomic-instrumented.h
atomic-long.h
atomic.h treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 36 2019-05-24 17:27:11 +02:00
audit_change_attr.h
audit_dir_write.h
audit_read.h
audit_signal.h
audit_write.h
barrier.h treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 36 2019-05-24 17:27:11 +02:00
bitops-instrumented.h asm-generic, x86: add bitops instrumentation for KASAN 2019-07-12 11:05:42 -07:00
bitops.h
bitsperlong.h
bug.h include/asm-generic/bug.h: fix "cut here" for WARN_ON for __WARN_TAINT architectures 2019-07-16 19:23:24 -07:00
bugs.h
cache.h
cacheflush.h asm-generic: fix a compilation warning 2019-07-16 19:23:22 -07:00
checksum.h
cmpxchg-local.h
cmpxchg.h
compat.h
current.h
delay.h
device.h treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 428 2019-06-05 17:37:16 +02:00
div64.h
dma-contiguous.h
dma-mapping.h
dma.h
early_ioremap.h
emergency-restart.h
error-injection.h
exec.h treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 36 2019-05-24 17:27:11 +02:00
export.h
extable.h
fb.h
fixmap.h
flat.h binfmt_flat: remove the persistent argument from flat_get_addr_from_rp 2019-06-24 09:16:47 +10:00
ftrace.h treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 500 2019-06-19 17:09:55 +02:00
futex.h futex: Cleanup generic SMP variant of arch_futex_atomic_op_inuser() 2019-07-22 11:20:10 +02:00
getorder.h asm-generic: fix -Wtype-limits compiler warnings 2019-08-03 07:02:01 -07:00
gpio.h
hardirq.h
hugetlb.h hugetlb: allow to free gigantic pages regardless of the configuration 2019-05-14 09:47:47 -07:00
hw_irq.h
ide_iops.h
int-ll64.h
io.h treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 36 2019-05-24 17:27:11 +02:00
ioctl.h
iomap.h
irq_regs.h treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 152 2019-05-30 11:26:32 -07:00
irq_work.h
irq.h
irqflags.h
Kbuild kbuild: force all architectures except um to include mandatory-y 2019-03-17 12:56:32 +09:00
kdebug.h
kmap_types.h
kprobes.h
kvm_para.h
linkage.h
local64.h
local.h
mcs_spinlock.h
memory_model.h
mm_hooks.h x86/mpx, mm/core: Fix recursive munmap() corruption 2019-05-09 10:37:17 +02:00
mm-arch-hooks.h
mmiowb_types.h asm-generic/mmiowb: Add generic implementation of mmiowb() tracking 2019-04-08 11:59:39 +01:00
mmiowb.h asm-generic/mmiowb: Add generic implementation of mmiowb() tracking 2019-04-08 11:59:39 +01:00
mmu_context.h
mmu.h
module.h
mshyperv.h Drivers: hv: vmbus: Break out ISA independent parts of mshyperv.h 2019-07-08 19:06:27 -04:00
msi.h
page.h
param.h
parport.h
pci_iomap.h
pci.h
percpu.h
pgalloc.h asm-generic, x86: introduce generic pte_{alloc,free}_one[_kernel] 2019-07-12 11:05:45 -07:00
pgtable-nop4d-hack.h
pgtable-nop4d.h
pgtable-nopmd.h
pgtable-nopud.h
pgtable.h x86/mm: Initialize PGD cache during mm initialization 2019-05-05 20:32:46 +02:00
preempt.h
qrwlock_types.h
qrwlock.h treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 157 2019-05-30 11:26:37 -07:00
qspinlock_types.h treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 157 2019-05-30 11:26:37 -07:00
qspinlock.h treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 157 2019-05-30 11:26:37 -07:00
resource.h
seccomp.h treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 500 2019-06-19 17:09:55 +02:00
sections.h locking/lockdep: check for freed initmem in static_obj() 2019-04-29 10:47:10 +02:00
serial.h
set_memory.h
shmparam.h treewide: remove SPDX "WITH Linux-syscall-note" from kernel-space headers 2019-05-14 19:52:48 -07:00
signal.h
simd.h
spinlock.h
statfs.h
string.h
switch_to.h treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 36 2019-05-24 17:27:11 +02:00
syscall.h treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 193 2019-05-30 11:29:21 -07:00
syscalls.h
termios-base.h
termios.h
timex.h
tlb.h treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 152 2019-05-30 11:26:32 -07:00
tlbflush.h
topology.h
trace_clock.h
uaccess.h asm-generic: optimize generic uaccess for 8-byte loads and stores 2019-04-23 21:51:41 +02:00
unaligned.h
user.h
vga.h
vmlinux.lds.h Merge branch 'next' of git://git.kernel.org/pub/scm/linux/kernel/git/rzhang/linux 2019-07-17 13:13:41 -07:00
vtime.h
word-at-a-time.h
xor.h treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 47 2019-05-24 17:27:13 +02:00