list_for_each_entry: fs-coda-psdev.c
Subsystems (2)
PATCH 1/1 list_for_each_entry: fs-coda-psdev.c
Use list_for_each_entry_safe to make code more readable. Compile tested.
Signed-off-by Domen Puncer <[email protected]>
Signed-off-by Maximilian Attems <[email protected]>
---
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
@@ -310,8 +310,7 @@ static int coda_psdev_open(struct inodestatic 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 ));
_
Jan Harkes
maintainerQuoted 1 line · On Sun, Oct 31, 2004 at 12:32:59AM +0200, [email protected] wrote:
Use
list_for_each_entry_safeto 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