Received: by 2002:a05:7412:8d23:b0:f7:29d7:fb05 with SMTP id bj35csp151150rdb; Sat, 16 Dec 2023 03:50:33 -0800 (PST) X-Google-Smtp-Source: AGHT+IFGoB1T4j41EENbJWMqNcQOl5I6lMPdv2rLQ1qcV3+EGmb9XHyN56wVzwGHoksPVJzJ+VWQ X-Received: by 2002:a17:903:2381:b0:1d3:629c:c02c with SMTP id v1-20020a170903238100b001d3629cc02cmr6180252plh.12.1702727432718; Sat, 16 Dec 2023 03:50:32 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1702727432; cv=none; d=google.com; s=arc-20160816; b=VBsZwxWRzI1Ilyq/HkrYzBA3Oa9BTOk7DliCQbsMdE8Jf5VnyKwqlBrvIf/QO6XoJO t8O/OFNDqMXFkdhMvbE0LI4VaHAB5VPpIME/r2TAfyCGP0UUZzvdl8wrjzTSroWeZ1E1 DekZDMM669oR3mF/ZOnDG8atd3jZ6L1l5DErubVqzmwudIAacH1W9DJd8lrdCwuUQla2 1n9+SfBRmjvwyKCAndJqdeMrR4IP9dMrYD8BvfNYIAkISlxQnyDPBoWxKp+JGutahxPH uS3kyqWZZmDeR4hWLMVfuSGJ83u/UFIw8AxmwlCoYfJOMsRosid6m+fXLNpI/M5mJnQ3 JrMQ== 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:date:subject:cc:to:from :dkim-signature; bh=33vAc5ck7zdvdX0qktOXfLvJPjpSeplyQvjMFmFH8tY=; fh=JRNH3R6BkbckLgmyv72Fq6g69IcAiTiL2Sp+o8fsz+8=; b=t91O+prEnwNXl1YyfheMzeziA2WF30eWFxegvKVLi9etmkqMZ6/jeiAcYXWGTguavA 1cnZGH7sKj+gjYWmn4YhDf3lIooeb8gWbMNDOESVV3O4xNhu++7HeBYbqfpjphcI6ohf S03Zrsnwa3FiMYLroB2Iucj8N8j1PM3NUAI44igudLcMlUwlNXHrY4S1/gLI/Cx6KmVy Jg1BO7SBKskRaQubeW/BmYU/7vTS+JdezYsaRUa+IZlpyEeL90Qr37ajKlGyLWpk7ZYY DAZNuB4T4+vg8csIvNiXFgyzh4Gm9lFOa9cK5ViCS5x2My3HouRZWCwn3ej8FwB4H/qx +j6g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@tuxon.dev header.s=google header.b=LoFzQsts; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:8 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from fry.vger.email (fry.vger.email. [2620:137:e000::3:8]) by mx.google.com with ESMTPS id u8-20020a170902e5c800b001d2e6c3f136si14958404plf.96.2023.12.16.03.50.32 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 16 Dec 2023 03:50:32 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:8 as permitted sender) client-ip=2620:137:e000::3:8; Authentication-Results: mx.google.com; dkim=pass header.i=@tuxon.dev header.s=google header.b=LoFzQsts; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:8 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 fry.vger.email (Postfix) with ESMTP id 247658108363; Thu, 14 Dec 2023 03:48:06 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at fry.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1444130AbjLNLrc (ORCPT + 99 others); Thu, 14 Dec 2023 06:47:32 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40538 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1444270AbjLNLq4 (ORCPT ); Thu, 14 Dec 2023 06:46:56 -0500 Received: from mail-ed1-x534.google.com (mail-ed1-x534.google.com [IPv6:2a00:1450:4864:20::534]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6E650D5D for ; Thu, 14 Dec 2023 03:46:44 -0800 (PST) Received: by mail-ed1-x534.google.com with SMTP id 4fb4d7f45d1cf-54bf9a54fe3so11086101a12.3 for ; Thu, 14 Dec 2023 03:46:44 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=tuxon.dev; s=google; t=1702554403; x=1703159203; 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=33vAc5ck7zdvdX0qktOXfLvJPjpSeplyQvjMFmFH8tY=; b=LoFzQstsVKFmbpptn1HQVy1NiqC8PnygBJJAhNpM54Cr8k0uT/Vih+aw8BmqUvYG1s EmtYhdKoEu5Bx7nQjjjFz57MaOu3btxYEAL27cxVYnQs9nlShDo1qCPTa1rs9ItTDPd8 YhKcm9Y+N+6qhI/v6YrD5lcXVw6R0SQkt/0F3g0B2cHPmoSqa2mfIunH8xMLg4oScPg5 MhhTqOlDK1ZuzZaBz73QeBDTkHJ1BE/O/o651PQj3iZBnLpCKAXAuSjMTWHFWTnBC9jd 5SS/rqPuhQOjRyd5tPH7a8r8/1WsVVzxJtOocpoHunTqKJYMWoThAAniuWb2dVtrEAPt Ne7w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1702554403; x=1703159203; 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=33vAc5ck7zdvdX0qktOXfLvJPjpSeplyQvjMFmFH8tY=; b=kKvep7p5g9kQEERFbPEKyNtw4UcW/qnZYlVB6gZeUyWXCpF4BH/Ci0x1V8KyMrK+Dd 6/HPl6S2JCj4RqHaIGObgoLlZOaN9MNYUcWgVLDAhyr2bArXXZHDCZNeUumzM3UF82D8 8HlVPw5kC8wFD7UMdPmrLePo+Ou04nxveVkZjPzVHzt0XCwnGlxMUVW4uQ55zX0abn+/ 4V9wqEGk58mga8eZFK9ewO7Cwhp4bxMHem5P6xwmdDxzAfF/b5U6Alpm4HKvXfxWOFmo xIFhma2wsiGNa8jHEL8TuUyjE/vNvxpj2cJSFT24TzabwNsUASYl3NLBhmZBI1rUkIoO g8Kg== X-Gm-Message-State: AOJu0Yy6jIWoPkimvt/lkCHX8w5q1+KAlHRLnK9DEN9LrEFR8ubX6q5r mp49t1dlgp0K0bAiwonI5lupaA== X-Received: by 2002:a17:907:c715:b0:a1d:551f:a197 with SMTP id ty21-20020a170907c71500b00a1d551fa197mr5941372ejc.82.1702554403005; Thu, 14 Dec 2023 03:46:43 -0800 (PST) Received: from claudiu-X670E-Pro-RS.. ([82.78.167.103]) by smtp.gmail.com with ESMTPSA id ll9-20020a170907190900b00a1da2f7c1d8sm9240877ejc.77.2023.12.14.03.46.41 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 14 Dec 2023 03:46:42 -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, yoshihiro.shimoda.uh@renesas.com, wsa+renesas@sang-engineering.com, geert+renesas@glider.be Cc: netdev@vger.kernel.org, linux-renesas-soc@vger.kernel.org, linux-kernel@vger.kernel.org, Claudiu Beznea Subject: [PATCH net-next v2 15/21] net: ravb: Simplify ravb_resume() Date: Thu, 14 Dec 2023 13:45:54 +0200 Message-Id: <20231214114600.2451162-16-claudiu.beznea.uj@bp.renesas.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20231214114600.2451162-1-claudiu.beznea.uj@bp.renesas.com> References: <20231214114600.2451162-1-claudiu.beznea.uj@bp.renesas.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-0.9 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on fry.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 (fry.vger.email [0.0.0.0]); Thu, 14 Dec 2023 03:48:06 -0800 (PST) From: Claudiu Beznea Remove explicit calls to functions that are called 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, PTP needed configurations were moved to ravb_wol_restore(). With this, code in ravb_resume() is simpler. Signed-off-by: Claudiu Beznea --- Changes in v2: - none; this patch is new drivers/net/ethernet/renesas/ravb_main.c | 60 ++++++++++-------------- 1 file changed, 24 insertions(+), 36 deletions(-) diff --git a/drivers/net/ethernet/renesas/ravb_main.c b/drivers/net/ethernet/renesas/ravb_main.c index 16450bf241cd..b581666e341f 100644 --- a/drivers/net/ethernet/renesas/ravb_main.c +++ b/drivers/net/ethernet/renesas/ravb_main.c @@ -2978,6 +2978,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_reset_mode(ndev); + 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]); @@ -3017,55 +3031,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_reset_mode(ndev); + 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; - ret = ravb_set_gti(ndev); - if (ret) - return ret; - - 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