Revert "sys_bitfield*(): use 'void *' instead of memaddr_t"

This reverts commit 1f2ee5c6bc.

Change-Id: I6d6662952450e54aea2ffbc43973a5ecc40767bb
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
This commit is contained in:
Anas Nashif 2017-02-28 16:05:55 -05:00
commit cd35c575ef
9 changed files with 79 additions and 148 deletions

View file

@ -266,37 +266,29 @@ static ALWAYS_INLINE
}
static ALWAYS_INLINE
void sys_bitfield_set_bit(void *addr, unsigned int bit)
void sys_bitfield_set_bit(mem_addr_t addr, unsigned int bit)
{
mem_addr_t _addr = (unsigned long) addr;
/* Doing memory offsets in terms of 32-bit values to prevent
* alignment issues. The 4 * is needed because void *
* arithmethic is byte based and by dividing by 32, we have
* the index of the four-byte block where the bit is.
* alignment issues
*/
sys_set_bit(_addr + 4 * (bit / 32), bit & 0x1F);
sys_set_bit(addr + ((bit >> 5) << 2), bit & 0x1F);
}
static ALWAYS_INLINE
void sys_bitfield_clear_bit(void *addr, unsigned int bit)
void sys_bitfield_clear_bit(mem_addr_t addr, unsigned int bit)
{
mem_addr_t _addr = (unsigned long) addr;
sys_clear_bit(_addr + 4 * (bit / 32), bit & 0x1F);
sys_clear_bit(addr + ((bit >> 5) << 2), bit & 0x1F);
}
static ALWAYS_INLINE
int sys_bitfield_test_bit(void *addr, unsigned int bit)
int sys_bitfield_test_bit(mem_addr_t addr, unsigned int bit)
{
mem_addr_t _addr = (unsigned long) addr;
return sys_test_bit(_addr + 4 * (bit / 32), bit & 0x1F);
return sys_test_bit(addr + ((bit >> 5) << 2), bit & 0x1F);
}
static ALWAYS_INLINE
int sys_bitfield_test_and_set_bit(void *addr, unsigned int bit)
int sys_bitfield_test_and_set_bit(mem_addr_t addr, unsigned int bit)
{
int ret;
@ -307,7 +299,7 @@ static ALWAYS_INLINE
}
static ALWAYS_INLINE
int sys_bitfield_test_and_clear_bit(void *addr, unsigned int bit)
int sys_bitfield_test_and_clear_bit(mem_addr_t addr, unsigned int bit)
{
int ret;

View file

@ -143,36 +143,29 @@ static ALWAYS_INLINE
}
static ALWAYS_INLINE
void sys_bitfield_set_bit(void *addr, unsigned int bit)
void sys_bitfield_set_bit(mem_addr_t addr, unsigned int bit)
{
/* Doing memory offsets in terms of 32-bit values to prevent
* alignment issues
*/
mem_addr_t _addr = (unsigned long) addr;
sys_set_bit(_addr + ((bit >> 5) << 2), bit & 0x1F);
sys_set_bit(addr + ((bit >> 5) << 2), bit & 0x1F);
}
static ALWAYS_INLINE
void sys_bitfield_clear_bit(void *addr, unsigned int bit)
void sys_bitfield_clear_bit(mem_addr_t addr, unsigned int bit)
{
mem_addr_t _addr = (unsigned long) addr;
sys_clear_bit(_addr + ((bit >> 5) << 2), bit & 0x1F);
sys_clear_bit(addr + ((bit >> 5) << 2), bit & 0x1F);
}
static ALWAYS_INLINE
int sys_bitfield_test_bit(const void *addr, unsigned int bit)
int sys_bitfield_test_bit(mem_addr_t addr, unsigned int bit)
{
mem_addr_t _addr = (unsigned long) addr;
return sys_test_bit(_addr + ((bit >> 5) << 2), bit & 0x1F);
return sys_test_bit(addr + ((bit >> 5) << 2), bit & 0x1F);
}
static ALWAYS_INLINE
int sys_bitfield_test_and_set_bit(void *addr, unsigned int bit)
int sys_bitfield_test_and_set_bit(mem_addr_t addr, unsigned int bit)
{
int ret;
@ -183,7 +176,7 @@ static ALWAYS_INLINE
}
static ALWAYS_INLINE
int sys_bitfield_test_and_clear_bit(void *addr, unsigned int bit)
int sys_bitfield_test_and_clear_bit(mem_addr_t addr, unsigned int bit)
{
int ret;

View file

@ -85,35 +85,29 @@ static ALWAYS_INLINE
}
static ALWAYS_INLINE
void sys_bitfield_set_bit(void *addr, unsigned int bit)
void sys_bitfield_set_bit(mem_addr_t addr, unsigned int bit)
{
/* Doing memory offsets in terms of 32-bit values to prevent
* alignment issues
*/
mem_addr_t _addr = (unsigned long) addr;
sys_set_bit(_addr + ((bit >> 5) << 2), bit & 0x1F);
sys_set_bit(addr + ((bit >> 5) << 2), bit & 0x1F);
}
static ALWAYS_INLINE
void sys_bitfield_clear_bit(void *addr, unsigned int bit)
void sys_bitfield_clear_bit(mem_addr_t addr, unsigned int bit)
{
mem_addr_t _addr = (unsigned long) addr;
sys_clear_bit(_addr + ((bit >> 5) << 2), bit & 0x1F);
sys_clear_bit(addr + ((bit >> 5) << 2), bit & 0x1F);
}
static ALWAYS_INLINE
int sys_bitfield_test_bit(void *addr, unsigned int bit)
int sys_bitfield_test_bit(mem_addr_t addr, unsigned int bit)
{
mem_addr_t _addr = (unsigned long) addr;
return sys_test_bit(_addr + ((bit >> 5) << 2), bit & 0x1F);
return sys_test_bit(addr + ((bit >> 5) << 2), bit & 0x1F);
}
static ALWAYS_INLINE
int sys_bitfield_test_and_set_bit(void *addr, unsigned int bit)
int sys_bitfield_test_and_set_bit(mem_addr_t addr, unsigned int bit)
{
int ret;
@ -124,7 +118,7 @@ static ALWAYS_INLINE
}
static ALWAYS_INLINE
int sys_bitfield_test_and_clear_bit(void *addr, unsigned int bit)
int sys_bitfield_test_and_clear_bit(mem_addr_t addr, unsigned int bit)
{
int ret;

View file

@ -474,51 +474,11 @@ static ALWAYS_INLINE
return ret;
}
static ALWAYS_INLINE
void sys_bitfield_set_bit(void *addr, unsigned int bit)
{
mem_addr_t _addr = (unsigned long) addr;
/* Doing memory offsets in terms of 32-bit values to prevent
* alignment issues. The 4 * is needed because void *
* arithmethic is byte based and by dividing by 32, we have
* the index of the four-byte block where the bit is.
*/
sys_set_bit(_addr + 4 * (bit / 32), bit & 0x1F);
}
static ALWAYS_INLINE
void sys_bitfield_clear_bit(void *addr, unsigned int bit)
{
sys_clear_bit((unsigned long) addr, bit);
}
static ALWAYS_INLINE
int sys_bitfield_test_bit(void *addr, unsigned int bit)
{
return sys_test_bit((mem_addr_t) addr, bit);
}
static ALWAYS_INLINE
int sys_bitfield_test_and_set_bit(void *addr, unsigned int bit)
{
int ret;
ret = sys_bitfield_test_bit(addr, bit);
sys_bitfield_set_bit(addr, bit);
return ret;
}
static ALWAYS_INLINE
int sys_bitfield_test_and_clear_bit(void *addr, unsigned int bit)
{
int ret;
ret = sys_bitfield_test_bit(addr, bit);
sys_bitfield_clear_bit(addr, bit);
return ret;
}
#define sys_bitfield_set_bit sys_set_bit
#define sys_bitfield_clear_bit sys_clear_bit
#define sys_bitfield_test_bit sys_test_bit
#define sys_bitfield_test_and_set_bit sys_test_and_set_bit
#define sys_bitfield_test_and_clear_bit sys_test_and_clear_bit
#endif /* _ASMLANGUAGE */