This only works if head->next == entry otherwise you lose half your
list. Also, none of this is SMP-safe.
I think you need something like this (but with locking!)
/*
* remove entry from list starting at head
* Return 0 if successful, non-zero otherwise.
*/
static inline int slist_del(struct slist *head, struct slist *entry)
{
struct slist **p;
for (p = &head->next; *p; p = &(*p)->next)
if (*p == entry) {
*p = entry->next;
entry->next = NULL;
return 0;
}
return -1;
}
Peter C
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/