Changeset 583c2a3 in mainline
- Timestamp:
- 2020-07-06T22:58:19Z (5 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 37d4c91, ee2f0beb
- Parents:
- 762f989
- Location:
- kernel/generic/src
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
kernel/generic/src/console/kconsole.c
r762f989 r583c2a3 172 172 173 173 if (*startpos == NULL) 174 *startpos = cmd_list.head.next;175 176 for (; *startpos != &cmd_list.head; *startpos = (*startpos)->next) {174 *startpos = list_first(&cmd_list); 175 176 for (; *startpos != NULL; *startpos = list_next(*startpos, &cmd_list)) { 177 177 cmd_info_t *hlp = list_get_instance(*startpos, cmd_info_t, link); 178 178 … … 182 182 183 183 if (str_lcmp(curname, name, namelen) == 0) { 184 *startpos = (*startpos)->next;184 *startpos = list_next(*startpos, &cmd_list); 185 185 if (h) 186 186 *h = hlp->description; -
kernel/generic/src/mm/slab.c
r762f989 r583c2a3 837 837 irq_spinlock_lock(&slab_cache_lock, true); 838 838 839 link_t *cur = slab_cache_list.head.next;839 link_t *cur = list_first(&slab_cache_list); 840 840 size_t i = 0; 841 while (i < skip && cur != &slab_cache_list.head) {841 while (i < skip && cur != NULL) { 842 842 i++; 843 cur = cur->next;843 cur = list_next(cur, &slab_cache_list); 844 844 } 845 845 846 if (cur == &slab_cache_list.head) {846 if (cur == NULL) { 847 847 irq_spinlock_unlock(&slab_cache_lock, true); 848 848 break; -
kernel/generic/src/proc/scheduler.c
r762f989 r583c2a3 610 610 611 611 /* Search rq from the back */ 612 link_t *link = cpu->rq[rq].rq.head.prev;613 614 while (link != &(cpu->rq[rq].rq.head)) {612 link_t *link = list_last(&cpu->rq[rq].rq); 613 614 while (link != NULL) { 615 615 thread = (thread_t *) list_get_instance(link, 616 616 thread_t, rq_link); … … 644 644 irq_spinlock_unlock(&thread->lock, false); 645 645 646 link = li nk->prev;646 link = list_prev(link, &cpu->rq[rq].rq); 647 647 thread = NULL; 648 648 } -
kernel/generic/src/time/timeout.c
r762f989 r583c2a3 118 118 uint64_t sum = 0; 119 119 timeout_t *target = NULL; 120 link_t *cur; 121 for (cur = CPU->timeout_active_list.head.next; 122 cur != &CPU->timeout_active_list.head; cur = cur->next) { 120 link_t *cur, *prev; 121 prev = NULL; 122 for (cur = list_first(&CPU->timeout_active_list); 123 cur != NULL; cur = list_next(cur, &CPU->timeout_active_list)) { 123 124 target = list_get_instance(cur, timeout_t, link); 124 125 irq_spinlock_lock(&target->lock, false); … … 131 132 sum += target->ticks; 132 133 irq_spinlock_unlock(&target->lock, false); 133 } 134 135 /* Avoid using cur->prev directly */ 136 link_t *prev = cur->prev; 137 list_insert_after(&timeout->link, prev); 134 prev = cur; 135 } 136 137 if (prev == NULL) 138 list_prepend(&timeout->link, &CPU->timeout_active_list); 139 else 140 list_insert_after(&timeout->link, prev); 138 141 139 142 /* … … 146 149 * Decrease ticks of timeout's immediate succesor by timeout->ticks. 147 150 */ 148 if (cur != &CPU->timeout_active_list.head) {151 if (cur != NULL) { 149 152 irq_spinlock_lock(&target->lock, false); 150 153 target->ticks -= timeout->ticks; … … 187 190 */ 188 191 189 link_t *cur = timeout->link.next; 190 if (cur != &timeout->cpu->timeout_active_list.head) { 192 link_t *cur = list_next(&timeout->link, 193 &timeout->cpu->timeout_active_list); 194 if (cur != NULL) { 191 195 timeout_t *tmp = list_get_instance(cur, timeout_t, link); 192 196 irq_spinlock_lock(&tmp->lock, false);
Note:
See TracChangeset
for help on using the changeset viewer.