Changeset dc747e3 in mainline for generic/src


Ignore:
Timestamp:
2005-12-15T10:27:59Z (20 years ago)
Author:
Jakub Jermar <jakub@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
7dd2561
Parents:
3fc03fd
Message:

Add SPINLOCK_DECLARE and SPINLOCK_INITIALIZE macros.
SPINLOCK_DECLARE is to be used instead of direct spinlock_t declarations
in dynamically allocated structures on which spinlock_initialize() is called after
their creation.
SPINLOCK_INITIALIZE is to be used instead of direct spinlock_t declarations
of global spinlocks. It declares and initializes the spinlock.
Moreover, both macros are empty on UP so that -Wall warnings about unused structures
get supressed.

Location:
generic/src
Files:
11 edited

Legend:

Unmodified
Added
Removed
  • generic/src/console/kconsole.c

    r3fc03fd rdc747e3  
    6666 */
    6767 
    68 spinlock_t cmd_lock;    /**< Lock protecting command list. */
    69 link_t cmd_head;        /**< Command list. */
     68SPINLOCK_INITIALIZE(cmd_lock);  /**< Lock protecting command list. */
     69link_t cmd_head;                /**< Command list. */
    7070
    7171static cmd_info_t *parse_cmdline(char *cmdline, size_t len);
     
    7878        int i;
    7979
    80         spinlock_initialize(&cmd_lock, "kconsole_cmd");
    8180        list_initialize(&cmd_head);
    8281
  • generic/src/cpu/cpu.c

    r3fc03fd rdc747e3  
    6767                        cpus[i].id = i;
    6868                       
     69                        spinlock_initialize(&cpus[i].lock, "cpu_t.lock");
     70
    6971                        #ifdef CONFIG_SMP
    7072                        waitq_initialize(&cpus[i].kcpulb_wq);
     
    7274                       
    7375                        for (j = 0; j < RQ_COUNT; j++) {
     76                                spinlock_initialize(&cpus[i].rq[j].lock, "rq_t.lock");
    7477                                list_initialize(&cpus[i].rq[j].rq_head);
    7578                        }
  • generic/src/debug/print.c

    r3fc03fd rdc747e3  
    3636#include <arch.h>
    3737
    38 static char digits[] = "0123456789abcdef"; /**< Hexadecimal characters */
    39 static spinlock_t printflock;              /**< printf spinlock */
     38static char digits[] = "0123456789abcdef";      /**< Hexadecimal characters */
     39SPINLOCK_INITIALIZE(printflock);                /**< printf spinlock */
    4040
    4141#define DEFAULT_DOUBLE_PRECISION 16
  • generic/src/interrupt/interrupt.c

    r3fc03fd rdc747e3  
    4141} exc_table[IVT_ITEMS];
    4242
    43 static spinlock_t exctbl_lock;
     43SPINLOCK_INITIALIZE(exctbl_lock);
    4444
    4545/** Register exception handler
     
    125125        int i;
    126126
    127         spinlock_initialize(&exctbl_lock, "exctbl_lock");
    128 
    129127        for (i=0;i < IVT_ITEMS; i++)
    130128                exc_register(i, "undef", exc_undef);
  • generic/src/main/main.c

    r3fc03fd rdc747e3  
    175175         */
    176176        kconsole_init();
     177
    177178        /* Exception handler initialization, before architecture
    178179         * starts adding it's own handlers
  • generic/src/mm/frame.c

    r3fc03fd rdc747e3  
    4242#include <align.h>
    4343
    44 spinlock_t zone_head_lock;       /**< this lock protects zone_head list */
    45 link_t zone_head;                /**< list of all zones in the system */
     44SPINLOCK_INITIALIZE(zone_head_lock);    /**< this lock protects zone_head list */
     45link_t zone_head;                       /**< list of all zones in the system */
    4646
    4747/** Blacklist containing non-available areas of memory.
     
    243243void zone_init(void)
    244244{
    245         spinlock_initialize(&zone_head_lock, "zone_head_lock");
    246245        list_initialize(&zone_head);
    247246}
  • generic/src/mm/heap.c

    r3fc03fd rdc747e3  
    4444
    4545static chunk_t *chunk0;
    46 static spinlock_t heaplock;
     46SPINLOCK_INITIALIZE(heaplock);
    4747
    4848void early_heap_init(__address heap, size_t size)
    4949{
    50         spinlock_initialize(&heaplock, "heap_lock");
    5150        memsetb(heap, size, 0);
    5251        chunk0 = (chunk_t *) heap;
  • generic/src/mm/tlb.c

    r3fc03fd rdc747e3  
    3838#include <panic.h>
    3939
    40 #ifdef CONFIG_SMP
    41 static spinlock_t tlblock;
    42 #endif
     40SPINLOCK_INITIALIZE(tlblock);
    4341
    4442void tlb_init(void)
    4543{
    46         if (config.cpu_active == 1)
    47                 spinlock_initialize(&tlblock, "tlb_lock");
    48 
    4944        tlb_arch_init();
    5045}
  • generic/src/proc/task.c

    r3fc03fd rdc747e3  
    3737#include <list.h>
    3838
    39 spinlock_t tasks_lock;
     39SPINLOCK_INITIALIZE(tasks_lock);
    4040link_t tasks_head;
    4141
     
    4949{
    5050        TASK = NULL;
    51         spinlock_initialize(&tasks_lock, "tasks_lock");
    5251        list_initialize(&tasks_head);
    5352}
  • generic/src/proc/thread.c

    r3fc03fd rdc747e3  
    5555char *thread_states[] = {"Invalid", "Running", "Sleeping", "Ready", "Entering", "Exiting"}; /**< Thread states */
    5656
    57 spinlock_t threads_lock;        /**< Lock protecting threads_head list. For locking rules, see declaration thereof. */
    58 link_t threads_head;            /**< List of all threads. */
    59 
    60 static spinlock_t tidlock;
     57SPINLOCK_INITIALIZE(threads_lock);      /**< Lock protecting threads_head list. For locking rules, see declaration thereof. */
     58link_t threads_head;                    /**< List of all threads. */
     59
     60SPINLOCK_INITIALIZE(tidlock);
    6161__u32 last_tid = 0;
    6262
     
    9797        THREAD = NULL;
    9898        nrdy = 0;
    99         spinlock_initialize(&threads_lock, "threads_lock");
    10099        list_initialize(&threads_head);
    101100}
  • generic/src/synch/rwlock.c

    r3fc03fd rdc747e3  
    193193                 * after this thread is put asleep.
    194194                 */
     195                #ifdef CONFIG_SMP
    195196                thread_register_call_me(release_spinlock, &rwl->lock);
     197                #else
     198                thread_register_call_me(release_spinlock, NULL);
     199                #endif
    196200                                 
    197201                rc = _mutex_lock_timeout(&rwl->exclusive, usec, trylock);
     
    201205                                 * release_spinlock() wasn't called
    202206                                 */
    203                                 thread_register_call_me(NULL, NULL);                             
     207                                thread_register_call_me(NULL, NULL);
    204208                                spinlock_unlock(&rwl->lock);
    205209                        case ESYNCH_TIMEOUT:
Note: See TracChangeset for help on using the changeset viewer.