fixes for #62: eliminate unused parameter warnings

NOTE: this commit introduces a kernel API change for mutex_unlock
This commit is contained in:
Oleg Hahm 2013-08-04 04:06:31 +02:00
parent cf7ab7f093
commit 39a4dc684e
19 changed files with 48 additions and 45 deletions

View File

@ -57,10 +57,8 @@ int mutex_lock(struct mutex_t *mutex);
* @brief Unlocks the mutex. * @brief Unlocks the mutex.
* *
* @param mutex Mutex-Object to unlock. * @param mutex Mutex-Object to unlock.
*
* @param yield If yield==MUTEX_YIELD, force context-switch after waking up other waiter.
*/ */
void mutex_unlock(struct mutex_t *mutex, int yield); void mutex_unlock(struct mutex_t *mutex);
#define MUTEX_YIELD 1 #define MUTEX_YIELD 1
#define MUTEX_INISR 2 #define MUTEX_INISR 2

View File

@ -92,7 +92,7 @@ void mutex_wait(struct mutex_t *mutex)
/* we were woken up by scheduler. waker removed us from queue. we have the mutex now. */ /* we were woken up by scheduler. waker removed us from queue. we have the mutex now. */
} }
void mutex_unlock(struct mutex_t *mutex, int yield) void mutex_unlock(struct mutex_t *mutex)
{ {
DEBUG("%s: unlocking mutex. val: %u pid: %u\n", active_thread->name, mutex->val, thread_pid); DEBUG("%s: unlocking mutex. val: %u pid: %u\n", active_thread->name, mutex->val, thread_pid);
int irqstate = disableIRQ(); int irqstate = disableIRQ();

View File

@ -66,6 +66,7 @@ unsigned long hwtimer_arch_now()
void hwtimer_arch_init(void (*handler)(int), uint32_t fcpu) void hwtimer_arch_init(void (*handler)(int), uint32_t fcpu)
{ {
(void) fcpu;
timerA_init(); timerA_init();
int_handler = handler; int_handler = handler;
TA0_enable_interrupt(0); TA0_enable_interrupt(0);

View File

@ -244,6 +244,7 @@ void hwtimer_arch_init(void (*handler)(int), uint32_t fcpu)
{ {
DEBUG("hwtimer_arch_init()\n"); DEBUG("hwtimer_arch_init()\n");
(void) fcpu;
hwtimer_arch_disable_interrupt(); hwtimer_arch_disable_interrupt();
int_handler = handler; int_handler = handler;

View File

@ -294,6 +294,7 @@ void native_irq_handler()
*/ */
void native_isr_entry(int sig, siginfo_t *info, void *context) void native_isr_entry(int sig, siginfo_t *info, void *context)
{ {
(void) info; /* unused at the moment */
DEBUG("\n\n\t\tnative_isr_entry\n\n"); DEBUG("\n\n\t\tnative_isr_entry\n\n");
if (native_interrupts_enabled == 0) { if (native_interrupts_enabled == 0) {

View File

@ -219,7 +219,7 @@ void cc1100_phy_mutex_lock(void)
void cc1100_phy_mutex_unlock(void) void cc1100_phy_mutex_unlock(void)
{ {
cc1100_mutex_pid = -1; cc1100_mutex_pid = -1;
mutex_unlock(&cc1100_mutex, 0); mutex_unlock(&cc1100_mutex);
} }
/*---------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------*/

View File

@ -347,7 +347,7 @@ uint8_t sht11_read_sensor(sht11_val_t *value, sht11_mode_t mode)
/* break on error */ /* break on error */
if (error != 0) { if (error != 0) {
connection_reset(); connection_reset();
mutex_unlock(&sht11_mutex, 0); mutex_unlock(&sht11_mutex);
return 0; return 0;
} }
@ -363,7 +363,7 @@ uint8_t sht11_read_sensor(sht11_val_t *value, sht11_mode_t mode)
} }
} }
mutex_unlock(&sht11_mutex, 0); mutex_unlock(&sht11_mutex);
return 1; return 1;
} }

View File

@ -117,7 +117,7 @@ static void logd_process(void)
free(node); free(node);
} }
mutex_unlock(&log_mutex, 0); mutex_unlock(&log_mutex);
} }
while (m.type != MSG_EXIT && !exit_flag); while (m.type != MSG_EXIT && !exit_flag);
@ -184,7 +184,7 @@ bool logd_log(char *str, int str_len)
lq->str[str_len] = '\0'; /* add string termination char at end of buffer */ lq->str[str_len] = '\0'; /* add string termination char at end of buffer */
mutex_lock(&log_mutex); mutex_lock(&log_mutex);
list_append(&log_msg_queue, (list_node_t *) lq); list_append(&log_msg_queue, (list_node_t *) lq);
mutex_unlock(&log_mutex, 0); mutex_unlock(&log_mutex);
m.type = MSG_POLL; m.type = MSG_POLL;
m.content.ptr = NULL; m.content.ptr = NULL;
msg_send(&m, log_pid, false); msg_send(&m, log_pid, false);

