Re: [PATCH] drm/radeon/mkregtable: Delete unused list functions and macros
On Thu, Mar 1, 2018 at 10:41 AM, Guenter Roeckwrote: > On Wed, Feb 28, 2018 at 2:17 PM, Matthias Kaehlcke wrote: >> The util mkregtable includes a copy of the kernel API for linked lists, >> only a small subset of it is used. Delete the unused functions and macros. >> >> Signed-off-by: Matthias Kaehlcke > > Reviewed-by: Guenter Roeck Applied. thanks! Alex > >> --- >> drivers/gpu/drm/radeon/mkregtable.c | 433 >> 1 file changed, 433 deletions(-) >> >> diff --git a/drivers/gpu/drm/radeon/mkregtable.c >> b/drivers/gpu/drm/radeon/mkregtable.c >> index c21d8fa591ef..ba704633b072 100644 >> --- a/drivers/gpu/drm/radeon/mkregtable.c >> +++ b/drivers/gpu/drm/radeon/mkregtable.c >> @@ -43,10 +43,6 @@ struct list_head { >> struct list_head *next, *prev; >> }; >> >> -#define LIST_HEAD_INIT(name) { &(name), &(name) } >> - >> -#define LIST_HEAD(name) \ >> - struct list_head name = LIST_HEAD_INIT(name) >> >> static inline void INIT_LIST_HEAD(struct list_head *list) >> { >> @@ -74,19 +70,6 @@ extern void __list_add(struct list_head *new, >>struct list_head *prev, struct list_head *next); >> #endif >> >> -/** >> - * list_add - add a new entry >> - * @new: new entry to be added >> - * @head: list head to add it after >> - * >> - * Insert a new entry after the specified head. >> - * This is good for implementing stacks. >> - */ >> -static inline void list_add(struct list_head *new, struct list_head *head) >> -{ >> - __list_add(new, head, head->next); >> -} >> - >> /** >> * list_add_tail - add a new entry >> * @new: new entry to be added >> @@ -100,250 +83,6 @@ static inline void list_add_tail(struct list_head *new, >> struct list_head *head) >> __list_add(new, head->prev, head); >> } >> >> -/* >> - * Delete a list entry by making the prev/next entries >> - * point to each other. >> - * >> - * This is only for internal list manipulation where we know >> - * the prev/next entries already! >> - */ >> -static inline void __list_del(struct list_head *prev, struct list_head >> *next) >> -{ >> - next->prev = prev; >> - prev->next = next; >> -} >> - >> -/** >> - * list_del - deletes entry from list. >> - * @entry: the element to delete from the list. >> - * Note: list_empty() on entry does not return true after this, the entry is >> - * in an undefined state. >> - */ >> -#ifndef CONFIG_DEBUG_LIST >> -static inline void list_del(struct list_head *entry) >> -{ >> - __list_del(entry->prev, entry->next); >> - entry->next = (void *)0xDEADBEEF; >> - entry->prev = (void *)0xBEEFDEAD; >> -} >> -#else >> -extern void list_del(struct list_head *entry); >> -#endif >> - >> -/** >> - * list_replace - replace old entry by new one >> - * @old : the element to be replaced >> - * @new : the new element to insert >> - * >> - * If @old was empty, it will be overwritten. >> - */ >> -static inline void list_replace(struct list_head *old, struct list_head >> *new) >> -{ >> - new->next = old->next; >> - new->next->prev = new; >> - new->prev = old->prev; >> - new->prev->next = new; >> -} >> - >> -static inline void list_replace_init(struct list_head *old, >> -struct list_head *new) >> -{ >> - list_replace(old, new); >> - INIT_LIST_HEAD(old); >> -} >> - >> -/** >> - * list_del_init - deletes entry from list and reinitialize it. >> - * @entry: the element to delete from the list. >> - */ >> -static inline void list_del_init(struct list_head *entry) >> -{ >> - __list_del(entry->prev, entry->next); >> - INIT_LIST_HEAD(entry); >> -} >> - >> -/** >> - * list_move - delete from one list and add as another's head >> - * @list: the entry to move >> - * @head: the head that will precede our entry >> - */ >> -static inline void list_move(struct list_head *list, struct list_head *head) >> -{ >> - __list_del(list->prev, list->next); >> - list_add(list, head); >> -} >> - >> -/** >> - * list_move_tail - delete from one list and add as another's tail >> - * @list: the entry to move >> - * @head: the head that will follow our entry >> - */ >> -static inline void list_move_tail(struct list_head *list, >> - struct list_head *head) >> -{ >> - __list_del(list->prev, list->next); >> - list_add_tail(list, head); >> -} >> - >> -/** >> - * list_is_last - tests whether @list is the last entry in list @head >> - * @list: the entry to test >> - * @head: the head of the list >> - */ >> -static inline int list_is_last(const struct list_head *list, >> - const struct list_head *head) >> -{ >> - return list->next == head; >> -} >> - >> -/** >> - * list_empty - tests whether a list is empty >> - * @head: the list to test. >> - */ >> -static inline int list_empty(const struct list_head *head) >> -{ >> -
Re: [PATCH] drm/radeon/mkregtable: Delete unused list functions and macros
On Thu, Mar 1, 2018 at 10:41 AM, Guenter Roeck wrote: > On Wed, Feb 28, 2018 at 2:17 PM, Matthias Kaehlcke wrote: >> The util mkregtable includes a copy of the kernel API for linked lists, >> only a small subset of it is used. Delete the unused functions and macros. >> >> Signed-off-by: Matthias Kaehlcke > > Reviewed-by: Guenter Roeck Applied. thanks! Alex > >> --- >> drivers/gpu/drm/radeon/mkregtable.c | 433 >> 1 file changed, 433 deletions(-) >> >> diff --git a/drivers/gpu/drm/radeon/mkregtable.c >> b/drivers/gpu/drm/radeon/mkregtable.c >> index c21d8fa591ef..ba704633b072 100644 >> --- a/drivers/gpu/drm/radeon/mkregtable.c >> +++ b/drivers/gpu/drm/radeon/mkregtable.c >> @@ -43,10 +43,6 @@ struct list_head { >> struct list_head *next, *prev; >> }; >> >> -#define LIST_HEAD_INIT(name) { &(name), &(name) } >> - >> -#define LIST_HEAD(name) \ >> - struct list_head name = LIST_HEAD_INIT(name) >> >> static inline void INIT_LIST_HEAD(struct list_head *list) >> { >> @@ -74,19 +70,6 @@ extern void __list_add(struct list_head *new, >>struct list_head *prev, struct list_head *next); >> #endif >> >> -/** >> - * list_add - add a new entry >> - * @new: new entry to be added >> - * @head: list head to add it after >> - * >> - * Insert a new entry after the specified head. >> - * This is good for implementing stacks. >> - */ >> -static inline void list_add(struct list_head *new, struct list_head *head) >> -{ >> - __list_add(new, head, head->next); >> -} >> - >> /** >> * list_add_tail - add a new entry >> * @new: new entry to be added >> @@ -100,250 +83,6 @@ static inline void list_add_tail(struct list_head *new, >> struct list_head *head) >> __list_add(new, head->prev, head); >> } >> >> -/* >> - * Delete a list entry by making the prev/next entries >> - * point to each other. >> - * >> - * This is only for internal list manipulation where we know >> - * the prev/next entries already! >> - */ >> -static inline void __list_del(struct list_head *prev, struct list_head >> *next) >> -{ >> - next->prev = prev; >> - prev->next = next; >> -} >> - >> -/** >> - * list_del - deletes entry from list. >> - * @entry: the element to delete from the list. >> - * Note: list_empty() on entry does not return true after this, the entry is >> - * in an undefined state. >> - */ >> -#ifndef CONFIG_DEBUG_LIST >> -static inline void list_del(struct list_head *entry) >> -{ >> - __list_del(entry->prev, entry->next); >> - entry->next = (void *)0xDEADBEEF; >> - entry->prev = (void *)0xBEEFDEAD; >> -} >> -#else >> -extern void list_del(struct list_head *entry); >> -#endif >> - >> -/** >> - * list_replace - replace old entry by new one >> - * @old : the element to be replaced >> - * @new : the new element to insert >> - * >> - * If @old was empty, it will be overwritten. >> - */ >> -static inline void list_replace(struct list_head *old, struct list_head >> *new) >> -{ >> - new->next = old->next; >> - new->next->prev = new; >> - new->prev = old->prev; >> - new->prev->next = new; >> -} >> - >> -static inline void list_replace_init(struct list_head *old, >> -struct list_head *new) >> -{ >> - list_replace(old, new); >> - INIT_LIST_HEAD(old); >> -} >> - >> -/** >> - * list_del_init - deletes entry from list and reinitialize it. >> - * @entry: the element to delete from the list. >> - */ >> -static inline void list_del_init(struct list_head *entry) >> -{ >> - __list_del(entry->prev, entry->next); >> - INIT_LIST_HEAD(entry); >> -} >> - >> -/** >> - * list_move - delete from one list and add as another's head >> - * @list: the entry to move >> - * @head: the head that will precede our entry >> - */ >> -static inline void list_move(struct list_head *list, struct list_head *head) >> -{ >> - __list_del(list->prev, list->next); >> - list_add(list, head); >> -} >> - >> -/** >> - * list_move_tail - delete from one list and add as another's tail >> - * @list: the entry to move >> - * @head: the head that will follow our entry >> - */ >> -static inline void list_move_tail(struct list_head *list, >> - struct list_head *head) >> -{ >> - __list_del(list->prev, list->next); >> - list_add_tail(list, head); >> -} >> - >> -/** >> - * list_is_last - tests whether @list is the last entry in list @head >> - * @list: the entry to test >> - * @head: the head of the list >> - */ >> -static inline int list_is_last(const struct list_head *list, >> - const struct list_head *head) >> -{ >> - return list->next == head; >> -} >> - >> -/** >> - * list_empty - tests whether a list is empty >> - * @head: the list to test. >> - */ >> -static inline int list_empty(const struct list_head *head) >> -{ >> - return head->next == head; >> -} >> - >> -/** >> - * list_empty_careful -
Re: [PATCH] drm/radeon/mkregtable: Delete unused list functions and macros
On Wed, Feb 28, 2018 at 2:17 PM, Matthias Kaehlckewrote: > The util mkregtable includes a copy of the kernel API for linked lists, > only a small subset of it is used. Delete the unused functions and macros. > > Signed-off-by: Matthias Kaehlcke Reviewed-by: Guenter Roeck > --- > drivers/gpu/drm/radeon/mkregtable.c | 433 > 1 file changed, 433 deletions(-) > > diff --git a/drivers/gpu/drm/radeon/mkregtable.c > b/drivers/gpu/drm/radeon/mkregtable.c > index c21d8fa591ef..ba704633b072 100644 > --- a/drivers/gpu/drm/radeon/mkregtable.c > +++ b/drivers/gpu/drm/radeon/mkregtable.c > @@ -43,10 +43,6 @@ struct list_head { > struct list_head *next, *prev; > }; > > -#define LIST_HEAD_INIT(name) { &(name), &(name) } > - > -#define LIST_HEAD(name) \ > - struct list_head name = LIST_HEAD_INIT(name) > > static inline void INIT_LIST_HEAD(struct list_head *list) > { > @@ -74,19 +70,6 @@ extern void __list_add(struct list_head *new, >struct list_head *prev, struct list_head *next); > #endif > > -/** > - * list_add - add a new entry > - * @new: new entry to be added > - * @head: list head to add it after > - * > - * Insert a new entry after the specified head. > - * This is good for implementing stacks. > - */ > -static inline void list_add(struct list_head *new, struct list_head *head) > -{ > - __list_add(new, head, head->next); > -} > - > /** > * list_add_tail - add a new entry > * @new: new entry to be added > @@ -100,250 +83,6 @@ static inline void list_add_tail(struct list_head *new, > struct list_head *head) > __list_add(new, head->prev, head); > } > > -/* > - * Delete a list entry by making the prev/next entries > - * point to each other. > - * > - * This is only for internal list manipulation where we know > - * the prev/next entries already! > - */ > -static inline void __list_del(struct list_head *prev, struct list_head *next) > -{ > - next->prev = prev; > - prev->next = next; > -} > - > -/** > - * list_del - deletes entry from list. > - * @entry: the element to delete from the list. > - * Note: list_empty() on entry does not return true after this, the entry is > - * in an undefined state. > - */ > -#ifndef CONFIG_DEBUG_LIST > -static inline void list_del(struct list_head *entry) > -{ > - __list_del(entry->prev, entry->next); > - entry->next = (void *)0xDEADBEEF; > - entry->prev = (void *)0xBEEFDEAD; > -} > -#else > -extern void list_del(struct list_head *entry); > -#endif > - > -/** > - * list_replace - replace old entry by new one > - * @old : the element to be replaced > - * @new : the new element to insert > - * > - * If @old was empty, it will be overwritten. > - */ > -static inline void list_replace(struct list_head *old, struct list_head *new) > -{ > - new->next = old->next; > - new->next->prev = new; > - new->prev = old->prev; > - new->prev->next = new; > -} > - > -static inline void list_replace_init(struct list_head *old, > -struct list_head *new) > -{ > - list_replace(old, new); > - INIT_LIST_HEAD(old); > -} > - > -/** > - * list_del_init - deletes entry from list and reinitialize it. > - * @entry: the element to delete from the list. > - */ > -static inline void list_del_init(struct list_head *entry) > -{ > - __list_del(entry->prev, entry->next); > - INIT_LIST_HEAD(entry); > -} > - > -/** > - * list_move - delete from one list and add as another's head > - * @list: the entry to move > - * @head: the head that will precede our entry > - */ > -static inline void list_move(struct list_head *list, struct list_head *head) > -{ > - __list_del(list->prev, list->next); > - list_add(list, head); > -} > - > -/** > - * list_move_tail - delete from one list and add as another's tail > - * @list: the entry to move > - * @head: the head that will follow our entry > - */ > -static inline void list_move_tail(struct list_head *list, > - struct list_head *head) > -{ > - __list_del(list->prev, list->next); > - list_add_tail(list, head); > -} > - > -/** > - * list_is_last - tests whether @list is the last entry in list @head > - * @list: the entry to test > - * @head: the head of the list > - */ > -static inline int list_is_last(const struct list_head *list, > - const struct list_head *head) > -{ > - return list->next == head; > -} > - > -/** > - * list_empty - tests whether a list is empty > - * @head: the list to test. > - */ > -static inline int list_empty(const struct list_head *head) > -{ > - return head->next == head; > -} > - > -/** > - * list_empty_careful - tests whether a list is empty and not being modified > - * @head: the list to test > - * > - * Description: > - * tests whether a list is empty _and_ checks that no other CPU might be > - * in
Re: [PATCH] drm/radeon/mkregtable: Delete unused list functions and macros
On Wed, Feb 28, 2018 at 2:17 PM, Matthias Kaehlcke wrote: > The util mkregtable includes a copy of the kernel API for linked lists, > only a small subset of it is used. Delete the unused functions and macros. > > Signed-off-by: Matthias Kaehlcke Reviewed-by: Guenter Roeck > --- > drivers/gpu/drm/radeon/mkregtable.c | 433 > 1 file changed, 433 deletions(-) > > diff --git a/drivers/gpu/drm/radeon/mkregtable.c > b/drivers/gpu/drm/radeon/mkregtable.c > index c21d8fa591ef..ba704633b072 100644 > --- a/drivers/gpu/drm/radeon/mkregtable.c > +++ b/drivers/gpu/drm/radeon/mkregtable.c > @@ -43,10 +43,6 @@ struct list_head { > struct list_head *next, *prev; > }; > > -#define LIST_HEAD_INIT(name) { &(name), &(name) } > - > -#define LIST_HEAD(name) \ > - struct list_head name = LIST_HEAD_INIT(name) > > static inline void INIT_LIST_HEAD(struct list_head *list) > { > @@ -74,19 +70,6 @@ extern void __list_add(struct list_head *new, >struct list_head *prev, struct list_head *next); > #endif > > -/** > - * list_add - add a new entry > - * @new: new entry to be added > - * @head: list head to add it after > - * > - * Insert a new entry after the specified head. > - * This is good for implementing stacks. > - */ > -static inline void list_add(struct list_head *new, struct list_head *head) > -{ > - __list_add(new, head, head->next); > -} > - > /** > * list_add_tail - add a new entry > * @new: new entry to be added > @@ -100,250 +83,6 @@ static inline void list_add_tail(struct list_head *new, > struct list_head *head) > __list_add(new, head->prev, head); > } > > -/* > - * Delete a list entry by making the prev/next entries > - * point to each other. > - * > - * This is only for internal list manipulation where we know > - * the prev/next entries already! > - */ > -static inline void __list_del(struct list_head *prev, struct list_head *next) > -{ > - next->prev = prev; > - prev->next = next; > -} > - > -/** > - * list_del - deletes entry from list. > - * @entry: the element to delete from the list. > - * Note: list_empty() on entry does not return true after this, the entry is > - * in an undefined state. > - */ > -#ifndef CONFIG_DEBUG_LIST > -static inline void list_del(struct list_head *entry) > -{ > - __list_del(entry->prev, entry->next); > - entry->next = (void *)0xDEADBEEF; > - entry->prev = (void *)0xBEEFDEAD; > -} > -#else > -extern void list_del(struct list_head *entry); > -#endif > - > -/** > - * list_replace - replace old entry by new one > - * @old : the element to be replaced > - * @new : the new element to insert > - * > - * If @old was empty, it will be overwritten. > - */ > -static inline void list_replace(struct list_head *old, struct list_head *new) > -{ > - new->next = old->next; > - new->next->prev = new; > - new->prev = old->prev; > - new->prev->next = new; > -} > - > -static inline void list_replace_init(struct list_head *old, > -struct list_head *new) > -{ > - list_replace(old, new); > - INIT_LIST_HEAD(old); > -} > - > -/** > - * list_del_init - deletes entry from list and reinitialize it. > - * @entry: the element to delete from the list. > - */ > -static inline void list_del_init(struct list_head *entry) > -{ > - __list_del(entry->prev, entry->next); > - INIT_LIST_HEAD(entry); > -} > - > -/** > - * list_move - delete from one list and add as another's head > - * @list: the entry to move > - * @head: the head that will precede our entry > - */ > -static inline void list_move(struct list_head *list, struct list_head *head) > -{ > - __list_del(list->prev, list->next); > - list_add(list, head); > -} > - > -/** > - * list_move_tail - delete from one list and add as another's tail > - * @list: the entry to move > - * @head: the head that will follow our entry > - */ > -static inline void list_move_tail(struct list_head *list, > - struct list_head *head) > -{ > - __list_del(list->prev, list->next); > - list_add_tail(list, head); > -} > - > -/** > - * list_is_last - tests whether @list is the last entry in list @head > - * @list: the entry to test > - * @head: the head of the list > - */ > -static inline int list_is_last(const struct list_head *list, > - const struct list_head *head) > -{ > - return list->next == head; > -} > - > -/** > - * list_empty - tests whether a list is empty > - * @head: the list to test. > - */ > -static inline int list_empty(const struct list_head *head) > -{ > - return head->next == head; > -} > - > -/** > - * list_empty_careful - tests whether a list is empty and not being modified > - * @head: the list to test > - * > - * Description: > - * tests whether a list is empty _and_ checks that no other CPU might be > - * in the process of modifying either member (next or prev) > - * >
[PATCH] drm/radeon/mkregtable: Delete unused list functions and macros
The util mkregtable includes a copy of the kernel API for linked lists, only a small subset of it is used. Delete the unused functions and macros. Signed-off-by: Matthias Kaehlcke--- drivers/gpu/drm/radeon/mkregtable.c | 433 1 file changed, 433 deletions(-) diff --git a/drivers/gpu/drm/radeon/mkregtable.c b/drivers/gpu/drm/radeon/mkregtable.c index c21d8fa591ef..ba704633b072 100644 --- a/drivers/gpu/drm/radeon/mkregtable.c +++ b/drivers/gpu/drm/radeon/mkregtable.c @@ -43,10 +43,6 @@ struct list_head { struct list_head *next, *prev; }; -#define LIST_HEAD_INIT(name) { &(name), &(name) } - -#define LIST_HEAD(name) \ - struct list_head name = LIST_HEAD_INIT(name) static inline void INIT_LIST_HEAD(struct list_head *list) { @@ -74,19 +70,6 @@ extern void __list_add(struct list_head *new, struct list_head *prev, struct list_head *next); #endif -/** - * list_add - add a new entry - * @new: new entry to be added - * @head: list head to add it after - * - * Insert a new entry after the specified head. - * This is good for implementing stacks. - */ -static inline void list_add(struct list_head *new, struct list_head *head) -{ - __list_add(new, head, head->next); -} - /** * list_add_tail - add a new entry * @new: new entry to be added @@ -100,250 +83,6 @@ static inline void list_add_tail(struct list_head *new, struct list_head *head) __list_add(new, head->prev, head); } -/* - * Delete a list entry by making the prev/next entries - * point to each other. - * - * This is only for internal list manipulation where we know - * the prev/next entries already! - */ -static inline void __list_del(struct list_head *prev, struct list_head *next) -{ - next->prev = prev; - prev->next = next; -} - -/** - * list_del - deletes entry from list. - * @entry: the element to delete from the list. - * Note: list_empty() on entry does not return true after this, the entry is - * in an undefined state. - */ -#ifndef CONFIG_DEBUG_LIST -static inline void list_del(struct list_head *entry) -{ - __list_del(entry->prev, entry->next); - entry->next = (void *)0xDEADBEEF; - entry->prev = (void *)0xBEEFDEAD; -} -#else -extern void list_del(struct list_head *entry); -#endif - -/** - * list_replace - replace old entry by new one - * @old : the element to be replaced - * @new : the new element to insert - * - * If @old was empty, it will be overwritten. - */ -static inline void list_replace(struct list_head *old, struct list_head *new) -{ - new->next = old->next; - new->next->prev = new; - new->prev = old->prev; - new->prev->next = new; -} - -static inline void list_replace_init(struct list_head *old, -struct list_head *new) -{ - list_replace(old, new); - INIT_LIST_HEAD(old); -} - -/** - * list_del_init - deletes entry from list and reinitialize it. - * @entry: the element to delete from the list. - */ -static inline void list_del_init(struct list_head *entry) -{ - __list_del(entry->prev, entry->next); - INIT_LIST_HEAD(entry); -} - -/** - * list_move - delete from one list and add as another's head - * @list: the entry to move - * @head: the head that will precede our entry - */ -static inline void list_move(struct list_head *list, struct list_head *head) -{ - __list_del(list->prev, list->next); - list_add(list, head); -} - -/** - * list_move_tail - delete from one list and add as another's tail - * @list: the entry to move - * @head: the head that will follow our entry - */ -static inline void list_move_tail(struct list_head *list, - struct list_head *head) -{ - __list_del(list->prev, list->next); - list_add_tail(list, head); -} - -/** - * list_is_last - tests whether @list is the last entry in list @head - * @list: the entry to test - * @head: the head of the list - */ -static inline int list_is_last(const struct list_head *list, - const struct list_head *head) -{ - return list->next == head; -} - -/** - * list_empty - tests whether a list is empty - * @head: the list to test. - */ -static inline int list_empty(const struct list_head *head) -{ - return head->next == head; -} - -/** - * list_empty_careful - tests whether a list is empty and not being modified - * @head: the list to test - * - * Description: - * tests whether a list is empty _and_ checks that no other CPU might be - * in the process of modifying either member (next or prev) - * - * NOTE: using list_empty_careful() without synchronization - * can only be safe if the only activity that can happen - * to the list entry is list_del_init(). Eg. it cannot be used - * if another CPU could re-list_add() it. - */ -static inline int list_empty_careful(const struct list_head *head) -{ - struct list_head *next = head->next; - return (next == head) && (next
[PATCH] drm/radeon/mkregtable: Delete unused list functions and macros
The util mkregtable includes a copy of the kernel API for linked lists, only a small subset of it is used. Delete the unused functions and macros. Signed-off-by: Matthias Kaehlcke --- drivers/gpu/drm/radeon/mkregtable.c | 433 1 file changed, 433 deletions(-) diff --git a/drivers/gpu/drm/radeon/mkregtable.c b/drivers/gpu/drm/radeon/mkregtable.c index c21d8fa591ef..ba704633b072 100644 --- a/drivers/gpu/drm/radeon/mkregtable.c +++ b/drivers/gpu/drm/radeon/mkregtable.c @@ -43,10 +43,6 @@ struct list_head { struct list_head *next, *prev; }; -#define LIST_HEAD_INIT(name) { &(name), &(name) } - -#define LIST_HEAD(name) \ - struct list_head name = LIST_HEAD_INIT(name) static inline void INIT_LIST_HEAD(struct list_head *list) { @@ -74,19 +70,6 @@ extern void __list_add(struct list_head *new, struct list_head *prev, struct list_head *next); #endif -/** - * list_add - add a new entry - * @new: new entry to be added - * @head: list head to add it after - * - * Insert a new entry after the specified head. - * This is good for implementing stacks. - */ -static inline void list_add(struct list_head *new, struct list_head *head) -{ - __list_add(new, head, head->next); -} - /** * list_add_tail - add a new entry * @new: new entry to be added @@ -100,250 +83,6 @@ static inline void list_add_tail(struct list_head *new, struct list_head *head) __list_add(new, head->prev, head); } -/* - * Delete a list entry by making the prev/next entries - * point to each other. - * - * This is only for internal list manipulation where we know - * the prev/next entries already! - */ -static inline void __list_del(struct list_head *prev, struct list_head *next) -{ - next->prev = prev; - prev->next = next; -} - -/** - * list_del - deletes entry from list. - * @entry: the element to delete from the list. - * Note: list_empty() on entry does not return true after this, the entry is - * in an undefined state. - */ -#ifndef CONFIG_DEBUG_LIST -static inline void list_del(struct list_head *entry) -{ - __list_del(entry->prev, entry->next); - entry->next = (void *)0xDEADBEEF; - entry->prev = (void *)0xBEEFDEAD; -} -#else -extern void list_del(struct list_head *entry); -#endif - -/** - * list_replace - replace old entry by new one - * @old : the element to be replaced - * @new : the new element to insert - * - * If @old was empty, it will be overwritten. - */ -static inline void list_replace(struct list_head *old, struct list_head *new) -{ - new->next = old->next; - new->next->prev = new; - new->prev = old->prev; - new->prev->next = new; -} - -static inline void list_replace_init(struct list_head *old, -struct list_head *new) -{ - list_replace(old, new); - INIT_LIST_HEAD(old); -} - -/** - * list_del_init - deletes entry from list and reinitialize it. - * @entry: the element to delete from the list. - */ -static inline void list_del_init(struct list_head *entry) -{ - __list_del(entry->prev, entry->next); - INIT_LIST_HEAD(entry); -} - -/** - * list_move - delete from one list and add as another's head - * @list: the entry to move - * @head: the head that will precede our entry - */ -static inline void list_move(struct list_head *list, struct list_head *head) -{ - __list_del(list->prev, list->next); - list_add(list, head); -} - -/** - * list_move_tail - delete from one list and add as another's tail - * @list: the entry to move - * @head: the head that will follow our entry - */ -static inline void list_move_tail(struct list_head *list, - struct list_head *head) -{ - __list_del(list->prev, list->next); - list_add_tail(list, head); -} - -/** - * list_is_last - tests whether @list is the last entry in list @head - * @list: the entry to test - * @head: the head of the list - */ -static inline int list_is_last(const struct list_head *list, - const struct list_head *head) -{ - return list->next == head; -} - -/** - * list_empty - tests whether a list is empty - * @head: the list to test. - */ -static inline int list_empty(const struct list_head *head) -{ - return head->next == head; -} - -/** - * list_empty_careful - tests whether a list is empty and not being modified - * @head: the list to test - * - * Description: - * tests whether a list is empty _and_ checks that no other CPU might be - * in the process of modifying either member (next or prev) - * - * NOTE: using list_empty_careful() without synchronization - * can only be safe if the only activity that can happen - * to the list entry is list_del_init(). Eg. it cannot be used - * if another CPU could re-list_add() it. - */ -static inline int list_empty_careful(const struct list_head *head) -{ - struct list_head *next = head->next; - return (next == head) && (next == head->prev); -}