Received: by 2002:ac0:a679:0:0:0:0:0 with SMTP id p54csp373058imp; Wed, 20 Feb 2019 01:40:59 -0800 (PST) X-Google-Smtp-Source: AHgI3IaHFzMtmCtF5cH7uhYuoeI/L7ryMeLozRXqptGlTVr20DVpX5oikiAvaszv/j38qGk8RzLD X-Received: by 2002:a62:b248:: with SMTP id x69mr33738898pfe.256.1550655659455; Wed, 20 Feb 2019 01:40:59 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1550655659; cv=none; d=google.com; s=arc-20160816; b=wXy21yPtUwOOE+xxyOmEQeirFwjX5EJDRLrd2Qd37rhD9Ytaol3JxvoP4PkrM4wKYI ZYCsgW3d0VAY2UhcEMo1ArNnpv3H7O7QApQJgCfrbmXPpXQB+lGDxB8vcqm7cN3SIK// gQGzj7z9hWcG7q/R5/lHas2ah2lcpTJLM5ghsS4a2eKSwuQ2kWFociYwpFJHIxePIcK/ VVkTIToUlRuMxfgpIzA/BNv3J/+fV0UnnTz7CqONEJf04UVO61W5rmq699ZvABMlIkgL rRaz2sT3xfO+6YbHz7z2aJFcfpYLEwLPikYYWTSNytLghMn2MGcateTt2KtmcRwTv9Pv ZEDQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:subject:content-transfer-encoding :mime-version:user-agent:references:in-reply-to:date:cc:to:from :message-id; bh=2HBNEpwnrrliFSN+0ADjaK1EMa9tOJgUIF1kgX/7CX0=; b=nBYQW3u9AZIu8Uq+NLQLX6j3Ngj8B9Hqiy0Fh7vK7YkrqWcTDJ1KOO+ocaSVbI/QW6 Cmj0BZtLGfRpMkl4Pi8vGhpLR/4vYfbvrqZ9PBvQufcbOCqNuIwEoTGjCY33huwWtEw9 RJPGhSCNpRyEfcIOwxij1m8BQcur1hXJU3rXLw05rKZ8qRicjVXXvYpIhAVVEPGFHQ/p cHzMnqYKhO6y4MnNzknx3YF2yzHE9M3rUmyHs2agUEAFIi90XEhOz3Zr9EV5gHx7yHOr rK4k3DyJ6TFs8ATaBo0nkuD89aXBARd+t9H1q00vHH1/SroiT7Xi3KDj6TpqPDPVoaFC 1cWg== 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 u24si9069389pfa.78.2019.02.20.01.40.44; Wed, 20 Feb 2019 01:40:59 -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 S1727067AbfBTJkB (ORCPT + 99 others); Wed, 20 Feb 2019 04:40:01 -0500 Received: from paleale.coelho.fi ([176.9.41.70]:34398 "EHLO farmhouse.coelho.fi" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1727021AbfBTJkB (ORCPT ); Wed, 20 Feb 2019 04:40:01 -0500 Received: from 91-156-4-241.elisa-laajakaista.fi ([91.156.4.241] helo=redipa) by farmhouse.coelho.fi with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.91) (envelope-from ) id 1gwOM7-0003vV-Lh; Wed, 20 Feb 2019 11:39:56 +0200 Message-ID: From: Luca Coelho To: Nick Desaulniers , Nathan Chancellor Cc: Johannes Berg , Emmanuel Grumbach , Intel Linux Wireless , Kalle Valo , linux-wireless@vger.kernel.org, netdev@vger.kernel.org, LKML Date: Wed, 20 Feb 2019 11:39:54 +0200 In-Reply-To: References: <20190219182105.19933-1-natechancellor@gmail.com> Content-Type: text/plain; charset="UTF-8" User-Agent: Evolution 3.30.5-1 MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Spam-Checker-Version: SpamAssassin 3.4.1 (2015-04-28) on farmhouse.coelho.fi X-Spam-Level: X-Spam-Status: No, score=-2.9 required=5.0 tests=ALL_TRUSTED,BAYES_00, TVD_RCVD_IP autolearn=ham autolearn_force=no version=3.4.1 Subject: Re: [PATCH] iwlwifi: mvm: Use div64_s64 instead of do_div in iwl_mvm_debug_range_resp Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, 2019-02-19 at 11:05 -0800, Nick Desaulniers wrote: > On Tue, Feb 19, 2019 at 10:21 AM Nathan Chancellor > wrote: > > Clang warns: > > > > drivers/net/wireless/intel/iwlwifi/mvm/ftm-initiator.c:465:2: > > warning: > > comparison of distinct pointer types ('typeof ((rtt_avg)) *' (aka > > 'long > > long *') and 'uint64_t *' (aka 'unsigned long long *')) > > [-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 warning generated. > > > > do_div expects an unsigned dividend. Use div64_s64, which expects a > > signed dividend. > > Eh, IIRC, signed vs unsigned division has implications for rounding > towards zero or not, but I doubt that the round trip time average > (RTT > avg) should ever be negative. General rule of thumb for C is to keep > arithmetic signed (even when working with non zero values), so rather > than make the literal (6666) a unsigned long, I agree with your > change > to keep the division signed as well. Thanks for the fix. > Reviewed-by: Nick Desaulniers Thanks for the patch and for the review. I've applied this to our internal tree and it will be sent upstreaming following our normal upstreaming process. -- Cheers, Luca.