Received: by 2002:a25:ad19:0:0:0:0:0 with SMTP id y25csp3055522ybi; Tue, 2 Jul 2019 01:15:25 -0700 (PDT) X-Google-Smtp-Source: APXvYqz9PAEHZiomvDVqBG0UHlUlQMnc3kwutIU1JXOd/J/y0KFFe5zYlzTcOHrHtn8SnJjslebk X-Received: by 2002:a17:90a:9289:: with SMTP id n9mr4180175pjo.35.1562055325217; Tue, 02 Jul 2019 01:15:25 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1562055325; cv=none; d=google.com; s=arc-20160816; b=Iw+YC6fe8QvzhsMUjPrRd9FX8aRFPENfAfOqMlVuCDT1hehvufksrWa7YVmJcfkscL /BxCmA7K4l3Z0mXh9PwsG9LmrZ4+rG9vzLceOO/xANxmr4chKl1tzaJxF0Un+wmDzo/1 t+FvkOTOJIcquEcMAP/Aua8Mk0h1hR3013vq+dDhj7WTersuZc3hPdk5t0nJa16P8N1U ltE0psRC3OfafkzowTb7aJryQ8PgwrS/PlRhTzVk/eAJOBZM3yjenwhRonht9U3PG1aA iJ2WTrveyjKYazL+t5r+MWWS0mhyh6nZ+MaJTT5U9q2vwcemsuopG4qD+QX2hT6GNsiw sMbQ== 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=PPs9ZxUOKCbjV3os3d128zPawot/EPVh+VJ+TQbBojM=; b=zcRTYhkj4t4Qud78abRJRRlE0nuh5tGAUmii13jGvO00BQjOSVbbPNbEwrySDAc+oF yTPg2mEI49xYMyNVkKhQAK6h5DJp0+7KmpVwg1VgGiEoXxsp/2MQl6ZZzFpXW7lNYzue QrvT3P0YSIEf3I1si/bX2e/fn5z2bIW7YtxkhgvjRvEqu8lpqG52/+uXebv9/AiB2Zpv b4ZnpMssQXEhmBS2C2lGjeQ17PQefGFM3XgWZMVIUzPerI2U+l5dZpLmEwbtxqU7sIZf j6umj3ieZiMNddCxGaJJ/I2EFkaGP+GMB9uxUJj520/6u7v7baPpks2Z5jSEb8dwlIti YD9w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b="0UjUi/dZ"; 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 d1si12149338pgb.24.2019.07.02.01.15.10; Tue, 02 Jul 2019 01:15:25 -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="0UjUi/dZ"; 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 S1728296AbfGBIHj (ORCPT + 99 others); Tue, 2 Jul 2019 04:07:39 -0400 Received: from mail.kernel.org ([198.145.29.99]:54944 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727724AbfGBIHh (ORCPT ); Tue, 2 Jul 2019 04:07:37 -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 F239321479; Tue, 2 Jul 2019 08:07:35 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1562054856; bh=JXLrTMyeRZdR8Tz9O6emJCMGlBucOV6CQTFmjD3gLUU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=0UjUi/dZfmUnixwTpTay/0bMlkhAxXWK2IQh4bkXwveChvz5uYv8XsTqTzf873U93 kRmVMWOwLHql0q5dnWspKJoZRnZ1vW2R8uXpLspsIouhAcJvDSuomtc1ndr9Vxglj5 nuRpWeIpdWeZebdBCNVY7Zb6juFM/3ZH1hIyCMFw= 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.19 55/72] net: stmmac: fixed new system time seconds value calculation Date: Tue, 2 Jul 2019 10:01:56 +0200 Message-Id: <20190702080127.429080021@linuxfoundation.org> X-Mailer: git-send-email 2.22.0 In-Reply-To: <20190702080124.564652899@linuxfoundation.org> References: <20190702080124.564652899@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 @@ -122,7 +122,7 @@ static int adjust_systime(void __iomem * * programmed with (2^32 – ) */ if (gmac4) - sec = (100000000ULL - sec); + sec = -sec; value = readl(ioaddr + PTP_TCR); if (value & PTP_TCR_TSCTRLSSR)