[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20151019113910.GA12394@zed.strato>
Date: Mon, 19 Oct 2015 14:39:10 +0300
From: Mike Rapoport <mike.rapoport@...il.com>
To: Luis de Bethencourt <luisbg@....samsung.com>
Cc: linux-kernel@...r.kernel.org, devel@...verdev.osuosl.org,
florian.c.schilhabel@...glemail.com, punitvara@...il.com,
carlos@...rcia.org, vthakkar1994@...il.com,
gregkh@...uxfoundation.org, jteki@...nedev.com,
Julia.Lawall@...6.fr, shivanib134@...il.com, luca@...aceresoli.net,
sudipm.mukherjee@...il.com, Larry.Finger@...inger.net
Subject: Re: [PATCH] staging: rtl8712: Remove boolean comparisons
On Sun, Oct 18, 2015 at 08:35:04PM +0100, Luis de Bethencourt wrote:
> Boolean tests do not need explicit comparison to true or false.
>
> Signed-off-by: Luis de Bethencourt <luisbg@....samsung.com>
> ---
> drivers/staging/rtl8712/os_intfs.c | 4 +-
> drivers/staging/rtl8712/rtl8712_cmd.c | 9 +-
> drivers/staging/rtl8712/rtl8712_efuse.c | 49 ++++----
> 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 | 41 +++----
> 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, 292 insertions(+), 302 deletions(-)
[ snip ]
> diff --git a/drivers/staging/rtl8712/rtl8712_efuse.c b/drivers/staging/rtl8712/rtl8712_efuse.c
> index d957169..83d418d 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
> */
[ snip ]
> @@ -466,7 +466,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 ==
> + if (efuse_is_empty(padapter, &offset) && (offset ==
> true)) {
offset == true can be replaced as well
> for (i = 0; i < cnts; i++)
> data[i] = 0xFF;
> @@ -504,13 +504,14 @@ 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
> + } else {
> return false;
> + }
Adding braces here is not related to patch subject
> 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 +555,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;
[ snip ]
> diff --git a/drivers/staging/rtl8712/rtl871x_xmit.c b/drivers/staging/rtl8712/rtl871x_xmit.c
> index 2e4fa88..70003d4 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,13 +300,14 @@ 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
> + } else {
> GET_ENCRY_ALGO(psecuritypriv, psta, pattrib->encrypt, bmcast);
> + }
Adding braces here is not related to patch subject
> switch (pattrib->encrypt) {
> case _WEP40_:
> case _WEP104_:
> @@ -330,14 +331,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;
> }
--
Sincerely yours,
Mike.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists