staging: rtl8188eu: ternary operator (?:) replaced by min/max kernel macro
authorIvan Safonov <insafonov@gmail.com>
Tue, 27 Oct 2015 15:16:25 +0000 (22:16 +0700)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 29 Oct 2015 00:09:08 +0000 (09:09 +0900)
min (or max) kernel macro better conveys the meaning of the code.

Signed-off-by: Ivan Safonov <insafonov@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/staging/rtl8188eu/hal/odm_RTL8188E.c
drivers/staging/rtl8188eu/os_dep/ioctl_linux.c
drivers/staging/rtl8188eu/os_dep/xmit_linux.c

index 0be6c051e804e7f6bf4b734596895bfaf37325a9..c0242a095c1910c04908bc4700bf885bfd1ae7fa 100644 (file)
@@ -292,8 +292,7 @@ static void rtl88eu_dm_hw_ant_div(struct odm_dm_struct *dm_odm)
                                    (dm_fat_tbl->AuxAnt_Sum[i]/dm_fat_tbl->AuxAnt_Cnt[i]) : 0;
                        target_ant = (main_rssi >= aux_rssi) ? MAIN_ANT : AUX_ANT;
                        /* 2 Select max_rssi for DIG */
-                       local_max_rssi = (main_rssi > aux_rssi) ?
-                                         main_rssi : aux_rssi;
+                       local_max_rssi = max(main_rssi, aux_rssi);
                        if ((local_max_rssi > ant_div_max_rssi) &&
                            (local_max_rssi < 40))
                                ant_div_max_rssi = local_max_rssi;
@@ -308,8 +307,7 @@ static void rtl88eu_dm_hw_ant_div(struct odm_dm_struct *dm_odm)
                                 (aux_rssi == 0))
                                aux_rssi = main_rssi;
 
-                       local_min_rssi = (main_rssi > aux_rssi) ?
-                                         aux_rssi : main_rssi;
+                       local_min_rssi = min(main_rssi, aux_rssi);
                        if (local_min_rssi < min_rssi) {
                                min_rssi = local_min_rssi;
                                RxIdleAnt = target_ant;
index bda423e72fa8d2409001eeca04450353e0d7eb50..fd01ca4b0c0f699258f4727c5abf76683bc90577 100644 (file)
@@ -604,7 +604,7 @@ static int rtw_set_wpa_ie(struct adapter *padapter, char *pie, unsigned short ie
                                if ((eid == _VENDOR_SPECIFIC_IE_) && (!memcmp(&buf[cnt+2], wps_oui, 4))) {
                                        DBG_88E("SET WPS_IE\n");
 
-                                       padapter->securitypriv.wps_ie_len = ((buf[cnt+1]+2) < (MAX_WPA_IE_LEN<<2)) ? (buf[cnt+1]+2) : (MAX_WPA_IE_LEN<<2);
+                                       padapter->securitypriv.wps_ie_len = min(buf[cnt + 1] + 2, MAX_WPA_IE_LEN << 2);
 
                                        memcpy(padapter->securitypriv.wps_ie, &buf[cnt], padapter->securitypriv.wps_ie_len);
 
@@ -2974,7 +2974,7 @@ static int rtw_wx_set_priv(struct net_device *dev,
 
                if ((_VENDOR_SPECIFIC_IE_ == probereq_wpsie[0]) &&
                    (!memcmp(&probereq_wpsie[2], wps_oui, 4))) {
-                       cp_sz = probereq_wpsie_len > MAX_WPS_IE_LEN ? MAX_WPS_IE_LEN : probereq_wpsie_len;
+                       cp_sz = min(probereq_wpsie_len, MAX_WPS_IE_LEN);
 
                        pmlmepriv->wps_probe_req_ie_len = 0;
                        kfree(pmlmepriv->wps_probe_req_ie);
index 5acf9a9dddeb40d9ea69c18599e591b9429e8195..1593e280e06038a1e3776810f2689857f6844267 100644 (file)
@@ -52,7 +52,7 @@ uint _rtw_pktfile_read(struct pkt_file *pfile, u8 *rmem, uint rlen)
 
 
        len =  rtw_remainder_len(pfile);
-       len = (rlen > len) ? len : rlen;
+       len = min(rlen, len);
 
        if (rmem)
                skb_copy_bits(pfile->pkt, pfile->buf_len-pfile->pkt_len, rmem, len);