From patchwork Mon Mar 4 20:38:42 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnd Bergmann X-Patchwork-Id: 159618 Delivered-To: patch@linaro.org Received: by 2002:a02:5cc1:0:0:0:0:0 with SMTP id w62csp4188925jad; Mon, 4 Mar 2019 12:39:43 -0800 (PST) X-Google-Smtp-Source: APXvYqy0zBiuo0Hj6T7NIax9I5kI86zEZZSwtuULgONHWqqaENwrdtKCAzAmP9aHTjcye3zmHpUg X-Received: by 2002:a63:e10:: with SMTP id d16mr20246359pgl.148.1551731983475; Mon, 04 Mar 2019 12:39:43 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1551731983; cv=none; d=google.com; s=arc-20160816; b=pru8Q999loUZvRTZwzmlWfDb0UUFZQqcgcKLTEQgH2+ugydggOlNZqQCtlQscjuJXl RWWYJ2tyXdFI4w5uoW9dx+1lzhP7bw8qUsYSWlY76toxZ9894vBeC8xPDyAOM3BbCxyR Yn8iCOgzcPB/lYG4YksfBbEuxfnszO/gzlQQFzAEMmgH+/XlgDjfcm3Oe5BKgIMAslC3 SauFzVy3t1qwCJrRin2iQV3gf/FrUgS31KM2HrqV5SX/GGIWyaL1F6MXc7MEjkc9jGQc Dkou1zVJILNbzyuSGMIFquSIuzXOhWU9GSdb+h64aFcn/STsIZd05b0ZSGZioYDemQPs 3TMA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from; bh=XuG6ITpFWBKKF4DvB/vpvn6nieED7v4jmC9T23NThp4=; b=ZF3pbQfrLOH/d8xGwHWjWtOnUgXuPUt30rSbjyCyOC6rfa+qihgn0zLpZXLOXJWSAG hI7/WwFsdXQxqXqI4rJx+JnKB002MctsVlTi/EKr6rRHANUDt400dLBfTCNezSOG74SO iKUSLQebMe9OyHQbaPR8+K5FpefF5sERRZQkGWYXcPKtLvL98A9e9doaaW2Bbf9YUZQ9 7DAE5pfq5t/dtDjiUbzokF1NieM1CG2KRpABLr/hTeYzQbVAJpJGMmNSA2Jg9GfYpsDH O3areiLmLYZE5uSW+0shwfY8TiXorD9MmIPnAQoYbjA0e7QNtzox8P3NKzkZN6gPyn1R /vIQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id e2si5825858pgs.387.2019.03.04.12.39.43; Mon, 04 Mar 2019 12:39:43 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726746AbfCDUjm (ORCPT + 31 others); Mon, 4 Mar 2019 15:39:42 -0500 Received: from mout.kundenserver.de ([212.227.126.135]:37963 "EHLO mout.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726101AbfCDUjl (ORCPT ); Mon, 4 Mar 2019 15:39:41 -0500 Received: from wuerfel.lan ([109.192.41.194]) by mrelayeu.kundenserver.de (mreue012 [212.227.15.129]) with ESMTPA (Nemesis) id 1N2jO8-1h6MTk0psC-01343O; Mon, 04 Mar 2019 21:39:28 +0100 From: Arnd Bergmann To: Johannes Berg , Emmanuel Grumbach , Luca Coelho , Intel Linux Wireless , Kalle Valo , "David S. Miller" Cc: Arnd Bergmann , Avraham Stern , linux-wireless@vger.kernel.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH] iwlwifi: fix 64-bit division Date: Mon, 4 Mar 2019 21:38:42 +0100 Message-Id: <20190304203924.2111146-1-arnd@arndb.de> X-Mailer: git-send-email 2.20.0 MIME-Version: 1.0 X-Provags-ID: V03:K1:13EZ5ioXLeca3oDvMvnCC57FRaccHP0KkoFmR49OnkNxuNVJvQc 41NyjHrRl/9BY5rDFB2nJPGdb1UBSbFSt2I75lD+xL+v5fFZipAXUaSt4xb9nCl82Qd+4JO aQiQQNPxErP6jawROrzHXPYSP7HSSvrDM4NzNGFakNCcfO0JbTXvApA6knoFSkCTzVeVLEP wvWwscEI8I6R3EGPVptew== X-Spam-Flag: NO X-UI-Out-Filterresults: notjunk:1; V03:K0:GIf2ikZWptk=:KKmIE00iaWcF6F9QVVLJq7 6kIsUPRoGhR/C4fBzu3QZRrcS9jRDVmGsq9lUyGgXBZtLLL6xjDgrn1X1OW/eVSfaHpYR5YBR g2tyP2c8rEggz9/fkAwbMQ9HJv1p/hx4c5CpfqBqOlio++yce8PHiA3SnXIc/79A5AVWiKIF6 ph/f67wwzq0qNdL4+K6Jr39TBKfOdODYG2jISqvg7mi0qUaB8xvy5q8rNBW6afmeIXPb9iifo 8YkziKT8tzFZilVWzEJ2t45be7yJay86mpzRakq46e/BZE+5jvj79wSlk6FI9iZMJYQuiBD3D s4OVXPlJ4iXpK6ZQi+yEJgGsVBc4+z4L8Z4zW7jv4/C9s+yipd2eeMqZeLspCYALLBDIQtsTD NwYYKYreD5Wl+/KX3dLB4k28lABedVkHhEndMOoHTd3mjjB/7WiP2oaGdX/W8Mzyz2CiTOpyo i4AMM38AxofZzQon3dNvq1mHWynZe5733LSXsgyq+qgfTkm0Nk8i5yeDCJQCrGqJFAQqsEVJ2 lPj1arY5w265+TWzkxaaAzIJnJA9nLabchbn5W1toJvBFvippkcUank9HImSNocGku9f+8p/Q i1wEg7lx901Pjtgw7D8YOi5pxhL8/5J1az0Qa4bhl5meGnKKO+6Yym6mLEvZMA4C9D/c1+VPf cqmUtFblvJuBH6oW4Hzvp1CySY8Owoy95eVO85MzHh0BDJXbKGz5O+FRiQGSvmwQ7DqyJIr1K 4KA1lEPM41f3Yarbnx6gZAekQABJZNm80TOvsA== Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org do_div() expects unsigned operands and otherwise triggers a warning like: drivers/net/wireless/intel/iwlwifi/mvm/ftm-initiator.c:465:2: error: comparison of distinct pointer types ('typeof ((rtt_avg)) *' (aka 'long long *') and 'uint64_t *' (aka 'unsigned long long *')) [-Werror,-Wcompare-distinct-pointer-types] do_div(rtt_avg, 6666); ^~~~~~~~~~~~~~~~~~~~~ include/asm-generic/div64.h:222:28: note: expanded from macro 'do_div' (void)(((typeof((n)) *)0) == ((uint64_t *)0)); \ ~~~~~~~~~~~~~~~~~~ ^ ~~~~~~~~~~~~~~~ 1 error generated. Change the do_div() to the simpler div_s64() that can handle negative inputs correctly. Fixes: 937b10c0de68 ("iwlwifi: mvm: add debug prints for FTM") Signed-off-by: Arnd Bergmann --- drivers/net/wireless/intel/iwlwifi/mvm/ftm-initiator.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) -- 2.20.0 diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/ftm-initiator.c b/drivers/net/wireless/intel/iwlwifi/mvm/ftm-initiator.c index e9822a3ec373..94132cfd1f56 100644 --- a/drivers/net/wireless/intel/iwlwifi/mvm/ftm-initiator.c +++ b/drivers/net/wireless/intel/iwlwifi/mvm/ftm-initiator.c @@ -460,9 +460,7 @@ static int iwl_mvm_ftm_range_resp_valid(struct iwl_mvm *mvm, u8 request_id, static void iwl_mvm_debug_range_resp(struct iwl_mvm *mvm, u8 index, struct cfg80211_pmsr_result *res) { - s64 rtt_avg = res->ftm.rtt_avg * 100; - - do_div(rtt_avg, 6666); + s64 rtt_avg = div_s64(res->ftm.rtt_avg * 100, 6666); IWL_DEBUG_INFO(mvm, "entry %d\n", index); IWL_DEBUG_INFO(mvm, "\tstatus: %d\n", res->status);