Received: by 2002:a25:ad19:0:0:0:0:0 with SMTP id y25csp3052129ybi; Tue, 2 Jul 2019 01:11:16 -0700 (PDT) X-Google-Smtp-Source: APXvYqyDBMDaGpJ6GeK62xZnNqAGUefGn8e+ioPUu6N/CN9io0953EtqtjXAnCp2U2YloXeVyeiU X-Received: by 2002:a17:902:9b81:: with SMTP id y1mr35323809plp.194.1562055076763; Tue, 02 Jul 2019 01:11:16 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1562055076; cv=none; d=google.com; s=arc-20160816; b=eITU5MdjWTU7VjQ64KAAVxXZE40wbMMEwbvcmpo1ywP3CeUpIUvexvMiKd5oTk04DQ VOYrZU4Uod3kzVb0s4L8MP7KP7r6aKh7Q6ylcc+sNFwMbu6suBN1Gifa34x28G6/bs+w sA5KzLh2xEY5/KhT5nIXyOhFT7fdTGLPfrQtE0fhqBM43jkxg1EROD5n9qnhOIjUQAR0 0eT4BbLJJ7+P+qrh+/L4Wm+7BXsqWjwvhba5lZye6mw5kVK5AdYG7tSfKqU9B6FnZaqk Je1sYTT4mDzSxVLIqD3evoF5CIRNXjkXG4U6eM9yT4ZicuPa10fufmmeEJ1Rz5K6w279 m+YQ== 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 :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=8BH3DmoU4xi1O1biMAjkgKOHd9DE8GcV1l1y1FeQYDg=; b=oN767fOrqcbp6794ZX97TiL+O1Wmo6xLwj2aEEnRdgDgS1mKQUjLgV8PpEXY8F+I0W KThLpFPY53dBkxDgUbz6l+XClfjA8WXqZ+9gk33TWnpGpFf2SJdVlB0fhRBAYTc6DPzJ wsQcx3SsZ7Go4Jf6sy8XbqeJCc1onLR71DFEskBum5i+lNR9vxNk/gE8hvkkkqnLYV4q gZJSUxmdzJqmierOA4v6rStUB2Rk4uiwxy/U5QXJCA2oBsmnqu64c8x3AZUSbN7EnC4J A25T0JcjwWxeRI86lcdiNrEC7ki+AJrgA7+Hrqcl5dYyyJLmVhSZPO3Un9f1TTbR5N70 IeXQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b="zS/i6f2/"; 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 f34si12198429plf.305.2019.07.02.01.11.02; Tue, 02 Jul 2019 01:11:16 -0700 (PDT) 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; dkim=pass header.i=@kernel.org header.s=default header.b="zS/i6f2/"; 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 S1728739AbfGBIJx (ORCPT + 99 others); Tue, 2 Jul 2019 04:09:53 -0400 Received: from mail.kernel.org ([198.145.29.99]:57918 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727678AbfGBIJv (ORCPT ); Tue, 2 Jul 2019 04:09:51 -0400 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 8DB5D2184B; Tue, 2 Jul 2019 08:09:50 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1562054991; bh=28Ru4aeXvLWSIhIKKU8OM7ebMN47JKfCB4G/ALz7aCw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=zS/i6f2/xF2SaZv8U/1bwEj2LrCyZ+6uRWJDdf00oKBW+1YR98FNcCKXF2FzTif6P IZ7no1zJGX7kwF6IkUS8VkaChziV31xon7BdsXQ7nhlmPhYLhuVc5EZ3d9fBWdLqah RsPNtDd7EvxWyy6xRLxGZeb6l0MEPY8OCTzoP/QQ= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Roland Hii , Ong Boon Leong , Voon Weifeng , "David S. Miller" Subject: [PATCH 4.14 31/43] net: stmmac: fixed new system time seconds value calculation Date: Tue, 2 Jul 2019 10:02:11 +0200 Message-Id: <20190702080125.489741778@linuxfoundation.org> X-Mailer: git-send-email 2.22.0 In-Reply-To: <20190702080123.904399496@linuxfoundation.org> References: <20190702080123.904399496@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Roland Hii [ Upstream commit a1e5388b4d5fc78688e5e9ee6641f779721d6291 ] When ADDSUB bit is set, the system time seconds field is calculated as the complement of the seconds part of the update value. For example, if 3.000000001 seconds need to be subtracted from the system time, this field is calculated as 2^32 - 3 = 4294967296 - 3 = 0x100000000 - 3 = 0xFFFFFFFD Previously, the 0x100000000 is mistakenly written as 100000000. This is further simplified from sec = (0x100000000ULL - sec); to sec = -sec; Fixes: ba1ffd74df74 ("stmmac: fix PTP support for GMAC4") Signed-off-by: Roland Hii Signed-off-by: Ong Boon Leong Signed-off-by: Voon Weifeng Signed-off-by: David S. Miller Signed-off-by: Greg Kroah-Hartman --- drivers/net/ethernet/stmicro/stmmac/stmmac_hwtstamp.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_hwtstamp.c +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_hwtstamp.c @@ -121,7 +121,7 @@ static int stmmac_adjust_systime(void __ * programmed with (2^32 – ) */ if (gmac4) - sec = (100000000ULL - sec); + sec = -sec; value = readl(ioaddr + PTP_TCR); if (value & PTP_TCR_TSCTRLSSR)