lkml.org 
[lkml]   [2022]   [Jan]   [24]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    Patch in this message
    /
    From
    Subject[PATCH 5.15 367/846] iwlwifi: mvm: Use div_s64 instead of do_div in iwl_mvm_ftm_rtt_smoothing()
    Date
    From: Nathan Chancellor <nathan@kernel.org>

    [ Upstream commit 4ccdcc8ffd955490feec05380223db6a48961eb5 ]

    When building ARCH=arm allmodconfig:

    drivers/net/wireless/intel/iwlwifi/mvm/ftm-initiator.c: In function ‘iwl_mvm_ftm_rtt_smoothing’:
    ./include/asm-generic/div64.h:222:35: error: comparison of distinct pointer types lacks a cast [-Werror]
    222 | (void)(((typeof((n)) *)0) == ((uint64_t *)0)); \
    | ^~
    drivers/net/wireless/intel/iwlwifi/mvm/ftm-initiator.c:1070:9: note: in expansion of macro ‘do_div’
    1070 | do_div(rtt_avg, 100);
    | ^~~~~~

    do_div() has to be used with an unsigned 64-bit integer dividend but
    rtt_avg is a signed 64-bit integer.

    div_s64() expects a signed 64-bit integer dividend and signed 32-bit
    divisor, which fits this scenario, so use that function here to fix the
    warning.

    Fixes: 8b0f92549f2c ("iwlwifi: mvm: fix 32-bit build in FTM")
    Signed-off-by: Nathan Chancellor <nathan@kernel.org>
    Link: https://lore.kernel.org/r/20211227191757.2354329-1-nathan@kernel.org
    Signed-off-by: Jakub Kicinski <kuba@kernel.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>
    ---
    drivers/net/wireless/intel/iwlwifi/mvm/ftm-initiator.c | 3 +--
    1 file changed, 1 insertion(+), 2 deletions(-)

    diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/ftm-initiator.c b/drivers/net/wireless/intel/iwlwifi/mvm/ftm-initiator.c
    index 6e1d37f258035..bb5fff8174435 100644
    --- a/drivers/net/wireless/intel/iwlwifi/mvm/ftm-initiator.c
    +++ b/drivers/net/wireless/intel/iwlwifi/mvm/ftm-initiator.c
    @@ -1054,8 +1054,7 @@ static void iwl_mvm_ftm_rtt_smoothing(struct iwl_mvm *mvm,
    overshoot = IWL_MVM_FTM_INITIATOR_SMOOTH_OVERSHOOT;
    alpha = IWL_MVM_FTM_INITIATOR_SMOOTH_ALPHA;

    - rtt_avg = alpha * rtt + (100 - alpha) * resp->rtt_avg;
    - do_div(rtt_avg, 100);
    + rtt_avg = div_s64(alpha * rtt + (100 - alpha) * resp->rtt_avg, 100);

    IWL_DEBUG_INFO(mvm,
    "%pM: prev rtt_avg=%lld, new rtt_avg=%lld, rtt=%lld\n",
    --
    2.34.1


    \
     
     \ /
      Last update: 2022-01-25 00:11    [W:6.966 / U:0.200 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site