linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: domen@coderock.org
To: akpm@osdl.org
Cc: linux-kernel@vger.kernel.org, domen@coderock.org,
	janitor@sternwelten.at, jdike@addtoit.com
Subject: [patch 04/11] list_for_each_entry: arch-um-drivers-chan_kern.c
Date: Wed, 12 Jan 2005 00:35:01 +0100	[thread overview]
Message-ID: <20050111233501.EB2A91F226@trashy.coderock.org> (raw)







Make code more readable with list_for_each_reverse.

Signed-off-by: Domen Puncer <domen@coderock.org>
Signed-off-by: Maximilian Attems <janitor@sternwelten.at>
Acked-by: Jeff Dike <jdike@addtoit.com>
Signed-off-by: Domen Puncer <domen@coderock.org>
---


 kj-domen/arch/um/drivers/chan_kern.c |    4 +---
 1 files changed, 1 insertion(+), 3 deletions(-)

diff -puN arch/um/drivers/chan_kern.c~list-for-each-entry-drivers_chan_kern arch/um/drivers/chan_kern.c
--- kj/arch/um/drivers/chan_kern.c~list-for-each-entry-drivers_chan_kern	2005-01-10 17:59:42.000000000 +0100
+++ kj-domen/arch/um/drivers/chan_kern.c	2005-01-10 17:59:42.000000000 +0100
@@ -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);
_

                 reply	other threads:[~2005-01-12  0:03 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20050111233501.EB2A91F226@trashy.coderock.org \
    --to=domen@coderock.org \
    --cc=akpm@osdl.org \
    --cc=janitor@sternwelten.at \
    --cc=jdike@addtoit.com \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).