Skip to contentSkip to conversation

Staging: gdm724x: Use list_next_entry instead of list_entry

PATCH In review Bhumika Goyal 2 participants 2 messages Mar 6, 2016 – Mar 11, 2016 Staging

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Staging: gdm724x: Use list_next_entry instead of list_entry

This patch replace list_entry with list_next_entry as it makes the code more clear to read.
Done using coccinelle:

@@
expression e1;
identifier e3;
type t;
@@
(
- list_entry(e1->e3.next,t,e3)
+ list_next_entry(e1,e3)
|
- list_entry(e1->e3.prev,t,e3)
+ list_prev_entry(e1,e3)
)

---
 drivers/staging/gdm724x/gdm_usb.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)
drivers/staging/gdm724x/gdm_usb.c +2 -3
index 9db9b90..a19d210 100644
@@ -227,7 +227,7 @@ static struct usb_rx *get_rx_struct(struct rx_cxt *rx, int *no_spc)
 		return NULL;
 	}
 
-	r = list_entry(rx->free_list.next, struct usb_rx, free_list);
+	r = list_next_entry(rx, free_list);
 	list_del(&r->free_list);
 
 	rx->avail_count--;
@@ -402,8 +402,7 @@ static void do_rx(struct work_struct *work)
 			spin_unlock_irqrestore(&rx->to_host_lock, flags);
 			break;
 		}
-		r = list_entry(rx->to_host_list.next,
-			       struct usb_rx, to_host_list);
+		r = list_next_entry(rx, to_host_list);
 		list_del(&r->to_host_list);
 		spin_unlock_irqrestore(&rx->to_host_lock, flags);
 
Signature · 1 line
1.9.1
maintainer
#1 lore raw
Quoted 17 lines · Bhumika Goyal

This patch replace list_entry with list_next_entry as it makes the code more clear to read.
Done using coccinelle:

@@
expression e1;
identifier e3;
type t;
@@
(
- list_entry(e1->e3.next,t,e3)
+ list_next_entry(e1,e3)
|
- list_entry(e1->e3.prev,t,e3)
+ list_prev_entry(e1,e3)
)

Quoted 4 lines
---
 drivers/staging/gdm724x/gdm_usb.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

Driver is no longer in the tree, sorry.