o wl3501: remove stupid loop

parent fa9a81ec
...@@ -757,19 +757,6 @@ static int wl3501_mgmt_start(struct wl3501_card *this) ...@@ -757,19 +757,6 @@ static int wl3501_mgmt_start(struct wl3501_card *this)
return rc; return rc;
} }
#undef WL3501_STUPID_LOOP
#ifdef WL3501_STUPID_LOOP
#define wl3501_loop(__cmd) \
({ int i; \
for (i = 0; i < 3000; i++) \
if (!__cmd) \
break; \
i == 3000; \
})
#else
#define wl3501_loop(__cmd) ({ __cmd; 0; })
#endif
static void wl3501_mgmt_scan_confirm(struct wl3501_card *this, u16 addr) static void wl3501_mgmt_scan_confirm(struct wl3501_card *this, u16 addr)
{ {
u16 i, j; u16 i, j;
...@@ -829,19 +816,18 @@ static void wl3501_mgmt_scan_confirm(struct wl3501_card *this, u16 addr) ...@@ -829,19 +816,18 @@ static void wl3501_mgmt_scan_confirm(struct wl3501_card *this, u16 addr)
this->driver_state != WL3501_SIG_SCAN_REQ) { this->driver_state != WL3501_SIG_SCAN_REQ) {
this->join_sta_bss = 0; this->join_sta_bss = 0;
for (j = this->join_sta_bss; j < this->bss_cnt; j++) for (j = this->join_sta_bss; j < this->bss_cnt; j++)
if (!wl3501_loop(wl3501_mgmt_join(this, j))) if (!wl3501_mgmt_join(this, j))
break; break;
this->join_sta_bss = j; this->join_sta_bss = j;
if (this->join_sta_bss == this->bss_cnt) { if (this->join_sta_bss == this->bss_cnt) {
if (this->net_type == WL3501_NET_TYPE_INFRASTRUCTURE) { if (this->net_type == WL3501_NET_TYPE_INFRASTRUCTURE)
wl3501_loop(wl3501_mgmt_scan(this, 100)); wl3501_mgmt_scan(this, 100);
} else { else {
this->adhoc_times++; this->adhoc_times++;
if (this->adhoc_times > WL3501_MAX_ADHOC_TRIES) if (this->adhoc_times > WL3501_MAX_ADHOC_TRIES)
wl3501_loop(wl3501_mgmt_start(this)); wl3501_mgmt_start(this);
else else
wl3501_loop(wl3501_mgmt_scan(this, wl3501_mgmt_scan(this, 100);
100));
} }
} }
...@@ -1011,7 +997,7 @@ static int wl3501_esbq_confirm(struct wl3501_card *this) ...@@ -1011,7 +997,7 @@ static int wl3501_esbq_confirm(struct wl3501_card *this)
static void wl3501_online(struct wl3501_card *this) static void wl3501_online(struct wl3501_card *this)
{ {
this->card_start = 1; this->card_start = 1;
printk(KERN_INFO "Wireless LAN On-Line. BSSID: " printk(KERN_INFO "Wireless LAN online. BSSID: "
"%02X %02X %02X %02X %02X %02X\n", "%02X %02X %02X %02X %02X %02X\n",
this->bssid.b0, this->bssid.b1, this->bssid.b2, this->bssid.b0, this->bssid.b1, this->bssid.b2,
this->bssid.b3, this->bssid.b4, this->bssid.b5); this->bssid.b3, this->bssid.b4, this->bssid.b5);
...@@ -1087,7 +1073,7 @@ static void wl3501_mgmt_join_confirm(struct net_device *dev, ...@@ -1087,7 +1073,7 @@ static void wl3501_mgmt_join_confirm(struct net_device *dev,
this->chan = this->bss_set[i].phy_pset[2]; this->chan = this->bss_set[i].phy_pset[2];
memcpy((char *)this->keep_essid, memcpy((char *)this->keep_essid,
(char *)this->bss_set[i].ssid, 34); (char *)this->bss_set[i].ssid, 34);
wl3501_loop(wl3501_mgmt_auth(this)); wl3501_mgmt_auth(this);
} }
} else { } else {
i = this->join_sta_bss; i = this->join_sta_bss;
...@@ -1101,19 +1087,18 @@ static void wl3501_mgmt_join_confirm(struct net_device *dev, ...@@ -1101,19 +1087,18 @@ static void wl3501_mgmt_join_confirm(struct net_device *dev,
} else { } else {
this->join_sta_bss++; this->join_sta_bss++;
for (j = this->join_sta_bss; j < this->bss_cnt; j++) for (j = this->join_sta_bss; j < this->bss_cnt; j++)
if (!wl3501_loop(wl3501_mgmt_join(this, j))) if (!wl3501_mgmt_join(this, j))
break; break;
this->join_sta_bss = j; this->join_sta_bss = j;
if (this->join_sta_bss == this->bss_cnt) { if (this->join_sta_bss == this->bss_cnt) {
if (this->net_type == WL3501_NET_TYPE_INFRASTRUCTURE) if (this->net_type == WL3501_NET_TYPE_INFRASTRUCTURE)
wl3501_loop(wl3501_mgmt_scan(this, 100)); wl3501_mgmt_scan(this, 100);
else { else {
this->adhoc_times++; this->adhoc_times++;
if (this->adhoc_times > WL3501_MAX_ADHOC_TRIES) if (this->adhoc_times > WL3501_MAX_ADHOC_TRIES)
wl3501_loop(wl3501_mgmt_start(this)); wl3501_mgmt_start(this);
else else
wl3501_loop(wl3501_mgmt_scan(this, wl3501_mgmt_scan(this, 100);
100));
} }
} }
} }
...@@ -1128,9 +1113,9 @@ static inline void wl3501_alarm_interrupt(struct net_device *dev, ...@@ -1128,9 +1113,9 @@ static inline void wl3501_alarm_interrupt(struct net_device *dev,
struct wl3501_card *this) struct wl3501_card *this)
{ {
if (this->net_type == WL3501_NET_TYPE_INFRASTRUCTURE) { if (this->net_type == WL3501_NET_TYPE_INFRASTRUCTURE) {
printk(KERN_INFO "Wireless LAN Off-Line\n"); printk(KERN_INFO "Wireless LAN offline\n");
netif_stop_queue(dev); netif_stop_queue(dev);
wl3501_loop(wl3501_mgmt_resync(this)); wl3501_mgmt_resync(this);
} }
} }
...@@ -1254,12 +1239,12 @@ static inline void wl3501_auth_confirm_interrupt(struct wl3501_card *this, ...@@ -1254,12 +1239,12 @@ static inline void wl3501_auth_confirm_interrupt(struct wl3501_card *this,
wl3501_get_from_wla(this, addr, &sig, sizeof(sig)); wl3501_get_from_wla(this, addr, &sig, sizeof(sig));
if (sig.status == WL3501_STATUS_SUCCESS) if (sig.status == WL3501_STATUS_SUCCESS)
wl3501_loop(wl3501_mgmt_association(this)); wl3501_mgmt_association(this);
else else
wl3501_loop(wl3501_mgmt_resync(this)); wl3501_mgmt_resync(this);
} }
static void wl3501_rx_interrupt(struct net_device *dev) static inline void wl3501_rx_interrupt(struct net_device *dev)
{ {
int morepkts; int morepkts;
u16 addr; u16 addr;
...@@ -1315,7 +1300,7 @@ static void wl3501_rx_interrupt(struct net_device *dev) ...@@ -1315,7 +1300,7 @@ static void wl3501_rx_interrupt(struct net_device *dev)
goto loop; goto loop;
} }
static __inline__ void wl3501_ack_interrupt(struct wl3501_card *this) static inline void wl3501_ack_interrupt(struct wl3501_card *this)
{ {
wl3501_outb(WL3501_GCR_ECINT, this->base_addr + WL3501_NIC_GCR); wl3501_outb(WL3501_GCR_ECINT, this->base_addr + WL3501_NIC_GCR);
} }
...@@ -1511,7 +1496,7 @@ static int wl3501_reset(struct net_device *dev) ...@@ -1511,7 +1496,7 @@ static int wl3501_reset(struct net_device *dev)
/* Enable interrupt from card */ /* Enable interrupt from card */
wl3501_unblock_interrupt(this); wl3501_unblock_interrupt(this);
wl3501_loop(wl3501_mgmt_scan(this, 100)); wl3501_mgmt_scan(this, 100);
printk(KERN_INFO "%s: device reset\n", dev->name); printk(KERN_INFO "%s: device reset\n", dev->name);
rc = 0; rc = 0;
out: out:
...@@ -1623,7 +1608,7 @@ static int wl3501_open(struct net_device *dev) ...@@ -1623,7 +1608,7 @@ static int wl3501_open(struct net_device *dev)
/* Enable interrupt from card after all */ /* Enable interrupt from card after all */
wl3501_unblock_interrupt(this); wl3501_unblock_interrupt(this);
wl3501_loop(wl3501_mgmt_scan(this, 100)); wl3501_mgmt_scan(this, 100);
rc = 0; rc = 0;
printk(KERN_INFO "%s: WL3501 opened\n", dev->name); printk(KERN_INFO "%s: WL3501 opened\n", dev->name);
out: out:
......
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