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


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/cpu
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • kernel/generic/src/cpu/cpu.c

    r3061bc1 ra35b458  
    6363        if (config.cpu_active == 1) {
    6464#endif /* CONFIG_SMP */
    65                
     65
    6666                cpus = (cpu_t *) malloc(sizeof(cpu_t) * config.cpu_count,
    6767                    FRAME_ATOMIC);
    6868                if (!cpus)
    6969                        panic("Cannot allocate CPU structures.");
    70                
     70
    7171                /* Initialize everything */
    7272                memsetb(cpus, sizeof(cpu_t) * config.cpu_count, 0);
    73                
     73
    7474                size_t i;
    7575                for (i = 0; i < config.cpu_count; i++) {
     
    7878                        if (!stack_phys)
    7979                                panic("Cannot allocate CPU stack.");
    80                        
     80
    8181                        cpus[i].stack = (uint8_t *) PA2KA(stack_phys);
    8282                        cpus[i].id = i;
    83                        
     83
    8484                        irq_spinlock_initialize(&cpus[i].lock, "cpus[].lock");
    85                        
     85
    8686                        for (unsigned int j = 0; j < RQ_COUNT; j++) {
    8787                                irq_spinlock_initialize(&cpus[i].rq[j].lock, "cpus[].rq[].lock");
     
    8989                        }
    9090                }
    91                
     91
    9292#ifdef CONFIG_SMP
    9393        }
    9494#endif /* CONFIG_SMP */
    95        
     95
    9696        CPU = &cpus[config.cpu_active - 1];
    97        
     97
    9898        CPU->active = true;
    9999        CPU->tlb_active = true;
    100        
     100
    101101        CPU->idle = false;
    102102        CPU->last_cycle = get_cycle();
    103103        CPU->idle_cycles = 0;
    104104        CPU->busy_cycles = 0;
    105        
     105
    106106        cpu_identify();
    107107        cpu_arch_init();
     
    113113{
    114114        unsigned int i;
    115        
     115
    116116        for (i = 0; i < config.cpu_count; i++) {
    117117                if (cpus[i].active)
  • kernel/generic/src/cpu/cpu_mask.c

    r3061bc1 ra35b458  
    5555        assert(NULL != cpus);
    5656        assert(cpu_cnt <= config.cpu_count);
    57        
     57
    5858        for (size_t active_word = 0;
    5959                (active_word + 1) * word_bit_cnt <= cpu_cnt;
     
    6262                cpus->mask[active_word] = -1;
    6363        }
    64        
     64
    6565        size_t remaining_bits = (cpu_cnt % word_bit_cnt);
    6666        if (0 < remaining_bits) {
     
    8989{
    9090        assert(cpus);
    91        
     91
    9292        size_t word_cnt = cpu_mask_size() / word_size;
    93                
     93
    9494        for (size_t word = 0; word < word_cnt; ++word) {
    9595                cpus->mask[word] = 0;
     
    102102        size_t word = cpu_id / word_bit_cnt;
    103103        size_t word_pos = cpu_id % word_bit_cnt;
    104        
     104
    105105        cpus->mask[word] |= (1U << word_pos);
    106106}
     
    111111        size_t word = cpu_id / word_bit_cnt;
    112112        size_t word_pos = cpu_id % word_bit_cnt;
    113        
     113
    114114        cpus->mask[word] &= ~(1U << word_pos);
    115115}
     
    120120        size_t word = cpu_id / word_bit_cnt;
    121121        size_t word_pos = cpu_id % word_bit_cnt;
    122        
     122
    123123        return 0 != (cpus->mask[word] & (1U << word_pos));
    124124}
     
    133133                        return false;
    134134        }
    135        
     135
    136136        return true;
    137137}
Note: See TracChangeset for help on using the changeset viewer.