Received: by 10.223.185.116 with SMTP id b49csp6369918wrg; Wed, 28 Feb 2018 08:17:54 -0800 (PST) X-Google-Smtp-Source: AG47ELsq1Qo5tujKNd6vcHeVmoK9wJchPTZxuHW9glsgKA1V8zcPP0zJz6YrnTCQ7oXh3nDjNcGF X-Received: by 2002:a17:902:1763:: with SMTP id i90-v6mr2254599pli.309.1519834674499; Wed, 28 Feb 2018 08:17:54 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1519834674; cv=none; d=google.com; s=arc-20160816; b=UWShYKMwddOIGIpCbGhrxw9/zar6Ugg9pIjEhoqjhwI/hEBKM1YiBJsg5AGj3UMzPt +kTdeDsfW/hzwPw5dOeCqciQBtY7fxpan8z/LrPX4nnyBIY9LINMYnwIsk9PZUUp/7rf NCNu/AOZ5kQfAfC5H3Re/4U38RueoEkKCgoJTUdBBOU6LnwVkO7VTlC93JWo0heO2VXD 082C79AJcQ/t0ENC21ncp7SQCwrOYQJ5vVZZOMtkgFGwC5adYwHXaVAibutesi8bir6J RAhF143dKQamfOjXbi9ntAjpnDi0L/Xk4DXSgnXz6CPVjGKdDdpbrOHdpzdASgP+G8cz t2GQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:in-reply-to:subject:message-id:date:cc:to :from:mime-version:content-transfer-encoding:content-disposition :arc-authentication-results; bh=QjfBTYgRfze/9r46X2nepwCfmJm0mKvmtoMahKlzfrc=; b=bavJWA7pENFKleKyJJTtvMzQhSinrYCiy/y1tkkOV7ZCVd7xJb5boIt9ZVYpMrjDFw 0X2Rtz5D0N+9oiQ1oikTxZtZsvOhOKeLwEdmzQt8ZZLMkq18ubFYTfP5T1BIQPSdambX L7G/ZwCXz44qs2uZrs3CJZZGGYFKO+Gp67AilWHiw++nOwB7J39JaXvzwkjtk7//CGUI HAfew3nW+vDCGwXoHp4Xa8lveu2jxOFvdVvNmZuPHnxbsW6wbgeKFQOVsqwyKYF74IkG 45th9PL3hWdMYAUDFlIJnUnHDyoFy3NHkGxt0WuWYSx8ZahVoo116C2wtELzOkKuS/mm v9Pg== 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 y5si1189871pgv.738.2018.02.28.08.17.39; Wed, 28 Feb 2018 08:17:54 -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 S935003AbeB1QQy (ORCPT + 99 others); Wed, 28 Feb 2018 11:16:54 -0500 Received: from shadbolt.e.decadent.org.uk ([88.96.1.126]:35248 "EHLO shadbolt.e.decadent.org.uk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932654AbeB1QQj (ORCPT ); Wed, 28 Feb 2018 11:16:39 -0500 Received: from [2a02:8011:400e:2:6f00:88c8:c921:d332] (helo=deadeye) by shadbolt.decadent.org.uk with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1er3Yn-0006Xm-Kl; Wed, 28 Feb 2018 15:22:26 +0000 Received: from ben by deadeye with local (Exim 4.90_1) (envelope-from ) id 1er3Yk-0000Ih-M2; Wed, 28 Feb 2018 15:22:22 +0000 Content-Type: text/plain; charset="UTF-8" Content-Disposition: inline Content-Transfer-Encoding: 8bit MIME-Version: 1.0 From: Ben Hutchings To: linux-kernel@vger.kernel.org, stable@vger.kernel.org CC: akpm@linux-foundation.org, "John W. Linville" , "Andrew Bresticker" Date: Wed, 28 Feb 2018 15:20:18 +0000 Message-ID: X-Mailer: LinuxStableQueue (scripts by bwh) Subject: [PATCH 3.16 233/254] mac80211_hwsim: fix compiler warning on MIPS In-Reply-To: X-SA-Exim-Connect-IP: 2a02:8011:400e:2:6f00:88c8:c921:d332 X-SA-Exim-Mail-From: ben@decadent.org.uk X-SA-Exim-Scanned: No (on shadbolt.decadent.org.uk); SAEximRunCond expanded to false Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 3.16.55-rc1 review patch. If anyone has any objections, please let me know. ------------------ From: Andrew Bresticker commit 5d26b50813ea6206a7bbab2e645e68044f101ac5 upstream. The dividend in do_div() is expected to be an unsigned 64-bit integer, which leads to the following warning when building for 32-bit MIPS: drivers/net/wireless/mac80211_hwsim.c: In function 'mac80211_hwsim_set_tsf': drivers/net/wireless/mac80211_hwsim.c:664:98: warning: comparison of distinct pointer types lacks a cast [enabled by default] data->bcn_delta = do_div(delta, bcn_int); Since we care about the signedness of delta when adjusting tsf_offset and bcm_delta, use the absolute value for the division and compare the two timestamps to determine the sign. Signed-off-by: Andrew Bresticker Signed-off-by: John W. Linville Signed-off-by: Ben Hutchings --- drivers/net/wireless/mac80211_hwsim.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) --- a/drivers/net/wireless/mac80211_hwsim.c +++ b/drivers/net/wireless/mac80211_hwsim.c @@ -685,11 +685,16 @@ static void mac80211_hwsim_set_tsf(struc struct mac80211_hwsim_data *data = hw->priv; u64 now = mac80211_hwsim_get_tsf(hw, vif); u32 bcn_int = data->beacon_int; - s64 delta = tsf - now; + u64 delta = abs64(tsf - now); - data->tsf_offset += delta; /* adjust after beaconing with new timestamp at old TBTT */ - data->bcn_delta = do_div(delta, bcn_int); + if (tsf > now) { + data->tsf_offset += delta; + data->bcn_delta = do_div(delta, bcn_int); + } else { + data->tsf_offset -= delta; + data->bcn_delta = -do_div(delta, bcn_int); + } } static void mac80211_hwsim_monitor_rx(struct ieee80211_hw *hw,