Browse Source

core: remove unneeded calls to mutex_init()

dev/timer
René Kijewski 9 years ago
parent
commit
6fae042a60
  1. 5
      core/hwtimer.c
  2. 3
      drivers/cc110x/cc1100_phy.c
  3. 3
      drivers/sht11/sht11.c
  4. 10
      sys/net/network_layer/sixlowpan/lowpan.c
  5. 3
      sys/net/routing/etx_beaconing.c
  6. 6
      sys/net/routing/rpl/rpl.c
  7. 3
      sys/vtimer/vtimer.c
  8. 3
      tests/test_mutex_unlock_and_sleep/main.c
  9. 3
      tests/test_pthread_condition_variable/main.c
  10. 4
      tests/test_thread_cooperation/main.c

5
core/hwtimer.c

@ -122,13 +122,12 @@ void hwtimer_wait(unsigned long ticks)
{
DEBUG("hwtimer_wait ticks=%lu\n", ticks);
mutex_t mutex;
if (ticks <= 6 || inISR()) {
hwtimer_spin(ticks);
return;
}
mutex_init(&mutex);
mutex_t mutex = MUTEX_INIT;
mutex_lock(&mutex);
/* -2 is to adjust the real value */
int res = hwtimer_set(ticks - 2, hwtimer_releasemutex, &mutex);

3
drivers/cc110x/cc1100_phy.c

@ -82,7 +82,7 @@ static packet_monitor_t packet_monitor;
static handler_entry_t handlers[MAX_PACKET_HANDLERS];
static const pm_table_t handler_table;
static const char *cc1100_event_handler_name = "cc1100_event_handler";
static mutex_t cc1100_mutex;
static mutex_t cc1100_mutex = MUTEX_INIT;
volatile int cc1100_mutex_pid;
static vtimer_t cc1100_watch_dog;
static timex_t cc1100_watch_dog_period;
@ -175,7 +175,6 @@ void cc1100_phy_init(void)
/* Initialize mutex */
cc1100_mutex_pid = -1;
mutex_init(&cc1100_mutex);
/* Allocate event numbers and start cc1100 event process */
cc1100_event_handler_pid = thread_create(event_handler_stack, sizeof(event_handler_stack), PRIORITY_CC1100, CREATE_STACKTEST,

3
drivers/sht11/sht11.c

@ -85,7 +85,7 @@ static void transmission_start(void);
static inline void clk_signal(void);
/* mutex for exclusive measurement operation */
mutex_t sht11_mutex;
mutex_t sht11_mutex = MUTEX_INIT;
/*---------------------------------------------------------------------------*/
static inline void clk_signal(void)
@ -266,7 +266,6 @@ static uint8_t measure(uint8_t *p_value, uint8_t *p_checksum, uint8_t mode)
void sht11_init(void)
{
sht11_temperature_offset = 0;
mutex_init(&sht11_mutex);
SHT11_INIT;
hwtimer_wait(11 * HWTIMER_TICKS(1000));
}

10
sys/net/network_layer/sixlowpan/lowpan.c

@ -121,14 +121,14 @@ uint8_t frag_size;
uint8_t reas_buf[512];
uint8_t comp_buf[512];
uint8_t first_frag = 0;
mutex_t fifo_mutex;
mutex_t fifo_mutex = MUTEX_INIT;
int ip_process_pid = 0;
int nd_nbr_cache_rem_pid = 0;
int contexts_rem_pid = 0;
int transfer_pid = 0;
mutex_t lowpan_context_mutex;
mutex_t lowpan_context_mutex = MUTEX_INIT;
/* registered upper layer threads */
int sixlowpan_reg[SIXLOWPAN_MAX_REGISTERED];
@ -1788,12 +1788,6 @@ int sixlowpan_lowpan_init(void)
/* init mac-layer and radio transceiver */
sixlowpan_mac_init();
/* init lowpan context mutex */
mutex_init(&lowpan_context_mutex);
/* init packet_fifo mutex */
mutex_init(&fifo_mutex);
if (!ip_process_pid) {
ip_process_pid = thread_create(ip_process_buf, IP_PROCESS_STACKSIZE,
PRIORITY_MAIN - 1, CREATE_STACKTEST,

3
sys/net/routing/etx_beaconing.c

@ -98,7 +98,7 @@ static etx_neighbor_t candidates[ETX_MAX_CANDIDATE_NEIGHBORS];
* In this time, no packet may be handled, otherwise it could assume values
* from the last round to count for this round.
*/
mutex_t etx_mutex;
mutex_t etx_mutex = MUTEX_INIT;
//Transceiver command for sending ETX probes
transceiver_command_t tcmd;
@ -141,7 +141,6 @@ void etx_show_candidates(void)
void etx_init_beaconing(ipv6_addr_t *address)
{
mutex_init(&etx_mutex);
own_address = address;
//set code
puts("ETX BEACON INIT");

6
sys/net/routing/rpl/rpl.c

@ -50,8 +50,8 @@ char addr_str[IPV6_MAX_ADDR_STR_LEN];
rpl_of_t *rpl_objective_functions[NUMBER_IMPLEMENTED_OFS];
rpl_routing_entry_t rpl_routing_table[RPL_MAX_ROUTING_ENTRIES];
unsigned int rpl_process_pid;
mutex_t rpl_recv_mutex;
mutex_t rpl_send_mutex;
mutex_t rpl_recv_mutex = MUTEX_INIT;
mutex_t rpl_send_mutex = MUTEX_INIT;
msg_t rpl_msg_queue[RPL_PKT_RECV_BUF_SIZE];
char rpl_process_buf[RPL_PROCESS_STACKSIZE];
uint8_t rpl_buffer[BUFFER_SIZE - LL_HDR_LEN];
@ -73,8 +73,6 @@ rpl_of_t *rpl_get_of_for_ocp(uint16_t ocp)
uint8_t rpl_init(int if_id)
{
mutex_init(&rpl_send_mutex);
mutex_init(&rpl_recv_mutex);
rpl_instances_init();
/* initialize routing table */

3
sys/vtimer/vtimer.c

@ -343,8 +343,7 @@ int vtimer_sleep(timex_t time)
int ret;
vtimer_t t;
mutex_t mutex;
mutex_init(&mutex);
mutex_t mutex = MUTEX_INIT;
mutex_lock(&mutex);
t.action = vtimer_callback_unlock;

3
tests/test_mutex_unlock_and_sleep/main.c

@ -22,7 +22,7 @@
#include "thread.h"
#include "mutex.h"
static mutex_t mutex;
static mutex_t mutex = MUTEX_INIT;
static volatile int indicator, count;
static char stack[KERNEL_CONF_STACKSIZE_MAIN];
@ -42,7 +42,6 @@ int main(void)
{
indicator = 0;
count = 0;
mutex_init(&mutex);
thread_create(stack,
sizeof(stack),

3
tests/test_pthread_condition_variable/main.c

@ -22,7 +22,7 @@
#include "pthread.h"
#include "thread.h"
static mutex_t mutex;
static mutex_t mutex = MUTEX_INIT;
static struct pthread_cond_t cv;
static volatile int is_finished;
static volatile long count;
@ -55,7 +55,6 @@ int main(void)
count = 0;
is_finished = 0;
expected_value = 1000*1000;
mutex_init(&mutex);
pthread_cond_init(&cv, NULL);
int pid = thread_create(stack,

4
tests/test_thread_cooperation/main.c

@ -26,7 +26,7 @@
#define PROBLEM 12
mutex_t mtx;
mutex_t mtx = MUTEX_INIT;
volatile int storage = 1;
int main_id;
@ -63,8 +63,6 @@ int main(void)
{
main_id = thread_getpid();
mutex_init(&mtx);
printf("Problem: %d\n", PROBLEM);
msg_t args[PROBLEM];

Loading…
Cancel
Save