All of lore.kernel.org
 help / color / mirror / Atom feed
* [Outreachy kernel] [PATCH v2 0/7] staging: rtlwifi: Compress two lines
@ 2019-03-31 14:41 Payal Kshirsagar
  2019-03-31 14:41 ` [Outreachy kernel] [PATCH v2 1/7] staging: rtlwifi: Compress two lines into one line Payal Kshirsagar
                   ` (6 more replies)
  0 siblings, 7 replies; 9+ messages in thread
From: Payal Kshirsagar @ 2019-03-31 14:41 UTC (permalink / raw)
  To: outreachy-kernel; +Cc: Payal Kshirsagar

This patchset:
        -Compresses two lines into one line that is to return a value sometimes it need not be stored in temporary return variable and removes unnecessary variables.

Changes in v2:
	-Subject line for patch number 6 and 7 made different.

Payal Kshirsagar (7):
  staging: rtlwifi: Compress two lines into one line
  staging: rtlwifi: phydm: phydm.c: Compress two lines into one line
  staging: rtlwifi: phydm: phydm_rainfo.c: Compress two lines into one
    line
  staging: rtlwifi: btcoexist: Compress two lines into one line
  staging: rtlwifi: halmac: halmac_88xx: Compress two lines into one
    line
  staging: rtlwifi: halmac: Compress two lines into one line
  staging: rtlwifi: halmac: halmac_api.c: Compress two lines into one
    line

 drivers/staging/rtlwifi/btcoexist/halbtcoutsrc.c         |  5 +----
 .../rtlwifi/halmac/halmac_88xx/halmac_api_88xx_sdio.c    |  5 +----
 .../rtlwifi/halmac/halmac_88xx/halmac_api_88xx_usb.c     |  5 +----
 drivers/staging/rtlwifi/halmac/halmac_api.c              |  7 ++-----
 drivers/staging/rtlwifi/phydm/phydm.c                    | 16 ++++------------
 drivers/staging/rtlwifi/phydm/phydm_rainfo.c             |  5 +----
 drivers/staging/rtlwifi/rtl8822be/phy.c                  | 12 ++++--------
 7 files changed, 14 insertions(+), 41 deletions(-)

-- 
2.7.4



^ permalink raw reply	[flat|nested] 9+ messages in thread

* [Outreachy kernel] [PATCH v2 1/7] staging: rtlwifi: Compress two lines into one line
  2019-03-31 14:41 [Outreachy kernel] [PATCH v2 0/7] staging: rtlwifi: Compress two lines Payal Kshirsagar
@ 2019-03-31 14:41 ` Payal Kshirsagar
  2019-04-01 17:22   ` Greg KH
  2019-03-31 14:41 ` [Outreachy kernel] [PATCH v2 2/7] staging: rtlwifi: phydm: phydm.c: " Payal Kshirsagar
                   ` (5 subsequent siblings)
  6 siblings, 1 reply; 9+ messages in thread
From: Payal Kshirsagar @ 2019-03-31 14:41 UTC (permalink / raw)
  To: outreachy-kernel; +Cc: Payal Kshirsagar

Challenge suggested by coccinelle.
Compresses two lines into one line and remove unnecessary variable.

Signed-off-by: Payal Kshirsagar <payal.s.kshirsagar.98@gmail.com>
---
 drivers/staging/rtlwifi/rtl8822be/phy.c | 12 ++++--------
 1 file changed, 4 insertions(+), 8 deletions(-)

