Commit 57477bf0 authored by Geliang Tang's avatar Geliang Tang Committed by Greg Kroah-Hartman

staging: wlan-ng: use list_for_each_entry*

Use list_for_each_entry*() instead of list_for_each*() to simplify
the code.
Signed-off-by: default avatarGeliang Tang <geliangtang@163.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 6c37e1f9
...@@ -2810,8 +2810,7 @@ void hfa384x_tx_timeout(wlandevice_t *wlandev) ...@@ -2810,8 +2810,7 @@ void hfa384x_tx_timeout(wlandevice_t *wlandev)
static void hfa384x_usbctlx_reaper_task(unsigned long data) static void hfa384x_usbctlx_reaper_task(unsigned long data)
{ {
hfa384x_t *hw = (hfa384x_t *)data; hfa384x_t *hw = (hfa384x_t *)data;
struct list_head *entry; hfa384x_usbctlx_t *ctlx, *temp;
struct list_head *temp;
unsigned long flags; unsigned long flags;
spin_lock_irqsave(&hw->ctlxq.lock, flags); spin_lock_irqsave(&hw->ctlxq.lock, flags);
...@@ -2819,10 +2818,7 @@ static void hfa384x_usbctlx_reaper_task(unsigned long data) ...@@ -2819,10 +2818,7 @@ static void hfa384x_usbctlx_reaper_task(unsigned long data)
/* This list is guaranteed to be empty if someone /* This list is guaranteed to be empty if someone
* has unplugged the adapter. * has unplugged the adapter.
*/ */
list_for_each_safe(entry, temp, &hw->ctlxq.reapable) { list_for_each_entry_safe(ctlx, temp, &hw->ctlxq.reapable, list) {
hfa384x_usbctlx_t *ctlx;
ctlx = list_entry(entry, hfa384x_usbctlx_t, list);
list_del(&ctlx->list); list_del(&ctlx->list);
kfree(ctlx); kfree(ctlx);
} }
...@@ -2847,8 +2843,7 @@ static void hfa384x_usbctlx_reaper_task(unsigned long data) ...@@ -2847,8 +2843,7 @@ static void hfa384x_usbctlx_reaper_task(unsigned long data)
static void hfa384x_usbctlx_completion_task(unsigned long data) static void hfa384x_usbctlx_completion_task(unsigned long data)
{ {
hfa384x_t *hw = (hfa384x_t *)data; hfa384x_t *hw = (hfa384x_t *)data;
struct list_head *entry; hfa384x_usbctlx_t *ctlx, *temp;
struct list_head *temp;
unsigned long flags; unsigned long flags;
int reap = 0; int reap = 0;
...@@ -2858,11 +2853,7 @@ static void hfa384x_usbctlx_completion_task(unsigned long data) ...@@ -2858,11 +2853,7 @@ static void hfa384x_usbctlx_completion_task(unsigned long data)
/* This list is guaranteed to be empty if someone /* This list is guaranteed to be empty if someone
* has unplugged the adapter ... * has unplugged the adapter ...
*/ */
list_for_each_safe(entry, temp, &hw->ctlxq.completing) { list_for_each_entry_safe(ctlx, temp, &hw->ctlxq.completing, list) {
hfa384x_usbctlx_t *ctlx;
ctlx = list_entry(entry, hfa384x_usbctlx_t, list);
/* Call the completion function that this /* Call the completion function that this
* command was assigned, assuming it has one. * command was assigned, assuming it has one.
*/ */
......
...@@ -139,8 +139,7 @@ static void prism2sta_disconnect_usb(struct usb_interface *interface) ...@@ -139,8 +139,7 @@ static void prism2sta_disconnect_usb(struct usb_interface *interface)
wlandev = (wlandevice_t *)usb_get_intfdata(interface); wlandev = (wlandevice_t *)usb_get_intfdata(interface);
if (wlandev != NULL) { if (wlandev != NULL) {
LIST_HEAD(cleanlist); LIST_HEAD(cleanlist);
struct list_head *entry; hfa384x_usbctlx_t *ctlx, *temp;
struct list_head *temp;
unsigned long flags; unsigned long flags;
hfa384x_t *hw = wlandev->priv; hfa384x_t *hw = wlandev->priv;
...@@ -184,12 +183,8 @@ static void prism2sta_disconnect_usb(struct usb_interface *interface) ...@@ -184,12 +183,8 @@ static void prism2sta_disconnect_usb(struct usb_interface *interface)
* and tell everyone who is waiting for their * and tell everyone who is waiting for their
* responses that we have shut down. * responses that we have shut down.
*/ */
list_for_each(entry, &cleanlist) { list_for_each_entry(ctlx, &cleanlist, list)
hfa384x_usbctlx_t *ctlx;
ctlx = list_entry(entry, hfa384x_usbctlx_t, list);
complete(&ctlx->done); complete(&ctlx->done);
}
/* Give any outstanding synchronous commands /* Give any outstanding synchronous commands
* a chance to complete. All they need to do * a chance to complete. All they need to do
...@@ -199,12 +194,8 @@ static void prism2sta_disconnect_usb(struct usb_interface *interface) ...@@ -199,12 +194,8 @@ static void prism2sta_disconnect_usb(struct usb_interface *interface)
msleep(100); msleep(100);
/* Now delete the CTLXs, because no-one else can now. */ /* Now delete the CTLXs, because no-one else can now. */
list_for_each_safe(entry, temp, &cleanlist) { list_for_each_entry_safe(ctlx, temp, &cleanlist, list)
hfa384x_usbctlx_t *ctlx;
ctlx = list_entry(entry, hfa384x_usbctlx_t, list);
kfree(ctlx); kfree(ctlx);
}
/* Unhook the wlandev */ /* Unhook the wlandev */
unregister_wlandev(wlandev); unregister_wlandev(wlandev);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment