diff options
author | Ivan Safonov <insafonov@gmail.com> | 2017-02-15 01:25:24 +0300 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2017-03-06 09:17:00 +0100 |
commit | 0bb2b81ee41397630ae94764a7db2e4caaa8df78 (patch) | |
tree | 14a167226aa7413b4ccc832c19dd78968cc2567a /drivers | |
parent | d680d24eacac3124fc0d6a2fab0eef0074f09efd (diff) |
staging:r8188eu: use DIV_ROUND_UP() in rtw_signal_stat_timer_hdl()
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>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/staging/rtl8188eu/core/rtw_recv.c | 10 |
1 files changed, 2 insertions, 8 deletions
diff --git a/drivers/staging/rtl8188eu/core/rtw_recv.c b/drivers/staging/rtl8188eu/core/rtw_recv.c index 53dc33c3f913..556be8cacdfd 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; |