Skip to contentSkip to conversation

list_for_each_entry: arch-um-drivers-chan_kern.c

PATCH In review [email protected] 2 participants 2 messages Nov 20, 2004 – Nov 21, 2004 User-mode Linux (UML)

lore
Share & tools
lore
#0 lore raw

PATCH 1/9 list_for_each_entry: arch-um-drivers-chan_kern.c

Make code more readable with list_for_each_reverse.

---

 linux-2.6.10-rc2-bk4-max/arch/um/drivers/chan_kern.c |    4 +---
 1 files changed, 1 insertion(+), 3 deletions(-)
arch/um/drivers/chan_kern.c renamed from arch/um/drivers/chan_kern.c~list-for-each-entry-drivers_chan_kern +1 -3
diff -puN arch/um/drivers/chan_kern.c~list-for-each-entry-drivers_chan_kern arch/um/drivers/chan_kern.c
@@ -218,7 +218,6 @@ void enable_chan(struct list_head *chans
 
 void close_chan(struct list_head *chans)
 {
-	struct list_head *ele;
 	struct chan *chan;
 
 	/* Close in reverse order as open in case more than one of them
@@ -226,8 +225,7 @@ void close_chan(struct list_head *chans)
 	 * state.  Then, the first one opened will have the original state,
 	 * so it must be the last closed.
 	 */
-        for(ele = chans->prev; ele != chans; ele = ele->prev){
-                chan = list_entry(ele, struct chan, list);
+	list_for_each_entry_reverse(chan, chans, list) {
 		if(!chan->opened) continue;
 		if(chan->ops->close != NULL)
 			(*chan->ops->close)(chan->fd, chan->data);

_