Oh, BTW, the kernel already has that macro but the last two words are swapped. It is called: list_for_each_entry_safe_reverse() Your lk-2.6 base is too old. --- Alexis Bruemmer <alexisb@xxxxxxxxxx> wrote: > Move list_each_entry_reverse_safe from sas_discover.h to the more > appropriate file list.h > > Signed-off-by: Alexis Bruemmer <alexisb@xxxxxxxxxx> > Signed-off-by: Mike Anderson <andmike@xxxxxxxxxx> > > --- > include/linux/list.h | 6 ++++++ > include/scsi/sas/sas_discover.h | 7 ------- > 2 files changed, 6 insertions(+), 7 deletions(-) > > Index: aic94xx-sas-2.6-patched/include/scsi/sas/sas_discover.h > =================================================================== > --- aic94xx-sas-2.6-patched.orig/include/scsi/sas/sas_discover.h > +++ aic94xx-sas-2.6-patched/include/scsi/sas/sas_discover.h > @@ -115,13 +115,6 @@ struct domain_device { > void *lldd_dev; > }; > > -#define list_for_each_entry_reverse_safe(pos, n, head, member) \ > - for (pos = list_entry((head)->prev, typeof(*pos), member), \ > - n = list_entry(pos->member.prev, typeof(*pos), member); \ > - &pos->member != (head); \ > - pos = n, n = list_entry(n->member.prev, typeof(*n), member)) > - > - > > void sas_init_disc(struct sas_discovery *disc, struct sas_port *port); > int sas_discover_event(struct sas_port *sas_port, enum discover_event ev); > Index: aic94xx-sas-2.6-patched/include/linux/list.h > =================================================================== > --- aic94xx-sas-2.6-patched.orig/include/linux/list.h > +++ aic94xx-sas-2.6-patched/include/linux/list.h > @@ -542,6 +542,12 @@ static inline void list_splice_init(stru > prefetch(rcu_dereference((pos))->next), (pos) != (head); \ > (pos) = (pos)->next) > > +#define list_for_each_entry_reverse_safe(pos, n, head, member) \ > + for (pos = list_entry((head)->prev, typeof(*pos), member), \ > + n = list_entry(pos->member.prev, typeof(*pos), member); \ > + &pos->member != (head); \ > + pos = n, n = list_entry(n->member.prev, typeof(*n), member)) > + > /* > * Double linked lists with a single pointer list head. > * Mostly useful for hash tables where the two pointer list head is > > > - > : send the line "unsubscribe linux-scsi" in > the body of a message to majordomo@xxxxxxxxxxxxxxx > More majordomo info at http://vger.kernel.org/majordomo-info.html > - : send the line "unsubscribe linux-scsi" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html