Received: by 2002:a05:6a10:af89:0:0:0:0 with SMTP id iu9csp5380753pxb; Wed, 26 Jan 2022 10:35:37 -0800 (PST) X-Google-Smtp-Source: ABdhPJyChZ9Xnc5ue+zlqtkjanqxIvmB3QFE7keMliPCUzccztusJKjk8I5kARCybgdwnCemjUG0 X-Received: by 2002:a17:907:7f90:: with SMTP id qk16mr10210ejc.85.1643222137028; Wed, 26 Jan 2022 10:35:37 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1643222137; cv=none; d=google.com; s=arc-20160816; b=NTOCtWmxGum7EG0V+DPVnXAS/lEG+k4rEuhSykrnWxx15rDor2fDH9KNMqOPoVBmnz t74Ssy0BlPLA8i+IpzkqfT5mBgsdAsXeQsvcZzrFQVrOIuh0Rrwnu+VtNBU1/k/m/aiO yvknG3ZIIzbRjNTcfA4GNyVOVwXYgBmswPOOTEVnBUpW6SZh78Aax7cI6QsIRFUomymG hx5u4k6LXHDJJIZL9VKBIaRbwtXCS2boxGxwCGC7u3MSmQSd3p6D51mnjmiSS/IcDvj/ 8CBbZdy+4ilRMQ/JT45l30SqUyQeTGhncMsXCnvyhgDEzkn1jTnD47/aJzx1Em1jrCHo KopQ== 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 :references:in-reply-to:message-id:subject:cc:to:from:date :dkim-signature; bh=qL3DjBVmDx7KXWh8M5YqktTuBw1cHFIaD7+I3Y1LOkw=; b=b+Egppjei0WPCkIzGoYfvYJo5qKu70but0wSxEipvVHVb8k+N9JIt/Iun2cVmrLKBv OPVszCDxgCMQyK/eCVH2wOixLltIKVFkV1+1CFADdgLfzs4J7BIQtu2rNuuUWC1UsbUS 5OP2XpV8QieOK/I5/JFOUkaoxs7FWtvQ4dl1lMK1/ORqOG4i4c4Zu1nWKlMtLciawkpM E701vOIoAXPulkqoRg87gHxUSbuZ7qp8/fQPkUJ65W1RlhVD8zulFrn0zBiuXYosYi2l 5s7mMTD8081oZ/3LG2bycfVWbW+WqKZzY2Qk+IafEm7wr4E8WGfJRlezRaSFimXHGVSF di8Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=cwQgwPJR; 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=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id s21si1473edd.236.2022.01.26.10.34.47; Wed, 26 Jan 2022 10:35:37 -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=@kernel.org header.s=k20201202 header.b=cwQgwPJR; 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=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229915AbiAZESD (ORCPT + 99 others); Tue, 25 Jan 2022 23:18:03 -0500 Received: from sin.source.kernel.org ([145.40.73.55]:49682 "EHLO sin.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229671AbiAZESB (ORCPT ); Tue, 25 Jan 2022 23:18:01 -0500 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sin.source.kernel.org (Postfix) with ESMTPS id CBE00CE1BBF; Wed, 26 Jan 2022 04:17:59 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 61B32C340E3; Wed, 26 Jan 2022 04:17:57 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1643170678; bh=MaAuNjsFO8On+BGpUOJ4aK1T9MBVNUh+44P2Z4qFPYQ=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=cwQgwPJRdJ0WHqCqAeWadgK+l1IyR8R05fdGOpE3f90v/9Ocq2lw1LDrenpG8/++/ 0bly1h4lIoY1v8CpsT7bVS4nLTaX4DPGQ6lnpLJKg3G0n0gqM9af7BGFVW94y75Y8n ZuJ7zuNkG5DK7zmOMxT2VCLsxahb9u6jfrgzLybhiWvhxkFjgx2weWPdnrD6i+6Anj d3Zzl0xzlwM0kjCF7uKvK+K6++Rn0uiiivlAX6fVtCZ7nhrdJRU0EsRolboOcSag92 NJ8fq7P66AT8IjK0TVB21pjKjmAsa1QskuKMIpB+4MwlFPbwaYYSMRiW+g1pezaYWm vV9d8AgmG3u4Q== Date: Tue, 25 Jan 2022 20:17:56 -0800 From: Jakub Kicinski To: Mohammad Athari Bin Ismail Cc: Giuseppe Cavallaro , Alexandre Torgue , Jose Abreu , "David S . Miller" , Maxime Coquelin , Ong Boon Leong , Voon Weifeng , Wong Vee Khee , Huacai Chen , Alexandre Torgue , netdev@vger.kernel.org, linux-stm32@st-md-mailman.stormreply.com, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, stable@vger.kernel.org Subject: Re: [PATCH net v2 2/2] net: stmmac: skip only stmmac_ptp_register when resume from suspend Message-ID: <20220125201756.1606e1c4@kicinski-fedora-PC1C0HJN.hsd1.ca.comcast.net> In-Reply-To: <20220125032324.4055-3-mohammad.athari.ismail@intel.com> References: <20220125032324.4055-1-mohammad.athari.ismail@intel.com> <20220125032324.4055-3-mohammad.athari.ismail@intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, 25 Jan 2022 11:23:24 +0800 Mohammad Athari Bin Ismail wrote: > diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c > index d7e261768f73..b8e5e19e6f7b 100644 > --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c > +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c > @@ -880,11 +880,12 @@ EXPORT_SYMBOL_GPL(stmmac_init_tstamp_counter); > /** > * stmmac_init_ptp - init PTP > * @priv: driver private structure > + * @ptp_register: register PTP if set > * Description: this is to verify if the HW supports the PTPv1 or PTPv2. > * This is done by looking at the HW cap. register. > * This function also registers the ptp driver. > */ > -static int stmmac_init_ptp(struct stmmac_priv *priv) > +static int stmmac_init_ptp(struct stmmac_priv *priv, bool ptp_register) > { > bool xmac = priv->plat->has_gmac4 || priv->plat->has_xgmac; > int ret; > @@ -914,7 +915,8 @@ static int stmmac_init_ptp(struct stmmac_priv *priv) > priv->hwts_tx_en = 0; > priv->hwts_rx_en = 0; > > - stmmac_ptp_register(priv); > + if (ptp_register) > + stmmac_ptp_register(priv); stmmac_init_ptp() only has one caller, and the registration step is last. Wouldn't it be better to move the stmmac_ptp_register() call out to stmmac_hw_setup()? That way we don't need to pass extra arguments to init. > return 0; > } > @@ -3241,7 +3243,7 @@ static int stmmac_fpe_start_wq(struct stmmac_priv *priv) > /** > * stmmac_hw_setup - setup mac in a usable state. > * @dev : pointer to the device structure. > - * @init_ptp: initialize PTP if set > + * @ptp_register: register PTP if set > * Description: > * this is the main function to setup the HW in a usable state because the > * dma engine is reset, the core registers are configured (e.g. AXI, > @@ -3251,7 +3253,7 @@ static int stmmac_fpe_start_wq(struct stmmac_priv *priv) > * 0 on success and an appropriate (-)ve integer as defined in errno.h > * file on failure. > */ > -static int stmmac_hw_setup(struct net_device *dev, bool init_ptp) > +static int stmmac_hw_setup(struct net_device *dev, bool ptp_register) > { > struct stmmac_priv *priv = netdev_priv(dev); > u32 rx_cnt = priv->plat->rx_queues_to_use; > @@ -3308,13 +3310,11 @@ static int stmmac_hw_setup(struct net_device *dev, bool init_ptp) > > stmmac_mmc_setup(priv); > > - if (init_ptp) { > - ret = stmmac_init_ptp(priv); > - if (ret == -EOPNOTSUPP) > - netdev_warn(priv->dev, "PTP not supported by HW\n"); > - else if (ret) > - netdev_warn(priv->dev, "PTP init failed\n"); > - } > + ret = stmmac_init_ptp(priv, ptp_register); > + if (ret == -EOPNOTSUPP) > + netdev_warn(priv->dev, "PTP not supported by HW\n"); > + else if (ret) > + netdev_warn(priv->dev, "PTP init failed\n");