View File

@ -529,14 +529,14 @@ int connect(int socket, sockaddr6_t *addr, uint32_t addrlen)
current_tcp_socket->tcp_control.rcv_irs = 0; current_tcp_socket->tcp_control.rcv_irs = 0;
mutex_lock(&global_sequence_clunter_mutex); mutex_lock(&global_sequence_clunter_mutex);
current_tcp_socket->tcp_control.send_iss = global_sequence_counter; current_tcp_socket->tcp_control.send_iss = global_sequence_counter;
mutex_unlock(&global_sequence_clunter_mutex, 0); mutex_unlock(&global_sequence_clunter_mutex);
current_tcp_socket->tcp_control.state = SYN_SENT; current_tcp_socket->tcp_control.state = SYN_SENT;
#ifdef TCP_HC #ifdef TCP_HC
/* Choosing random number Context ID */ /* Choosing random number Context ID */
mutex_lock(&global_context_counter_mutex); mutex_lock(&global_context_counter_mutex);
current_tcp_socket->tcp_control.tcp_context.context_id = global_context_counter; current_tcp_socket->tcp_control.tcp_context.context_id = global_context_counter;
mutex_unlock(&global_context_counter_mutex, 0); mutex_unlock(&global_context_counter_mutex);
current_tcp_socket->tcp_control.tcp_context.hc_type = FULL_HEADER; current_tcp_socket->tcp_control.tcp_context.hc_type = FULL_HEADER;
@ -871,7 +871,7 @@ uint8_t read_from_socket(socket_internal_t *current_int_tcp_socket,
current_int_tcp_socket->tcp_input_buffer_end); current_int_tcp_socket->tcp_input_buffer_end);
current_int_tcp_socket->tcp_input_buffer_end = 0; current_int_tcp_socket->tcp_input_buffer_end = 0;
current_int_tcp_socket->socket_values.tcp_control.rcv_wnd += read_bytes; current_int_tcp_socket->socket_values.tcp_control.rcv_wnd += read_bytes;
mutex_unlock(&current_int_tcp_socket->tcp_buffer_mutex, 0); mutex_unlock(&current_int_tcp_socket->tcp_buffer_mutex);
return read_bytes; return read_bytes;
} }
else { else {
@ -883,7 +883,7 @@ uint8_t read_from_socket(socket_internal_t *current_int_tcp_socket,
current_int_tcp_socket->tcp_input_buffer_end = current_int_tcp_socket->tcp_input_buffer_end =
current_int_tcp_socket->tcp_input_buffer_end - len; current_int_tcp_socket->tcp_input_buffer_end - len;
current_int_tcp_socket->socket_values.tcp_control.rcv_wnd += len; current_int_tcp_socket->socket_values.tcp_control.rcv_wnd += len;
mutex_unlock(&current_int_tcp_socket->tcp_buffer_mutex, 0); mutex_unlock(&current_int_tcp_socket->tcp_buffer_mutex);
return len; return len;
} }
} }
@ -1326,7 +1326,7 @@ socket_internal_t *new_tcp_queued_socket(ipv6_hdr_t *ipv6_header,
mutex_lock(&global_sequence_clunter_mutex); mutex_lock(&global_sequence_clunter_mutex);
current_queued_socket->socket_values.tcp_control.send_iss = current_queued_socket->socket_values.tcp_control.send_iss =
global_sequence_counter; global_sequence_counter;
mutex_unlock(&global_sequence_clunter_mutex, 0); mutex_unlock(&global_sequence_clunter_mutex);
current_queued_socket->socket_values.tcp_control.state = SYN_RCVD; current_queued_socket->socket_values.tcp_control.state = SYN_RCVD;
set_tcp_cb(&current_queued_socket->socket_values.tcp_control, set_tcp_cb(&current_queued_socket->socket_values.tcp_control,
tcp_header->seq_nr + 1, STATIC_WINDOW, tcp_header->seq_nr + 1, STATIC_WINDOW,

View File

@ -85,7 +85,7 @@ uint8_t handle_payload(ipv6_hdr_t *ipv6_header, tcp_hdr_t *tcp_header,
tcp_socket->socket_values.tcp_control.rcv_wnd = 0; tcp_socket->socket_values.tcp_control.rcv_wnd = 0;
tcp_socket->tcp_input_buffer_end = tcp_socket->tcp_input_buffer_end + tcp_socket->tcp_input_buffer_end = tcp_socket->tcp_input_buffer_end +
tcp_socket->socket_values.tcp_control.rcv_wnd; tcp_socket->socket_values.tcp_control.rcv_wnd;
mutex_unlock(&tcp_socket->tcp_buffer_mutex, 0); mutex_unlock(&tcp_socket->tcp_buffer_mutex);
} }
else { else {
mutex_lock(&tcp_socket->tcp_buffer_mutex); mutex_lock(&tcp_socket->tcp_buffer_mutex);
@ -95,7 +95,7 @@ uint8_t handle_payload(ipv6_hdr_t *ipv6_header, tcp_hdr_t *tcp_header,
acknowledged_bytes = tcp_payload_len; acknowledged_bytes = tcp_payload_len;
tcp_socket->tcp_input_buffer_end = tcp_socket->tcp_input_buffer_end + tcp_socket->tcp_input_buffer_end = tcp_socket->tcp_input_buffer_end +
tcp_payload_len; tcp_payload_len;
mutex_unlock(&tcp_socket->tcp_buffer_mutex, 0); mutex_unlock(&tcp_socket->tcp_buffer_mutex);
} }
if (thread_getstatus(tcp_socket->recv_pid) == STATUS_RECEIVE_BLOCKED) { if (thread_getstatus(tcp_socket->recv_pid) == STATUS_RECEIVE_BLOCKED) {

View File

@ -134,11 +134,11 @@ void inc_global_variables(void)
{ {
mutex_lock(&global_sequence_clunter_mutex); mutex_lock(&global_sequence_clunter_mutex);
global_sequence_counter += rand(); global_sequence_counter += rand();
mutex_unlock(&global_sequence_clunter_mutex, 0); mutex_unlock(&global_sequence_clunter_mutex);
#ifdef TCP_HC #ifdef TCP_HC
mutex_lock(&global_context_counter_mutex); mutex_lock(&global_context_counter_mutex);
global_context_counter += rand(); global_context_counter += rand();
mutex_unlock(&global_context_counter_mutex, 0); mutex_unlock(&global_context_counter_mutex);
#endif #endif
} }

View File

@ -76,7 +76,7 @@ void demultiplex(border_packet_t *packet, int len)
context->context.comp, context->context.comp,
context->context.lifetime context->context.lifetime
); );
mutex_unlock(&lowpan_context_mutex, 0); mutex_unlock(&lowpan_context_mutex);
abr_add_context(context->context.version, &abr_addr, context->context.cid); abr_add_context(context->context.version, &abr_addr, context->context.cid);
/* Send router advertisement */ /* Send router advertisement */
break; break;

View File

@ -187,7 +187,7 @@ void etx_beacon(void) {
} }
cur_round = 0; cur_round = 0;
} }
mutex_unlock(&etx_mutex,0); mutex_unlock(&etx_mutex);
} }
} }
@ -378,7 +378,7 @@ void etx_radio(void) {
//handle the beacon //handle the beacon
mutex_lock(&etx_mutex); mutex_lock(&etx_mutex);
etx_handle_beacon(&candidate_addr); etx_handle_beacon(&candidate_addr);
mutex_unlock(&etx_mutex,1); mutex_unlock(&etx_mutex);
} }
p->processing--; p->processing--;