diff --git a/drivers/staging/rtlwifi/rtl8822be/phy.c b/drivers/staging/rtlwifi/rtl8822be/phy.c
index 048904d..4f69776 100644
--- a/drivers/staging/rtlwifi/rtl8822be/phy.c
+++ b/drivers/staging/rtlwifi/rtl8822be/phy.c
@@ -1566,13 +1566,12 @@ _rtl8822be_phy_get_txpower_by_rate(struct ieee80211_hw *hw, u8 band, u8 path,
 	struct rtl_priv *rtlpriv = rtl_priv(hw);
 	struct rtl_phy *rtlphy = &rtlpriv->phy;
 	u8 tx_num;
-	char tx_pwr_diff = 0;
 
 	if (band != BAND_ON_2_4G && band != BAND_ON_5G)
-		return tx_pwr_diff;
+		return 0;
 
 	if (path > RF90_PATH_B)
-		return tx_pwr_diff;
+		return 0;
 
 	if ((rate >= DESC_RATEMCS8 && rate <= DESC_RATEMCS15) ||
 	    (rate >= DESC_RATEVHT2SS_MCS0 && rate <= DESC_RATEVHT2SS_MCS9))
@@ -1580,11 +1579,8 @@ _rtl8822be_phy_get_txpower_by_rate(struct ieee80211_hw *hw, u8 band, u8 path,
 	else
 		tx_num = RF_1TX;
 
-	tx_pwr_diff = (char)(rtlphy->tx_power_by_rate_offset[band][path][tx_num]
-							    [rate] &
-			     0xff);
-
-	return tx_pwr_diff;
+	return (char)(rtlphy->tx_power_by_rate_offset[band][path][tx_num]
+						     [rate] & 0xff);
 }
 
 u8 rtl8822be_get_txpower_index(struct ieee80211_hw *hw, u8 path, u8 rate,
-- 
2.7.4



^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [Outreachy kernel] [PATCH v2 2/7] staging: rtlwifi: phydm: phydm.c: Compress two lines into one line
  2019-03-31 14:41 [Outreachy kernel] [PATCH v2 0/7] staging: rtlwifi: Compress two lines Payal Kshirsagar
  2019-03-31 14:41 ` [Outreachy kernel] [PATCH v2 1/7] staging: rtlwifi: Compress two lines into one line Payal Kshirsagar
@ 2019-03-31 14:41 ` Payal Kshirsagar
  2019-03-31 14:41 ` [Outreachy kernel] [PATCH v2 3/7] staging: rtlwifi: phydm: phydm_rainfo.c: " Payal Kshirsagar
                   ` (4 subsequent siblings)
  6 siblings, 0 replies; 9+ messages in thread
From: Payal Kshirsagar @ 2019-03-31 14:41 UTC (permalink / raw)
  To: outreachy-kernel; +Cc: Payal Kshirsagar

Challenge suggested by coccinelle.
Compresses two lines into one line and remove unnecessary variables.

Signed-off-by: Payal Kshirsagar <payal.s.kshirsagar.98@gmail.com>
---
 drivers/staging/rtlwifi/phydm/phydm.c | 16 ++++------------
 1 file changed, 4 insertions(+), 12 deletions(-)

diff --git a/drivers/staging/rtlwifi/phydm/phydm.c b/drivers/staging/rtlwifi/phydm/phydm.c
index 473eeb6..09dbb96 100644
--- a/drivers/staging/rtlwifi/phydm/phydm.c
+++ b/drivers/staging/rtlwifi/phydm/phydm.c
@@ -49,7 +49,7 @@ static void odm_update_power_training_state(struct phy_dm_struct *dm);
 /*Y = 10*log(X)*/
 s32 odm_pwdb_conversion(s32 X, u32 total_bit, u32 decimal_bit)
 {
-	s32 Y, integer = 0, decimal = 0;
+	s32 integer = 0, decimal = 0;
 	u32 i;
 
 	if (X == 0)
@@ -66,9 +66,7 @@ s32 odm_pwdb_conversion(s32 X, u32 total_bit, u32 decimal_bit)
 		}
 	}
 
-	Y = 3 * (integer - decimal_bit) + decimal; /* 10*log(x)=3*log2(x), */
-
-	return Y;
+	return 3 * (integer - decimal_bit) + decimal; /* 10*log(x)=3*log2(x), */;
 }
 
 s32 odm_sign_conversion(s32 value, u32 total_bit)
@@ -1240,7 +1238,6 @@ u32 odm_convert_to_db(u32 value)
 {
 	u8 i;
 	u8 j;
-	u32 dB;
 
 	value = value & 0xFFFF;
 
@@ -1257,16 +1254,13 @@ u32 odm_convert_to_db(u32 value)
 			break;
 	}
 
-	dB = (i << 3) + j + 1;
-
-	return dB;
+	return (i << 3) + j + 1;
 }
 
 u32 odm_convert_to_linear(u32 value)
 {
 	u8 i;
 	u8 j;
-	u32 linear;
 
 	/* 1dB~96dB */
 
@@ -1275,9 +1269,7 @@ u32 odm_convert_to_linear(u32 value)
 	i = (u8)((value - 1) >> 3);
 	j = (u8)(value - 1) - (i << 3);
 
-	linear = db_invert_table[i][j];
-
-	return linear;
+	return db_invert_table[i][j];
 }
 
 /*
-- 
2.7.4



^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [Outreachy kernel] [PATCH v2 3/7] staging: rtlwifi: phydm: phydm_rainfo.c: Compress two lines into one line
  2019-03-31 14:41 [Outreachy kernel] [PATCH v2 0/7] staging: rtlwifi: Compress two lines Payal Kshirsagar
  2019-03-31 14:41 ` [Outreachy kernel] [PATCH v2 1/7] staging: rtlwifi: Compress two lines into one line Payal Kshirsagar
  2019-03-31 14:41 ` [Outreachy kernel] [PATCH v2 2/7] staging: rtlwifi: phydm: phydm.c: " Payal Kshirsagar
@ 2019-03-31 14:41 ` Payal Kshirsagar
  2019-03-31 14:41 ` [Outreachy kernel] [PATCH v2 4/7] staging: rtlwifi: btcoexist: " Payal Kshirsagar
                   ` (3 subsequent siblings)
  6 siblings, 0 replies; 9+ messages in thread
From: Payal Kshirsagar @ 2019-03-31 14:41 UTC (permalink / raw)
  To: outreachy-kernel; +Cc: Payal Kshirsagar

Challenge suggested by coccinelle.
Compresses two lines into one line and remove unnecessary variable.

Signed-off-by: Payal Kshirsagar <payal.s.kshirsagar.98@gmail.com>
---
 drivers/staging/rtlwifi/phydm/phydm_rainfo.c | 5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)

diff --git a/drivers/staging/rtlwifi/phydm/phydm_rainfo.c b/drivers/staging/rtlwifi/phydm/phydm_rainfo.c
index ed740a9..0f24bb2 100644
--- a/drivers/staging/rtlwifi/phydm/phydm_rainfo.c
+++ b/drivers/staging/rtlwifi/phydm/phydm_rainfo.c
@@ -926,8 +926,6 @@ void odm_refresh_basic_rate_mask(void *dm_void) {}
 
 u8 phydm_rate_order_compute(void *dm_void, u8 rate_idx)
 {
-	u8 rate_order = 0;
-
 	if (rate_idx >= ODM_RATEVHTSS4MCS0) {
 		rate_idx -= ODM_RATEVHTSS4MCS0;
 		/**/
@@ -950,9 +948,8 @@ u8 phydm_rate_order_compute(void *dm_void, u8 rate_idx)
 		rate_idx -= ODM_RATEMCS8;
 		/**/
 	}
-	rate_order = rate_idx;
 
-	return rate_order;
+	return rate_idx;
 }
 
 static void phydm_ra_common_info_update(void *dm_void)
-- 
2.7.4



^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [Outreachy kernel] [PATCH v2 4/7] staging: rtlwifi: btcoexist: Compress two lines into one line
  2019-03-31 14:41 [Outreachy kernel] [PATCH v2 0/7] staging: rtlwifi: Compress two lines Payal Kshirsagar
                   ` (2 preceding siblings ...)
  2019-03-31 14:41 ` [Outreachy kernel] [PATCH v2 3/7] staging: rtlwifi: phydm: phydm_rainfo.c: " Payal Kshirsagar
