Received: by 2002:a25:8b12:0:0:0:0:0 with SMTP id i18csp3567204ybl; Mon, 12 Aug 2019 02:42:00 -0700 (PDT) X-Google-Smtp-Source: APXvYqxcuU7mESgvO0Eb1zr9XqApio2AFMbtdbcW2hW0FciCwrQbwsAGarTcCv5ppDUyfCTjKbNO X-Received: by 2002:aa7:8e17:: with SMTP id c23mr34946565pfr.227.1565602920642; Mon, 12 Aug 2019 02:42:00 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1565602920; cv=none; d=google.com; s=arc-20160816; b=abRseyoFCxBjfxvEsBK/YwMC3Yus/alo5ohZf68oaLv4p8I6n7CzCw4dnu6C/CfArx Bff+i+A6pqD8y7ipA1rAjuhkirQGLJrS2bv27UO9mnPP14oz660d7BFT2O/UehC75wlW C6icu5dHH9K05065TvWhJ4ti9I4wcBY5sT/4mdb7rA80uOATS3JRF4wFfUqf3woAAYeJ nGRbk3NDNXDfwmptxM/ktwNigIAH3feQq9rRCRTvcmo8sVkR1eV+Trgbm9WQl27jOmjj ykY5g0yT4B34HHxOivHO0S4n9M5dOh5Rzz/vfPeAGRLdYtNCTbPSq0+Pyq3JxqVozfzX s8Nw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:reply-to:references:in-reply-to :message-id:date:subject:cc:to:from; bh=TH+xPDYf0bXNTaCEjvE+lwoWHDTGNpRCrVLnjI9VRoE=; b=s1i8b4xIEfD2emXU/Q00CUBkJY3u1y93gtuTI1kLAgjmSAp+l+DedSJf2l2sjEJQs3 uFM6KMdei6uGHXHQYWEWzMAOomGz4atEh2Gryeh6vFvoqKd6deKks6NjADtnH8KBcYh6 p3bJujgcw1bUSLMwhM3WurjDcgeKx35q3nZ0MjKoQaA8iN1dwh5rVoGE9cx7Lu/wpXij X/q7fNu74iD/EoP9E9Gpq53TNxKiQimQTOhOK1lGjwNZueagkrcXi5F1LBFxLlAk2qVh 481swc0JECzJOwUmOMi9CNVdD7Hy8/2olHGyQx1MqS61ULuoV+MyI/9xpkRaPJhPv/GX KnBg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=nxp.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id x78si60471311pgx.471.2019.08.12.02.41.45; Mon, 12 Aug 2019 02:42:00 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=nxp.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727498AbfHLJjh (ORCPT + 99 others); Mon, 12 Aug 2019 05:39:37 -0400 Received: from inva020.nxp.com ([92.121.34.13]:49650 "EHLO inva020.nxp.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727298AbfHLJjf (ORCPT ); Mon, 12 Aug 2019 05:39:35 -0400 Received: from inva020.nxp.com (localhost [127.0.0.1]) by inva020.eu-rdc02.nxp.com (Postfix) with ESMTP id 8E01D1A02DB; Mon, 12 Aug 2019 11:39:33 +0200 (CEST) Received: from inva024.eu-rdc02.nxp.com (inva024.eu-rdc02.nxp.com [134.27.226.22]) by inva020.eu-rdc02.nxp.com (Postfix) with ESMTP id 821F41A011B; Mon, 12 Aug 2019 11:39:33 +0200 (CEST) Received: from fsr-ub1464-137.ea.freescale.net (fsr-ub1464-137.ea.freescale.net [10.171.82.114]) by inva024.eu-rdc02.nxp.com (Postfix) with ESMTP id 4A025205ED; Mon, 12 Aug 2019 11:39:33 +0200 (CEST) From: Ioana Ciornei To: gregkh@linuxfoundation.org, linux-kernel@vger.kernel.org Cc: andrew@lunn.ch, ruxandra.radulescu@nxp.com, Ioana Ciornei Subject: [PATCH 02/10] staging: fsl-dpaa2/ethsw: enable switch ports only on dev_open Date: Mon, 12 Aug 2019 12:39:10 +0300 Message-Id: <1565602758-14434-3-git-send-email-ioana.ciornei@nxp.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1565602758-14434-1-git-send-email-ioana.ciornei@nxp.com> References: <1565602758-14434-1-git-send-email-ioana.ciornei@nxp.com> Reply-to: ioana.ciornei@nxp.com X-Virus-Scanned: ClamAV using ClamSMTP Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org At probe time, only the DPSW object should be enabled without the associated ports, which will get enabled on dev_open. Remove the ethsw_open() and ethsw_stop() functions and replace them only with dpsw_enable()/_disable(). Signed-off-by: Ioana Ciornei --- drivers/staging/fsl-dpaa2/ethsw/ethsw.c | 59 ++++----------------------------- 1 file changed, 6 insertions(+), 53 deletions(-) diff --git a/drivers/staging/fsl-dpaa2/ethsw/ethsw.c b/drivers/staging/fsl-dpaa2/ethsw/ethsw.c index 8032314d5cae..302842c3bdfe 100644 --- a/drivers/staging/fsl-dpaa2/ethsw/ethsw.c +++ b/drivers/staging/fsl-dpaa2/ethsw/ethsw.c @@ -1363,48 +1363,6 @@ static int ethsw_register_notifier(struct device *dev) return err; } -static int ethsw_open(struct ethsw_core *ethsw) -{ - struct ethsw_port_priv *port_priv = NULL; - int i, err; - - err = dpsw_enable(ethsw->mc_io, 0, ethsw->dpsw_handle); - if (err) { - dev_err(ethsw->dev, "dpsw_enable err %d\n", err); - return err; - } - - for (i = 0; i < ethsw->sw_attr.num_ifs; i++) { - port_priv = ethsw->ports[i]; - err = dev_open(port_priv->netdev, NULL); - if (err) { - netdev_err(port_priv->netdev, "dev_open err %d\n", err); - return err; - } - } - - return 0; -} - -static int ethsw_stop(struct ethsw_core *ethsw) -{ - struct ethsw_port_priv *port_priv = NULL; - int i, err; - - for (i = 0; i < ethsw->sw_attr.num_ifs; i++) { - port_priv = ethsw->ports[i]; - dev_close(port_priv->netdev); - } - - err = dpsw_disable(ethsw->mc_io, 0, ethsw->dpsw_handle); - if (err) { - dev_err(ethsw->dev, "dpsw_disable err %d\n", err); - return err; - } - - return 0; -} - static int ethsw_init(struct fsl_mc_device *sw_dev) { struct device *dev = &sw_dev->dev; @@ -1586,9 +1544,7 @@ static int ethsw_remove(struct fsl_mc_device *sw_dev) destroy_workqueue(ethsw_owq); - rtnl_lock(); - ethsw_stop(ethsw); - rtnl_unlock(); + dpsw_disable(ethsw->mc_io, 0, ethsw->dpsw_handle); for (i = 0; i < ethsw->sw_attr.num_ifs; i++) { port_priv = ethsw->ports[i]; @@ -1708,12 +1664,11 @@ static int ethsw_probe(struct fsl_mc_device *sw_dev) goto err_free_ports; } - /* Switch starts up enabled */ - rtnl_lock(); - err = ethsw_open(ethsw); - rtnl_unlock(); - if (err) + err = dpsw_enable(ethsw->mc_io, 0, ethsw->dpsw_handle); + if (err) { + dev_err(ethsw->dev, "dpsw_enable err %d\n", err); goto err_free_ports; + } /* Setup IRQs */ err = ethsw_setup_irqs(sw_dev); @@ -1724,9 +1679,7 @@ static int ethsw_probe(struct fsl_mc_device *sw_dev) return 0; err_stop: - rtnl_lock(); - ethsw_stop(ethsw); - rtnl_unlock(); + dpsw_disable(ethsw->mc_io, 0, ethsw->dpsw_handle); err_free_ports: /* Cleanup registered ports only */ -- 1.9.1