View File

@ -280,7 +280,7 @@ void send_DIO(ipv6_addr_t *destination)
if (mydodag == NULL) { if (mydodag == NULL) {
DEBUG("Error - trying to send DIO without being part of a dodag.\n"); DEBUG("Error - trying to send DIO without being part of a dodag.\n");
mutex_unlock(&rpl_send_mutex, 0); mutex_unlock(&rpl_send_mutex);
return; return;
} }
@ -321,7 +321,7 @@ void send_DIO(ipv6_addr_t *destination)
uint16_t plen = ICMPV6_HDR_LEN + DIO_BASE_LEN + opt_hdr_len; uint16_t plen = ICMPV6_HDR_LEN + DIO_BASE_LEN + opt_hdr_len;
rpl_send(destination, (uint8_t *)icmp_send_buf, plen, PROTO_NUM_ICMPV6, NULL); rpl_send(destination, (uint8_t *)icmp_send_buf, plen, PROTO_NUM_ICMPV6, NULL);
mutex_unlock(&rpl_send_mutex, 0); mutex_unlock(&rpl_send_mutex);
} }
void send_DIS(ipv6_addr_t *destination) void send_DIS(ipv6_addr_t *destination)
@ -337,7 +337,7 @@ void send_DIS(ipv6_addr_t *destination)
uint16_t plen = ICMPV6_HDR_LEN + DIS_BASE_LEN; uint16_t plen = ICMPV6_HDR_LEN + DIS_BASE_LEN;
rpl_send(destination, (uint8_t *)icmp_send_buf, plen, PROTO_NUM_ICMPV6, NULL); rpl_send(destination, (uint8_t *)icmp_send_buf, plen, PROTO_NUM_ICMPV6, NULL);
mutex_unlock(&rpl_send_mutex, 0); mutex_unlock(&rpl_send_mutex);
} }
@ -366,7 +366,7 @@ void send_DAO(ipv6_addr_t *destination, uint8_t lifetime, bool default_lifetime,
icmp_send_buf->checksum = ~icmpv6_csum(PROTO_NUM_ICMPV6); icmp_send_buf->checksum = ~icmpv6_csum(PROTO_NUM_ICMPV6);
if (my_dodag == NULL) { if (my_dodag == NULL) {
mutex_unlock(&rpl_send_mutex, 0); mutex_unlock(&rpl_send_mutex);
return; return;
} }
@ -428,7 +428,7 @@ void send_DAO(ipv6_addr_t *destination, uint8_t lifetime, bool default_lifetime,
uint16_t plen = ICMPV6_HDR_LEN + DAO_BASE_LEN + opt_len; uint16_t plen = ICMPV6_HDR_LEN + DAO_BASE_LEN + opt_len;
rpl_send(destination, (uint8_t *)icmp_send_buf, plen, PROTO_NUM_ICMPV6, NULL); rpl_send(destination, (uint8_t *)icmp_send_buf, plen, PROTO_NUM_ICMPV6, NULL);
mutex_unlock(&rpl_send_mutex, 0); mutex_unlock(&rpl_send_mutex);
if (continue_index > 1) { if (continue_index > 1) {
send_DAO(destination, lifetime, default_lifetime, continue_index); send_DAO(destination, lifetime, default_lifetime, continue_index);
@ -460,7 +460,7 @@ void send_DAO_ACK(ipv6_addr_t *destination)
uint16_t plen = ICMPV6_HDR_LEN + DIS_BASE_LEN; uint16_t plen = ICMPV6_HDR_LEN + DIS_BASE_LEN;
rpl_send(destination, (uint8_t *)icmp_send_buf, plen, PROTO_NUM_ICMPV6, NULL); rpl_send(destination, (uint8_t *)icmp_send_buf, plen, PROTO_NUM_ICMPV6, NULL);
mutex_unlock(&rpl_send_mutex, 0); mutex_unlock(&rpl_send_mutex);
} }
void rpl_process(void) void rpl_process(void)
@ -480,30 +480,30 @@ void rpl_process(void)
switch(*code) { switch(*code) {
case (ICMP_CODE_DIS): { case (ICMP_CODE_DIS): {
recv_rpl_dis(); recv_rpl_dis();
mutex_unlock(&rpl_recv_mutex, 0); mutex_unlock(&rpl_recv_mutex);
break; break;
} }
case (ICMP_CODE_DIO): { case (ICMP_CODE_DIO): {
recv_rpl_dio(); recv_rpl_dio();
mutex_unlock(&rpl_recv_mutex, 0); mutex_unlock(&rpl_recv_mutex);
break; break;
} }
case (ICMP_CODE_DAO): { case (ICMP_CODE_DAO): {
recv_rpl_dao(); recv_rpl_dao();
mutex_unlock(&rpl_recv_mutex, 0); mutex_unlock(&rpl_recv_mutex);
break; break;
} }
case (ICMP_CODE_DAO_ACK): { case (ICMP_CODE_DAO_ACK): {
recv_rpl_dao_ack(); recv_rpl_dao_ack();
mutex_unlock(&rpl_recv_mutex, 0); mutex_unlock(&rpl_recv_mutex);
break; break;
} }
default: default:
mutex_unlock(&rpl_recv_mutex, 0); mutex_unlock(&rpl_recv_mutex);
break; break;
} }
} }

