From 1ca96884b12dd2d57e0339d9f4a29e4888edc0e2 Mon Sep 17 00:00:00 2001 From: Luis de Bethencourt Date: Mon, 19 Oct 2015 18:14:29 +0100 Subject: [PATCH] staging: rtl8712: Remove boolean comparisons Boolean tests do not need explicit comparison to true or false. Signed-off-by: Luis de Bethencourt Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8712/os_intfs.c | 4 +- drivers/staging/rtl8712/rtl8712_cmd.c | 9 +- drivers/staging/rtl8712/rtl8712_efuse.c | 56 +++--- drivers/staging/rtl8712/rtl8712_io.c | 6 +- drivers/staging/rtl8712/rtl8712_led.c | 164 +++++++++--------- drivers/staging/rtl8712/rtl8712_recv.c | 25 ++- drivers/staging/rtl8712/rtl8712_xmit.c | 4 +- drivers/staging/rtl8712/rtl871x_cmd.c | 8 +- drivers/staging/rtl8712/rtl871x_eeprom.c | 22 +-- drivers/staging/rtl8712/rtl871x_ioctl_linux.c | 56 +++--- drivers/staging/rtl8712/rtl871x_ioctl_rtl.c | 12 +- drivers/staging/rtl8712/rtl871x_ioctl_set.c | 26 +-- drivers/staging/rtl8712/rtl871x_mlme.c | 77 ++++---- drivers/staging/rtl8712/rtl871x_mlme.h | 2 +- drivers/staging/rtl8712/rtl871x_mp_ioctl.c | 16 +- drivers/staging/rtl8712/rtl871x_pwrctrl.c | 6 +- drivers/staging/rtl8712/rtl871x_recv.c | 39 ++--- drivers/staging/rtl8712/rtl871x_security.c | 4 +- drivers/staging/rtl8712/rtl871x_sta_mgt.c | 6 +- drivers/staging/rtl8712/rtl871x_xmit.c | 38 ++-- drivers/staging/rtl8712/usb_intf.c | 4 +- drivers/staging/rtl8712/usb_ops_linux.c | 10 +- drivers/staging/rtl8712/xmit_linux.c | 4 +- 23 files changed, 291 insertions(+), 307 deletions(-) diff --git a/drivers/staging/rtl8712/os_intfs.c b/drivers/staging/rtl8712/os_intfs.c index 6805f79ae00a..92ab59dcb5ec 100644 --- a/drivers/staging/rtl8712/os_intfs.c +++ b/drivers/staging/rtl8712/os_intfs.c @@ -177,7 +177,7 @@ static int r871x_net_set_mac_address(struct net_device *pnetdev, void *p) struct _adapter *padapter = netdev_priv(pnetdev); struct sockaddr *addr = p; - if (padapter->bup == false) + if (!padapter->bup) ether_addr_copy(pnetdev->dev_addr, addr->sa_data); return 0; } @@ -384,7 +384,7 @@ static int netdev_open(struct net_device *pnetdev) struct _adapter *padapter = netdev_priv(pnetdev); mutex_lock(&padapter->mutex_start); - if (padapter->bup == false) { + if (!padapter->bup) { padapter->bDriverStopped = false; padapter->bSurpriseRemoved = false; padapter->bup = true; diff --git a/drivers/staging/rtl8712/rtl8712_cmd.c b/drivers/staging/rtl8712/rtl8712_cmd.c index f70235c8683d..39b63207fa52 100644 --- a/drivers/staging/rtl8712/rtl8712_cmd.c +++ b/drivers/staging/rtl8712/rtl8712_cmd.c @@ -85,7 +85,7 @@ static void query_fw_rx_phy_status(struct _adapter *padapter) u32 val32 = 0; int pollingcnts = 50; - if (check_fwstate(&padapter->mlmepriv, _FW_LINKED) == true) { + if (check_fwstate(&padapter->mlmepriv, _FW_LINKED)) { r8712_write32(padapter, IOCMD_CTRL_REG, 0xf4000001); msleep(100); /* Wait FW complete IO Cmd */ @@ -324,8 +324,7 @@ int r8712_cmd_thread(void *context) while (1) { if ((_down_sema(&(pcmdpriv->cmd_queue_sema))) == _FAIL) break; - if ((padapter->bDriverStopped == true) || - (padapter->bSurpriseRemoved == true)) + if (padapter->bDriverStopped || padapter->bSurpriseRemoved) break; if (r8712_register_cmd_alive(padapter) != _SUCCESS) continue; @@ -375,8 +374,8 @@ _next: pcmdbuf += 2; /* 8 bytes alignment */ memcpy((u8 *)pcmdbuf, pcmd->parmbuf, pcmd->cmdsz); while (check_cmd_fifo(padapter, wr_sz) == _FAIL) { - if ((padapter->bDriverStopped == true) || - (padapter->bSurpriseRemoved == true)) + if (padapter->bDriverStopped || + padapter->bSurpriseRemoved) break; msleep(100); continue; diff --git a/drivers/staging/rtl8712/rtl8712_efuse.c b/drivers/staging/rtl8712/rtl8712_efuse.c index d95716999498..13d4b8dcf073 100644 --- a/drivers/staging/rtl8712/rtl8712_efuse.c +++ b/drivers/staging/rtl8712/rtl8712_efuse.c @@ -39,7 +39,7 @@ static void efuse_reg_ctrl(struct _adapter *padapter, u8 bPowerOn) { u8 tmpu8 = 0; - if (true == bPowerOn) { + if (bPowerOn) { /* -----------------e-fuse pwr & clk reg ctrl --------------- * Enable LDOE25 Macro Block */ @@ -127,7 +127,7 @@ static u8 efuse_one_byte_rw(struct _adapter *padapter, u8 bRead, u16 addr, tmpv8 = ((u8)((addr >> 8) & 0x03)) | (r8712_read8(padapter, EFUSE_CTRL + 2) & 0xFC); r8712_write8(padapter, EFUSE_CTRL+2, tmpv8); - if (true == bRead) { + if (bRead) { r8712_write8(padapter, EFUSE_CTRL+3, 0x72); /* read cmd */ while (!(0x80 & r8712_read8(padapter, EFUSE_CTRL+3)) && (tmpidx < 100)) @@ -158,7 +158,7 @@ static u8 efuse_is_empty(struct _adapter *padapter, u8 *empty) u8 value, ret = true; /* read one byte to check if E-Fuse is empty */ - if (efuse_one_byte_rw(padapter, true, 0, &value) == true) { + if (efuse_one_byte_rw(padapter, true, 0, &value)) { if (0xFF == value) *empty = true; else @@ -250,8 +250,7 @@ u8 r8712_efuse_pg_packet_read(struct _adapter *padapter, u8 offset, u8 *data) return false; memset(data, 0xFF, sizeof(u8)*PGPKT_DATA_SIZE); while (efuse_addr < efuse_available_max_size) { - if (efuse_one_byte_read(padapter, efuse_addr, &efuse_data) == - true) { + if (efuse_one_byte_read(padapter, efuse_addr, &efuse_data)) { if (efuse_data == 0xFF) break; hoffset = (efuse_data >> 4) & 0x0F; @@ -262,8 +261,7 @@ u8 r8712_efuse_pg_packet_read(struct _adapter *padapter, u8 offset, u8 *data) for (tmpidx = 0; tmpidx < word_cnts * 2; tmpidx++) { if (efuse_one_byte_read(padapter, - efuse_addr+1+tmpidx, &efuse_data) == - true) { + efuse_addr+1+tmpidx, &efuse_data)) { tmpdata[tmpidx] = efuse_data; } else ret = false; @@ -295,7 +293,7 @@ static u8 fix_header(struct _adapter *padapter, u8 header, u16 header_addr) /* retrieve original data */ addr = 0; while (addr < header_addr) { - if (efuse_one_byte_read(padapter, addr++, &value) == false) { + if (!efuse_one_byte_read(padapter, addr++, &value)) { ret = false; break; } @@ -310,14 +308,14 @@ static u8 fix_header(struct _adapter *padapter, u8 header, u16 header_addr) if (BIT(i) & pkt.word_en) { if (efuse_one_byte_read( padapter, addr, - &value) == true) + &value)) pkt.data[i*2] = value; else return false; if (efuse_one_byte_read( padapter, addr + 1, - &value) == true) + &value)) pkt.data[i*2 + 1] = value; else @@ -337,8 +335,7 @@ static u8 fix_header(struct _adapter *padapter, u8 header, u16 header_addr) efuse_one_byte_write(padapter, addr+1, pkt.data[i*2 + 1]); /* additional check */ - if (efuse_one_byte_read(padapter, addr, &value) - == false) + if (!efuse_one_byte_read(padapter, addr, &value)) ret = false; else if (pkt.data[i*2] != value) { ret = false; @@ -346,8 +343,7 @@ static u8 fix_header(struct _adapter *padapter, u8 header, u16 header_addr) efuse_one_byte_write(padapter, addr, pkt.data[i * 2]); } - if (efuse_one_byte_read(padapter, addr+1, &value) == - false) + if (!efuse_one_byte_read(padapter, addr+1, &value)) ret = false; else if (pkt.data[i*2 + 1] != value) { ret = false; @@ -388,8 +384,8 @@ u8 r8712_efuse_pg_packet_write(struct _adapter *padapter, const u8 offset, efuse_one_byte_write(padapter, efuse_addr, pg_header); /*hdr*/ sub_repeat = 0; /* check if what we read is what we write */ - while (efuse_one_byte_read(padapter, efuse_addr, - &efuse_data) == false) { + while (!efuse_one_byte_read(padapter, efuse_addr, + &efuse_data)) { if (++sub_repeat > _REPEAT_THRESHOLD_) { bResult = false; /* continue to blind write */ break; /* continue to blind write */ @@ -406,8 +402,9 @@ u8 r8712_efuse_pg_packet_write(struct _adapter *padapter, const u8 offset, efuse_one_byte_write(padapter, efuse_addr + i, *(data + i)); - if (efuse_one_byte_read(padapter, - efuse_addr + i, &efuse_data) == false) + if (!efuse_one_byte_read(padapter, + efuse_addr + i, + &efuse_data)) bResult = false; else if (*(data+i) != efuse_data) /* fail */ bResult = false; @@ -437,10 +434,10 @@ u8 r8712_efuse_access(struct _adapter *padapter, u8 bRead, u16 start_addr, if (start_addr > EFUSE_MAX_SIZE) return false; - if ((bRead == false) && ((start_addr + cnts) > + if (!bRead && ((start_addr + cnts) > efuse_available_max_size)) return false; - if ((false == bRead) && (r8712_efuse_reg_init(padapter) == false)) + if (!bRead && !r8712_efuse_reg_init(padapter)) return false; /* -----------------e-fuse one byte read / write ---------------------*/ for (i = 0; i < cnts; i++) { @@ -450,10 +447,10 @@ u8 r8712_efuse_access(struct _adapter *padapter, u8 bRead, u16 start_addr, } res = efuse_one_byte_rw(padapter, bRead, start_addr + i, data + i); - if ((false == bRead) && (false == res)) + if (!bRead && !res) break; } - if (false == bRead) + if (!bRead) r8712_efuse_reg_uninit(padapter); return res; } @@ -466,8 +463,7 @@ u8 r8712_efuse_map_read(struct _adapter *padapter, u16 addr, u16 cnts, u8 *data) if ((addr + cnts) > EFUSE_MAP_MAX_SIZE) return false; - if ((efuse_is_empty(padapter, &offset) == true) && (offset == - true)) { + if (efuse_is_empty(padapter, &offset) && offset) { for (i = 0; i < cnts; i++) data[i] = 0xFF; return ret; @@ -504,13 +500,13 @@ u8 r8712_efuse_map_write(struct _adapter *padapter, u16 addr, u16 cnts, empty = r8712_read8(padapter, EFUSE_CLK_CTRL); if (empty != 0x03) return false; - if (efuse_is_empty(padapter, &empty) == true) { - if (true == empty) + if (efuse_is_empty(padapter, &empty)) { + if (empty) memset(pktdata, 0xFF, PGPKT_DATA_SIZE); } else return false; offset = (addr >> 3) & 0xF; - if (empty == false) + if (!empty) if (!r8712_efuse_pg_packet_read(padapter, offset, pktdata)) return false; word_en = 0xF; @@ -554,13 +550,13 @@ u8 r8712_efuse_map_write(struct _adapter *padapter, u16 addr, u16 cnts, } if (word_en != 0xF) - if (r8712_efuse_pg_packet_write(padapter, offset, - word_en, newdata) == false) + if (!r8712_efuse_pg_packet_write(padapter, offset, + word_en, newdata)) return false; if (idx == cnts) break; offset++; - if (empty == false) + if (!empty) if (!r8712_efuse_pg_packet_read(padapter, offset, pktdata)) return false; diff --git a/drivers/staging/rtl8712/rtl8712_io.c b/drivers/staging/rtl8712/rtl8712_io.c index b9abe05e6078..4148d48ece62 100644 --- a/drivers/staging/rtl8712/rtl8712_io.c +++ b/drivers/staging/rtl8712/rtl8712_io.c @@ -102,8 +102,7 @@ void r8712_read_mem(struct _adapter *adapter, u32 addr, u32 cnt, u8 *pmem) void (*_read_mem)(struct intf_hdl *pintfhdl, u32 addr, u32 cnt, u8 *pmem); - if ((adapter->bDriverStopped == true) || - (adapter->bSurpriseRemoved == true)) + if (adapter->bDriverStopped || adapter->bSurpriseRemoved) return; _read_mem = pintfhdl->io_ops._read_mem; _read_mem(pintfhdl, addr, cnt, pmem); @@ -127,8 +126,7 @@ void r8712_read_port(struct _adapter *adapter, u32 addr, u32 cnt, u8 *pmem) u32 (*_read_port)(struct intf_hdl *pintfhdl, u32 addr, u32 cnt, u8 *pmem); - if ((adapter->bDriverStopped == true) || - (adapter->bSurpriseRemoved == true)) + if (adapter->bDriverStopped || adapter->bSurpriseRemoved) return; _read_port = pintfhdl->io_ops._read_port; _read_port(pintfhdl, addr, cnt, pmem); diff --git a/drivers/staging/rtl8712/rtl8712_led.c b/drivers/staging/rtl8712/rtl8712_led.c index ada8d5dafd49..48d744df47df 100644 --- a/drivers/staging/rtl8712/rtl8712_led.c +++ b/drivers/staging/rtl8712/rtl8712_led.c @@ -122,8 +122,7 @@ static void SwLedOn(struct _adapter *padapter, struct LED_871x *pLed) { u8 LedCfg; - if ((padapter->bSurpriseRemoved == true) || - (padapter->bDriverStopped == true)) + if (padapter->bSurpriseRemoved || padapter->bDriverStopped) return; LedCfg = r8712_read8(padapter, LEDCFG); switch (pLed->LedPin) { @@ -151,8 +150,7 @@ static void SwLedOff(struct _adapter *padapter, struct LED_871x *pLed) { u8 LedCfg; - if ((padapter->bSurpriseRemoved == true) || - (padapter->bDriverStopped == true)) + if (padapter->bSurpriseRemoved || padapter->bDriverStopped) return; LedCfg = r8712_read8(padapter, LEDCFG); switch (pLed->LedPin) { @@ -222,11 +220,11 @@ static void SwLedBlink(struct LED_871x *pLed) bStopBlinking = true; break; case LED_BLINK_StartToBlink: - if ((check_fwstate(pmlmepriv, _FW_LINKED) == true) && + if (check_fwstate(pmlmepriv, _FW_LINKED) && (pmlmepriv->fw_state & WIFI_STATION_STATE)) bStopBlinking = true; - if ((check_fwstate(pmlmepriv, _FW_LINKED) == true) && - ((pmlmepriv->fw_state & WIFI_ADHOC_STATE) || + if (check_fwstate(pmlmepriv, _FW_LINKED) && + ((pmlmepriv->fw_state & WIFI_ADHOC_STATE) || (pmlmepriv->fw_state & WIFI_ADHOC_MASTER_STATE))) bStopBlinking = true; else if (pLed->BlinkTimes == 0) @@ -241,11 +239,10 @@ static void SwLedBlink(struct LED_871x *pLed) break; } if (bStopBlinking) { - if ((check_fwstate(pmlmepriv, _FW_LINKED) == true) && - (pLed->bLedOn == false)) + if (check_fwstate(pmlmepriv, _FW_LINKED) && + !pLed->bLedOn) SwLedOn(padapter, pLed); - else if ((check_fwstate(pmlmepriv, _FW_LINKED) == - true) && pLed->bLedOn == true) + else if (check_fwstate(pmlmepriv, _FW_LINKED) && pLed->bLedOn) SwLedOff(padapter, pLed); pLed->BlinkTimes = 0; pLed->bLedBlinkInProgress = false; @@ -296,7 +293,7 @@ static void SwLedBlink1(struct LED_871x *pLed) else SwLedOff(padapter, pLed); if (peeprompriv->CustomerID == RT_CID_DEFAULT) { - if (check_fwstate(pmlmepriv, _FW_LINKED) == true) { + if (check_fwstate(pmlmepriv, _FW_LINKED)) { if (!pLed1->bSWLedCtrl) { SwLedOn(padapter, pLed1); pLed1->bSWLedCtrl = true; @@ -332,7 +329,7 @@ static void SwLedBlink1(struct LED_871x *pLed) if (pLed->BlinkTimes == 0) bStopBlinking = true; if (bStopBlinking) { - if (check_fwstate(pmlmepriv, _FW_LINKED) == true) { + if (check_fwstate(pmlmepriv, _FW_LINKED)) { pLed->bLedLinkBlinkInProgress = true; pLed->CurrLedState = LED_BLINK_NORMAL; if (pLed->bLedOn) @@ -366,7 +363,7 @@ static void SwLedBlink1(struct LED_871x *pLed) if (pLed->BlinkTimes == 0) bStopBlinking = true; if (bStopBlinking) { - if (check_fwstate(pmlmepriv, _FW_LINKED) == true) { + if (check_fwstate(pmlmepriv, _FW_LINKED)) { pLed->bLedLinkBlinkInProgress = true; pLed->CurrLedState = LED_BLINK_NORMAL; if (pLed->bLedOn) @@ -446,7 +443,7 @@ static void SwLedBlink2(struct LED_871x *pLed) if (pLed->BlinkTimes == 0) bStopBlinking = true; if (bStopBlinking) { - if (check_fwstate(pmlmepriv, _FW_LINKED) == true) { + if (check_fwstate(pmlmepriv, _FW_LINKED)) { pLed->CurrLedState = LED_ON; pLed->BlinkingLedState = LED_ON; SwLedOn(padapter, pLed); @@ -470,7 +467,7 @@ static void SwLedBlink2(struct LED_871x *pLed) if (pLed->BlinkTimes == 0) bStopBlinking = true; if (bStopBlinking) { - if (check_fwstate(pmlmepriv, _FW_LINKED) == true) { + if (check_fwstate(pmlmepriv, _FW_LINKED)) { pLed->CurrLedState = LED_ON; pLed->BlinkingLedState = LED_ON; SwLedOn(padapter, pLed); @@ -512,7 +509,7 @@ static void SwLedBlink3(struct LED_871x *pLed) if (pLed->BlinkTimes == 0) bStopBlinking = true; if (bStopBlinking) { - if (check_fwstate(pmlmepriv, _FW_LINKED) == true) { + if (check_fwstate(pmlmepriv, _FW_LINKED)) { pLed->CurrLedState = LED_ON; pLed->BlinkingLedState = LED_ON; if (!pLed->bLedOn) @@ -538,7 +535,7 @@ static void SwLedBlink3(struct LED_871x *pLed) if (pLed->BlinkTimes == 0) bStopBlinking = true; if (bStopBlinking) { - if (check_fwstate(pmlmepriv, _FW_LINKED) == true) { + if (check_fwstate(pmlmepriv, _FW_LINKED)) { pLed->CurrLedState = LED_ON; pLed->BlinkingLedState = LED_ON; if (!pLed->bLedOn) @@ -827,8 +824,7 @@ static void BlinkTimerCallback(unsigned long data) /* This fixed the crash problem on Fedora 12 when trying to do the * insmod;ifconfig up;rmmod commands. */ - if ((pLed->padapter->bSurpriseRemoved == true) || - (pLed->padapter->bDriverStopped == true)) + if (pLed->padapter->bSurpriseRemoved || pLed->padapter->bDriverStopped) return; schedule_work(&pLed->BlinkWorkItem); } @@ -893,15 +889,15 @@ static void SwLedControlMode1(struct _adapter *padapter, switch (LedAction) { case LED_CTL_START_TO_LINK: case LED_CTL_NO_LINK: - if (pLed->bLedNoLinkBlinkInProgress == false) { + if (!pLed->bLedNoLinkBlinkInProgress) { if (pLed->CurrLedState == LED_SCAN_BLINK || IS_LED_WPS_BLINKING(pLed)) return; - if (pLed->bLedLinkBlinkInProgress == true) { + if (pLed->bLedLinkBlinkInProgress) { del_timer(&pLed->BlinkTimer); pLed->bLedLinkBlinkInProgress = false; } - if (pLed->bLedBlinkInProgress == true) { + if (pLed->bLedBlinkInProgress) { del_timer(&pLed->BlinkTimer); pLed->bLedBlinkInProgress = false; } @@ -916,15 +912,15 @@ static void SwLedControlMode1(struct _adapter *padapter, } break; case LED_CTL_LINK: - if (pLed->bLedLinkBlinkInProgress == false) { + if (!pLed->bLedLinkBlinkInProgress) { if (pLed->CurrLedState == LED_SCAN_BLINK || IS_LED_WPS_BLINKING(pLed)) return; - if (pLed->bLedNoLinkBlinkInProgress == true) { + if (pLed->bLedNoLinkBlinkInProgress) { del_timer(&pLed->BlinkTimer); pLed->bLedNoLinkBlinkInProgress = false; } - if (pLed->bLedBlinkInProgress == true) { + if (pLed->bLedBlinkInProgress) { del_timer(&pLed->BlinkTimer); pLed->bLedBlinkInProgress = false; } @@ -939,21 +935,21 @@ static void SwLedControlMode1(struct _adapter *padapter, } break; case LED_CTL_SITE_SURVEY: - if ((psitesurveyctrl->traffic_busy) && - (check_fwstate(pmlmepriv, _FW_LINKED) == true)) + if (psitesurveyctrl->traffic_busy && + check_fwstate(pmlmepriv, _FW_LINKED)) ; /* dummy branch */ - else if (pLed->bLedScanBlinkInProgress == false) { + else if (!pLed->bLedScanBlinkInProgress) { if (IS_LED_WPS_BLINKING(pLed)) return; - if (pLed->bLedNoLinkBlinkInProgress == true) { + if (pLed->bLedNoLinkBlinkInProgress) { del_timer(&pLed->BlinkTimer); pLed->bLedNoLinkBlinkInProgress = false; } - if (pLed->bLedLinkBlinkInProgress == true) { + if (pLed->bLedLinkBlinkInProgress) { del_timer(&pLed->BlinkTimer); pLed->bLedLinkBlinkInProgress = false; } - if (pLed->bLedBlinkInProgress == true) { + if (pLed->bLedBlinkInProgress) { del_timer(&pLed->BlinkTimer); pLed->bLedBlinkInProgress = false; } @@ -970,15 +966,15 @@ static void SwLedControlMode1(struct _adapter *padapter, break; case LED_CTL_TX: case LED_CTL_RX: - if (pLed->bLedBlinkInProgress == false) { + if (!pLed->bLedBlinkInProgress) { if (pLed->CurrLedState == LED_SCAN_BLINK || IS_LED_WPS_BLINKING(pLed)) return; - if (pLed->bLedNoLinkBlinkInProgress == true) { + if (pLed->bLedNoLinkBlinkInProgress) { del_timer(&pLed->BlinkTimer); pLed->bLedNoLinkBlinkInProgress = false; } - if (pLed->bLedLinkBlinkInProgress == true) { + if (pLed->bLedLinkBlinkInProgress) { del_timer(&pLed->BlinkTimer); pLed->bLedLinkBlinkInProgress = false; } @@ -996,20 +992,20 @@ static void SwLedControlMode1(struct _adapter *padapter, case LED_CTL_START_WPS: /*wait until xinpin finish */ case LED_CTL_START_WPS_BOTTON: - if (pLed->bLedWPSBlinkInProgress == false) { - if (pLed->bLedNoLinkBlinkInProgress == true) { + if (!pLed->bLedWPSBlinkInProgress) { + if (pLed->bLedNoLinkBlinkInProgress) { del_timer(&pLed->BlinkTimer); pLed->bLedNoLinkBlinkInProgress = false; } - if (pLed->bLedLinkBlinkInProgress == true) { + if (pLed->bLedLinkBlinkInProgress) { del_timer(&pLed->BlinkTimer); pLed->bLedLinkBlinkInProgress = false; } - if (pLed->bLedBlinkInProgress == true) { + if (pLed->bLedBlinkInProgress) { del_timer(&pLed->BlinkTimer); pLed->bLedBlinkInProgress = false; } - if (pLed->bLedScanBlinkInProgress == true) { + if (pLed->bLedScanBlinkInProgress) { del_timer(&pLed->BlinkTimer); pLed->bLedScanBlinkInProgress = false; } @@ -1024,19 +1020,19 @@ static void SwLedControlMode1(struct _adapter *padapter, } break; case LED_CTL_STOP_WPS: - if (pLed->bLedNoLinkBlinkInProgress == true) { + if (pLed->bLedNoLinkBlinkInProgress) { del_timer(&pLed->BlinkTimer); pLed->bLedNoLinkBlinkInProgress = false; } - if (pLed->bLedLinkBlinkInProgress == true) { + if (pLed->bLedLinkBlinkInProgress) { del_timer(&pLed->BlinkTimer); pLed->bLedLinkBlinkInProgress = false; } - if (pLed->bLedBlinkInProgress == true) { + if (pLed->bLedBlinkInProgress) { del_timer(&pLed->BlinkTimer); pLed->bLedBlinkInProgress = false; } - if (pLed->bLedScanBlinkInProgress == true) { + if (pLed->bLedScanBlinkInProgress) { del_timer(&pLed->BlinkTimer); pLed->bLedScanBlinkInProgress = false; } @@ -1111,11 +1107,11 @@ static void SwLedControlMode2(struct _adapter *padapter, case LED_CTL_SITE_SURVEY: if (pmlmepriv->sitesurveyctrl.traffic_busy) ; /* dummy branch */ - else if (pLed->bLedScanBlinkInProgress == false) { + else if (!pLed->bLedScanBlinkInProgress) { if (IS_LED_WPS_BLINKING(pLed)) return; - if (pLed->bLedBlinkInProgress == true) { + if (pLed->bLedBlinkInProgress) { del_timer(&pLed->BlinkTimer); pLed->bLedBlinkInProgress = false; } @@ -1133,8 +1129,8 @@ static void SwLedControlMode2(struct _adapter *padapter, case LED_CTL_TX: case LED_CTL_RX: - if ((pLed->bLedBlinkInProgress == false) && - (check_fwstate(pmlmepriv, _FW_LINKED) == true)) { + if (!pLed->bLedBlinkInProgress && + check_fwstate(pmlmepriv, _FW_LINKED)) { if (pLed->CurrLedState == LED_SCAN_BLINK || IS_LED_WPS_BLINKING(pLed)) return; @@ -1168,12 +1164,12 @@ static void SwLedControlMode2(struct _adapter *padapter, case LED_CTL_START_WPS: /*wait until xinpin finish*/ case LED_CTL_START_WPS_BOTTON: - if (pLed->bLedWPSBlinkInProgress == false) { - if (pLed->bLedBlinkInProgress == true) { + if (!pLed->bLedWPSBlinkInProgress) { + if (pLed->bLedBlinkInProgress) { del_timer(&pLed->BlinkTimer); pLed->bLedBlinkInProgress = false; } - if (pLed->bLedScanBlinkInProgress == true) { + if (pLed->bLedScanBlinkInProgress) { del_timer(&pLed->BlinkTimer); pLed->bLedScanBlinkInProgress = false; } @@ -1244,10 +1240,10 @@ static void SwLedControlMode3(struct _adapter *padapter, case LED_CTL_SITE_SURVEY: if (pmlmepriv->sitesurveyctrl.traffic_busy) ; /* dummy branch */ - else if (pLed->bLedScanBlinkInProgress == false) { + else if (!pLed->bLedScanBlinkInProgress) { if (IS_LED_WPS_BLINKING(pLed)) return; - if (pLed->bLedBlinkInProgress == true) { + if (pLed->bLedBlinkInProgress) { del_timer(&pLed->BlinkTimer); pLed->bLedBlinkInProgress = false; } @@ -1264,8 +1260,8 @@ static void SwLedControlMode3(struct _adapter *padapter, break; case LED_CTL_TX: case LED_CTL_RX: - if ((pLed->bLedBlinkInProgress == false) && - (check_fwstate(pmlmepriv, _FW_LINKED) == true)) { + if (!pLed->bLedBlinkInProgress && + check_fwstate(pmlmepriv, _FW_LINKED)) { if (pLed->CurrLedState == LED_SCAN_BLINK || IS_LED_WPS_BLINKING(pLed)) return; @@ -1298,12 +1294,12 @@ static void SwLedControlMode3(struct _adapter *padapter, break; case LED_CTL_START_WPS: /* wait until xinpin finish */ case LED_CTL_START_WPS_BOTTON: - if (pLed->bLedWPSBlinkInProgress == false) { - if (pLed->bLedBlinkInProgress == true) { + if (!pLed->bLedWPSBlinkInProgress) { + if (pLed->bLedBlinkInProgress) { del_timer(&pLed->BlinkTimer); pLed->bLedBlinkInProgress = false; } - if (pLed->bLedScanBlinkInProgress == true) { + if (pLed->bLedScanBlinkInProgress) { del_timer(&pLed->BlinkTimer); pLed->bLedScanBlinkInProgress = false; } @@ -1395,15 +1391,15 @@ static void SwLedControlMode4(struct _adapter *padapter, mod_timer(&pLed->BlinkTimer, jiffies + msecs_to_jiffies(0)); } - if (pLed->bLedStartToLinkBlinkInProgress == false) { + if (!pLed->bLedStartToLinkBlinkInProgress) { if (pLed->CurrLedState == LED_SCAN_BLINK || IS_LED_WPS_BLINKING(pLed)) return; - if (pLed->bLedBlinkInProgress == true) { + if (pLed->bLedBlinkInProgress) { del_timer(&pLed->BlinkTimer); pLed->bLedBlinkInProgress = false; } - if (pLed->bLedNoLinkBlinkInProgress == true) { + if (pLed->bLedNoLinkBlinkInProgress) { del_timer(&pLed->BlinkTimer); pLed->bLedNoLinkBlinkInProgress = false; } @@ -1434,11 +1430,11 @@ static void SwLedControlMode4(struct _adapter *padapter, jiffies + msecs_to_jiffies(0)); } } - if (pLed->bLedNoLinkBlinkInProgress == false) { + if (!pLed->bLedNoLinkBlinkInProgress) { if (pLed->CurrLedState == LED_SCAN_BLINK || IS_LED_WPS_BLINKING(pLed)) return; - if (pLed->bLedBlinkInProgress == true) { + if (pLed->bLedBlinkInProgress) { del_timer(&pLed->BlinkTimer); pLed->bLedBlinkInProgress = false; } @@ -1453,17 +1449,17 @@ static void SwLedControlMode4(struct _adapter *padapter, } break; case LED_CTL_SITE_SURVEY: - if ((pmlmepriv->sitesurveyctrl.traffic_busy) && - (check_fwstate(pmlmepriv, _FW_LINKED) == true)) + if (pmlmepriv->sitesurveyctrl.traffic_busy && + check_fwstate(pmlmepriv, _FW_LINKED)) ; - else if (pLed->bLedScanBlinkInProgress == false) { + else if (!pLed->bLedScanBlinkInProgress) { if (IS_LED_WPS_BLINKING(pLed)) return; - if (pLed->bLedNoLinkBlinkInProgress == true) { + if (pLed->bLedNoLinkBlinkInProgress) { del_timer(&pLed->BlinkTimer); pLed->bLedNoLinkBlinkInProgress = false; } - if (pLed->bLedBlinkInProgress == true) { + if (pLed->bLedBlinkInProgress) { del_timer(&pLed->BlinkTimer); pLed->bLedBlinkInProgress = false; } @@ -1480,11 +1476,11 @@ static void SwLedControlMode4(struct _adapter *padapter, break; case LED_CTL_TX: case LED_CTL_RX: - if (pLed->bLedBlinkInProgress == false) { + if (!pLed->bLedBlinkInProgress) { if (pLed->CurrLedState == LED_SCAN_BLINK || IS_LED_WPS_BLINKING(pLed)) return; - if (pLed->bLedNoLinkBlinkInProgress == true) { + if (pLed->bLedNoLinkBlinkInProgress) { del_timer(&pLed->BlinkTimer); pLed->bLedNoLinkBlinkInProgress = false; } @@ -1510,16 +1506,16 @@ static void SwLedControlMode4(struct _adapter *padapter, mod_timer(&pLed->BlinkTimer, jiffies + msecs_to_jiffies(0)); } - if (pLed->bLedWPSBlinkInProgress == false) { - if (pLed->bLedNoLinkBlinkInProgress == true) { + if (!pLed->bLedWPSBlinkInProgress) { + if (pLed->bLedNoLinkBlinkInProgress) { del_timer(&pLed->BlinkTimer); pLed->bLedNoLinkBlinkInProgress = false; } - if (pLed->bLedBlinkInProgress == true) { + if (pLed->bLedBlinkInProgress) { del_timer(&pLed->BlinkTimer); pLed->bLedBlinkInProgress = false; } - if (pLed->bLedScanBlinkInProgress == true) { + if (pLed->bLedScanBlinkInProgress) { del_timer(&pLed->BlinkTimer); pLed->bLedScanBlinkInProgress = false; } @@ -1666,11 +1662,11 @@ static void SwLedControlMode5(struct _adapter *padapter, jiffies + msecs_to_jiffies(0)); break; case LED_CTL_SITE_SURVEY: - if ((pmlmepriv->sitesurveyctrl.traffic_busy) && - (check_fwstate(pmlmepriv, _FW_LINKED) == true)) + if (pmlmepriv->sitesurveyctrl.traffic_busy && + check_fwstate(pmlmepriv, _FW_LINKED)) ; /* dummy branch */ - else if (pLed->bLedScanBlinkInProgress == false) { - if (pLed->bLedBlinkInProgress == true) { + else if (!pLed->bLedScanBlinkInProgress) { + if (pLed->bLedBlinkInProgress) { del_timer(&pLed->BlinkTimer); pLed->bLedBlinkInProgress = false; } @@ -1687,7 +1683,7 @@ static void SwLedControlMode5(struct _adapter *padapter, break; case LED_CTL_TX: case LED_CTL_RX: - if (pLed->bLedBlinkInProgress == false) { + if (!pLed->bLedBlinkInProgress) { if (pLed->CurrLedState == LED_SCAN_BLINK) return; pLed->bLedBlinkInProgress = true; @@ -1737,8 +1733,8 @@ static void SwLedControlMode6(struct _adapter *padapter, break; case LED_CTL_TX: case LED_CTL_RX: - if (pLed->bLedBlinkInProgress == false && - (check_fwstate(pmlmepriv, _FW_LINKED) == true)) { + if (!pLed->bLedBlinkInProgress && + check_fwstate(pmlmepriv, _FW_LINKED)) { if (IS_LED_WPS_BLINKING(pLed)) return; pLed->bLedBlinkInProgress = true; @@ -1754,8 +1750,8 @@ static void SwLedControlMode6(struct _adapter *padapter, break; case LED_CTL_START_WPS: /*wait until xinpin finish*/ case LED_CTL_START_WPS_BOTTON: - if (pLed->bLedWPSBlinkInProgress == false) { - if (pLed->bLedBlinkInProgress == true) { + if (!pLed->bLedWPSBlinkInProgress) { + if (pLed->bLedBlinkInProgress) { del_timer(&pLed->BlinkTimer); pLed->bLedBlinkInProgress = false; } @@ -1805,7 +1801,7 @@ void LedControl871x(struct _adapter *padapter, enum LED_CTL_MODE LedAction) { struct led_priv *ledpriv = &(padapter->ledpriv); - if (ledpriv->bRegUseLed == false) + if (!ledpriv->bRegUseLed) return; switch (ledpriv->LedStrategy) { case SW_LED_MODE0: diff --git a/drivers/staging/rtl8712/rtl8712_recv.c b/drivers/staging/rtl8712/rtl8712_recv.c index 534dc04d51a6..83cdb6146216 100644 --- a/drivers/staging/rtl8712/rtl8712_recv.c +++ b/drivers/staging/rtl8712/rtl8712_recv.c @@ -217,7 +217,7 @@ static union recv_frame *recvframe_defrag(struct _adapter *adapter, curfragnum++; plist = &defrag_q->queue; plist = plist->next; - while (end_of_queue_search(phead, plist) == false) { + while (!end_of_queue_search(phead, plist)) { pnextrframe = LIST_CONTAINOR(plist, union recv_frame, u); pnfhdr = &pnextrframe->u.hdr; /*check the fragment sequence (2nd ~n fragment frame) */ @@ -489,7 +489,7 @@ static int enqueue_reorder_recvframe(struct recv_reorder_ctrl *preorder_ctrl, phead = &ppending_recvframe_queue->queue; plist = phead->next; - while (end_of_queue_search(phead, plist) == false) { + while (!end_of_queue_search(phead, plist)) { pnextrframe = LIST_CONTAINOR(plist, union recv_frame, u); pnextattrib = &pnextrframe->u.hdr.attrib; if (SN_LESS(pnextattrib->seq_num, pattrib->seq_num)) @@ -519,7 +519,7 @@ int r8712_recv_indicatepkts_in_order(struct _adapter *padapter, phead = &ppending_recvframe_queue->queue; plist = phead->next; /* Handling some condition for forced indicate case.*/ - if (bforced == true) { + if (bforced) { if (list_empty(phead)) return true; @@ -541,8 +541,8 @@ int r8712_recv_indicatepkts_in_order(struct _adapter *padapter, (preorder_ctrl->indicate_seq + 1) % 4096; /*indicate this recv_frame*/ if (!pattrib->amsdu) { - if ((padapter->bDriverStopped == false) && - (padapter->bSurpriseRemoved == false)) { + if (!padapter->bDriverStopped && + !padapter->bSurpriseRemoved) { /* indicate this recv_frame */ r8712_recv_indicatepkt(padapter, prframe); @@ -576,8 +576,8 @@ static int recv_indicatepkt_reorder(struct _adapter *padapter, /* s1. */ r8712_wlanhdr_to_ethhdr(prframe); if (pattrib->qos != 1) { - if ((padapter->bDriverStopped == false) && - (padapter->bSurpriseRemoved == false)) { + if (!padapter->bDriverStopped && + !padapter->bSurpriseRemoved) { r8712_recv_indicatepkt(padapter, prframe); return _SUCCESS; } else @@ -643,16 +643,15 @@ static int r8712_process_recv_indicatepkts(struct _adapter *padapter, if (phtpriv->ht_option == 1) { /*B/G/N Mode*/ if (recv_indicatepkt_reorder(padapter, prframe) != _SUCCESS) { /* including perform A-MPDU Rx Ordering Buffer Control*/ - if ((padapter->bDriverStopped == false) && - (padapter->bSurpriseRemoved == false)) + if (!padapter->bDriverStopped && + !padapter->bSurpriseRemoved) return _FAIL; } } else { /*B/G mode*/ retval = r8712_wlanhdr_to_ethhdr(prframe); if (retval != _SUCCESS) return retval; - if ((padapter->bDriverStopped == false) && - (padapter->bSurpriseRemoved == false)) { + if (!padapter->bDriverStopped && !padapter->bSurpriseRemoved) { /* indicate this recv_frame */ r8712_recv_indicatepkt(padapter, prframe); } else @@ -962,12 +961,12 @@ int recv_func(struct _adapter *padapter, void *pcontext) prframe = (union recv_frame *)pcontext; orig_prframe = prframe; pattrib = &prframe->u.hdr.attrib; - if (check_fwstate(pmlmepriv, WIFI_MP_STATE) == true) { + if (check_fwstate(pmlmepriv, WIFI_MP_STATE)) { if (pattrib->crc_err == 1) padapter->mppriv.rx_crcerrpktcount++; else padapter->mppriv.rx_pktcount++; - if (check_fwstate(pmlmepriv, WIFI_MP_LPBK_STATE) == false) { + if (!check_fwstate(pmlmepriv, WIFI_MP_LPBK_STATE)) { /* free this recv_frame */ r8712_free_recvframe(orig_prframe, pfree_recv_queue); goto _exit_recv_func; diff --git a/drivers/staging/rtl8712/rtl8712_xmit.c b/drivers/staging/rtl8712/rtl8712_xmit.c index 27b121398027..296591902e19 100644 --- a/drivers/staging/rtl8712/rtl8712_xmit.c +++ b/drivers/staging/rtl8712/rtl8712_xmit.c @@ -168,7 +168,7 @@ static struct xmit_frame *dequeue_one_xmitframe(struct xmit_priv *pxmitpriv, xmitframe_phead = &pframe_queue->queue; xmitframe_plist = xmitframe_phead->next; - if ((end_of_queue_search(xmitframe_phead, xmitframe_plist)) == false) { + if (!end_of_queue_search(xmitframe_phead, xmitframe_plist)) { pxmitframe = LIST_CONTAINOR(xmitframe_plist, struct xmit_frame, list); list_del_init(&pxmitframe->list); @@ -208,7 +208,7 @@ static struct xmit_frame *dequeue_xframe_ex(struct xmit_priv *pxmitpriv, phwxmit = phwxmit_i + inx[i]; sta_phead = &phwxmit->sta_queue->queue; sta_plist = sta_phead->next; - while ((end_of_queue_search(sta_phead, sta_plist)) == false) { + while (!end_of_queue_search(sta_phead, sta_plist)) { ptxservq = LIST_CONTAINOR(sta_plist, struct tx_servq, tx_pending); pframe_queue = &ptxservq->sta_pending; diff --git a/drivers/staging/rtl8712/rtl871x_cmd.c b/drivers/staging/rtl8712/rtl871x_cmd.c index ef7182961002..83317815be40 100644 --- a/drivers/staging/rtl8712/rtl871x_cmd.c +++ b/drivers/staging/rtl8712/rtl871x_cmd.c @@ -172,7 +172,7 @@ u32 r8712_enqueue_cmd(struct cmd_priv *pcmdpriv, struct cmd_obj *obj) { int res; - if (pcmdpriv->padapter->eeprompriv.bautoload_fail_flag == true) + if (pcmdpriv->padapter->eeprompriv.bautoload_fail_flag) return _FAIL; res = _enqueue_cmd(&pcmdpriv->cmd_queue, obj); up(&pcmdpriv->cmd_queue_sema); @@ -186,7 +186,7 @@ u32 r8712_enqueue_cmd_ex(struct cmd_priv *pcmdpriv, struct cmd_obj *obj) if (obj == NULL) return _SUCCESS; - if (pcmdpriv->padapter->eeprompriv.bautoload_fail_flag == true) + if (pcmdpriv->padapter->eeprompriv.bautoload_fail_flag) return _FAIL; queue = &pcmdpriv->cmd_queue; spin_lock_irqsave(&queue->lock, irqL); @@ -519,7 +519,7 @@ u8 r8712_joinbss_cmd(struct _adapter *padapter, struct wlan_network *pnetwork) * If not, we copy the connecting AP's MAC address to it so that * the driver just has the bssid information for PMKIDList searching. */ - if (pmlmepriv->assoc_by_bssid == false) + if (!pmlmepriv->assoc_by_bssid) ether_addr_copy(&pmlmepriv->assoc_bssid[0], &pnetwork->network.MacAddress[0]); psecnetwork->IELength = r8712_restruct_sec_ie(padapter, @@ -679,7 +679,7 @@ u8 r8712_setstakey_cmd(struct _adapter *padapter, u8 *psta, u8 unicast_key) else GET_ENCRY_ALGO(psecuritypriv, sta, psetstakey_para->algorithm, false); - if (unicast_key == true) + if (unicast_key) memcpy(&psetstakey_para->key, &sta->x_UncstKey, 16); else memcpy(&psetstakey_para->key, diff --git a/drivers/staging/rtl8712/rtl871x_eeprom.c b/drivers/staging/rtl8712/rtl871x_eeprom.c index 50339e67da07..4e713610ad8b 100644 --- a/drivers/staging/rtl8712/rtl871x_eeprom.c +++ b/drivers/staging/rtl8712/rtl871x_eeprom.c @@ -49,7 +49,7 @@ static void shift_out_bits(struct _adapter *padapter, u16 data, u16 count) { u16 x, mask; - if (padapter->bSurpriseRemoved == true) + if (padapter->bSurpriseRemoved) goto out; mask = 0x01 << (count - 1); x = r8712_read8(padapter, EE_9346CR); @@ -58,7 +58,7 @@ static void shift_out_bits(struct _adapter *padapter, u16 data, u16 count) x &= ~_EEDI; if (data & mask) x |= _EEDI; - if (padapter->bSurpriseRemoved == true) + if (padapter->bSurpriseRemoved) goto out; r8712_write8(padapter, EE_9346CR, (u8)x); udelay(CLOCK_RATE); @@ -66,7 +66,7 @@ static void shift_out_bits(struct _adapter *padapter, u16 data, u16 count) down_clk(padapter, &x); mask >>= 1; } while (mask); - if (padapter->bSurpriseRemoved == true) + if (padapter->bSurpriseRemoved) goto out; x &= ~_EEDI; r8712_write8(padapter, EE_9346CR, (u8)x); @@ -77,7 +77,7 @@ static u16 shift_in_bits(struct _adapter *padapter) { u16 x, d = 0, i; - if (padapter->bSurpriseRemoved == true) + if (padapter->bSurpriseRemoved) goto out; x = r8712_read8(padapter, EE_9346CR); x &= ~(_EEDO | _EEDI); @@ -85,7 +85,7 @@ static u16 shift_in_bits(struct _adapter *padapter) for (i = 0; i < 16; i++) { d <<= 1; up_clk(padapter, &x); - if (padapter->bSurpriseRemoved == true) + if (padapter->bSurpriseRemoved) goto out; x = r8712_read8(padapter, EE_9346CR); x &= ~(_EEDI); @@ -129,17 +129,17 @@ static void eeprom_clean(struct _adapter *padapter) { u16 x; - if (padapter->bSurpriseRemoved == true) + if (padapter->bSurpriseRemoved) return; x = r8712_read8(padapter, EE_9346CR); - if (padapter->bSurpriseRemoved == true) + if (padapter->bSurpriseRemoved) return; x &= ~(_EECS | _EEDI); r8712_write8(padapter, EE_9346CR, (u8)x); - if (padapter->bSurpriseRemoved == true) + if (padapter->bSurpriseRemoved) return; up_clk(padapter, &x); - if (padapter->bSurpriseRemoved == true) + if (padapter->bSurpriseRemoved) return; down_clk(padapter, &x); } @@ -206,11 +206,11 @@ u16 r8712_eeprom_read16(struct _adapter *padapter, u16 reg) /*ReadEEprom*/ tmp8_clk_new = tmp8_clk_ori | 0x20; if (tmp8_clk_new != tmp8_clk_ori) r8712_write8(padapter, 0x10250003, tmp8_clk_new); - if (padapter->bSurpriseRemoved == true) + if (padapter->bSurpriseRemoved) goto out; /* select EEPROM, reset bits, set _EECS */ x = r8712_read8(padapter, EE_9346CR); - if (padapter->bSurpriseRemoved == true) + if (padapter->bSurpriseRemoved) goto out; x &= ~(_EEDI | _EEDO | _EESK | _EEM0); x |= _EEM1 | _EECS; diff --git a/drivers/staging/rtl8712/rtl871x_ioctl_linux.c b/drivers/staging/rtl8712/rtl871x_ioctl_linux.c index a96481609f39..a7f581633c23 100644 --- a/drivers/staging/rtl8712/rtl871x_ioctl_linux.c +++ b/drivers/staging/rtl8712/rtl871x_ioctl_linux.c @@ -178,17 +178,17 @@ static inline char *translate_scan(struct _adapter *padapter, /* Add the protocol name */ iwe.cmd = SIOCGIWNAME; if (r8712_is_cckratesonly_included(pnetwork->network.rates)) { - if (ht_cap == true) + if (ht_cap) snprintf(iwe.u.name, IFNAMSIZ, "IEEE 802.11bn"); else snprintf(iwe.u.name, IFNAMSIZ, "IEEE 802.11b"); } else if (r8712_is_cckrates_included(pnetwork->network.rates)) { - if (ht_cap == true) + if (ht_cap) snprintf(iwe.u.name, IFNAMSIZ, "IEEE 802.11bgn"); else snprintf(iwe.u.name, IFNAMSIZ, "IEEE 802.11bg"); } else { - if (ht_cap == true) + if (ht_cap) snprintf(iwe.u.name, IFNAMSIZ, "IEEE 802.11gn"); else snprintf(iwe.u.name, IFNAMSIZ, "IEEE 802.11g"); @@ -310,7 +310,7 @@ static inline char *translate_scan(struct _adapter *padapter, if (r8712_get_wps_ie(pnetwork->network.IEs, pnetwork->network.IELength, - wps_ie, &wps_ielen) == true) { + wps_ie, &wps_ielen)) { if (wps_ielen > 2) { iwe.cmd = IWEVGENIE; iwe.u.data.length = (u16)wps_ielen; @@ -443,7 +443,7 @@ static int wpa_set_encryption(struct net_device *dev, struct ieee_param *param, struct sta_priv *pstapriv = &padapter->stapriv; if (check_fwstate(pmlmepriv, WIFI_STATION_STATE | - WIFI_MP_STATE) == true) { /* sta mode */ + WIFI_MP_STATE)) { /* sta mode */ psta = r8712_get_stainfo(pstapriv, get_bssid(pmlmepriv)); if (psta) { @@ -617,22 +617,22 @@ static int r8711_wx_get_name(struct net_device *dev, if (p && ht_ielen > 0) ht_cap = true; prates = pcur_bss->rates; - if (r8712_is_cckratesonly_included(prates) == true) { - if (ht_cap == true) + if (r8712_is_cckratesonly_included(prates)) { + if (ht_cap) snprintf(wrqu->name, IFNAMSIZ, "IEEE 802.11bn"); else snprintf(wrqu->name, IFNAMSIZ, "IEEE 802.11b"); - } else if ((r8712_is_cckrates_included(prates)) == true) { - if (ht_cap == true) + } else if (r8712_is_cckrates_included(prates)) { + if (ht_cap) snprintf(wrqu->name, IFNAMSIZ, "IEEE 802.11bgn"); else snprintf(wrqu->name, IFNAMSIZ, "IEEE 802.11bg"); } else { - if (ht_cap == true) + if (ht_cap) snprintf(wrqu->name, IFNAMSIZ, "IEEE 802.11gn"); else @@ -697,7 +697,7 @@ static int r8711_wx_get_freq(struct net_device *dev, struct mlme_priv *pmlmepriv = &padapter->mlmepriv; struct wlan_bssid_ex *pcur_bss = &pmlmepriv->cur_network.network; - if (check_fwstate(pmlmepriv, _FW_LINKED) == true) { + if (check_fwstate(pmlmepriv, _FW_LINKED)) { wrqu->freq.m = ieee80211_wlan_frequencies[ pcur_bss->Configuration.DSConfig-1] * 100000; wrqu->freq.e = 1; @@ -746,12 +746,12 @@ static int r8711_wx_get_mode(struct net_device *dev, struct iw_request_info *a, struct _adapter *padapter = netdev_priv(dev); struct mlme_priv *pmlmepriv = &padapter->mlmepriv; - if (check_fwstate(pmlmepriv, WIFI_STATION_STATE) == true) + if (check_fwstate(pmlmepriv, WIFI_STATION_STATE)) wrqu->mode = IW_MODE_INFRA; else if (check_fwstate(pmlmepriv, - WIFI_ADHOC_MASTER_STATE|WIFI_ADHOC_STATE) == true) + WIFI_ADHOC_MASTER_STATE | WIFI_ADHOC_STATE)) wrqu->mode = IW_MODE_ADHOC; - else if (check_fwstate(pmlmepriv, WIFI_AP_STATE) == true) + else if (check_fwstate(pmlmepriv, WIFI_AP_STATE)) wrqu->mode = IW_MODE_MASTER; else wrqu->mode = IW_MODE_AUTO; @@ -940,7 +940,7 @@ static int r871x_wx_set_priv(struct net_device *dev, struct mlme_priv *pmlmepriv = &(padapter->mlmepriv); struct wlan_network *pcur_network = &pmlmepriv->cur_network; /*static u8 xxxx; */ - if (check_fwstate(pmlmepriv, _FW_LINKED) == true) { + if (check_fwstate(pmlmepriv, _FW_LINKED)) { sprintf(ext, "%s rssi %d", pcur_network->network.Ssid.Ssid, /*(xxxx=xxxx+10) */ @@ -1044,9 +1044,9 @@ static int r8711_wx_set_wap(struct net_device *dev, struct wlan_network *pnetwork = NULL; enum NDIS_802_11_AUTHENTICATION_MODE authmode; - if (check_fwstate(pmlmepriv, _FW_UNDER_SURVEY) == true) + if (check_fwstate(pmlmepriv, _FW_UNDER_SURVEY)) return -EBUSY; - if (check_fwstate(pmlmepriv, _FW_UNDER_LINKING) == true) + if (check_fwstate(pmlmepriv, _FW_UNDER_LINKING)) return ret; if (temp->sa_family != ARPHRD_ETHER) return -EINVAL; @@ -1055,7 +1055,7 @@ static int r8711_wx_set_wap(struct net_device *dev, phead = &queue->queue; pmlmepriv->pscanned = phead->next; while (1) { - if (end_of_queue_search(phead, pmlmepriv->pscanned) == true) + if (end_of_queue_search(phead, pmlmepriv->pscanned)) break; pnetwork = LIST_CONTAINOR(pmlmepriv->pscanned, struct wlan_network, list); @@ -1137,17 +1137,17 @@ static int r8711_wx_set_scan(struct net_device *dev, struct mlme_priv *pmlmepriv = &padapter->mlmepriv; u8 status = true; - if (padapter->bDriverStopped == true) { + if (padapter->bDriverStopped) { netdev_info(dev, "In %s: bDriverStopped=%d\n", __func__, padapter->bDriverStopped); return -1; } - if (padapter->bup == false) + if (!padapter->bup) return -ENETDOWN; - if (padapter->hw_init_completed == false) + if (!padapter->hw_init_completed) return -1; if ((check_fwstate(pmlmepriv, _FW_UNDER_SURVEY|_FW_UNDER_LINKING)) || - (pmlmepriv->sitesurveyctrl.traffic_busy == true)) + (pmlmepriv->sitesurveyctrl.traffic_busy)) return 0; if (wrqu->data.length == sizeof(struct iw_scan_req)) { struct iw_scan_req *req = (struct iw_scan_req *)extra; @@ -1164,7 +1164,7 @@ static int r8711_wx_set_scan(struct net_device *dev, spin_lock_irqsave(&pmlmepriv->lock, irqL); if ((check_fwstate(pmlmepriv, _FW_UNDER_SURVEY | _FW_UNDER_LINKING)) || - (pmlmepriv->sitesurveyctrl.traffic_busy == true)) { + (pmlmepriv->sitesurveyctrl.traffic_busy)) { if (check_fwstate(pmlmepriv, _FW_UNDER_LINKING)) status = false; } else @@ -1173,7 +1173,7 @@ static int r8711_wx_set_scan(struct net_device *dev, } } else status = r8712_set_802_11_bssid_list_scan(padapter); - if (status == false) + if (!status) return -1; return 0; } @@ -1204,7 +1204,7 @@ static int r8711_wx_get_scan(struct net_device *dev, phead = &queue->queue; plist = phead->next; while (1) { - if (end_of_queue_search(phead, plist) == true) + if (end_of_queue_search(phead, plist)) break; if ((stop - ev) < SCAN_ITEM_SIZE) { ret = -E2BIG; @@ -1427,7 +1427,7 @@ static int r8711_wx_get_rate(struct net_device *dev, wrqu->bitrate.value = rate*500000; i++; } - if (ht_cap == true) { + if (ht_cap) { if (mcs_rate & 0x8000 /* MCS15 */ && rf_type == RTL8712_RF_2T2R) @@ -1599,7 +1599,7 @@ static int r8711_wx_get_enc(struct net_device *dev, struct iw_point *erq = &(wrqu->encoding); struct mlme_priv *pmlmepriv = &(padapter->mlmepriv); - if (check_fwstate(pmlmepriv, _FW_LINKED) == false) { + if (!check_fwstate(pmlmepriv, _FW_LINKED)) { if (!check_fwstate(pmlmepriv, WIFI_ADHOC_MASTER_STATE)) { erq->length = 0; erq->flags |= IW_ENCODE_DISABLED; @@ -1973,7 +1973,7 @@ static int r871x_get_ap_info(struct net_device *dev, phead = &queue->queue; plist = phead->next; while (1) { - if (end_of_queue_search(phead, plist) == true) + if (end_of_queue_search(phead, plist)) break; pnetwork = LIST_CONTAINOR(plist, struct wlan_network, list); if (!mac_pton(data, bssid)) { diff --git a/drivers/staging/rtl8712/rtl871x_ioctl_rtl.c b/drivers/staging/rtl8712/rtl871x_ioctl_rtl.c index ac0baff7f090..d8e62ec697b3 100644 --- a/drivers/staging/rtl8712/rtl871x_ioctl_rtl.c +++ b/drivers/staging/rtl8712/rtl871x_ioctl_rtl.c @@ -324,8 +324,8 @@ uint oid_rt_get_channel_hdl(struct oid_par_priv *poid_par_priv) if (poid_par_priv->type_of_oid != QUERY_OID) return RNDIS_STATUS_NOT_ACCEPTED; - if ((check_fwstate(pmlmepriv, _FW_LINKED) == true) || - (check_fwstate(pmlmepriv, WIFI_ADHOC_MASTER_STATE) == true)) + if (check_fwstate(pmlmepriv, _FW_LINKED) || + check_fwstate(pmlmepriv, WIFI_ADHOC_MASTER_STATE)) pnic_Config = &pmlmepriv->cur_network.network.Configuration; else pnic_Config = &padapter->registrypriv.dev_network. @@ -465,7 +465,7 @@ uint oid_rt_pro_rf_read_registry_hdl(struct oid_par_priv *poid_par_priv) if (poid_par_priv->type_of_oid != SET_OID) /* QUERY_OID */ return RNDIS_STATUS_NOT_ACCEPTED; if (poid_par_priv->information_buf_len == (sizeof(unsigned long)*3)) { - if (Adapter->mppriv.act_in_progress == true) + if (Adapter->mppriv.act_in_progress) status = RNDIS_STATUS_NOT_ACCEPTED; else { /* init workparam */ @@ -515,11 +515,11 @@ uint oid_rt_get_connect_state_hdl(struct oid_par_priv *poid_par_priv) * nStatus==2 AdHocMode * nStatus==3 NotAssociated */ - if (check_fwstate(pmlmepriv, _FW_UNDER_LINKING) == true) + if (check_fwstate(pmlmepriv, _FW_UNDER_LINKING)) ulInfo = CHECKINGSTATUS; - else if (check_fwstate(pmlmepriv, _FW_LINKED) == true) + else if (check_fwstate(pmlmepriv, _FW_LINKED)) ulInfo = ASSOCIATED; - else if (check_fwstate(pmlmepriv, WIFI_ADHOC_STATE) == true) + else if (check_fwstate(pmlmepriv, WIFI_ADHOC_STATE)) ulInfo = ADHOCMODE; else ulInfo = NOTASSOCIATED; diff --git a/drivers/staging/rtl8712/rtl871x_ioctl_set.c b/drivers/staging/rtl8712/rtl871x_ioctl_set.c index 22262b3558ba..67a2695fbeed 100644 --- a/drivers/staging/rtl8712/rtl871x_ioctl_set.c +++ b/drivers/staging/rtl8712/rtl871x_ioctl_set.c @@ -136,12 +136,12 @@ u8 r8712_set_802_11_bssid(struct _adapter *padapter, u8 *bssid) } spin_lock_irqsave(&pmlmepriv->lock, irqL); if (check_fwstate(pmlmepriv, _FW_UNDER_SURVEY | - _FW_UNDER_LINKING) == true) { + _FW_UNDER_LINKING)) { status = check_fwstate(pmlmepriv, _FW_UNDER_LINKING); goto _Abort_Set_BSSID; } if (check_fwstate(pmlmepriv, - _FW_LINKED|WIFI_ADHOC_MASTER_STATE) == true) { + _FW_LINKED | WIFI_ADHOC_MASTER_STATE)) { if (!memcmp(&pmlmepriv->cur_network.network.MacAddress, bssid, ETH_ALEN)) { if (!check_fwstate(pmlmepriv, WIFI_STATION_STATE)) @@ -149,7 +149,7 @@ u8 r8712_set_802_11_bssid(struct _adapter *padapter, u8 *bssid) * WIFI_ADHOC_MASTER_STATE */ } else { r8712_disassoc_cmd(padapter); - if (check_fwstate(pmlmepriv, _FW_LINKED) == true) + if (check_fwstate(pmlmepriv, _FW_LINKED)) r8712_ind_disconnect(padapter); r8712_free_assoc_resources(padapter); if ((check_fwstate(pmlmepriv, @@ -197,7 +197,7 @@ void r8712_set_802_11_ssid(struct _adapter *padapter, */ r8712_disassoc_cmd(padapter); if (check_fwstate(pmlmepriv, - _FW_LINKED) == true) + _FW_LINKED)) r8712_ind_disconnect(padapter); r8712_free_assoc_resources(padapter); if (check_fwstate(pmlmepriv, @@ -213,18 +213,18 @@ void r8712_set_802_11_ssid(struct _adapter *padapter, } } else { r8712_disassoc_cmd(padapter); - if (check_fwstate(pmlmepriv, _FW_LINKED) == true) + if (check_fwstate(pmlmepriv, _FW_LINKED)) r8712_ind_disconnect(padapter); r8712_free_assoc_resources(padapter); if (check_fwstate(pmlmepriv, - WIFI_ADHOC_MASTER_STATE) == true) { + WIFI_ADHOC_MASTER_STATE)) { _clr_fwstate_(pmlmepriv, WIFI_ADHOC_MASTER_STATE); set_fwstate(pmlmepriv, WIFI_ADHOC_STATE); } } } - if (padapter->securitypriv.btkip_countermeasure == true) + if (padapter->securitypriv.btkip_countermeasure) goto _Abort_Set_SSID; if (!validate_ssid(ssid)) goto _Abort_Set_SSID; @@ -248,13 +248,13 @@ void r8712_set_802_11_infrastructure_mode(struct _adapter *padapter, if (*pold_state != networktype) { spin_lock_irqsave(&pmlmepriv->lock, irqL); - if ((check_fwstate(pmlmepriv, _FW_LINKED) == true) || + if (check_fwstate(pmlmepriv, _FW_LINKED) || (*pold_state == Ndis802_11IBSS)) r8712_disassoc_cmd(padapter); if (check_fwstate(pmlmepriv, - _FW_LINKED|WIFI_ADHOC_MASTER_STATE) == true) + _FW_LINKED | WIFI_ADHOC_MASTER_STATE)) r8712_free_assoc_resources(padapter); - if ((check_fwstate(pmlmepriv, _FW_LINKED) == true) || + if (check_fwstate(pmlmepriv, _FW_LINKED) || (*pold_state == Ndis802_11Infrastructure) || (*pold_state == Ndis802_11IBSS)) { /* will clr Linked_state before this function, @@ -291,7 +291,7 @@ u8 r8712_set_802_11_disassociate(struct _adapter *padapter) struct mlme_priv *pmlmepriv = &padapter->mlmepriv; spin_lock_irqsave(&pmlmepriv->lock, irqL); - if (check_fwstate(pmlmepriv, _FW_LINKED) == true) { + if (check_fwstate(pmlmepriv, _FW_LINKED)) { r8712_disassoc_cmd(padapter); r8712_ind_disconnect(padapter); r8712_free_assoc_resources(padapter); @@ -312,8 +312,8 @@ u8 r8712_set_802_11_bssid_list_scan(struct _adapter *padapter) if (!padapter->hw_init_completed) return false; spin_lock_irqsave(&pmlmepriv->lock, irqL); - if ((check_fwstate(pmlmepriv, _FW_UNDER_SURVEY|_FW_UNDER_LINKING)) || - (pmlmepriv->sitesurveyctrl.traffic_busy == true)) { + if (check_fwstate(pmlmepriv, _FW_UNDER_SURVEY | _FW_UNDER_LINKING) || + pmlmepriv->sitesurveyctrl.traffic_busy) { /* Scan or linking is in progress, do nothing. */ ret = (u8)check_fwstate(pmlmepriv, _FW_UNDER_SURVEY); } else { diff --git a/drivers/staging/rtl8712/rtl871x_mlme.c b/drivers/staging/rtl8712/rtl871x_mlme.c index fbcb248b0235..c1890f54b527 100644 --- a/drivers/staging/rtl8712/rtl871x_mlme.c +++ b/drivers/staging/rtl8712/rtl871x_mlme.c @@ -110,7 +110,7 @@ static void _free_network(struct mlme_priv *pmlmepriv, if (pnetwork == NULL) return; - if (pnetwork->fixed == true) + if (pnetwork->fixed) return; curr_time = jiffies; delta_time = (curr_time - (u32)pnetwork->last_scanned) / HZ; @@ -130,7 +130,7 @@ static void _free_network_nolock(struct mlme_priv *pmlmepriv, if (pnetwork == NULL) return; - if (pnetwork->fixed == true) + if (pnetwork->fixed) return; list_del_init(&pnetwork->list); list_add_tail(&pnetwork->list, &free_queue->queue); @@ -176,7 +176,7 @@ static void _free_network_queue(struct _adapter *padapter) spin_lock_irqsave(&scanned_queue->lock, irqL); phead = &scanned_queue->queue; plist = phead->next; - while (end_of_queue_search(phead, plist) == false) { + while (!end_of_queue_search(phead, plist)) { pnetwork = LIST_CONTAINOR(plist, struct wlan_network, list); plist = plist->next; _free_network(pmlmepriv, pnetwork); @@ -189,7 +189,7 @@ sint r8712_if_up(struct _adapter *padapter) sint res; if (padapter->bDriverStopped || padapter->bSurpriseRemoved || - (check_fwstate(&padapter->mlmepriv, _FW_LINKED) == false)) { + !check_fwstate(&padapter->mlmepriv, _FW_LINKED)) { res = false; } else res = true; @@ -392,7 +392,7 @@ static void update_scanned_network(struct _adapter *adapter, plist = phead->next; while (1) { - if (end_of_queue_search(phead, plist) == true) + if (end_of_queue_search(phead, plist)) break; pnetwork = LIST_CONTAINOR(plist, struct wlan_network, list); @@ -409,7 +409,7 @@ static void update_scanned_network(struct _adapter *adapter, /* If we didn't find a match, then get a new network slot to initialize * with this beacon's information */ - if (end_of_queue_search(phead, plist) == true) { + if (end_of_queue_search(phead, plist)) { if (list_empty(&pmlmepriv->free_bss_pool.queue)) { /* If there are no more slots, expire the oldest */ pnetwork = oldest; @@ -468,10 +468,10 @@ static int is_desired_network(struct _adapter *adapter, int bselected = true; struct security_priv *psecuritypriv = &adapter->securitypriv; - if (psecuritypriv->wps_phase == true) { + if (psecuritypriv->wps_phase) { if (r8712_get_wps_ie(pnetwork->network.IEs, pnetwork->network.IELength, wps_ie, - &wps_ielen) == true) + &wps_ielen)) return true; else return false; @@ -479,7 +479,7 @@ static int is_desired_network(struct _adapter *adapter, if ((psecuritypriv->PrivacyAlgrthm != _NO_PRIVACY_) && (pnetwork->network.Privacy == 0)) bselected = false; - if (check_fwstate(&adapter->mlmepriv, WIFI_ADHOC_STATE) == true) { + if (check_fwstate(&adapter->mlmepriv, WIFI_ADHOC_STATE)) { if (pnetwork->network.InfrastructureMode != adapter->mlmepriv.cur_network.network. InfrastructureMode) @@ -533,7 +533,7 @@ void r8712_survey_event_callback(struct _adapter *adapter, u8 *pbuf) return; spin_lock_irqsave(&pmlmepriv->lock2, flags); /* update IBSS_network 's timestamp */ - if (check_fwstate(pmlmepriv, WIFI_ADHOC_MASTER_STATE) == true) { + if (check_fwstate(pmlmepriv, WIFI_ADHOC_MASTER_STATE)) { if (!memcmp(&(pmlmepriv->cur_network.network.MacAddress), pnetwork->MacAddress, ETH_ALEN)) { struct wlan_network *ibss_wlan = NULL; @@ -551,7 +551,7 @@ void r8712_survey_event_callback(struct _adapter *adapter, u8 *pbuf) } } /* lock pmlmepriv->lock when you accessing network_q */ - if (check_fwstate(pmlmepriv, _FW_UNDER_LINKING) == false) { + if (!check_fwstate(pmlmepriv, _FW_UNDER_LINKING)) { if (pnetwork->Ssid.Ssid[0] != 0) rtl8711_add_network(adapter, pnetwork); else { @@ -571,15 +571,15 @@ void r8712_surveydone_event_callback(struct _adapter *adapter, u8 *pbuf) spin_lock_irqsave(&pmlmepriv->lock, irqL); - if (check_fwstate(pmlmepriv, _FW_UNDER_SURVEY) == true) { + if (check_fwstate(pmlmepriv, _FW_UNDER_SURVEY)) { del_timer(&pmlmepriv->scan_to_timer); _clr_fwstate_(pmlmepriv, _FW_UNDER_SURVEY); } - if (pmlmepriv->to_join == true) { - if (check_fwstate(pmlmepriv, WIFI_ADHOC_STATE) == true) { - if (check_fwstate(pmlmepriv, _FW_LINKED) == false) { + if (pmlmepriv->to_join) { + if (check_fwstate(pmlmepriv, WIFI_ADHOC_STATE)) { + if (!check_fwstate(pmlmepriv, _FW_LINKED)) { set_fwstate(pmlmepriv, _FW_UNDER_LINKING); if (r8712_select_and_join_from_scan(pmlmepriv) @@ -679,7 +679,7 @@ void r8712_ind_disconnect(struct _adapter *padapter) { struct mlme_priv *pmlmepriv = &padapter->mlmepriv; - if (check_fwstate(pmlmepriv, _FW_LINKED) == true) { + if (check_fwstate(pmlmepriv, _FW_LINKED)) { _clr_fwstate_(pmlmepriv, _FW_LINKED); padapter->ledpriv.LedControlHandler(padapter, LED_CTL_NO_LINK); r8712_os_indicate_disconnect(padapter); @@ -764,10 +764,10 @@ void r8712_joinbss_event_callback(struct _adapter *adapter, u8 *pbuf) if (pnetwork->network.Length > sizeof(struct wlan_bssid_ex)) goto ignore_joinbss_callback; if (pnetwork->join_res > 0) { - if (check_fwstate(pmlmepriv, _FW_UNDER_LINKING) == true) { + if (check_fwstate(pmlmepriv, _FW_UNDER_LINKING)) { /*s1. find ptarget_wlan*/ - if (check_fwstate(pmlmepriv, _FW_LINKED) == true) { - if (the_same_macaddr == true) + if (check_fwstate(pmlmepriv, _FW_LINKED)) { + if (the_same_macaddr) ptarget_wlan = r8712_find_network(&pmlmepriv-> scanned_queue, @@ -813,7 +813,7 @@ void r8712_joinbss_event_callback(struct _adapter *adapter, u8 *pbuf) /*s2. find ptarget_sta & update ptarget_sta*/ if (check_fwstate(pmlmepriv, WIFI_STATION_STATE)) { - if (the_same_macaddr == true) { + if (the_same_macaddr) { ptarget_sta = r8712_get_stainfo(pstapriv, pnetwork->network.MacAddress); @@ -897,14 +897,13 @@ void r8712_joinbss_event_callback(struct _adapter *adapter, u8 *pbuf) update_ht_cap(adapter, cur_network->network.IEs, cur_network->network.IELength); /*indicate connect*/ - if (check_fwstate(pmlmepriv, WIFI_STATION_STATE) - == true) + if (check_fwstate(pmlmepriv, WIFI_STATION_STATE)) r8712_indicate_connect(adapter); del_timer(&pmlmepriv->assoc_timer); } else goto ignore_joinbss_callback; } else { - if (check_fwstate(pmlmepriv, _FW_UNDER_LINKING) == true) { + if (check_fwstate(pmlmepriv, _FW_UNDER_LINKING)) { mod_timer(&pmlmepriv->assoc_timer, jiffies + msecs_to_jiffies(1)); _clr_fwstate_(pmlmepriv, _FW_UNDER_LINKING); @@ -924,7 +923,7 @@ void r8712_stassoc_event_callback(struct _adapter *adapter, u8 *pbuf) struct stassoc_event *pstassoc = (struct stassoc_event *)pbuf; /* to do: */ - if (r8712_access_ctrl(&adapter->acl_list, pstassoc->macaddr) == false) + if (!r8712_access_ctrl(&adapter->acl_list, pstassoc->macaddr)) return; psta = r8712_get_stainfo(&adapter->stapriv, pstassoc->macaddr); if (psta != NULL) { @@ -946,8 +945,8 @@ void r8712_stassoc_event_callback(struct _adapter *adapter, u8 *pbuf) psta->XPrivacy = adapter->securitypriv.PrivacyAlgrthm; psta->ieee8021x_blocked = false; spin_lock_irqsave(&pmlmepriv->lock, irqL); - if ((check_fwstate(pmlmepriv, WIFI_ADHOC_MASTER_STATE) == true) || - (check_fwstate(pmlmepriv, WIFI_ADHOC_STATE) == true)) { + if (check_fwstate(pmlmepriv, WIFI_ADHOC_MASTER_STATE) || + check_fwstate(pmlmepriv, WIFI_ADHOC_STATE)) { if (adapter->stapriv.asoc_sta_count == 2) { /* a sta + bc/mc_stainfo (not Ibss_stainfo) */ r8712_indicate_connect(adapter); @@ -969,7 +968,7 @@ void r8712_stadel_event_callback(struct _adapter *adapter, u8 *pbuf) struct wlan_network *tgt_network = &pmlmepriv->cur_network; spin_lock_irqsave(&pmlmepriv->lock, irqL2); - if (check_fwstate(pmlmepriv, WIFI_STATION_STATE) == true) { + if (check_fwstate(pmlmepriv, WIFI_STATION_STATE)) { r8712_ind_disconnect(adapter); r8712_free_assoc_resources(adapter); } @@ -1046,7 +1045,7 @@ void r8712_got_addbareq_event_callback(struct _adapter *adapter, u8 *pbuf) void r8712_wpspbc_event_callback(struct _adapter *adapter, u8 *pbuf) { - if (adapter->securitypriv.wps_hw_pbc_pressed == false) + if (!adapter->securitypriv.wps_hw_pbc_pressed) adapter->securitypriv.wps_hw_pbc_pressed = true; } @@ -1081,7 +1080,7 @@ void _r8712_join_timeout_handler(struct _adapter *adapter) spin_lock_irqsave(&pmlmepriv->lock, irqL); _clr_fwstate_(pmlmepriv, _FW_UNDER_LINKING); pmlmepriv->to_join = false; - if (check_fwstate(pmlmepriv, _FW_LINKED) == true) { + if (check_fwstate(pmlmepriv, _FW_LINKED)) { r8712_os_indicate_disconnect(adapter); _clr_fwstate_(pmlmepriv, _FW_LINKED); } @@ -1131,8 +1130,8 @@ int r8712_select_and_join_from_scan(struct mlme_priv *pmlmepriv) phead = &queue->queue; pmlmepriv->pscanned = phead->next; while (1) { - if (end_of_queue_search(phead, pmlmepriv->pscanned) == true) { - if ((pmlmepriv->assoc_by_rssi == true) && + if (end_of_queue_search(phead, pmlmepriv->pscanned)) { + if ((pmlmepriv->assoc_by_rssi) && (pnetwork_max_rssi != NULL)) { pnetwork = pnetwork_max_rssi; goto ask_for_joinbss; @@ -1144,7 +1143,7 @@ int r8712_select_and_join_from_scan(struct mlme_priv *pmlmepriv) if (pnetwork == NULL) return _FAIL; pmlmepriv->pscanned = pmlmepriv->pscanned->next; - if (pmlmepriv->assoc_by_bssid == true) { + if (pmlmepriv->assoc_by_bssid) { dst_ssid = pnetwork->network.MacAddress; src_ssid = pmlmepriv->assoc_bssid; if (!memcmp(dst_ssid, src_ssid, ETH_ALEN)) { @@ -1172,7 +1171,7 @@ int r8712_select_and_join_from_scan(struct mlme_priv *pmlmepriv) pmlmepriv->assoc_ssid.SsidLength) && (!memcmp(dst_ssid, src_ssid, pmlmepriv->assoc_ssid.SsidLength))) { - if (pmlmepriv->assoc_by_rssi == true) { + if (pmlmepriv->assoc_by_rssi) { /* if the ssid is the same, select the bss * which has the max rssi*/ if (pnetwork_max_rssi) { @@ -1429,7 +1428,7 @@ sint r8712_restruct_sec_ie(struct _adapter *adapter, u8 *in_ie, cnt += in_ie[cnt+1] + 2; /*get next*/ } /*restruct WPA IE or WPA2 IE in sec_ie[] */ - if (match == true) { + if (match) { if (sec_ie[0] == _WPA_IE_ID_) { /* parsing SSN IE to select required encryption * algorithm, and set the bc/mc encryption algorithm */ @@ -1566,7 +1565,7 @@ sint r8712_restruct_sec_ie(struct _adapter *adapter, u8 *in_ie, memcpy(out_ie, in_ie, 12); ielength = 12; /*copy RSN or SSN*/ - if (match == true) { + if (match) { memcpy(&out_ie[ielength], &sec_ie[0], sec_ie[1]+2); ielength += sec_ie[1] + 2; if (authmode == _WPA2_IE_ID_) { @@ -1580,7 +1579,7 @@ sint r8712_restruct_sec_ie(struct _adapter *adapter, u8 *in_ie, /*copy fixed ie only*/ memcpy(out_ie, in_ie, 12); ielength = 12; - if (psecuritypriv->wps_phase == true) { + if (psecuritypriv->wps_phase) { memcpy(out_ie+ielength, psecuritypriv->wps_ie, psecuritypriv->wps_ie_len); ielength += psecuritypriv->wps_ie_len; @@ -1738,7 +1737,7 @@ static void update_ht_cap(struct _adapter *padapter, u8 *pie, uint ie_len) if (!phtpriv->ht_option) return; /* maybe needs check if ap supports rx ampdu. */ - if ((phtpriv->ampdu_enable == false) && + if (!phtpriv->ampdu_enable && (pregistrypriv->ampdu_enable == 1)) phtpriv->ampdu_enable = true; /*check Max Rx A-MPDU Size*/ @@ -1788,8 +1787,8 @@ void r8712_issue_addbareq_cmd(struct _adapter *padapter, int priority) struct mlme_priv *pmlmepriv = &padapter->mlmepriv; struct ht_priv *phtpriv = &pmlmepriv->htpriv; - if ((phtpriv->ht_option == 1) && (phtpriv->ampdu_enable == true)) { - if (phtpriv->baddbareq_issued[priority] == false) { + if ((phtpriv->ht_option == 1) && (phtpriv->ampdu_enable)) { + if (!phtpriv->baddbareq_issued[priority]) { r8712_addbareq_cmd(padapter, (u8)priority); phtpriv->baddbareq_issued[priority] = true; } diff --git a/drivers/staging/rtl8712/rtl871x_mlme.h b/drivers/staging/rtl8712/rtl871x_mlme.h index 08d6c986c11e..61e0eb745d21 100644 --- a/drivers/staging/rtl8712/rtl871x_mlme.h +++ b/drivers/staging/rtl8712/rtl871x_mlme.h @@ -153,7 +153,7 @@ static inline void clr_fwstate(struct mlme_priv *pmlmepriv, sint state) unsigned long irqL; spin_lock_irqsave(&pmlmepriv->lock, irqL); - if (check_fwstate(pmlmepriv, state) == true) + if (check_fwstate(pmlmepriv, state)) pmlmepriv->fw_state ^= state; spin_unlock_irqrestore(&pmlmepriv->lock, irqL); } diff --git a/drivers/staging/rtl8712/rtl871x_mp_ioctl.c b/drivers/staging/rtl8712/rtl871x_mp_ioctl.c index 77f01bf1ca3c..7b00c350d147 100644 --- a/drivers/staging/rtl8712/rtl871x_mp_ioctl.c +++ b/drivers/staging/rtl8712/rtl871x_mp_ioctl.c @@ -181,7 +181,7 @@ static int mp_start_test(struct _adapter *padapter) } else bssid.Length = length; spin_lock_irqsave(&pmlmepriv->lock, irqL); - if (check_fwstate(pmlmepriv, WIFI_MP_STATE) == true) + if (check_fwstate(pmlmepriv, WIFI_MP_STATE)) goto end_of_mp_start_test; /*init mp_start_test status*/ pmppriv->prev_fw_state = get_fwstate(pmlmepriv); @@ -223,7 +223,7 @@ static int mp_stop_test(struct _adapter *padapter) unsigned long irqL; spin_lock_irqsave(&pmlmepriv->lock, irqL); - if (check_fwstate(pmlmepriv, WIFI_MP_STATE) == false) + if (!check_fwstate(pmlmepriv, WIFI_MP_STATE)) goto end_of_mp_stop_test; /* 3 1. disconnect psudo AdHoc */ r8712_os_indicate_disconnect(padapter); @@ -247,9 +247,9 @@ int mp_start_joinbss(struct _adapter *padapter, struct ndis_802_11_ssid *pssid) struct mlme_priv *pmlmepriv = &padapter->mlmepriv; unsigned char res = _SUCCESS; - if (check_fwstate(pmlmepriv, WIFI_MP_STATE) == false) + if (!check_fwstate(pmlmepriv, WIFI_MP_STATE)) return _FAIL; - if (check_fwstate(pmlmepriv, _FW_LINKED) == false) + if (!check_fwstate(pmlmepriv, _FW_LINKED)) return _FAIL; _clr_fwstate_(pmlmepriv, _FW_LINKED); res = r8712_setassocsta_cmd(padapter, pmppriv->network_macaddr); @@ -684,7 +684,7 @@ uint oid_rt_get_thermal_meter_hdl(struct oid_par_priv *poid_par_priv) if (poid_par_priv->type_of_oid != QUERY_OID) return RNDIS_STATUS_NOT_ACCEPTED; - if (Adapter->mppriv.act_in_progress == true) + if (Adapter->mppriv.act_in_progress) return RNDIS_STATUS_NOT_ACCEPTED; if (poid_par_priv->information_buf_len < sizeof(u8)) @@ -728,7 +728,7 @@ uint oid_rt_pro_read_efuse_hdl(struct oid_par_priv *poid_par_priv) if ((addr > 511) || (cnts < 1) || (cnts > 512) || (addr + cnts) > EFUSE_MAX_SIZE) return RNDIS_STATUS_NOT_ACCEPTED; - if (r8712_efuse_access(Adapter, true, addr, cnts, data) == false) + if (!r8712_efuse_access(Adapter, true, addr, cnts, data)) status = RNDIS_STATUS_FAILURE; *poid_par_priv->bytes_rw = poid_par_priv->information_buf_len; return status; @@ -756,7 +756,7 @@ uint oid_rt_pro_write_efuse_hdl(struct oid_par_priv *poid_par_priv) if ((addr > 511) || (cnts < 1) || (cnts > 512) || (addr + cnts) > r8712_efuse_get_max_size(Adapter)) return RNDIS_STATUS_NOT_ACCEPTED; - if (r8712_efuse_access(Adapter, false, addr, cnts, data) == false) + if (!r8712_efuse_access(Adapter, false, addr, cnts, data)) status = RNDIS_STATUS_FAILURE; return status; } @@ -824,7 +824,7 @@ uint oid_rt_pro_efuse_map_hdl(struct oid_par_priv *poid_par_priv) status = RNDIS_STATUS_FAILURE; } else { /* SET_OID */ - if (r8712_efuse_reg_init(Adapter) == true) { + if (r8712_efuse_reg_init(Adapter)) { if (r8712_efuse_map_write(Adapter, 0, EFUSE_MAP_MAX_SIZE, data)) *poid_par_priv->bytes_rw = EFUSE_MAP_MAX_SIZE; diff --git a/drivers/staging/rtl8712/rtl871x_pwrctrl.c b/drivers/staging/rtl8712/rtl871x_pwrctrl.c index 9bc04f474d18..bf10d6db50e8 100644 --- a/drivers/staging/rtl8712/rtl871x_pwrctrl.c +++ b/drivers/staging/rtl8712/rtl871x_pwrctrl.c @@ -44,8 +44,7 @@ void r8712_set_rpwm(struct _adapter *padapter, u8 val8) if (pwrpriv->rpwm_retry == 0) return; } - if ((padapter->bDriverStopped == true) || - (padapter->bSurpriseRemoved == true)) + if (padapter->bDriverStopped || padapter->bSurpriseRemoved) return; rpwm = val8 | pwrpriv->tog; switch (val8) { @@ -129,8 +128,7 @@ static void _rpwm_check_handler (struct _adapter *padapter) { struct pwrctrl_priv *pwrpriv = &padapter->pwrctrlpriv; - if (padapter->bDriverStopped == true || - padapter->bSurpriseRemoved == true) + if (padapter->bDriverStopped || padapter->bSurpriseRemoved) return; if (pwrpriv->cpwm != pwrpriv->rpwm) schedule_work(&pwrpriv->rpwm_workitem); diff --git a/drivers/staging/rtl8712/rtl871x_recv.c b/drivers/staging/rtl8712/rtl871x_recv.c index 046a46c4cd7f..8a544364b86b 100644 --- a/drivers/staging/rtl8712/rtl871x_recv.c +++ b/drivers/staging/rtl8712/rtl871x_recv.c @@ -147,7 +147,7 @@ void r8712_free_recvframe_queue(struct __queue *pframequeue, spin_lock(&pframequeue->lock); phead = &pframequeue->queue; plist = phead->next; - while (end_of_queue_search(phead, plist) == false) { + while (!end_of_queue_search(phead, plist)) { precvframe = LIST_CONTAINOR(plist, union recv_frame, u); plist = plist->next; r8712_free_recvframe(precvframe, pfree_recv_queue); @@ -178,7 +178,7 @@ sint r8712_recvframe_chkmic(struct _adapter *adapter, idx = iv[3]; mickey = &psecuritypriv->XGrprxmickey[(((idx >> 6) & 0x3)) - 1].skey[0]; - if (psecuritypriv->binstallGrpkey == false) + if (!psecuritypriv->binstallGrpkey) return _FAIL; } else mickey = &stainfo->tkiprxmickey.skey[0]; @@ -197,16 +197,15 @@ sint r8712_recvframe_chkmic(struct _adapter *adapter, if (miccode[i] != *(pframemic + i)) bmic_err = true; } - if (bmic_err == true) { - if (prxattrib->bdecrypted == true) + if (bmic_err) { + if (prxattrib->bdecrypted) r8712_handle_tkip_mic_err(adapter, (u8)IS_MCAST(prxattrib->ra)); res = _FAIL; } else { /* mic checked ok */ - if ((psecuritypriv->bcheck_grpkey == - false) && (IS_MCAST(prxattrib->ra) == - true)) + if (!psecuritypriv->bcheck_grpkey && + IS_MCAST(prxattrib->ra)) psecuritypriv->bcheck_grpkey = true; } recvframe_pull_tail(precvframe, 8); @@ -224,7 +223,7 @@ union recv_frame *r8712_decryptor(struct _adapter *padapter, union recv_frame *return_packet = precv_frame; if ((prxattrib->encrypt > 0) && ((prxattrib->bdecrypted == 0) || - (psecuritypriv->sw_decrypt == true))) { + psecuritypriv->sw_decrypt)) { psecuritypriv->hw_decrypted = false; switch (prxattrib->encrypt) { case _WEP40_: @@ -324,8 +323,8 @@ static sint sta2sta_data_frame(struct _adapter *adapter, u8 *sta_addr = NULL; sint bmcast = IS_MCAST(pattrib->dst); - if ((check_fwstate(pmlmepriv, WIFI_ADHOC_STATE) == true) || - (check_fwstate(pmlmepriv, WIFI_ADHOC_MASTER_STATE) == true)) { + if (check_fwstate(pmlmepriv, WIFI_ADHOC_STATE) || + check_fwstate(pmlmepriv, WIFI_ADHOC_MASTER_STATE)) { /* filter packets that SA is myself or multicast or broadcast */ if (!memcmp(myhwaddr, pattrib->src, ETH_ALEN)) return _FAIL; @@ -336,13 +335,13 @@ static sint sta2sta_data_frame(struct _adapter *adapter, (memcmp(pattrib->bssid, mybssid, ETH_ALEN))) return _FAIL; sta_addr = pattrib->src; - } else if (check_fwstate(pmlmepriv, WIFI_STATION_STATE) == true) { + } else if (check_fwstate(pmlmepriv, WIFI_STATION_STATE)) { /* For Station mode, sa and bssid should always be BSSID, * and DA is my mac-address */ if (memcmp(pattrib->bssid, pattrib->src, ETH_ALEN)) return _FAIL; sta_addr = pattrib->bssid; - } else if (check_fwstate(pmlmepriv, WIFI_AP_STATE) == true) { + } else if (check_fwstate(pmlmepriv, WIFI_AP_STATE)) { if (bmcast) { /* For AP mode, if DA == MCAST, then BSSID should * be also MCAST */ @@ -355,7 +354,7 @@ static sint sta2sta_data_frame(struct _adapter *adapter, return _FAIL; sta_addr = pattrib->src; } - } else if (check_fwstate(pmlmepriv, WIFI_MP_STATE) == true) { + } else if (check_fwstate(pmlmepriv, WIFI_MP_STATE)) { memcpy(pattrib->dst, GetAddr1Ptr(ptr), ETH_ALEN); memcpy(pattrib->src, GetAddr2Ptr(ptr), ETH_ALEN); memcpy(pattrib->bssid, GetAddr3Ptr(ptr), ETH_ALEN); @@ -369,7 +368,7 @@ static sint sta2sta_data_frame(struct _adapter *adapter, else *psta = r8712_get_stainfo(pstapriv, sta_addr); /* get ap_info */ if (*psta == NULL) { - if (check_fwstate(pmlmepriv, WIFI_MP_STATE) == true) + if (check_fwstate(pmlmepriv, WIFI_MP_STATE)) adapter->mppriv.rx_pktloss++; return _FAIL; } @@ -388,8 +387,8 @@ static sint ap2sta_data_frame(struct _adapter *adapter, u8 *myhwaddr = myid(&adapter->eeprompriv); sint bmcast = IS_MCAST(pattrib->dst); - if ((check_fwstate(pmlmepriv, WIFI_STATION_STATE) == true) - && (check_fwstate(pmlmepriv, _FW_LINKED) == true)) { + if (check_fwstate(pmlmepriv, WIFI_STATION_STATE) && + check_fwstate(pmlmepriv, _FW_LINKED)) { /* if NULL-frame, drop packet */ if ((GetFrameSubType(ptr)) == WIFI_DATA_NULL) return _FAIL; @@ -419,8 +418,8 @@ static sint ap2sta_data_frame(struct _adapter *adapter, *psta = r8712_get_stainfo(pstapriv, pattrib->bssid); if (*psta == NULL) return _FAIL; - } else if ((check_fwstate(pmlmepriv, WIFI_MP_STATE) == true) && - (check_fwstate(pmlmepriv, _FW_LINKED) == true)) { + } else if (check_fwstate(pmlmepriv, WIFI_MP_STATE) && + check_fwstate(pmlmepriv, _FW_LINKED)) { memcpy(pattrib->dst, GetAddr1Ptr(ptr), ETH_ALEN); memcpy(pattrib->src, GetAddr2Ptr(ptr), ETH_ALEN); memcpy(pattrib->bssid, GetAddr3Ptr(ptr), ETH_ALEN); @@ -444,7 +443,7 @@ static sint sta2ap_data_frame(struct _adapter *adapter, struct mlme_priv *pmlmepriv = &adapter->mlmepriv; unsigned char *mybssid = get_bssid(pmlmepriv); - if (check_fwstate(pmlmepriv, WIFI_AP_STATE) == true) { + if (check_fwstate(pmlmepriv, WIFI_AP_STATE)) { /* For AP mode, if DA is non-MCAST, then it must be BSSID, * and bssid == BSSID * For AP mode, RA=BSSID, TX=STA(SRC_ADDR), A3=DST_ADDR */ @@ -630,7 +629,7 @@ sint r8712_wlanhdr_to_ethhdr(union recv_frame *precvframe) rmv_len = pattrib->hdrlen + pattrib->iv_len + (bsnaphdr ? SNAP_SIZE : 0); len = precvframe->u.hdr.len - rmv_len; - if (check_fwstate(pmlmepriv, WIFI_MP_STATE) == true) { + if (check_fwstate(pmlmepriv, WIFI_MP_STATE)) { ptr += rmv_len; *ptr = 0x87; *(ptr+1) = 0x12; diff --git a/drivers/staging/rtl8712/rtl871x_security.c b/drivers/staging/rtl8712/rtl871x_security.c index 862792826dc5..48b05578e80e 100644 --- a/drivers/staging/rtl8712/rtl871x_security.c +++ b/drivers/staging/rtl8712/rtl871x_security.c @@ -675,7 +675,7 @@ u32 r8712_tkip_decrypt(struct _adapter *padapter, u8 *precvframe) idx = iv[3]; prwskey = &psecuritypriv->XGrpKey[ ((idx >> 6) & 0x3) - 1].skey[0]; - if (psecuritypriv->binstallGrpkey == false) + if (!psecuritypriv->binstallGrpkey) return _FAIL; } else prwskey = &stainfo->x_UncstKey.skey[0]; @@ -1374,7 +1374,7 @@ u32 r8712_aes_decrypt(struct _adapter *padapter, u8 *precvframe) idx = iv[3]; prwskey = &psecuritypriv->XGrpKey[ ((idx >> 6) & 0x3) - 1].skey[0]; - if (psecuritypriv->binstallGrpkey == false) + if (!psecuritypriv->binstallGrpkey) return _FAIL; } else diff --git a/drivers/staging/rtl8712/rtl871x_sta_mgt.c b/drivers/staging/rtl8712/rtl871x_sta_mgt.c index 6ae8cdc1bfd1..400dfb612183 100644 --- a/drivers/staging/rtl8712/rtl871x_sta_mgt.c +++ b/drivers/staging/rtl8712/rtl871x_sta_mgt.c @@ -83,7 +83,7 @@ static void mfree_all_stainfo(struct sta_priv *pstapriv) spin_lock_irqsave(&pstapriv->sta_hash_lock, irqL); phead = &pstapriv->free_sta_queue.queue; plist = phead->next; - while ((end_of_queue_search(phead, plist)) == false) + while (!end_of_queue_search(phead, plist)) plist = plist->next; spin_unlock_irqrestore(&pstapriv->sta_hash_lock, irqL); @@ -222,7 +222,7 @@ void r8712_free_all_stainfo(struct _adapter *padapter) for (index = 0; index < NUM_STA; index++) { phead = &(pstapriv->sta_hash[index]); plist = phead->next; - while ((end_of_queue_search(phead, plist)) == false) { + while (!end_of_queue_search(phead, plist)) { psta = LIST_CONTAINOR(plist, struct sta_info, hash_list); plist = plist->next; @@ -247,7 +247,7 @@ struct sta_info *r8712_get_stainfo(struct sta_priv *pstapriv, u8 *hwaddr) spin_lock_irqsave(&pstapriv->sta_hash_lock, irqL); phead = &(pstapriv->sta_hash[index]); plist = phead->next; - while ((end_of_queue_search(phead, plist)) == false) { + while (!end_of_queue_search(phead, plist)) { psta = LIST_CONTAINOR(plist, struct sta_info, hash_list); if ((!memcmp(psta->hwaddr, hwaddr, ETH_ALEN))) { /* if found the matched address */ diff --git a/drivers/staging/rtl8712/rtl871x_xmit.c b/drivers/staging/rtl8712/rtl871x_xmit.c index 2e4fa88951ad..d41413991017 100644 --- a/drivers/staging/rtl8712/rtl871x_xmit.c +++ b/drivers/staging/rtl8712/rtl871x_xmit.c @@ -217,8 +217,8 @@ sint r8712_update_attrib(struct _adapter *padapter, _pkt *pkt, memcpy(pattrib->dst, ðerhdr.h_dest, ETH_ALEN); memcpy(pattrib->src, ðerhdr.h_source, ETH_ALEN); pattrib->pctrl = 0; - if ((check_fwstate(pmlmepriv, WIFI_ADHOC_STATE) == true) || - (check_fwstate(pmlmepriv, WIFI_ADHOC_MASTER_STATE) == true)) { + if (check_fwstate(pmlmepriv, WIFI_ADHOC_STATE) || + check_fwstate(pmlmepriv, WIFI_ADHOC_MASTER_STATE)) { memcpy(pattrib->ra, pattrib->dst, ETH_ALEN); memcpy(pattrib->ta, pattrib->src, ETH_ALEN); } else if (check_fwstate(pmlmepriv, WIFI_STATION_STATE)) { @@ -227,7 +227,7 @@ sint r8712_update_attrib(struct _adapter *padapter, _pkt *pkt, } else if (check_fwstate(pmlmepriv, WIFI_AP_STATE)) { memcpy(pattrib->ra, pattrib->dst, ETH_ALEN); memcpy(pattrib->ta, get_bssid(pmlmepriv), ETH_ALEN); - } else if (check_fwstate(pmlmepriv, WIFI_MP_STATE) == true) { + } else if (check_fwstate(pmlmepriv, WIFI_MP_STATE)) { /*firstly, filter packet not belongs to mp*/ if (pattrib->ether_type != 0x8712) return _FAIL; @@ -267,7 +267,7 @@ sint r8712_update_attrib(struct _adapter *padapter, _pkt *pkt, psta = r8712_get_bcmc_stainfo(padapter); pattrib->mac_id = 4; } else { - if (check_fwstate(pmlmepriv, WIFI_MP_STATE) == true) { + if (check_fwstate(pmlmepriv, WIFI_MP_STATE)) { psta = r8712_get_stainfo(pstapriv, get_bssid(pmlmepriv)); pattrib->mac_id = 5; @@ -300,10 +300,10 @@ sint r8712_update_attrib(struct _adapter *padapter, _pkt *pkt, pattrib->subtype = WIFI_DATA_TYPE; pattrib->priority = 0; } - if (psta->ieee8021x_blocked == true) { + if (psta->ieee8021x_blocked) { pattrib->encrypt = 0; if ((pattrib->ether_type != 0x888e) && - (check_fwstate(pmlmepriv, WIFI_MP_STATE) == false)) + !check_fwstate(pmlmepriv, WIFI_MP_STATE)) return _FAIL; } else GET_ENCRY_ALGO(psecuritypriv, psta, pattrib->encrypt, bmcast); @@ -330,14 +330,14 @@ sint r8712_update_attrib(struct _adapter *padapter, _pkt *pkt, } if (pattrib->encrypt && - ((padapter->securitypriv.sw_encrypt == true) || - (psecuritypriv->hw_decrypted == false))) + (padapter->securitypriv.sw_encrypt || + !psecuritypriv->hw_decrypted)) pattrib->bswenc = true; else pattrib->bswenc = false; /* if in MP_STATE, update pkt_attrib from mp_txcmd, and overwrite * some settings above.*/ - if (check_fwstate(pmlmepriv, WIFI_MP_STATE) == true) + if (check_fwstate(pmlmepriv, WIFI_MP_STATE)) pattrib->priority = (txdesc.txdw1 >> QSEL_SHT) & 0x1f; return _SUCCESS; } @@ -483,28 +483,28 @@ static sint make_wlanhdr(struct _adapter *padapter, u8 *hdr, memset(hdr, 0, WLANHDR_OFFSET); SetFrameSubType(fctrl, pattrib->subtype); if (pattrib->subtype & WIFI_DATA_TYPE) { - if (check_fwstate(pmlmepriv, WIFI_STATION_STATE) == true) { + if (check_fwstate(pmlmepriv, WIFI_STATION_STATE)) { /* to_ds = 1, fr_ds = 0; */ SetToDs(fctrl); memcpy(pwlanhdr->addr1, get_bssid(pmlmepriv), ETH_ALEN); memcpy(pwlanhdr->addr2, pattrib->src, ETH_ALEN); memcpy(pwlanhdr->addr3, pattrib->dst, ETH_ALEN); - } else if (check_fwstate(pmlmepriv, WIFI_AP_STATE) == true) { + } else if (check_fwstate(pmlmepriv, WIFI_AP_STATE)) { /* to_ds = 0, fr_ds = 1; */ SetFrDs(fctrl); memcpy(pwlanhdr->addr1, pattrib->dst, ETH_ALEN); memcpy(pwlanhdr->addr2, get_bssid(pmlmepriv), ETH_ALEN); memcpy(pwlanhdr->addr3, pattrib->src, ETH_ALEN); - } else if ((check_fwstate(pmlmepriv, WIFI_ADHOC_STATE) == true) - || (check_fwstate(pmlmepriv, WIFI_ADHOC_MASTER_STATE) - == true)) { + } else if (check_fwstate(pmlmepriv, WIFI_ADHOC_STATE) || + check_fwstate(pmlmepriv, + WIFI_ADHOC_MASTER_STATE)) { memcpy(pwlanhdr->addr1, pattrib->dst, ETH_ALEN); memcpy(pwlanhdr->addr2, pattrib->src, ETH_ALEN); memcpy(pwlanhdr->addr3, get_bssid(pmlmepriv), ETH_ALEN); - } else if (check_fwstate(pmlmepriv, WIFI_MP_STATE) == true) { + } else if (check_fwstate(pmlmepriv, WIFI_MP_STATE)) { memcpy(pwlanhdr->addr1, pattrib->dst, ETH_ALEN); memcpy(pwlanhdr->addr2, pattrib->src, ETH_ALEN); memcpy(pwlanhdr->addr3, get_bssid(pmlmepriv), @@ -609,7 +609,7 @@ sint r8712_xmitframe_coalesce(struct _adapter *padapter, _pkt *pkt, return _FAIL; _r8712_open_pktfile(pkt, &pktfile); _r8712_pktfile_read(&pktfile, NULL, (uint) pattrib->pkt_hdrlen); - if (check_fwstate(pmlmepriv, WIFI_MP_STATE) == true) { + if (check_fwstate(pmlmepriv, WIFI_MP_STATE)) { /* truncate TXDESC_SIZE bytes txcmd if at mp mode for 871x */ if (pattrib->ether_type == 0x8712) { /* take care - update_txdesc overwrite this */ @@ -680,7 +680,7 @@ sint r8712_xmitframe_coalesce(struct _adapter *padapter, _pkt *pkt, pframe += pattrib->icv_len; } frg_inx++; - if (bmcst || (r8712_endofpktfile(&pktfile) == true)) { + if (bmcst || r8712_endofpktfile(&pktfile)) { pattrib->nr_frags = frg_inx; pattrib->last_txcmdsz = pattrib->hdrlen + pattrib->iv_len + @@ -855,7 +855,7 @@ void r8712_free_xmitframe_queue(struct xmit_priv *pxmitpriv, spin_lock_irqsave(&(pframequeue->lock), irqL); phead = &pframequeue->queue; plist = phead->next; - while (end_of_queue_search(phead, plist) == false) { + while (!end_of_queue_search(phead, plist)) { pxmitframe = LIST_CONTAINOR(plist, struct xmit_frame, list); plist = plist->next; r8712_free_xmitframe(pxmitpriv, pxmitframe); @@ -923,7 +923,7 @@ sint r8712_xmit_classifier(struct _adapter *padapter, if (bmcst) psta = r8712_get_bcmc_stainfo(padapter); else { - if (check_fwstate(pmlmepriv, WIFI_MP_STATE) == true) + if (check_fwstate(pmlmepriv, WIFI_MP_STATE)) psta = r8712_get_stainfo(pstapriv, get_bssid(pmlmepriv)); else diff --git a/drivers/staging/rtl8712/usb_intf.c b/drivers/staging/rtl8712/usb_intf.c index d1ff7c9d66ba..91d33e77b434 100644 --- a/drivers/staging/rtl8712/usb_intf.c +++ b/drivers/staging/rtl8712/usb_intf.c @@ -302,7 +302,7 @@ void rtl871x_intf_stop(struct _adapter *padapter) void r871x_dev_unload(struct _adapter *padapter) { - if (padapter->bup == true) { + if (padapter->bup) { /*s1.*/ padapter->bDriverStopped = true; @@ -611,7 +611,7 @@ static void r871xu_dev_remove(struct usb_interface *pusb_intf) release_firmware(padapter->fw); /* never exit with a firmware callback pending */ wait_for_completion(&padapter->rtl8712_fw_ready); - if (drvpriv.drv_registered == true) + if (drvpriv.drv_registered) padapter->bSurpriseRemoved = true; unregister_netdev(pnetdev); /* will call netdev_close() */ flush_scheduled_work(); diff --git a/drivers/staging/rtl8712/usb_ops_linux.c b/drivers/staging/rtl8712/usb_ops_linux.c index c940722fbfd3..e33eeedfdddf 100644 --- a/drivers/staging/rtl8712/usb_ops_linux.c +++ b/drivers/staging/rtl8712/usb_ops_linux.c @@ -266,7 +266,7 @@ u32 r8712_usb_read_port(struct intf_hdl *pintfhdl, u32 addr, u32 cnt, u8 *rmem) if (adapter->bDriverStopped || adapter->bSurpriseRemoved || adapter->pwrctrlpriv.pnp_bstop_trx) return _FAIL; - if (!precvbuf->reuse == false || !precvbuf->pskb) { + if (precvbuf->reuse || !precvbuf->pskb) { precvbuf->pskb = skb_dequeue(&precvpriv->free_recv_skb_queue); if (precvbuf->pskb != NULL) precvbuf->reuse = true; @@ -330,13 +330,13 @@ void r8712_xmit_bh(void *priv) struct _adapter *padapter = (struct _adapter *)priv; struct xmit_priv *pxmitpriv = &padapter->xmitpriv; - if ((padapter->bDriverStopped == true) || - (padapter->bSurpriseRemoved == true)) { + if (padapter->bDriverStopped || + padapter->bSurpriseRemoved) { netdev_err(padapter->pnetdev, "xmit_bh => bDriverStopped or bSurpriseRemoved\n"); return; } ret = r8712_xmitframe_complete(padapter, pxmitpriv, NULL); - if (ret == false) + if (!ret) return; tasklet_hi_schedule(&pxmitpriv->xmit_tasklet); } @@ -410,7 +410,7 @@ u32 r8712_usb_write_port(struct intf_hdl *pintfhdl, u32 addr, u32 cnt, u8 *wmem) (padapter->pwrctrlpriv.pnp_bstop_trx)) return _FAIL; for (i = 0; i < 8; i++) { - if (pxmitframe->bpending[i] == false) { + if (!pxmitframe->bpending[i]) { spin_lock_irqsave(&pxmitpriv->lock, irqL); pxmitpriv->txirp_cnt++; pxmitframe->bpending[i] = true; diff --git a/drivers/staging/rtl8712/xmit_linux.c b/drivers/staging/rtl8712/xmit_linux.c index d15fb1ad45b9..d3981836ce26 100644 --- a/drivers/staging/rtl8712/xmit_linux.c +++ b/drivers/staging/rtl8712/xmit_linux.c @@ -166,7 +166,7 @@ int r8712_xmit_entry(_pkt *pkt, struct net_device *pnetdev) struct xmit_priv *pxmitpriv = &(padapter->xmitpriv); int ret = 0; - if (r8712_if_up(padapter) == false) { + if (!r8712_if_up(padapter)) { ret = 0; goto _xmit_entry_drop; } @@ -181,7 +181,7 @@ int r8712_xmit_entry(_pkt *pkt, struct net_device *pnetdev) } padapter->ledpriv.LedControlHandler(padapter, LED_CTL_TX); pxmitframe->pkt = pkt; - if (r8712_pre_xmit(padapter, pxmitframe) == true) { + if (r8712_pre_xmit(padapter, pxmitframe)) { /*dump xmitframe directly or drop xframe*/ dev_kfree_skb_any(pkt); pxmitframe->pkt = NULL; -- 2.20.1