Commit 5b4685c3 authored by Geert Uytterhoeven's avatar Geert Uytterhoeven Committed by Linus Torvalds

[PATCH] M68k update (part 8)

M68k bitops updates
  - use bitmap_member() for bitops data declaration
  - Make the m68k bitops really operate on unsigned long
  - Add fls()
parent c0138240
......@@ -80,7 +80,7 @@ struct zorro_dev *zorro_find_device(zorro_id id, struct zorro_dev *from)
* FIXME: use the normal resource management
*/
u32 zorro_unused_z2ram[4] = { 0, 0, 0, 0 };
bitmap_member(zorro_unused_z2ram, 128);
static void __init mark_region(unsigned long start, unsigned long end,
......
......@@ -19,7 +19,7 @@
__constant_test_and_set_bit(nr, vaddr) : \
__generic_test_and_set_bit(nr, vaddr))
extern __inline__ int __constant_test_and_set_bit(int nr,volatile void * vaddr)
extern __inline__ int __constant_test_and_set_bit(int nr,volatile unsigned long * vaddr)
{
char retval;
......@@ -30,7 +30,7 @@ extern __inline__ int __constant_test_and_set_bit(int nr,volatile void * vaddr)
return retval;
}
extern __inline__ int __generic_test_and_set_bit(int nr,volatile void * vaddr)
extern __inline__ int __generic_test_and_set_bit(int nr,volatile unsigned long * vaddr)
{
char retval;
......@@ -47,13 +47,13 @@ extern __inline__ int __generic_test_and_set_bit(int nr,volatile void * vaddr)
#define __set_bit(nr,vaddr) set_bit(nr,vaddr)
extern __inline__ void __constant_set_bit(int nr, volatile void * vaddr)
extern __inline__ void __constant_set_bit(int nr, volatile unsigned long * vaddr)
{
__asm__ __volatile__ ("bset %1,%0"
: "+m" (((volatile char *)vaddr)[(nr^31) >> 3]) : "di" (nr & 7));
}
extern __inline__ void __generic_set_bit(int nr, volatile void * vaddr)
extern __inline__ void __generic_set_bit(int nr, volatile unsigned long * vaddr)
{
__asm__ __volatile__ ("bfset %1@{%0:#1}"
: : "d" (nr^31), "a" (vaddr) : "memory");
......@@ -66,7 +66,7 @@ extern __inline__ void __generic_set_bit(int nr, volatile void * vaddr)
#define __test_and_clear_bit(nr,vaddr) test_and_clear_bit(nr,vaddr)
extern __inline__ int __constant_test_and_clear_bit(int nr, volatile void * vaddr)
extern __inline__ int __constant_test_and_clear_bit(int nr, volatile unsigned long * vaddr)
{
char retval;
......@@ -77,7 +77,7 @@ extern __inline__ int __constant_test_and_clear_bit(int nr, volatile void * vadd
return retval;
}
extern __inline__ int __generic_test_and_clear_bit(int nr, volatile void * vaddr)
extern __inline__ int __generic_test_and_clear_bit(int nr, volatile unsigned long * vaddr)
{
char retval;
......@@ -99,13 +99,13 @@ extern __inline__ int __generic_test_and_clear_bit(int nr, volatile void * vaddr
__generic_clear_bit(nr, vaddr))
#define __clear_bit(nr,vaddr) clear_bit(nr,vaddr)
extern __inline__ void __constant_clear_bit(int nr, volatile void * vaddr)
extern __inline__ void __constant_clear_bit(int nr, volatile unsigned long * vaddr)
{
__asm__ __volatile__ ("bclr %1,%0"
: "+m" (((volatile char *)vaddr)[(nr^31) >> 3]) : "di" (nr & 7));
}
extern __inline__ void __generic_clear_bit(int nr, volatile void * vaddr)
extern __inline__ void __generic_clear_bit(int nr, volatile unsigned long * vaddr)
{
__asm__ __volatile__ ("bfclr %1@{%0:#1}"
: : "d" (nr^31), "a" (vaddr) : "memory");
......@@ -119,7 +119,7 @@ extern __inline__ void __generic_clear_bit(int nr, volatile void * vaddr)
#define __test_and_change_bit(nr,vaddr) test_and_change_bit(nr,vaddr)
#define __change_bit(nr,vaddr) change_bit(nr,vaddr)
extern __inline__ int __constant_test_and_change_bit(int nr, volatile void * vaddr)
extern __inline__ int __constant_test_and_change_bit(int nr, volatile unsigned long * vaddr)
{
char retval;
......@@ -130,7 +130,7 @@ extern __inline__ int __constant_test_and_change_bit(int nr, volatile void * vad
return retval;
}
extern __inline__ int __generic_test_and_change_bit(int nr, volatile void * vaddr)
extern __inline__ int __generic_test_and_change_bit(int nr, volatile unsigned long * vaddr)
{
char retval;
......@@ -145,24 +145,24 @@ extern __inline__ int __generic_test_and_change_bit(int nr, volatile void * vadd
__constant_change_bit(nr, vaddr) : \
__generic_change_bit(nr, vaddr))
extern __inline__ void __constant_change_bit(int nr, volatile void * vaddr)
extern __inline__ void __constant_change_bit(int nr, volatile unsigned long * vaddr)
{
__asm__ __volatile__ ("bchg %1,%0"
: "+m" (((volatile char *)vaddr)[(nr^31) >> 3]) : "di" (nr & 7));
}
extern __inline__ void __generic_change_bit(int nr, volatile void * vaddr)
extern __inline__ void __generic_change_bit(int nr, volatile unsigned long * vaddr)
{
__asm__ __volatile__ ("bfchg %1@{%0:#1}"
: : "d" (nr^31), "a" (vaddr) : "memory");
}
extern __inline__ int test_bit(int nr, const volatile void * vaddr)
extern __inline__ int test_bit(int nr, const volatile unsigned long * vaddr)
{
return ((1UL << (nr & 31)) & (((const volatile unsigned int *) vaddr)[nr >> 5])) != 0;
return ((1UL << (nr & 31)) & (((const volatile unsigned long *) vaddr)[nr >> 5])) != 0;
}
extern __inline__ int find_first_zero_bit(void * vaddr, unsigned size)
extern __inline__ int find_first_zero_bit(unsigned long * vaddr, unsigned size)
{
unsigned long *p = vaddr, *addr = vaddr;
unsigned long allones = ~0UL;
......@@ -185,7 +185,7 @@ extern __inline__ int find_first_zero_bit(void * vaddr, unsigned size)
return ((p - addr) << 5) + (res ^ 31);
}
extern __inline__ int find_next_zero_bit (void *vaddr, int size,
extern __inline__ int find_next_zero_bit (unsigned long *vaddr, int size,
int offset)
{
unsigned long *addr = vaddr;
......@@ -232,16 +232,28 @@ extern __inline__ unsigned long ffz(unsigned long word)
* differs in spirit from the above ffz (man ffs).
*/
extern __inline__ int ffs(int x)
static inline int ffs(int x)
{
int cnt;
__asm__ __volatile__("bfffo %1{#0:#0},%0" : "=d" (cnt) : "dm" (x & -x));
asm ("bfffo %1{#0:#0},%0" : "=d" (cnt) : "dm" (x & -x));
return 32 - cnt;
}
#define __ffs(x) (ffs(x) - 1)
/*
* fls: find last bit set.
*/
static inline int fls(int x)
{
int cnt;
asm ("bfffo %1{#0,#0},%0" : "=d" (cnt) : "dm" (x));
return 32 - cnt;
}
/*
* Every architecture must define this function. It's the fastest
......
......@@ -45,7 +45,7 @@ struct gs_port {
int count;
int blocked_open;
struct tty_struct *tty;
int event;
unsigned long event;
unsigned short closing_wait;
int close_delay;
struct real_driver *rd;
......
......@@ -37,7 +37,7 @@ struct cyclades_port {
int ignore_status_mask;
int close_delay;
int IER; /* Interrupt Enable Register */
int event;
unsigned long event;
unsigned long last_active;
int count; /* # of fd on device */
int x_char; /* to be pushed out ASAP */
......
......@@ -199,7 +199,7 @@ extern struct zorro_dev *zorro_find_device(zorro_id id,
* the corresponding bits.
*/
extern __u32 zorro_unused_z2ram[4];
extern bitmap_member(zorro_unused_z2ram, 128);
#define Z2RAM_START (0x00200000)
#define Z2RAM_END (0x00a00000)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment