mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH 1/9] staging:r8188eu: use DIV_ROUND_UP() in rtw_signal_stat_timer_hdl()
@ 2017-02-14 22:25 Ivan Safonov
  2017-02-14 22:25 ` [PATCH 2/9] staging:r8188eu: refactor add_RATid() - remove rtw_hal_get_hwreg() call Ivan Safonov
                   ` (7 more replies)
  0 siblings, 8 replies; 9+ messages in thread
From: Ivan Safonov @ 2017-02-14 22:25 UTC (permalink / raw)
  To: Greg Kroah-Hartman
  Cc: Scott Matheina, Claudiu Beznea, sayli karnik, Luca Ceresoli,
	Jacky Boen, Victor Carvajal, devel, linux-kernel, Ivan Safonov

DIV_ROUND_UP macro is shorter and look better than if-else construction.
DIV_ROUND_UP used in rtw_signal_stat_timer_hdl().

Signed-off-by: Ivan Safonov <insafonov@gmail.com>
---
 drivers/staging/rtl8188eu/core/rtw_recv.c | 10 ++--------
 1 file changed, 2 insertions(+), 8 deletions(-)

diff --git a/drivers/staging/rtl8188eu/core/rtw_recv.c b/drivers/staging/rtl8188eu/core/rtw_recv.c
index 53dc33c..556be8c 100644
--- a/drivers/staging/rtl8188eu/core/rtw_recv.c
+++ b/drivers/staging/rtl8188eu/core/rtw_recv.c
@@ -2050,19 +2050,13 @@ static void rtw_signal_stat_timer_hdl(unsigned long data)
 	if (check_fwstate(&adapter->mlmepriv, _FW_UNDER_SURVEY) == false) {
 		tmp_s = avg_signal_strength +
 			(_alpha - 1) * recvpriv->signal_strength;
-		if (tmp_s % _alpha)
-			tmp_s = tmp_s / _alpha + 1;
-		else
-			tmp_s = tmp_s / _alpha;
+		tmp_s = DIV_ROUND_UP(tmp_s, _alpha);
 		if (tmp_s > 100)
 			tmp_s = 100;
 
 		tmp_q = avg_signal_qual +
 			(_alpha - 1) * recvpriv->signal_qual;
-		if (tmp_q % _alpha)
-			tmp_q = tmp_q / _alpha + 1;
-		else
-			tmp_q = tmp_q / _alpha;
+		tmp_q = DIV_ROUND_UP(tmp_q, _alpha);
 		if (tmp_q > 100)
 			tmp_q = 100;
 
-- 
2.10.2

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

end of thread, other threads:[~2017-02-14 22:25 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-02-14 22:25 [PATCH 1/9] staging:r8188eu: use DIV_ROUND_UP() in rtw_signal_stat_timer_hdl() Ivan Safonov
2017-02-14 22:25 ` [PATCH 2/9] staging:r8188eu: refactor add_RATid() - remove rtw_hal_get_hwreg() call Ivan Safonov
2017-02-14 22:25 ` [PATCH 3/9] staging:r8188eu: refactor rtw_check_beacon_data() " Ivan Safonov
2017-02-14 22:25 ` [PATCH 4/9] staging:r8188eu: refactor rtw_get_cur_max_rate() " Ivan Safonov
2017-02-14 22:25 ` [PATCH 5/9] staging:r8188eu: refactor issue_assocreq() " Ivan Safonov
2017-02-14 22:25 ` [PATCH 6/9] staging:r8188eu: refactor rtw_update_ht_cap() " Ivan Safonov
2017-02-14 22:25 ` [PATCH 7/9] staging:r8188eu: refactor HT_caps_handler() " Ivan Safonov
2017-02-14 22:25 ` [PATCH 8/9] staging:r8188eu: remove unused HW_VAR_RF_TYPE parameter of HT_caps_handler Ivan Safonov
2017-02-14 22:25 ` [PATCH 9/9] staging:r8188eu: remove unused MCS_rate_2R array Ivan Safonov

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®