Skip to contentSkip to conversation

list_for_each_entry: fs-coda-psdev.c

PATCH In review [email protected] 2 participants 2 messages Oct 30, 2004 – Oct 31, 2004

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 list_for_each_entry: fs-coda-psdev.c

Use list_for_each_entry_safe to make code more readable. Compile tested.

---

 linux-2.6.10-rc1-max/fs/coda/psdev.c |    6 ++----
 1 files changed, 2 insertions(+), 4 deletions(-)
fs/coda/psdev.c renamed from fs/coda/psdev.c~list-for-each-entry-safe-fs_coda_psdev +2 -4
diff -puN fs/coda/psdev.c~list-for-each-entry-safe-fs_coda_psdev fs/coda/psdev.c
@@ -310,8 +310,7 @@ static int coda_psdev_open(struct inode 
 static int coda_psdev_release(struct inode * inode, struct file * file)
 {
         struct venus_comm *vcp = (struct venus_comm *) file->private_data;
-        struct upc_req *req;
-	struct list_head *lh, *next;
+        struct upc_req *req, *tmp;
 
 	lock_kernel();
 	if ( !vcp->vc_inuse ) {
@@ -326,8 +325,7 @@ static int coda_psdev_release(struct ino
 	}
         
         /* Wakeup clients so they can return. */
-	list_for_each_safe(lh, next, &vcp->vc_pending) {
-		req = list_entry(lh, struct upc_req, uc_chain);
+	list_for_each_entry_safe(req, tmp, &vcp->vc_pending, uc_chain) {
 		/* Async requests need to be freed here */
 		if (req->uc_flags & REQ_ASYNC) {
 			CODA_FREE(req->uc_data, sizeof(struct coda_in_hdr));

_

maintainer
#1 lore raw
Quoted 1 line · On Sun, Oct 31, 2004 at 12:32:59AM +0200, [email protected] wrote:

Use list_for_each_entry_safe to make code more readable.

I have no problem with this patch, I'm just wondering whether it is really worth the trouble.

Readability isn't all that bad with the existing 2 lines. Code wise it is identical, and if this is such a big deal why aren't the other list_for_each/list_entry macros in the same file corrected as well?

Jan