Changeset a35b458 in mainline for kernel/generic/src/time


Ignore:
Timestamp:
2018-03-02T20:10:49Z (7 years ago)
Author:
Jiří Zárevúcky <zarevucky.jiri@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
f1380b7
Parents:
3061bc1
git-author:
Jiří Zárevúcky <zarevucky.jiri@…> (2018-02-28 17:38:31)
git-committer:
Jiří Zárevúcky <zarevucky.jiri@…> (2018-03-02 20:10:49)
Message:

style: Remove trailing whitespace on _all_ lines, including empty ones, for particular file types.

Command used: tools/srepl '\s\+$' '' -- *.c *.h *.py *.sh *.s *.S *.ag

Currently, whitespace on empty lines is very inconsistent.
There are two basic choices: Either remove the whitespace, or keep empty lines
indented to the level of surrounding code. The former is AFAICT more common,
and also much easier to do automatically.

Alternatively, we could write script for automatic indentation, and use that
instead. However, if such a script exists, it's possible to use the indented
style locally, by having the editor apply relevant conversions on load/save,
without affecting remote repository. IMO, it makes more sense to adopt
the simpler rule.

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

Legend:

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

    r3061bc1 ra35b458  
    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 ra35b458  
    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 ra35b458  
    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.