@ 2019-03-31 14:41 ` Payal Kshirsagar
  2019-03-31 14:41 ` [Outreachy kernel] [PATCH v2 5/7] staging: rtlwifi: halmac: halmac_88xx: " Payal Kshirsagar
                   ` (2 subsequent siblings)
  6 siblings, 0 replies; 9+ messages in thread
From: Payal Kshirsagar @ 2019-03-31 14:41 UTC (permalink / raw)
  To: outreachy-kernel; +Cc: Payal Kshirsagar

Challenge suggested by coccinelle.
Compresses two lines into one line and remove unnecessary variable.

Signed-off-by: Payal Kshirsagar <payal.s.kshirsagar.98@gmail.com>
---
 drivers/staging/rtlwifi/btcoexist/halbtcoutsrc.c | 5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)

diff --git a/drivers/staging/rtlwifi/btcoexist/halbtcoutsrc.c b/drivers/staging/rtlwifi/btcoexist/halbtcoutsrc.c
index b519d18..dbb11c2 100644
--- a/drivers/staging/rtlwifi/btcoexist/halbtcoutsrc.c
+++ b/drivers/staging/rtlwifi/btcoexist/halbtcoutsrc.c
@@ -456,7 +456,6 @@ static u32 halbtc_get_wifi_link_status(struct btc_coexist *btcoexist)
 	 */
 	struct rtl_priv *rtlpriv = btcoexist->adapter;
 	struct rtl_mac *mac = rtl_mac(rtlpriv);
-	u32 ret_val = 0;
 	u32 port_connected_status = 0, num_of_connected_port = 0;
 
 	if (mac->opmode == NL80211_IFTYPE_STATION &&
@@ -471,9 +470,7 @@ static u32 halbtc_get_wifi_link_status(struct btc_coexist *btcoexist)
 	}
 	/* TODO: P2P Connected Status */
 
-	ret_val = (num_of_connected_port << 16) | port_connected_status;
-
-	return ret_val;
+	return (num_of_connected_port << 16) | port_connected_status;
 }
 
 static bool halbtc_get(void *void_btcoexist, u8 get_type, void *out_buf)
-- 
2.7.4



^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [Outreachy kernel] [PATCH v2 5/7] staging: rtlwifi: halmac: halmac_88xx: Compress two lines into one line
  2019-03-31 14:41 [Outreachy kernel] [PATCH v2 0/7] staging: rtlwifi: Compress two lines Payal Kshirsagar
                   ` (3 preceding siblings ...)
  2019-03-31 14:41 ` [Outreachy kernel] [PATCH v2 4/7] staging: rtlwifi: btcoexist: " Payal Kshirsagar
@ 2019-03-31 14:41 ` Payal Kshirsagar
  2019-03-31 14:41 ` [Outreachy kernel] [PATCH v2 6/7] staging: rtlwifi: halmac: " Payal Kshirsagar
  2019-03-31 14:41 ` [Outreachy kernel] [PATCH v2 7/7] staging: rtlwifi: halmac: halmac_api.c: " Payal Kshirsagar
  6 siblings, 0 replies; 9+ messages in thread
From: Payal Kshirsagar @ 2019-03-31 14:41 UTC (permalink / raw)
  To: outreachy-kernel; +Cc: Payal Kshirsagar

Challenge suggested by coccinelle.
Compresses two lines into one line and remove unnecessary variable.

Signed-off-by: Payal Kshirsagar <payal.s.kshirsagar.98@gmail.com>
---
 drivers/staging/rtlwifi/halmac/halmac_88xx/halmac_api_88xx_sdio.c | 5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)

