Received: by 2002:a25:8b12:0:0:0:0:0 with SMTP id i18csp855958ybl; Tue, 13 Aug 2019 03:48:12 -0700 (PDT) X-Google-Smtp-Source: APXvYqzsPj2PpVR9Hbl73L+Zt0fbPSNVhyvOjtCqXMabDezda6cqCpGPSCsnP/nkH2i7yQXr8+4I X-Received: by 2002:a05:6a00:cd:: with SMTP id e13mr11188735pfj.202.1565693291928; Tue, 13 Aug 2019 03:48:11 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1565693291; cv=none; d=google.com; s=arc-20160816; b=dMyRfSTdpGigFBEsTlXdX3Zy8X5DM+IYgTiLOHulmaa0JLEDpiUMJYAJf7qsix2C0h bQjxCn+iUetckqT3bWje/jgMvRCrpoGF+2uUfazcaBY1VTWufGFm9/WEmbTTXf2SiXNH SMfT4SSFFde0JduxGEkRkmnUJAKpaJj+mB4nLmLofo18WRxafqLo9PoGBj+lLSGp/G0k Kddb/6aS7Nd8qcyoc9PJKZX4FIpLGdF/iG2VS+Xy35//JPOlPVlFkpCiGk5xeuc5ONcB SUiS37Pox2rLLtEmV1DwLxRsRxGetR2GmBt4iOAh2RpjKNbZehdLa70G1J+QB+xkgqGN fTVA== 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=e6U4cx7Qpsgda+vRWZjMW9lpR6kmwkNiTYQ45ltMJbc=; b=hRwXdZUZTjmI/ZLADkmp7tE1v0iAnuxv1oOOdM1luZD91y5Jdsj5uzMwMNvBN4WeuS GJ+0qoOD88V957L4U1U213o7NpTaLjYpDkyCG+26wQ3SATuempz1iccNAHIZo/HFSV8r rLFG7f3WeHzoYA6V0JO9FSbG/6e5fUMo9j8J3p+ZMHKINcmsTG4mjzAUhkrOoYDTDA7C dM1plmWHSTqEIRvWNJm6zYvlQGIzcOhK7XFLiscCocVhRz8xrVg1IRLYDR6kRe2XgSDL L1CRM6AT+t132BK/TJdPDiZXMcxp/RCgXja4/z0e0XEpUpuagFbAPrP6WkJ7R25ir6Hj aomg== 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 39si7768696plc.377.2019.08.13.03.47.56; Tue, 13 Aug 2019 03:48:11 -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 S1727844AbfHMIzW (ORCPT + 99 others); Tue, 13 Aug 2019 04:55:22 -0400 Received: from inva020.nxp.com ([92.121.34.13]:56080 "EHLO inva020.nxp.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727683AbfHMIyx (ORCPT ); Tue, 13 Aug 2019 04:54:53 -0400 Received: from inva020.nxp.com (localhost [127.0.0.1]) by inva020.eu-rdc02.nxp.com (Postfix) with ESMTP id 450EB1A075F; Tue, 13 Aug 2019 10:54:51 +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 387AD1A02B4; Tue, 13 Aug 2019 10:54:51 +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 E2E372060E; Tue, 13 Aug 2019 10:54:50 +0200 (CEST) From: Ioana Ciornei To: gregkh@linuxfoundation.org, linux-kernel@vger.kernel.org Cc: joe@perches.com, andrew@lunn.ch, ruxandra.radulescu@nxp.com, Ioana Ciornei Subject: [PATCH v2 02/10] staging: fsl-dpaa2/ethsw: enable switch ports only on dev_open Date: Tue, 13 Aug 2019 11:54:31 +0300 Message-Id: <1565686479-32577-3-git-send-email-ioana.ciornei@nxp.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1565686479-32577-1-git-send-email-ioana.ciornei@nxp.com> References: <1565686479-32577-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(). Reported-by: Andrew Lunn Signed-off-by: Ioana Ciornei --- Changes in v2: - added Reported-by tag 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