Changeset 8565a42 in mainline for kernel/generic/src/time


Ignore:
Timestamp:
2018-03-02T20:34:50Z (8 years ago)
Author:
GitHub <noreply@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
a1a81f69, d5e5fd1
Parents:
3061bc1 (diff), 34e1206 (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the (diff) links above to see all the changes relative to each parent.
git-author:
Jiří Zárevúcky <zarevucky.jiri@…> (2018-03-02 20:34:50)
git-committer:
GitHub <noreply@…> (2018-03-02 20:34:50)
Message:

Remove all trailing whitespace, everywhere.

See individual commit messages for details.

Location:
kernel/generic/src/time
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • kernel/generic/src/time/clock.c

    r3061bc1 r8565a42  
    8484        if (faddr == 0)
    8585                panic("Cannot allocate page for clock.");
    86        
     86
    8787        uptime = (uptime_t *) PA2KA(faddr);
    88        
     88
    8989        uptime->seconds1 = 0;
    9090        uptime->seconds2 = 0;
    9191        uptime->useconds = 0;
    92        
     92
    9393        clock_parea.pbase = faddr;
    9494        clock_parea.frames = 1;
     
    9696        clock_parea.mapped = false;
    9797        ddi_parea_register(&clock_parea);
    98        
     98
    9999        /*
    100100         * Prepare information for the userspace so that it can successfully
     
    146146{
    147147        size_t missed_clock_ticks = CPU->missed_clock_ticks;
    148        
     148
    149149        /* Account CPU usage */
    150150        cpu_update_accounting();
    151        
     151
    152152        /*
    153153         * To avoid lock ordering problems,
     
    160160                clock_update_counters();
    161161                cpu_update_accounting();
    162                
     162
    163163                irq_spinlock_lock(&CPU->timeoutlock, false);
    164                
     164
    165165                link_t *cur;
    166166                while ((cur = list_first(&CPU->timeout_active_list)) != NULL) {
    167167                        timeout_t *timeout = list_get_instance(cur, timeout_t,
    168168                            link);
    169                        
     169
    170170                        irq_spinlock_lock(&timeout->lock, false);
    171171                        if (timeout->ticks-- != 0) {
     
    173173                                break;
    174174                        }
    175                        
     175
    176176                        list_remove(cur);
    177177                        timeout_handler_t handler = timeout->handler;
    178178                        void *arg = timeout->arg;
    179179                        timeout_reinitialize(timeout);
    180                        
     180
    181181                        irq_spinlock_unlock(&timeout->lock, false);
    182182                        irq_spinlock_unlock(&CPU->timeoutlock, false);
    183                        
     183
    184184                        handler(arg);
    185                        
     185
    186186                        irq_spinlock_lock(&CPU->timeoutlock, false);
    187187                }
    188                
     188
    189189                irq_spinlock_unlock(&CPU->timeoutlock, false);
    190190        }
    191191        CPU->missed_clock_ticks = 0;
    192        
     192
    193193        /*
    194194         * Do CPU usage accounting and find out whether to preempt THREAD.
    195195         *
    196196         */
    197        
     197
    198198        if (THREAD) {
    199199                uint64_t ticks;
    200                
     200
    201201                irq_spinlock_lock(&CPU->lock, false);
    202202                CPU->needs_relink += 1 + missed_clock_ticks;
    203203                irq_spinlock_unlock(&CPU->lock, false);
    204                
     204
    205205                irq_spinlock_lock(&THREAD->lock, false);
    206206                if ((ticks = THREAD->ticks)) {
     
    211211                }
    212212                irq_spinlock_unlock(&THREAD->lock, false);
    213                
     213
    214214                if (ticks == 0 && PREEMPTION_ENABLED) {
    215215                        scheduler();
  • kernel/generic/src/time/delay.c

    r3061bc1 r8565a42  
    3535 * @brief       Active delay function.
    3636 */
    37  
     37
    3838#include <time/delay.h>
    3939#include <proc/thread.h>
  • kernel/generic/src/time/timeout.c

    r3061bc1 r8565a42  
    103103        irq_spinlock_lock(&CPU->timeoutlock, true);
    104104        irq_spinlock_lock(&timeout->lock, false);
    105        
     105
    106106        if (timeout->cpu)
    107107                panic("Unexpected: timeout->cpu != 0.");
    108        
     108
    109109        timeout->cpu = CPU;
    110110        timeout->ticks = us2ticks(time);
    111        
     111
    112112        timeout->handler = handler;
    113113        timeout->arg = arg;
    114        
     114
    115115        /*
    116116         * Insert timeout into the active timeouts list according to timeout->ticks.
     
    123123                target = list_get_instance(cur, timeout_t, link);
    124124                irq_spinlock_lock(&target->lock, false);
    125                
     125
    126126                if (timeout->ticks < sum + target->ticks) {
    127127                        irq_spinlock_unlock(&target->lock, false);
    128128                        break;
    129129                }
    130                
     130
    131131                sum += target->ticks;
    132132                irq_spinlock_unlock(&target->lock, false);
    133133        }
    134        
     134
    135135        /* Avoid using cur->prev directly */
    136136        link_t *prev = cur->prev;
    137137        list_insert_after(&timeout->link, prev);
    138        
     138
    139139        /*
    140140         * Adjust timeout->ticks according to ticks
     
    142142         */
    143143        timeout->ticks -= sum;
    144        
     144
    145145        /*
    146146         * Decrease ticks of timeout's immediate succesor by timeout->ticks.
     
    151151                irq_spinlock_unlock(&target->lock, false);
    152152        }
    153        
     153
    154154        irq_spinlock_unlock(&timeout->lock, false);
    155155        irq_spinlock_unlock(&CPU->timeoutlock, true);
     
    168168{
    169169        DEADLOCK_PROBE_INIT(p_tolock);
    170        
     170
    171171grab_locks:
    172172        irq_spinlock_lock(&timeout->lock, true);
     
    175175                return false;
    176176        }
    177        
     177
    178178        if (!irq_spinlock_trylock(&timeout->cpu->timeoutlock)) {
    179179                irq_spinlock_unlock(&timeout->lock, true);
     
    181181                goto grab_locks;
    182182        }
    183        
     183
    184184        /*
    185185         * Now we know for sure that timeout hasn't been activated yet
    186186         * and is lurking in timeout->cpu->timeout_active_list.
    187187         */
    188        
     188
    189189        link_t *cur = timeout->link.next;
    190190        if (cur != &timeout->cpu->timeout_active_list.head) {
     
    194194                irq_spinlock_unlock(&tmp->lock, false);
    195195        }
    196        
     196
    197197        list_remove(&timeout->link);
    198198        irq_spinlock_unlock(&timeout->cpu->timeoutlock, false);
    199        
     199
    200200        timeout_reinitialize(timeout);
    201201        irq_spinlock_unlock(&timeout->lock, true);
    202        
     202
    203203        return true;
    204204}
Note: See TracChangeset for help on using the changeset viewer.