(btpad) Cleanups

This commit is contained in:
Twinaphex 2015-04-03 15:11:47 +02:00
parent 5045e82c85
commit dbc981363e

View File

@ -105,12 +105,8 @@ static uint32_t can_run;
#define INCPOS(POS) { POS##_position = (POS##_position + 1) % 64; }
static void btpad_queue_process(void)
static void btpad_queue_process_cmd(struct btpad_queue_command *cmd)
{
for (; can_run && (insert_position != read_position); can_run --)
{
struct btpad_queue_command* cmd = &commands[read_position];
if (!cmd)
return;
@ -145,7 +141,14 @@ static void btpad_queue_process(void)
cmd->hci_pin_code_request_reply.bd_addr,
6,
cmd->hci_pin_code_request_reply.pin);
}
static void btpad_queue_process(void)
{
for (; can_run && (insert_position != read_position); can_run --)
{
struct btpad_queue_command* cmd = &commands[read_position];
btpad_queue_process_cmd(cmd);
INCPOS(read);
}
}
@ -279,10 +282,12 @@ void btpad_set_inquiry_state(bool on)
/* Internal interface. */
static struct pad_connection* btpad_find_empty_connection(void)
{
int i;
for (i = 0; i < MAX_USERS; i ++)
unsigned i;
for (i = 0; i < MAX_USERS; i++)
{
if (g_connections[i].state == BTPAD_EMPTY)
return &g_connections[i];
}
return 0;
}
@ -290,8 +295,8 @@ static struct pad_connection* btpad_find_empty_connection(void)
static struct pad_connection* btpad_find_connection_for(
uint16_t handle, bd_addr_t address)
{
int i;
for (i = 0; i < MAX_USERS; i ++)
unsigned i;
for (i = 0; i < MAX_USERS; i++)
{
if (!g_connections[i].handle && !g_connections[i].has_address)
continue;