{
DPRINTK(4, "psstatus.status=%d\n", atomic_read(&priv->psstatus.status));
- if ((priv->connect_status & CONNECT_STATUS_MASK) == CONNECT_STATUS)
+ if (is_connect_status(priv->connect_status))
hostif_sme_enqueue(priv, SME_POW_MNGMT_REQUEST);
else
priv->dev_state = DEVICE_STATE_READY;
DPRINTK(3, "\n");
ap = &priv->current_ap;
- if ((priv->connect_status & CONNECT_STATUS_MASK) == DISCONNECT_STATUS) {
+ if (is_disconnect_status(priv->connect_status)) {
memset(ap, 0, sizeof(struct local_ap_t));
return -EPERM;
}
wrqu.data.length = 0;
wrqu.data.flags = 0;
wrqu.ap_addr.sa_family = ARPHRD_ETHER;
- if ((priv->connect_status & CONNECT_STATUS_MASK) == CONNECT_STATUS) {
+ if (is_connect_status(priv->connect_status)) {
memcpy(wrqu.ap_addr.sa_data,
priv->current_ap.bssid, ETH_ALEN);
DPRINTK(3,
wrqu.data.length = 0;
wrqu.data.flags = 0;
wrqu.ap_addr.sa_family = ARPHRD_ETHER;
- if ((priv->connect_status & CONNECT_STATUS_MASK) == CONNECT_STATUS) {
+ if (is_connect_status(priv->connect_status)) {
eth_zero_addr(wrqu.ap_addr.sa_data);
DPRINTK(3, "IWEVENT: disconnect\n");
wireless_send_event(priv->net_dev, SIOCGIWAP, &wrqu, NULL);
}
get_current_ap(priv, (struct link_ap_info_t *)priv->rxp);
- if ((priv->connect_status & CONNECT_STATUS_MASK) == CONNECT_STATUS &&
- (old_status & CONNECT_STATUS_MASK) == DISCONNECT_STATUS) {
+ if (is_connect_status(priv->connect_status) &&
+ is_disconnect_status(old_status)) {
/* for power save */
atomic_set(&priv->psstatus.snooze_guard, 0);
atomic_set(&priv->psstatus.confirm_wait, 0);
wrqu0.data.length = 0;
wrqu0.data.flags = 0;
wrqu0.ap_addr.sa_family = ARPHRD_ETHER;
- if ((priv->connect_status & CONNECT_STATUS_MASK) == DISCONNECT_STATUS &&
- (old_status & CONNECT_STATUS_MASK) == CONNECT_STATUS) {
+ if (is_disconnect_status(priv->connect_status) &&
+ is_connect_status(old_status)) {
eth_zero_addr(wrqu0.ap_addr.sa_data);
DPRINTK(3, "IWEVENT: disconnect\n");
DPRINTK(3, "disconnect :: scan_ind_count=%d\n",
priv->dev_state = DEVICE_STATE_READY;
/* disconnect indication */
- if ((priv->connect_status & CONNECT_STATUS_MASK) == CONNECT_STATUS) {
+ if (is_connect_status(priv->connect_status)) {
netif_carrier_off(netdev);
tmp = FORCE_DISCONNECT & priv->connect_status;
priv->connect_status = tmp | DISCONNECT_STATUS;
wrqu0.data.length = 0;
wrqu0.data.flags = 0;
wrqu0.ap_addr.sa_family = ARPHRD_ETHER;
- if ((priv->connect_status & CONNECT_STATUS_MASK) == DISCONNECT_STATUS &&
- (old_status & CONNECT_STATUS_MASK) == CONNECT_STATUS) {
+ if (is_disconnect_status(priv->connect_status) &&
+ is_connect_status(old_status)) {
eth_zero_addr(wrqu0.ap_addr.sa_data);
DPRINTK(3, "IWEVENT: disconnect\n");
netdev_info(netdev, "IWEVENT: disconnect\n");
goto err_kfree_skb;
}
- if (((priv->connect_status & CONNECT_STATUS_MASK) == DISCONNECT_STATUS) ||
+ if (is_disconnect_status(priv->connect_status) ||
(priv->connect_status & FORCE_DISCONNECT) ||
priv->wpa.mic_failure.stop) {
DPRINTK(3, " DISCONNECT\n");
return -EPERM;
/* for SLEEP MODE */
- if ((priv->connect_status & CONNECT_STATUS_MASK) == CONNECT_STATUS)
+ if (is_connect_status(priv->connect_status))
f = (int)priv->current_ap.channel;
- else
+ else
f = (int)priv->reg.channel;
+
fwrq->m = frequency_list[f - 1] * 100000;
fwrq->e = 1;
return -EPERM;
/* for SLEEP MODE */
- if ((priv->connect_status & CONNECT_STATUS_MASK) == CONNECT_STATUS)
+ if (is_connect_status(priv->connect_status))
memcpy(awrq->sa_data, priv->current_ap.bssid, ETH_ALEN);
else
eth_zero_addr(awrq->sa_data);
return 0;
}
+
+/**
+ * is_connect_status() - return true if status is 'connected'
+ * @status: high bit is used as FORCE_DISCONNECT, low bits used for
+ * connect status.
+ */
+bool is_connect_status(u32 status)
+{
+ return (status & CONNECT_STATUS_MASK) == CONNECT_STATUS;
+}
+
+/**
+ * is_disconnect_status() - return true if status is 'disconnected'
+ * @status: high bit is used as FORCE_DISCONNECT, low bits used for
+ * disconnect status.
+ */
+bool is_disconnect_status(u32 status)
+{
+ return (status & CONNECT_STATUS_MASK) == DISCONNECT_STATUS;
+}