Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp4020913pxb; Mon, 8 Feb 2021 06:12:23 -0800 (PST) X-Google-Smtp-Source: ABdhPJzqKo4eylWdAAIieEOxgcRAt2PWfp83iaMpUOGrQ955ew7tHwEY1gw5JuRtot92gajNaxkZ X-Received: by 2002:a05:6402:558:: with SMTP id i24mr15196045edx.190.1612793542929; Mon, 08 Feb 2021 06:12:22 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1612793542; cv=none; d=google.com; s=arc-20160816; b=jJfQAWGI89976SNfopJWsCx91O345df6IeYY/FVpbLem4r+aocl2M43knE62WL4sKU EKRSVLRUSx45Y5/IZAnX/HUia2kQEVXVfuyDP8w7uKg5tAAZXy2EWOid/TlOKUlARCLO qLpwdhHiTQXTwm5+r+EKrqBdEc+ERaImUU0nOC1CntC70ws+9moYxSl1mi4XMVFBPYUe TOCqP5aXlMWw9+L4+nFbD6KKf0wb4nbxhnk8Acc4XcDPZqE+15h+nkA7qlob9aJn14pE Ev82gKIPc1ZawODTAV7RuhgbSeFY66DJEEi+DxGkPvbn5zHqBIlGdfXr98uONpKOfl/g 34Tw== 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; bh=SltGs9DrCv2LPdq9BGMrfwgFkgHGWBEZUx/rnVENGVY=; b=DEXdhUQQly69NhGExT2wufBGDFFjxvdj6UL7qTYPFBzM16mvxE/Ks5r5EAZsxNpk2m cVL2UBw0QKU86rbaj1RPDf23V47ZouP/HbBm5fo6QieaIMXkY9cbt4IZcO90y/OrWaTy /9q1zy782zEBdx+sH5uy7Cw/SwHIDJzi2QILTfbejjjt0oaEWcmjf0CSgPs06QlvuFPg 4PsWssFrZ+X/JdB8ccOH0FxR5PEZe7nf/fL1kRzkxoINfD6KnBPiIdeMClcoxQAJRqI1 6P2plHQYW0Dk7nEMk6i+813IdqfbVxZUduQVEe6RlRHIxEwelWzwEPmd/5SVTVBv9yjY 8wXA== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id q18si1111013eji.611.2021.02.08.06.11.48; Mon, 08 Feb 2021 06:12:22 -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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232499AbhBHOLE (ORCPT + 99 others); Mon, 8 Feb 2021 09:11:04 -0500 Received: from mail.baikalelectronics.com ([87.245.175.226]:57062 "EHLO mail.baikalelectronics.ru" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231976AbhBHN6I (ORCPT ); Mon, 8 Feb 2021 08:58:08 -0500 From: Serge Semin To: Rob Herring , Giuseppe Cavallaro , Alexandre Torgue , Jose Abreu , "David S. Miller" , Jakub Kicinski , Johan Hovold , Maxime Ripard , Joao Pinto , Lars Persson , Maxime Coquelin , Jisheng Zhang CC: Serge Semin , Serge Semin , Alexey Malahov , Pavel Parkhomenko , Vyacheslav Mitrofanov , , , , , Subject: [PATCH v2 16/24] net: stmmac: Use optional reset control API to work with stmmaceth Date: Mon, 8 Feb 2021 16:56:00 +0300 Message-ID: <20210208135609.7685-17-Sergey.Semin@baikalelectronics.ru> In-Reply-To: <20210208135609.7685-1-Sergey.Semin@baikalelectronics.ru> References: <20210208135609.7685-1-Sergey.Semin@baikalelectronics.ru> MIME-Version: 1.0 Content-Transfer-Encoding: 7BIT Content-Type: text/plain; charset=US-ASCII X-ClientProxiedBy: MAIL.baikal.int (192.168.51.25) To mail (192.168.51.25) Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Since commit bb3222f71b57 ("net: stmmac: platform: use optional clk/reset get APIs") a manual implementation of the optional device reset control functionality has been replaced with using the devm_reset_control_get_optional() method. But for some reason the optional reset control handler usage hasn't been fixed and preserved the NULL-checking statements. There is no need in that in order to perform the reset control assertion/deassertion because the passed NULL will be considered by the reset framework as absent optional reset control handler anyway. Fixes: bb3222f71b57 ("net: stmmac: platform: use optional clk/reset get APIs") Signed-off-by: Serge Semin --- .../net/ethernet/stmicro/stmmac/stmmac_main.c | 19 ++++++++----------- 1 file changed, 8 insertions(+), 11 deletions(-) diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c index 4f1bf8f6538b..a8dec219c295 100644 --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c @@ -4935,15 +4935,13 @@ int stmmac_dvr_probe(struct device *device, if ((phyaddr >= 0) && (phyaddr <= 31)) priv->plat->phy_addr = phyaddr; - if (priv->plat->stmmac_rst) { - ret = reset_control_assert(priv->plat->stmmac_rst); - reset_control_deassert(priv->plat->stmmac_rst); - /* Some reset controllers have only reset callback instead of - * assert + deassert callbacks pair. - */ - if (ret == -ENOTSUPP) - reset_control_reset(priv->plat->stmmac_rst); - } + ret = reset_control_assert(priv->plat->stmmac_rst); + reset_control_deassert(priv->plat->stmmac_rst); + /* Some reset controllers have only reset callback instead of + * assert + deassert callbacks pair. + */ + if (ret == -ENOTSUPP) + reset_control_reset(priv->plat->stmmac_rst); /* Init MAC and get the capabilities */ ret = stmmac_hw_init(priv); @@ -5155,8 +5153,7 @@ int stmmac_dvr_remove(struct device *dev) stmmac_exit_fs(ndev); #endif phylink_destroy(priv->phylink); - if (priv->plat->stmmac_rst) - reset_control_assert(priv->plat->stmmac_rst); + reset_control_assert(priv->plat->stmmac_rst); if (priv->hw->pcs != STMMAC_PCS_TBI && priv->hw->pcs != STMMAC_PCS_RTBI) stmmac_mdio_unregister(ndev); -- 2.29.2