Received: by 2002:a05:7412:98c1:b0:fa:551:50a7 with SMTP id kc1csp10038rdb; Fri, 5 Jan 2024 00:29:16 -0800 (PST) X-Google-Smtp-Source: AGHT+IFuArZlA+afrQjWZQLHCtdaHxmyeq+6uQ2xGFcrtrRRGwJKifMBIqPlcmhpRDj7cTUGfNVl X-Received: by 2002:a05:6808:10c4:b0:3bb:bf35:f82f with SMTP id s4-20020a05680810c400b003bbbf35f82fmr2195688ois.104.1704443355928; Fri, 05 Jan 2024 00:29:15 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1704443355; cv=none; d=google.com; s=arc-20160816; b=D4OWYe2AXAzBQQOj1cZICkkjSiFXBPV+KooaFgmCFtM4sjM2Di5Kjfm2xNltYw3nAc cTLeNOiRz9j9dQopQFoa2DG/Xnbi1HFS9AVVteebFRMZFRZ2bIKsGAvuKVVDi846e6/e R29GQODAkmv6T9Uinv2xSASIvNJp0I/49vQWnb+BdK+NAuWvwwP+CLuOoROAfTeJ+PaA 7u2a33/X3WKNxd8fLSCplXWfH5XidxFtgHupNzT0iSgvOoOJwLc4kUvhTAzaTzvjy2y8 GuNhsKYr42ixE0cBsGW9xo8GWG1C0Oa+/hZm67W0tHcnGBU82gZzZLzDRlFehDv7yaZO blKw== ARC-Message-Signature: i=1; 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=5U2pCYzsTsR2Xw27TGhf44nRfdvpa0/cuFsAnchyMS4=; fh=qryrdWWtksp4Ojh0keXejXriHeHARah4mOGZkuZ1jnk=; b=yD4hAQ53KmHpOiC79JglAxBXXPqXXvjD2WaWVVlwkXZCNCbZWclpg4AMH/6enLkZpU xNjVI4p6sbhzDVkqx2PowgA4hSjFHHjKC6JZyFv4BVoOty3NgiAwKo9z1oIOgkvurCHy f03lQ9MuPTDYqYmdsCeNhoaU5BlH20ztHC19uD5PrcZd92ATJ11/hliz2rMZUkc9NVmM ipfciAOXMnoT7xEoU+56Lu4fdqYyDWTgK3ZqaetSJHuNqTcmMcgoJfAtatS2/xszg8Rm DrcyA722+AX6SkRb1bn/ubRu1EIr0VLAxxM8OMO7DNJ9tU4yxZUC55F3pGJesRI24ATP ryDg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@tuxon.dev header.s=google header.b=gsgGM5Lt; spf=pass (google.com: domain of linux-kernel+bounces-17594-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-17594-linux.lists.archive=gmail.com@vger.kernel.org" Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id bj20-20020a056a02019400b005b16e351343si962444pgb.241.2024.01.05.00.29.15 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 05 Jan 2024 00:29:15 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-17594-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) client-ip=2604:1380:45e3:2400::1; Authentication-Results: mx.google.com; dkim=pass header.i=@tuxon.dev header.s=google header.b=gsgGM5Lt; spf=pass (google.com: domain of linux-kernel+bounces-17594-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-17594-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 sv.mirrors.kernel.org (Postfix) with ESMTPS id 8EC83287B0A for ; Fri, 5 Jan 2024 08:29:15 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 52D5822F0A; Fri, 5 Jan 2024 08:25:15 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=tuxon.dev header.i=@tuxon.dev header.b="gsgGM5Lt" X-Original-To: linux-kernel@vger.kernel.org Received: from mail-ed1-f46.google.com (mail-ed1-f46.google.com [209.85.208.46]) (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 256D72E62D for ; Fri, 5 Jan 2024 08:25:13 +0000 (UTC) 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-ed1-f46.google.com with SMTP id 4fb4d7f45d1cf-55722620e4aso520254a12.0 for ; Fri, 05 Jan 2024 00:25:12 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=tuxon.dev; s=google; t=1704443111; x=1705047911; 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=5U2pCYzsTsR2Xw27TGhf44nRfdvpa0/cuFsAnchyMS4=; b=gsgGM5Lt+4lEhMw05w9UEQd3DGPWmnaC5f0z0sLslPQpx9dpaeKjQEp5k9f3pO2yy2 lzn/2HBTokVHEa02+U4zjBDDXOoqaiv+f3XuyoEWSMpVsjyvERRMKj6vJFuCPrlI5foX AQy7kCNLwvS8/abhkZZW4+K30yCTdkbNh9y/3MHbpAuaskEGwF1KE9Mbvq8tcM+NMGt2 GRJbt8nK39bKsylVPs/XjBcn2R2amhqEamfaaV1OCXF6S6qcegdSkfgwXZfZTU9Aac2t ty3yBpgmN3G1G5Ki9orffF3G4CNbMErPHqYnCT6XDG6YMHEuYyW/FoNrkPImP+4hVBh8 ZkHw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1704443111; x=1705047911; 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=5U2pCYzsTsR2Xw27TGhf44nRfdvpa0/cuFsAnchyMS4=; b=KDxXxIz4Iev5+a+65xVqKjpqAQVj87/nqgxp+kFVy5ZREYGu7ZGiR/ILSX5/VHjNSB urnY/b9ErsoQkWP6qxawVsi4yuu9CBleq+rOzvUVnhA+cz3HhtP/WLv1asEfldUBgEsU L0v5yWcRSA5O0ziFn1FFiPD1gqfdw/rUOmFaOYx/Br70OT/PqKUz8sgY/i98S/pApVnA UzJ2EhcubO7vHAWEVvsAeTTD9ivsIXZIQMg/4d+SriyHvKHCL7a0CvKkcuxw/rI/B0y1 JALcvugJJYKuvTVcZ7zJueDXj3gvKo8xnsRSB7u6ALXEgxUUERoP5A2DT6CtTKzMXBiO 0JcQ== X-Gm-Message-State: AOJu0YxTliscEZAQCL6t51Wolz8cVfpS0f0isTqz2RtehKoH7t9MevlZ o6dIQDyVQv3oelyLprjIfBzn4TuZncD6MA== X-Received: by 2002:a17:907:747:b0:a27:d1d6:c578 with SMTP id xc7-20020a170907074700b00a27d1d6c578mr1065921ejb.27.1704443111453; Fri, 05 Jan 2024 00:25:11 -0800 (PST) Received: from claudiu-X670E-Pro-RS.. ([82.78.167.5]) by smtp.gmail.com with ESMTPSA id j15-20020a1709064b4f00b00a28e759a447sm596198ejv.213.2024.01.05.00.25.07 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 05 Jan 2024 00:25:11 -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 Cc: netdev@vger.kernel.org, linux-renesas-soc@vger.kernel.org, linux-kernel@vger.kernel.org, claudiu.beznea@tuxon.dev, geert+renesas@glider.be, Claudiu Beznea Subject: [PATCH net-next v3 15/19] net: ravb: Simplify ravb_resume() Date: Fri, 5 Jan 2024 10:23:35 +0200 Message-Id: <20240105082339.1468817-16-claudiu.beznea.uj@bp.renesas.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240105082339.1468817-1-claudiu.beznea.uj@bp.renesas.com> References: <20240105082339.1468817-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 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 1d228e0d875f..06c7ee45d567 100644 --- a/drivers/net/ethernet/renesas/ravb_main.c +++ b/drivers/net/ethernet/renesas/ravb_main.c @@ -2900,6 +2900,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]); @@ -2939,53 +2953,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