Received: by 2002:a05:6a10:2785:0:0:0:0 with SMTP id ia5csp2273948pxb; Mon, 11 Jan 2021 05:46:55 -0800 (PST) X-Google-Smtp-Source: ABdhPJxwWv/kljrSUvsiIil+IwMm2VVX9om/hfGNAeHJUHoqorLY438Rj+d21PN/8bmuUO4PzdWc X-Received: by 2002:a17:906:2798:: with SMTP id j24mr10987053ejc.328.1610372815752; Mon, 11 Jan 2021 05:46:55 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1610372815; cv=none; d=google.com; s=arc-20160816; b=Vv81mvtxMmeeSQLrSWvVeo8YScXLLVSOY0JywL9hHmvqkF7iCiYEFBRyB62R+eH+b9 0fG4Wx4p7JwAk5365y7Sx+Bjoo+fPXwkPAoYygNSTnqTP1LW+hxc10ihIJeeBZ02JUJG p/PF28tAF2iAyAXGfUEZ1rMzR03oje0L5FjBdQX6DFynB2mwx34BJYzS5EPWW2KPKjqO syQpHMrTbUnmuP+nkS6jHWnsYmYQJmbiPE6JnxnBx42z9RT7ec6S18uizvXyZx4wU2lq VRrAtxLzCU7eJDqiowsmmHsX7pScBBSYOS668jlcsJJOpdcTnWyxHdDSQchjHRyteJKh keiw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=BN0OG5L4rtXf0J1eBR94A3w6wDYYG29G7ogYyjIS10A=; b=utso7cwCZw4PJOLUkHNWlAJvsAsSebKud+KcdrYdvfjP3qnIfc+xs/7zsSz90zd0i2 h5PW+98Q4niZXVSLWGjc0htQKPs3c/9T0CIBciaVQE7gDOHXZPtwnDV4h0Lxde2XDoTe s8aXQkJpPypBt6Mb3HW2m6eMrT6Yy5QTnzDrdK1tUH4pVVk4OJnuEzA24hPGp6oQ9Y42 MbqQQAPo/AeoGnhpMg/fzJ9wwv49Uzrx6lnEmpedRgGVR/Y3w/YvWn/P5HZhNEs7ooD7 Gh1oi1KGVrjBnqcKs3BvOeC2l6n7FRgikemPLkS7cHL61OJ9t7f5E2kNNgQQwtOwoLnK aB+w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=pchh0mRp; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id q18si6626397ejt.469.2021.01.11.05.46.31; Mon, 11 Jan 2021 05:46:55 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=pchh0mRp; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2387426AbhAKNmD (ORCPT + 99 others); Mon, 11 Jan 2021 08:42:03 -0500 Received: from mail.kernel.org ([198.145.29.99]:59494 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730977AbhAKNMW (ORCPT ); Mon, 11 Jan 2021 08:12:22 -0500 Received: by mail.kernel.org (Postfix) with ESMTPSA id 684372253A; Mon, 11 Jan 2021 13:11:41 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1610370701; bh=ELab6JmI6Vjau1uX1EZ9XSVTKXfryRr71i/2nF9x+Mo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=pchh0mRpv6Dg1YHD13O0StNiLTErQAeSuUCuOaH65DrWH5txaJjl46tBKePjR3vLH zqaqvGz/E9CnZN5v29UymuXEb5q5ysyzAgRCWIEpmDuh3fAaBksZ+7wAcVUx1O482i deBxRC3apjCEBw5BUYJWenximcbv+BjcV0IsNmpA= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Grygorii Strashko , Richard Cochran , Jakub Kicinski Subject: [PATCH 5.4 30/92] net: ethernet: ti: cpts: fix ethtool output when no ptp_clock registered Date: Mon, 11 Jan 2021 14:01:34 +0100 Message-Id: <20210111130040.600057780@linuxfoundation.org> X-Mailer: git-send-email 2.30.0 In-Reply-To: <20210111130039.165470698@linuxfoundation.org> References: <20210111130039.165470698@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Grygorii Strashko [ Upstream commit 4614792eebcbf81c60ad3604c1aeeb2b0899cea4 ] The CPTS driver registers PTP PHC clock when first netif is going up and unregister it when all netif are down. Now ethtool will show: - PTP PHC clock index 0 after boot until first netif is up; - the last assigned PTP PHC clock index even if PTP PHC clock is not registered any more after all netifs are down. This patch ensures that -1 is returned by ethtool when PTP PHC clock is not registered any more. Fixes: 8a2c9a5ab4b9 ("net: ethernet: ti: cpts: rework initialization/deinitialization") Signed-off-by: Grygorii Strashko Acked-by: Richard Cochran Link: https://lore.kernel.org/r/20201224162405.28032-1-grygorii.strashko@ti.com Signed-off-by: Jakub Kicinski Signed-off-by: Greg Kroah-Hartman --- drivers/net/ethernet/ti/cpts.c | 2 ++ 1 file changed, 2 insertions(+) --- a/drivers/net/ethernet/ti/cpts.c +++ b/drivers/net/ethernet/ti/cpts.c @@ -485,6 +485,7 @@ void cpts_unregister(struct cpts *cpts) ptp_clock_unregister(cpts->clock); cpts->clock = NULL; + cpts->phc_index = -1; cpts_write32(cpts, 0, int_enable); cpts_write32(cpts, 0, control); @@ -667,6 +668,7 @@ struct cpts *cpts_create(struct device * cpts->cc.read = cpts_systim_read; cpts->cc.mask = CLOCKSOURCE_MASK(32); cpts->info = cpts_info; + cpts->phc_index = -1; cpts_calc_mult_shift(cpts); /* save cc.mult original value as it can be modified