Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

kconfig: import list_move(_tail) and list_for_each_entry_reverse macros

Import more macros from include/linux/list.h.

These will be used in the next commit.

Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>

+53
+53
scripts/kconfig/list.h
··· 128 128 } 129 129 130 130 /** 131 + * list_move - delete from one list and add as another's head 132 + * @list: the entry to move 133 + * @head: the head that will precede our entry 134 + */ 135 + static inline void list_move(struct list_head *list, struct list_head *head) 136 + { 137 + __list_del_entry(list); 138 + list_add(list, head); 139 + } 140 + 141 + /** 142 + * list_move_tail - delete from one list and add as another's tail 143 + * @list: the entry to move 144 + * @head: the head that will follow our entry 145 + */ 146 + static inline void list_move_tail(struct list_head *list, 147 + struct list_head *head) 148 + { 149 + __list_del_entry(list); 150 + list_add_tail(list, head); 151 + } 152 + 153 + /** 131 154 * list_is_head - tests whether @list is the list @head 132 155 * @list: the entry to test 133 156 * @head: the head of the list ··· 190 167 list_entry((ptr)->next, type, member) 191 168 192 169 /** 170 + * list_last_entry - get the last element from a list 171 + * @ptr: the list head to take the element from. 172 + * @type: the type of the struct this is embedded in. 173 + * @member: the name of the list_head within the struct. 174 + * 175 + * Note, that list is expected to be not empty. 176 + */ 177 + #define list_last_entry(ptr, type, member) \ 178 + list_entry((ptr)->prev, type, member) 179 + 180 + /** 193 181 * list_next_entry - get the next element in list 194 182 * @pos: the type * to cursor 195 183 * @member: the name of the list_head within the struct. 196 184 */ 197 185 #define list_next_entry(pos, member) \ 198 186 list_entry((pos)->member.next, typeof(*(pos)), member) 187 + 188 + /** 189 + * list_prev_entry - get the prev element in list 190 + * @pos: the type * to cursor 191 + * @member: the name of the list_head within the struct. 192 + */ 193 + #define list_prev_entry(pos, member) \ 194 + list_entry((pos)->member.prev, typeof(*(pos)), member) 199 195 200 196 /** 201 197 * list_entry_is_head - test if the entry points to the head of the list ··· 235 193 for (pos = list_first_entry(head, typeof(*pos), member); \ 236 194 !list_entry_is_head(pos, head, member); \ 237 195 pos = list_next_entry(pos, member)) 196 + 197 + /** 198 + * list_for_each_entry_reverse - iterate backwards over list of given type. 199 + * @pos: the type * to use as a loop cursor. 200 + * @head: the head for your list. 201 + * @member: the name of the list_head within the struct. 202 + */ 203 + #define list_for_each_entry_reverse(pos, head, member) \ 204 + for (pos = list_last_entry(head, typeof(*pos), member); \ 205 + !list_entry_is_head(pos, head, member); \ 206 + pos = list_prev_entry(pos, member)) 238 207 239 208 /** 240 209 * list_for_each_entry_safe - iterate over list of given type. Safe against removal of list entry