Received: by 2002:a05:7412:5112:b0:fa:6e18:a558 with SMTP id fm18csp1047788rdb; Wed, 24 Jan 2024 03:22:01 -0800 (PST) X-Google-Smtp-Source: AGHT+IGM8SYLL+tcnoI6wy9G9LdOpaFdbqOX3NVYg+P8n42oq3Hrw8LfNV2H3NpPRHpiy4mweBgq X-Received: by 2002:a17:906:5294:b0:a2d:d05e:c46a with SMTP id c20-20020a170906529400b00a2dd05ec46amr1092120ejm.15.1706095320899; Wed, 24 Jan 2024 03:22:00 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1706095320; cv=pass; d=google.com; s=arc-20160816; b=FFIDEsHukPYEy9ssfb+hP9K4puvorXNmeSAa12ZoYs3pjDEdWoZAA1w/Inr1ghO++R LjVUTCwuBjw1YC6AMVt/E3JOJ22aFuo2j4uNPjzA6N4PsGmF+fn5W1DrzhlSeP4QBIuZ woQKgqwIbtDzGC17MrqptfK1XyPxV+MOzv0sRjDq2gH6KSccgeo5uH0ozQau0W5AohI9 tDLGw3WAulNjYrd+he9IqiHqp+/8bzaHhZsFuQNF1hv2djvwothIY2bouQyk0HwN82nK hgAOy8xxVvpOMIMK65etuSz7khkUg+l4MU9JwFmn0HLa0Sqekjl7an1/fjHmM0rz0tOy 6YsA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=Gee9HyQUIxP/lOlV73mQEGTBYaMlN2Gud82I2snD3lY=; fh=UyecQQQXnYrqJOxUwLOxxxo1ko/XVjNRN6+YZN+rtNE=; b=SS5GyVOueUeBQPfhm+v3SbiwEpTc0coYdvNRYpMrosq+VZUw9VaNZlHsabeb0Ktq7t PM6cwcbMTn/3913wVtQg8p1doLjx0fDcEBRil4u7mlEB9QxDlNiwxT3KUlvhRfyEc9bJ njRiNya2jPDVoeP9V+cIjbx7NeejLH2sSewRhn00OEfrkS6jv8raH/0QQvo2mH1TNMrF T1hvyuVtBZJdICLGafVEfnZE10JHE/xNTjkwNUKbRwpNt8nhDvo5bjfqao3pgGK5+jiJ v1ITIMUDalRPWc1aYXZfe1b4gXA4LP0HjqSR4wIaD2Z4wM93sWzFiJHaDVlIsw1u8pBE dr+w== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@tuxon.dev header.s=google header.b=Ti8TJJXr; arc=pass (i=1 spf=pass spfdomain=tuxon.dev dkim=pass dkdomain=tuxon.dev); spf=pass (google.com: domain of linux-kernel+bounces-35305-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-35305-linux.lists.archive=gmail.com@vger.kernel.org" Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [147.75.80.249]) by mx.google.com with ESMTPS id bf10-20020a0564021a4a00b0055c2c6a4df4si3509949edb.319.2024.01.24.03.22.00 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 24 Jan 2024 03:22:00 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-35305-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) client-ip=147.75.80.249; Authentication-Results: mx.google.com; dkim=pass header.i=@tuxon.dev header.s=google header.b=Ti8TJJXr; arc=pass (i=1 spf=pass spfdomain=tuxon.dev dkim=pass dkdomain=tuxon.dev); spf=pass (google.com: domain of linux-kernel+bounces-35305-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-35305-linux.lists.archive=gmail.com@vger.kernel.org" Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id 7F31D1F2A064 for ; Tue, 23 Jan 2024 13:05:46 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 9E1FE61679; Tue, 23 Jan 2024 12:59:55 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=tuxon.dev header.i=@tuxon.dev header.b="Ti8TJJXr" Received: from mail-wm1-f50.google.com (mail-wm1-f50.google.com [209.85.128.50]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 1C5FD60EE4 for ; Tue, 23 Jan 2024 12:59:52 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.50 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706014794; cv=none; b=hLsEseJc6jMkOpOxeht4+fNjTDnO7rihHZbFGPWeXOpc1kdyiO1Fb3FghMFPudKbp886cJLa93lQv2NF5jBSnz3eXrbbRndrzH3GPQaE+02bsUjUeAnDT0d6g4lPDBeye+GipV3pdZeupGdrPtXpwAP6xrd9jVQNd+efLxRXEfs= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706014794; c=relaxed/simple; bh=GAfex3EeCPOP5cI6V5/XBZUeYcq3hRCugb2RoCTcDIw=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=ajRk1/K2w6t1euU3qxCv2uRFwOZwEacMICRMF8XP21boVOT5+RNMJccty/fMrYB3YUDngiSe+drGhuJTRWrchncGaqdVgZ8fxb/+IB4ePrggPJ8HQzHgYoyCPLWe/kN0PzPt4icQTDfND84feTQHJFI912wZsd0Y8dnFrHNq06k= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=tuxon.dev; spf=pass smtp.mailfrom=tuxon.dev; dkim=pass (2048-bit key) header.d=tuxon.dev header.i=@tuxon.dev header.b=Ti8TJJXr; arc=none smtp.client-ip=209.85.128.50 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=tuxon.dev Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=tuxon.dev Received: by mail-wm1-f50.google.com with SMTP id 5b1f17b1804b1-40e490c2115so32382165e9.0 for ; Tue, 23 Jan 2024 04:59:52 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=tuxon.dev; s=google; t=1706014791; x=1706619591; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=Gee9HyQUIxP/lOlV73mQEGTBYaMlN2Gud82I2snD3lY=; b=Ti8TJJXrVyNSkWt4/LQ3iQAdtT/hduqfZPWbO8tIv/sETH09Pb9WiSYh1Q7sIptpMH kRyf+RlG8GNmLtupoJDbQvFbg1MB7MD034YPKRJNnVy3GY749dMZc0NI9uMSUi13qy4X 9NB1ZhyY+aX/k2TgwAwUA5AVSX6GBSE4vl5YnwgMci+vjZD1s/xA7a+t4LYTFUL7Uig0 Jjy+rViQ4KheY8M8XGVmeh6/+/DAw4LOgSBftQFqPjrAsxoLl2Nx+VUxRtHpyIkv711l 2KqjQR4R14LJ9yhVquyQLdlvaLt78TUuRz3iju/6QOTJgBfPoqWew//RQEY2bRMWhHXg tXdg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1706014791; x=1706619591; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=Gee9HyQUIxP/lOlV73mQEGTBYaMlN2Gud82I2snD3lY=; b=LurIr53Z98wd3zOul7iUk53h2tWV279M0PQVVGO8C8mH/JRqS3GkFcWncv9a79nzx6 z07hOJ966J6/VCYl5poDMlq9zX7CWQ1xM/ckcpVZZkuRYfIokoJDdlSdI4B9Bc0hpyHp 8vOkyCD8SS+1NHnHOvic6kP7hdJEiPyrpgcEILU6c8NLTVtkcalsFHi8Fdxi91L+y5hp SU7MRknU3Ak1iFcZSuMN0unMajEKbdFpwQF7NDw0yCWpDKfadw40XXxh31gV81RLf2+h C9duI81MADVyJJOfEwGp4HHa1TFMBcshbwsLJJ7p+1ta1NP14yH7p5vfo4oF9XP1lCCm 2aBg== X-Gm-Message-State: AOJu0YzopSYA2wkm22QQhv4DVzvREGeoD02OsKJk+Z2u03ChPbDWDIG/ 6kPXWo2tZgBiNTo/Fny506Wcz7kYZBUHjR72bSimNUFvVuDkneDrTlaHydLghB4= X-Received: by 2002:a7b:c4d0:0:b0:40e:937f:16d8 with SMTP id g16-20020a7bc4d0000000b0040e937f16d8mr122523wmk.50.1706014791440; Tue, 23 Jan 2024 04:59:51 -0800 (PST) Received: from claudiu-X670E-Pro-RS.. ([82.78.167.135]) by smtp.gmail.com with ESMTPSA id s4-20020a05600c45c400b0040e6ff60057sm33655711wmo.48.2024.01.23.04.59.50 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 23 Jan 2024 04:59:51 -0800 (PST) From: Claudiu X-Google-Original-From: Claudiu To: s.shtylyov@omp.ru, davem@davemloft.net, edumazet@google.com, kuba@kernel.org, pabeni@redhat.com, richardcochran@gmail.com, p.zabel@pengutronix.de, geert+renesas@glider.be Cc: netdev@vger.kernel.org, linux-renesas-soc@vger.kernel.org, linux-kernel@vger.kernel.org, claudiu.beznea@tuxon.dev, Claudiu Beznea Subject: [PATCH net-next v4 15/15] net: ravb: Simplify ravb_resume() Date: Tue, 23 Jan 2024 14:58:29 +0200 Message-Id: <20240123125829.3970325-16-claudiu.beznea.uj@bp.renesas.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240123125829.3970325-1-claudiu.beznea.uj@bp.renesas.com> References: <20240123125829.3970325-1-claudiu.beznea.uj@bp.renesas.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit From: Claudiu Beznea Remove explicit calls to functions that are called by ravb_open(). There is no need to have them doubled now that the ravb_open() already contains what is needed for the interface configuration. Along with it, configurations needed by PTP were moved to ravb_wol_restore(). With this, code in ravb_resume() becomes simpler. Reviewed-by: Sergey Shtylyov Signed-off-by: Claudiu Beznea --- Changes in v4: - none Changes in v3: - fixed typos in patch description - collected tags Changes in v2: - none; this patch is new drivers/net/ethernet/renesas/ravb_main.c | 58 ++++++++++-------------- 1 file changed, 24 insertions(+), 34 deletions(-) diff --git a/drivers/net/ethernet/renesas/ravb_main.c b/drivers/net/ethernet/renesas/ravb_main.c index 74568c836468..ff105e332396 100644 --- a/drivers/net/ethernet/renesas/ravb_main.c +++ b/drivers/net/ethernet/renesas/ravb_main.c @@ -2939,6 +2939,20 @@ static int ravb_wol_restore(struct net_device *ndev) { struct ravb_private *priv = netdev_priv(ndev); const struct ravb_hw_info *info = priv->info; + int error; + + /* Set reset mode to rearm the WoL logic. */ + error = ravb_set_opmode(ndev, CCC_OPC_RESET); + if (error) + return error; + + /* Set AVB config mode. */ + error = ravb_set_config_mode(ndev); + if (error) + return error; + + if (priv->info->ccc_gac) + ravb_ptp_init(ndev, priv->pdev); if (info->nc_queues) napi_enable(&priv->napi[RAVB_NC]); @@ -2978,53 +2992,29 @@ static int ravb_resume(struct device *dev) { struct net_device *ndev = dev_get_drvdata(dev); struct ravb_private *priv = netdev_priv(ndev); - const struct ravb_hw_info *info = priv->info; int ret; ret = reset_control_deassert(priv->rstc); if (ret) return ret; - /* If WoL is enabled set reset mode to rearm the WoL logic */ + if (!netif_running(ndev)) + return 0; + + /* If WoL is enabled restore the interface. */ if (priv->wol_enabled) { - ret = ravb_set_opmode(ndev, CCC_OPC_RESET); + ret = ravb_wol_restore(ndev); if (ret) return ret; } - /* All register have been reset to default values. - * Restore all registers which where setup at probe time and - * reopen device if it was running before system suspended. - */ - - /* Set AVB config mode */ - ret = ravb_set_config_mode(ndev); - if (ret) + /* Reopening the interface will restore the device to the working state. */ + ret = ravb_open(ndev); + if (ret < 0) return ret; - ravb_set_gti(ndev); - - if (info->internal_delay) - ravb_set_delay_mode(ndev); - - /* Restore descriptor base address table */ - ravb_write(ndev, priv->desc_bat_dma, DBAT); - - if (priv->info->ccc_gac) - ravb_ptp_init(ndev, priv->pdev); - - if (netif_running(ndev)) { - if (priv->wol_enabled) { - ret = ravb_wol_restore(ndev); - if (ret) - return ret; - } - ret = ravb_open(ndev); - if (ret < 0) - return ret; - ravb_set_rx_mode(ndev); - netif_device_attach(ndev); - } + ravb_set_rx_mode(ndev); + netif_device_attach(ndev); return ret; } -- 2.39.2