From patchwork Wed Oct 18 07:09:56 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Johannes Zink X-Patchwork-Id: 154726 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:612c:2908:b0:403:3b70:6f57 with SMTP id ib8csp4614478vqb; Wed, 18 Oct 2023 00:11:20 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEN3ZkrgD27Ldkp4H9tSY8dQ7LRUyQZIffxo01kQwdESeG3y+R2q1yp/nhtc/AWlrdHGx0n X-Received: by 2002:a17:903:26c2:b0:1b8:9fc4:2733 with SMTP id jg2-20020a17090326c200b001b89fc42733mr4389819plb.3.1697613080148; Wed, 18 Oct 2023 00:11:20 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697613080; cv=none; d=google.com; s=arc-20160816; b=0Go6DW076HG38Sm+8n+Eb+q8GVU0tEkJrwTE7FTjl1AaARwXNviEbdbpf6sBL91bz6 AQ0qq6UsBuN3MeVe+MU5PCH1aVM2wCYLTc7AzR72AViQbCkAWdvksXv4bauHtbhEQKBX yBk49Bm4JdxWKz6T5uxuFSosE6WX4FZI+yZQ9gtf/KspceERzqbgkTnwCGxK6XEUd2xt NzqsD5vVs/9ZHzLV4/M+Pl6jvG+SU53YfXVRgCX6mTq+Pv9EqUesWemohAcmLu4fa07Q gadF/QnP3LjPndnRXiPtKJUTe9lxLmobKm3SlXs2cumES6nDzJKFjwaSNUXYZ54ZZ7x7 5Edg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:in-reply-to:references:message-id :content-transfer-encoding:mime-version:subject:date:from; bh=/cvKlTDHD/2GK5Lh+wVMi0wyjHRyajFhX5yTKYHDpUw=; fh=ORiYWFGzsNPHx3R9sUr4HChCwLBtdlxf7scKSjOZpOw=; b=glT7klV2TsfhlF+2/TXa8hYxaM1bZNeKJVFZw92ZKuSAAfyz8YsCkEbkkx7FBWE43x uY/p6QY2Ic1hxX49nPPodBOpg51ZQasV77n2V2w8odv235tNPlmCDbZAW6QuriMuT2Sr MuMUR0OabS7ZQ7c/v4n75wtyWk4+fuq0MyrIs2URMMHV7wu9Y7AbJHZiwqxnaiKIp76H xIwxoIXOwFTCkzKdol1UYmBBPW/fTsXsNCczX9y4sX5TK2wKmakEf3mxHYSpnrG9E8MF zsZzQ26sALo8atKeEKmyBFgCjwl5cV2AAjsw4YeQvvLiMYi5xnosIT70kuYZO7yed2UG Gk7A== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:2 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from agentk.vger.email (agentk.vger.email. [2620:137:e000::3:2]) by mx.google.com with ESMTPS id 20-20020a170902c25400b001c9de48fc7asi3471752plg.170.2023.10.18.00.11.19 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 18 Oct 2023 00:11:20 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:2 as permitted sender) client-ip=2620:137:e000::3:2; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:2 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by agentk.vger.email (Postfix) with ESMTP id 1864A809EC99; Wed, 18 Oct 2023 00:11:09 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at agentk.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1344595AbjJRHKq (ORCPT + 23 others); Wed, 18 Oct 2023 03:10:46 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40374 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229807AbjJRHKf (ORCPT ); Wed, 18 Oct 2023 03:10:35 -0400 Received: from metis.whiteo.stw.pengutronix.de (metis.whiteo.stw.pengutronix.de [IPv6:2a0a:edc0:2:b01:1d::104]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DF032100 for ; Wed, 18 Oct 2023 00:10:33 -0700 (PDT) Received: from drehscheibe.grey.stw.pengutronix.de ([2a0a:edc0:0:c01:1d::a2]) by metis.whiteo.stw.pengutronix.de with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1qt0h1-0007Yt-S9; Wed, 18 Oct 2023 09:10:11 +0200 Received: from [2a0a:edc0:0:1101:1d::39] (helo=dude03.red.stw.pengutronix.de) by drehscheibe.grey.stw.pengutronix.de with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1qt0gz-002V9c-41; Wed, 18 Oct 2023 09:10:09 +0200 Received: from localhost ([::1] helo=dude03.red.stw.pengutronix.de) by dude03.red.stw.pengutronix.de with esmtp (Exim 4.96) (envelope-from ) id 1qt0gz-003JoA-07; Wed, 18 Oct 2023 09:10:09 +0200 From: Johannes Zink Date: Wed, 18 Oct 2023 09:09:56 +0200 Subject: [PATCH net-next v2 4/5] net: stmmac: ptp: stmmac_enable(): move change of plat->flags into mutex MIME-Version: 1.0 Message-Id: <20231010-stmmac_fix_auxiliary_event_capture-v2-4-51d5f56542d7@pengutronix.de> References: <20231010-stmmac_fix_auxiliary_event_capture-v2-0-51d5f56542d7@pengutronix.de> In-Reply-To: <20231010-stmmac_fix_auxiliary_event_capture-v2-0-51d5f56542d7@pengutronix.de> To: Alexandre Torgue , Jose Abreu , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Maxime Coquelin , Richard Cochran , Kurt Kanzenbach Cc: patchwork-jzi@pengutronix.de, netdev@vger.kernel.org, linux-stm32@st-md-mailman.stormreply.com, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, kernel@pengutronix.de, vee.khee.wong@linux.intel.com, tee.min.tan@intel.com, rmk+kernel@armlinux.org.uk, bartosz.golaszewski@linaro.org, ahalaney@redhat.com, horms@kernel.org, Johannes Zink X-Mailer: b4 0.12.0 X-SA-Exim-Connect-IP: 2a0a:edc0:0:c01:1d::a2 X-SA-Exim-Mail-From: j.zink@pengutronix.de X-SA-Exim-Scanned: No (on metis.whiteo.stw.pengutronix.de); SAEximRunCond expanded to false X-PTX-Original-Recipient: linux-kernel@vger.kernel.org X-Spam-Status: No, score=-0.8 required=5.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on agentk.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (agentk.vger.email [0.0.0.0]); Wed, 18 Oct 2023 00:11:09 -0700 (PDT) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1780076333231264236 X-GMAIL-MSGID: 1780076333231264236 This is a preparation patch. The next patch will check if an external TS is active and return with an error. So we have to move the change of the plat->flags that tracks if external timestamping is enabled after that check. Prepare for this change and move the plat->flags change into the mutex and the if (on). Signed-off-by: Johannes Zink --- Changelog: v1 -> v2: no changes --- drivers/net/ethernet/stmicro/stmmac/stmmac_ptp.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_ptp.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_ptp.c index 300e673d2a36..6b639b62f778 100644 --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_ptp.c +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_ptp.c @@ -192,17 +192,17 @@ static int stmmac_enable(struct ptp_clock_info *ptp, write_unlock_irqrestore(&priv->ptp_lock, flags); break; case PTP_CLK_REQ_EXTTS: - if (on) - priv->plat->flags |= STMMAC_FLAG_EXT_SNAPSHOT_EN; - else - priv->plat->flags &= ~STMMAC_FLAG_EXT_SNAPSHOT_EN; mutex_lock(&priv->aux_ts_lock); acr_value = readl(ptpaddr + PTP_ACR); acr_value &= ~PTP_ACR_MASK; if (on) { + priv->plat->flags |= STMMAC_FLAG_EXT_SNAPSHOT_EN; + /* Enable External snapshot trigger */ acr_value |= PTP_ACR_ATSEN(rq->extts.index); acr_value |= PTP_ACR_ATSFC; + } else { + priv->plat->flags &= ~STMMAC_FLAG_EXT_SNAPSHOT_EN; } netdev_dbg(priv->dev, "Auxiliary Snapshot %d %s.\n", rq->extts.index, on ? "enabled" : "disabled");