View File

@ -47,7 +47,7 @@ int sem_signal(sem_t *sem)
{ {
if (++(sem->value) > 0 && sem->locked) { if (++(sem->value) > 0 && sem->locked) {
sem->locked = !(sem->locked); sem->locked = !(sem->locked);
mutex_unlock(&(sem->mutex), 0); mutex_unlock(&(sem->mutex));
} }
return 0; return 0;

View File

@ -208,7 +208,7 @@ void send_ieee802154_frame(ieee_802154_long_t *addr, uint8_t *payload,
memcpy(&buf[hdrlen], frame.payload, frame.payload_len); memcpy(&buf[hdrlen], frame.payload, frame.payload_len);
/* mutex unlock */ /* mutex unlock */
mutex_unlock(&buf_mutex, 0); mutex_unlock(&buf_mutex);
p.length = hdrlen + frame.payload_len; p.length = hdrlen + frame.payload_len;

View File

@ -423,7 +423,7 @@ void init_rtr_adv(ipv6_addr_t *addr, uint8_t sllao, uint8_t mtu, uint8_t pi,
free(contexts); free(contexts);
} }
mutex_unlock(&lowpan_context_mutex, 0); mutex_unlock(&lowpan_context_mutex);
} }
if (pi == OPT_PI) { if (pi == OPT_PI) {
@ -617,7 +617,7 @@ void recv_rtr_adv(void)
} }
} }
mutex_unlock(&lowpan_context_mutex, 0); mutex_unlock(&lowpan_context_mutex);
if (trigger_ns >= 0) { if (trigger_ns >= 0) {
/* send ns - draft-ietf-6lowpan-nd-15#section-5.5.1 /* send ns - draft-ietf-6lowpan-nd-15#section-5.5.1

View File

@ -234,7 +234,7 @@ void lowpan_transfer(void)
current_buf = packet_fifo; current_buf = packet_fifo;
if (current_buf != NULL) { if (current_buf != NULL) {
mutex_unlock(&fifo_mutex, 0); mutex_unlock(&fifo_mutex);
if ((current_buf->packet)[0] == LOWPAN_IPV6_DISPATCH) { if ((current_buf->packet)[0] == LOWPAN_IPV6_DISPATCH) {
ipv6_buf = get_ipv6_buf(); ipv6_buf = get_ipv6_buf();
@ -263,7 +263,7 @@ void lowpan_transfer(void)
if (gotosleep == 1) { if (gotosleep == 1) {
mutex_unlock(&fifo_mutex, 0); mutex_unlock(&fifo_mutex);
thread_sleep(); thread_sleep();
} }
} }
@ -450,7 +450,7 @@ lowpan_reas_buf_t *collect_garbage_fifo(lowpan_reas_buf_t *current_buf)
return_buf = my_buf->next; return_buf = my_buf->next;
} }
mutex_unlock(&fifo_mutex, 0); mutex_unlock(&fifo_mutex);
current_list = current_buf->interval_list_head; current_list = current_buf->interval_list_head;
temp_list = current_list; temp_list = current_list;
@ -610,7 +610,7 @@ void add_fifo_packet(lowpan_reas_buf_t *current_packet)
my_buf->next = current_packet; my_buf->next = current_packet;
} }
mutex_unlock(&fifo_mutex, 0); mutex_unlock(&fifo_mutex);
current_packet->next = NULL; current_packet->next = NULL;
} }
@ -973,7 +973,7 @@ void lowpan_iphc_encoding(ieee_802154_long_t *dest, ipv6_hdr_t *ipv6_buf_extra,
} }
} }
mutex_unlock(&lowpan_context_mutex, 0); mutex_unlock(&lowpan_context_mutex);
comp_buf[0] = lowpan_iphc[0]; comp_buf[0] = lowpan_iphc[0];
comp_buf[1] = lowpan_iphc[1]; comp_buf[1] = lowpan_iphc[1];
@ -1160,7 +1160,7 @@ void lowpan_iphc_decoding(uint8_t *data, uint8_t length,
} }
} }
mutex_unlock(&lowpan_context_mutex, 0); mutex_unlock(&lowpan_context_mutex);
} }
else { else {
switch(((lowpan_iphc[1] & LOWPAN_IPHC_SAM) >> 4) & 0x03) { switch(((lowpan_iphc[1] & LOWPAN_IPHC_SAM) >> 4) & 0x03) {
@ -1223,7 +1223,7 @@ void lowpan_iphc_decoding(uint8_t *data, uint8_t length,
} }
// TODO: // TODO:
mutex_unlock(&lowpan_context_mutex, 0); mutex_unlock(&lowpan_context_mutex);
} }
else { else {
/* If M=1 and DAC=0: */ /* If M=1 and DAC=0: */
@ -1326,7 +1326,7 @@ void lowpan_iphc_decoding(uint8_t *data, uint8_t length,
break; break;
} }
mutex_unlock(&lowpan_context_mutex, 0); mutex_unlock(&lowpan_context_mutex);
} }
else { else {
switch((lowpan_iphc[1] & LOWPAN_IPHC_DAM) & 0x03) { switch((lowpan_iphc[1] & LOWPAN_IPHC_DAM) & 0x03) {
@ -1487,7 +1487,7 @@ void lowpan_context_auto_remove(void)
lowpan_context_remove(to_remove[i]); lowpan_context_remove(to_remove[i]);
} }
mutex_unlock(&lowpan_context_mutex, 0); mutex_unlock(&lowpan_context_mutex);
} }
} }

View File

@ -79,6 +79,7 @@ static int update_shortterm(void)
void vtimer_tick(void *ptr) void vtimer_tick(void *ptr)
{ {
(void) ptr;
DEBUG("vtimer_tick()."); DEBUG("vtimer_tick().");
seconds += SECONDS_PER_TICK; seconds += SECONDS_PER_TICK;
@ -111,6 +112,7 @@ static int set_shortterm(vtimer_t *timer)
void vtimer_callback(void *ptr) void vtimer_callback(void *ptr)
{ {
(void) ptr;
vtimer_t *timer; vtimer_t *timer;
in_callback = true; in_callback = true;
hwtimer_id = -1; hwtimer_id = -1;