Changeset a35b458 in mainline for kernel/generic/src/synch/spinlock.c


Ignore:
Timestamp:
2018-03-02T20:10:49Z (6 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.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • kernel/generic/src/synch/spinlock.c

    r3061bc1 ra35b458  
    7777        size_t i = 0;
    7878        bool deadlock_reported = false;
    79        
     79
    8080        preemption_disable();
    8181        while (test_and_set(&lock->val)) {
     
    101101                if (lock->name[0] == '*')
    102102                        continue;
    103                
     103
    104104                if (i++ > DEADLOCK_THRESHOLD) {
    105105                        printf("cpu%u: looping on spinlock %p:%s, "
     
    107107                            (void *) CALLER, symtab_fmt_name_lookup(CALLER));
    108108                        stack_trace();
    109                        
     109
    110110                        i = 0;
    111111                        deadlock_reported = true;
    112112                }
    113113        }
    114        
     114
    115115        if (deadlock_reported)
    116116                printf("cpu%u: not deadlocked\n", CPU->id);
    117        
     117
    118118        /*
    119119         * Prevent critical section code from bleeding out this way up.
     
    131131{
    132132        ASSERT_SPINLOCK(spinlock_locked(lock), lock);
    133        
     133
    134134        /*
    135135         * Prevent critical section code from bleeding out this way down.
    136136         */
    137137        CS_LEAVE_BARRIER();
    138        
     138
    139139        atomic_set(&lock->val, 0);
    140140        preemption_enable();
     
    157157        preemption_disable();
    158158        bool ret = !test_and_set(&lock->val);
    159        
     159
    160160        /*
    161161         * Prevent critical section code from bleeding out this way up.
    162162         */
    163163        CS_ENTER_BARRIER();
    164        
     164
    165165        if (!ret)
    166166                preemption_enable();
    167        
     167
    168168        return ret;
    169169}
     
    208208                ipl_t ipl = interrupts_disable();
    209209                spinlock_lock(&(lock->lock));
    210                
     210
    211211                lock->guard = true;
    212212                lock->ipl = ipl;
    213213        } else {
    214214                ASSERT_IRQ_SPINLOCK(interrupts_disabled(), lock);
    215                
     215
    216216                spinlock_lock(&(lock->lock));
    217217                ASSERT_IRQ_SPINLOCK(!lock->guard, lock);
     
    231231{
    232232        ASSERT_IRQ_SPINLOCK(interrupts_disabled(), lock);
    233        
     233
    234234        if (irq_res) {
    235235                ASSERT_IRQ_SPINLOCK(lock->guard, lock);
    236                
     236
    237237                lock->guard = false;
    238238                ipl_t ipl = lock->ipl;
    239                
     239
    240240                spinlock_unlock(&(lock->lock));
    241241                interrupts_restore(ipl);
     
    261261        ASSERT_IRQ_SPINLOCK(interrupts_disabled(), lock);
    262262        bool ret = spinlock_trylock(&(lock->lock));
    263        
     263
    264264        ASSERT_IRQ_SPINLOCK((!ret) || (!lock->guard), lock);
    265265        return ret;
     
    280280{
    281281        ASSERT_IRQ_SPINLOCK(interrupts_disabled(), unlock);
    282        
     282
    283283        /* Pass guard from unlock to lock */
    284284        bool guard = unlock->guard;
    285285        ipl_t ipl = unlock->ipl;
    286286        unlock->guard = false;
    287        
     287
    288288        spinlock_unlock(&(unlock->lock));
    289289        spinlock_lock(&(lock->lock));
    290        
     290
    291291        ASSERT_IRQ_SPINLOCK(!lock->guard, lock);
    292        
     292
    293293        if (guard) {
    294294                lock->guard = true;
     
    311311{
    312312        ASSERT_IRQ_SPINLOCK(interrupts_disabled(), unlock);
    313        
     313
    314314        spinlock_lock(&(lock->lock));
    315315        ASSERT_IRQ_SPINLOCK(!lock->guard, lock);
    316        
     316
    317317        /* Pass guard from unlock to lock */
    318318        if (unlock->guard) {
     
    321321                unlock->guard = false;
    322322        }
    323        
     323
    324324        spinlock_unlock(&(unlock->lock));
    325325}
Note: See TracChangeset for help on using the changeset viewer.