diff options
author | Bhumika Goyal <bhumirks@gmail.com> | 2016-02-26 13:04:30 +0300 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2016-03-12 09:09:09 +0300 |
commit | 4b25ce977e43f55f88df30a4d338b63bb597fdef (patch) | |
tree | 48b25a45f5d96f0f6c4fd37c85a6665ef5ac1de4 /drivers/staging/rtl8723au | |
parent | 37491cd6fcf6474262fbff9c10208a8105573abf (diff) | |
download | linux-4b25ce977e43f55f88df30a4d338b63bb597fdef.tar.xz |
Staging: rtl8723au: Use min macro instead of ternary operator
This patch replaces ternary operator with macro min as it shorter and
thus increases code readability. Macro min return the minimum of the
two compared values.
Made a semantic patch for changes:
@@
type T;
T x;
T y;
@@
(
- x < y ? x : y
+ min(x,y)
|
- x > y ? x : y
+ max(x,y)
)
Signed-off-by: Bhumika Goyal <bhumirks@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/staging/rtl8723au')
-rw-r--r-- | drivers/staging/rtl8723au/os_dep/ioctl_cfg80211.c | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/drivers/staging/rtl8723au/os_dep/ioctl_cfg80211.c b/drivers/staging/rtl8723au/os_dep/ioctl_cfg80211.c index 8850898dc53d..e64b7e14341e 100644 --- a/drivers/staging/rtl8723au/os_dep/ioctl_cfg80211.c +++ b/drivers/staging/rtl8723au/os_dep/ioctl_cfg80211.c @@ -543,7 +543,7 @@ static int rtw_cfg80211_ap_set_encryption(struct net_device *dev, u8 key_index, memcpy(psecuritypriv-> dot118021XGrpKey[key_index].skey, keyparms->key, - (key_len > 16 ? 16 : key_len)); + (min(16, key_len))); /* set mic key */ memcpy(psecuritypriv-> @@ -565,7 +565,7 @@ static int rtw_cfg80211_ap_set_encryption(struct net_device *dev, u8 key_index, memcpy(psecuritypriv-> dot118021XGrpKey[key_index].skey, keyparms->key, - (key_len > 16 ? 16 : key_len)); + (min(16, key_len))); } else { DBG_8723A("%s, set group_key, none\n", __func__); @@ -603,7 +603,7 @@ static int rtw_cfg80211_ap_set_encryption(struct net_device *dev, u8 key_index, if (set_tx == 1) { /* pairwise key */ memcpy(psta->dot118021x_UncstKey.skey, - keyparms->key, (key_len > 16 ? 16 : key_len)); + keyparms->key, (min(16, key_len))); if (keyparms->cipher == WLAN_CIPHER_SUITE_WEP40 || keyparms->cipher == WLAN_CIPHER_SUITE_WEP104) { @@ -661,7 +661,7 @@ static int rtw_cfg80211_ap_set_encryption(struct net_device *dev, u8 key_index, memcpy(psecuritypriv-> dot118021XGrpKey[key_index].skey, keyparms->key, - (key_len > 16 ? 16 : key_len)); + (min(16, key_len))); /* set mic key */ memcpy(psecuritypriv-> @@ -679,7 +679,7 @@ static int rtw_cfg80211_ap_set_encryption(struct net_device *dev, u8 key_index, memcpy(psecuritypriv-> dot118021XGrpKey[key_index].skey, keyparms->key, - (key_len > 16 ? 16 : key_len)); + (min(16, key_len))); } else { psecuritypriv->dot118021XGrpPrivacy = 0; } @@ -789,7 +789,7 @@ static int rtw_cfg80211_set_encryption(struct net_device *dev, u8 key_index, memcpy(psta->dot118021x_UncstKey.skey, keyparms->key, - (key_len > 16 ? 16 : key_len)); + (min(16, key_len))); if (keyparms->cipher == WLAN_CIPHER_SUITE_TKIP) { @@ -812,7 +812,7 @@ static int rtw_cfg80211_set_encryption(struct net_device *dev, u8 key_index, memcpy(padapter->securitypriv. dot118021XGrpKey[key_index].skey, keyparms->key, - (key_len > 16 ? 16 : key_len)); + (min(16, key_len))); memcpy(padapter->securitypriv. dot118021XGrptxmickey[key_index]. skey, &keyparms->key[16], 8); |