Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 3fca5af7 authored by Akinobu Mita's avatar Akinobu Mita Committed by Linus Torvalds
Browse files

m68k: remove inline asm from minix_find_first_zero_bit



As a preparation for moving minix bit operations from asm/bitops.h to
architecture independent code in minix filesystem, this removes inline asm
from minix_find_first_zero_bit() for m68k.

Signed-off-by: default avatarAkinobu Mita <akinobu.mita@gmail.com>
Cc: Geert Uytterhoeven <geert@linux-m68k.org>
Cc: Roman Zippel <zippel@linux-m68k.org>
Cc: Andreas Schwab <schwab@linux-m68k.org>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
parent f312eff8
Loading
Loading
Loading
Loading
+3 −7
Original line number Original line Diff line number Diff line
@@ -330,23 +330,19 @@ static inline int __fls(int x)
static inline int minix_find_first_zero_bit(const void *vaddr, unsigned size)
static inline int minix_find_first_zero_bit(const void *vaddr, unsigned size)
{
{
	const unsigned short *p = vaddr, *addr = vaddr;
	const unsigned short *p = vaddr, *addr = vaddr;
	int res;
	unsigned short num;
	unsigned short num;


	if (!size)
	if (!size)
		return 0;
		return 0;


	size = (size >> 4) + ((size & 15) > 0);
	size = (size >> 4) + ((size & 15) > 0);
	while (*p++ == 0xffff)
	while (*p++ == 0xffff) {
	{
		if (--size == 0)
		if (--size == 0)
			return (p - addr) << 4;
			return (p - addr) << 4;
	}
	}


	num = ~*--p;
	num = *--p;
	__asm__ __volatile__ ("bfffo %1{#16,#16},%0"
	return ((p - addr) << 4) + ffz(num);
			      : "=d" (res) : "d" (num & -num));
	return ((p - addr) << 4) + (res ^ 31);
}
}


#define minix_test_and_set_bit(nr, addr)	__test_and_set_bit((nr) ^ 16, (unsigned long *)(addr))
#define minix_test_and_set_bit(nr, addr)	__test_and_set_bit((nr) ^ 16, (unsigned long *)(addr))