diff --git a/drivers/staging/rtlwifi/halmac/halmac_88xx/halmac_api_88xx_sdio.c b/drivers/staging/rtlwifi/halmac/halmac_88xx/halmac_api_88xx_sdio.c
index 979821e..5811787 100644
--- a/drivers/staging/rtlwifi/halmac/halmac_88xx/halmac_api_88xx_sdio.c
+++ b/drivers/staging/rtlwifi/halmac/halmac_88xx/halmac_api_88xx_sdio.c
@@ -165,7 +165,6 @@ halmac_cfg_rx_aggregation_88xx_sdio(struct halmac_adapter *halmac_adapter,
 u8 halmac_reg_read_8_sdio_88xx(struct halmac_adapter *halmac_adapter,
 			       u32 halmac_offset)
 {
-	u8 value8;
 	void *driver_adapter = NULL;
 	struct halmac_api *halmac_api;
 	enum halmac_ret_status status = HALMAC_RET_SUCCESS;
@@ -190,9 +189,7 @@ u8 halmac_reg_read_8_sdio_88xx(struct halmac_adapter *halmac_adapter,
 		return status;
 	}
 
-	value8 = PLATFORM_SDIO_CMD52_READ(driver_adapter, halmac_offset);
-
-	return value8;
+	return PLATFORM_SDIO_CMD52_READ(driver_adapter, halmac_offset);
 }
 
 /**
-- 
2.7.4



^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [Outreachy kernel] [PATCH v2 6/7] staging: rtlwifi: halmac: Compress two lines into one line
  2019-03-31 14:41 [Outreachy kernel] [PATCH v2 0/7] staging: rtlwifi: Compress two lines Payal Kshirsagar
                   ` (4 preceding siblings ...)
  2019-03-31 14:41 ` [Outreachy kernel] [PATCH v2 5/7] staging: rtlwifi: halmac: halmac_88xx: " Payal Kshirsagar
@ 2019-03-31 14:41 ` Payal Kshirsagar
  2019-03-31 14:41 ` [Outreachy kernel] [PATCH v2 7/7] staging: rtlwifi: halmac: halmac_api.c: " Payal Kshirsagar
  6 siblings, 0 replies; 9+ messages in thread
From: Payal Kshirsagar @ 2019-03-31 14:41 UTC (permalink / raw)
  To: outreachy-kernel; +Cc: Payal Kshirsagar

Challenge suggested by coccinelle.
Compresses two lines into one line and remove unnecessary variable.

Signed-off-by: Payal Kshirsagar <payal.s.kshirsagar.98@gmail.com>
---
 drivers/staging/rtlwifi/halmac/halmac_88xx/halmac_api_88xx_usb.c | 5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)

diff --git a/drivers/staging/rtlwifi/halmac/halmac_88xx/halmac_api_88xx_usb.c b/drivers/staging/rtlwifi/halmac/halmac_88xx/halmac_api_88xx_usb.c
index 0bd6abd..0ae0d02 100644
--- a/drivers/staging/rtlwifi/halmac/halmac_88xx/halmac_api_88xx_usb.c
+++ b/drivers/staging/rtlwifi/halmac/halmac_88xx/halmac_api_88xx_usb.c
@@ -192,7 +192,6 @@ halmac_cfg_rx_aggregation_88xx_usb(struct halmac_adapter *halmac_adapter,
 u8 halmac_reg_read_8_usb_88xx(struct halmac_adapter *halmac_adapter,
 			      u32 halmac_offset)
 {
-	u8 value8;
 	void *driver_adapter = NULL;
 	struct halmac_api *halmac_api;
 
@@ -205,9 +204,7 @@ u8 halmac_reg_read_8_usb_88xx(struct halmac_adapter *halmac_adapter,
 	driver_adapter = halmac_adapter->driver_adapter;
 	halmac_api = (struct halmac_api *)halmac_adapter->halmac_api;
 
-	value8 = PLATFORM_REG_READ_8(driver_adapter, halmac_offset);
-
-	return value8;
+	return PLATFORM_REG_READ_8(driver_adapter, halmac_offset);
 }
 
 /**
-- 
2.7.4



^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [Outreachy kernel] [PATCH v2 7/7] staging: rtlwifi: halmac: halmac_api.c: Compress two lines into one line
  2019-03-31 14:41 [Outreachy kernel] [PATCH v2 0/7] staging: rtlwifi: Compress two lines Payal Kshirsagar
                   ` (5 preceding siblings ...)
  2019-03-31 14:41 ` [Outreachy kernel] [PATCH v2 6/7] staging: rtlwifi: halmac: " Payal Kshirsagar
@ 2019-03-31 14:41 ` Payal Kshirsagar
  6 siblings, 0 replies; 9+ messages in thread
From: Payal Kshirsagar @ 2019-03-31 14:41 UTC (permalink / raw)
  To: outreachy-kernel; +Cc: Payal Kshirsagar

Challenge suggested by coccinelle.
Compresses two lines into one line and remove unnecessary variable.

Signed-off-by: Payal Kshirsagar <payal.s.kshirsagar.98@gmail.com>
---
 drivers/staging/rtlwifi/halmac/halmac_api.c | 7 ++-----
 1 file changed, 2 insertions(+), 5 deletions(-)

diff --git a/drivers/staging/rtlwifi/halmac/halmac_api.c b/drivers/staging/rtlwifi/halmac/halmac_api.c
index e75eb42..be75731 100644
--- a/drivers/staging/rtlwifi/halmac/halmac_api.c
+++ b/drivers/staging/rtlwifi/halmac/halmac_api.c
@@ -133,7 +133,6 @@ platform_reg_read_8_sdio(void *driver_adapter,
 			 struct halmac_platform_api *halmac_platform_api,
 			 u32 offset)
 {
-	u8 value8;
 	u32 halmac_offset = offset;
 	enum halmac_ret_status status = HALMAC_RET_SUCCESS;
 
@@ -146,10 +145,8 @@ platform_reg_read_8_sdio(void *driver_adapter,
 		return status;
 	}
 
-	value8 = halmac_platform_api->SDIO_CMD52_READ(driver_adapter,
-						      halmac_offset);
-
-	return value8;
+	return halmac_platform_api->SDIO_CMD52_READ(driver_adapter,
+						    halmac_offset);
 }
 
 static enum halmac_ret_status
-- 
2.7.4



^ permalink raw reply related	[flat|nested] 9+ messages in thread

* Re: [Outreachy kernel] [PATCH v2 1/7] staging: rtlwifi: Compress two lines into one line
  2019-03-31 14:41 ` [Outreachy kernel] [PATCH v2 1/7] staging: rtlwifi: Compress two lines into one line Payal Kshirsagar
@ 2019-04-01 17:22   ` Greg KH
  0 siblings, 0 replies; 9+ messages in thread
From: Greg KH @ 2019-04-01 17:22 UTC (permalink / raw)
  To: Payal Kshirsagar; +Cc: outreachy-kernel

On Sun, Mar 31, 2019 at 08:11:28PM +0530, Payal Kshirsagar wrote:
> Challenge suggested by coccinelle.
> Compresses two lines into one line and remove unnecessary variable.
> 
> Signed-off-by: Payal Kshirsagar <payal.s.kshirsagar.98@gmail.com>
> ---
>  drivers/staging/rtlwifi/rtl8822be/phy.c | 12 ++++--------
>  1 file changed, 4 insertions(+), 8 deletions(-)

This patch does not apply to my tree :(


^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2019-04-01 17:40 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-03-31 14:41 [Outreachy kernel] [PATCH v2 0/7] staging: rtlwifi: Compress two lines Payal Kshirsagar
2019-03-31 14:41 ` [Outreachy kernel] [PATCH v2 1/7] staging: rtlwifi: Compress two lines into one line Payal Kshirsagar
2019-04-01 17:22   ` Greg KH
2019-03-31 14:41 ` [Outreachy kernel] [PATCH v2 2/7] staging: rtlwifi: phydm: phydm.c: " Payal Kshirsagar
2019-03-31 14:41 ` [Outreachy kernel] [PATCH v2 3/7] staging: rtlwifi: phydm: phydm_rainfo.c: " Payal Kshirsagar
2019-03-31 14:41 ` [Outreachy kernel] [PATCH v2 4/7] staging: rtlwifi: btcoexist: " Payal Kshirsagar
2019-03-31 14:41 ` [Outreachy kernel] [PATCH v2 5/7] staging: rtlwifi: halmac: halmac_88xx: " Payal Kshirsagar
2019-03-31 14:41 ` [Outreachy kernel] [PATCH v2 6/7] staging: rtlwifi: halmac: " Payal Kshirsagar
2019-03-31 14:41 ` [Outreachy kernel] [PATCH v2 7/7] staging: rtlwifi: halmac: halmac_api.c: " Payal Kshirsagar

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.