From patchwork Tue Jun 11 21:49:03 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ivan Khoronzhuk X-Patchwork-Id: 166494 Delivered-To: patch@linaro.org Received: by 2002:a92:4782:0:0:0:0:0 with SMTP id e2csp2868748ilk; Tue, 11 Jun 2019 14:49:11 -0700 (PDT) X-Google-Smtp-Source: APXvYqwD9XEfVoA9r4SOvtRCDS1P3pUHmhBSO78hmhN+8kqwU6G/uLHq0Wj8GNs1+TVygKcbfvgs X-Received: by 2002:a63:d415:: with SMTP id a21mr4351303pgh.229.1560289751455; Tue, 11 Jun 2019 14:49:11 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1560289751; cv=none; d=google.com; s=arc-20160816; b=PBBwM/L96Nui6x6bN0uo3N5+gw9zyerfHwX/BCIeXYDerIfOLJ+d28BdZd3dvlzfMz rtpBZpffPL29QVolYmcFTrU9FqIgCZ/Q22rURDN4GMqFEN8/GG+jemdMMWay8+E6LGFb Yhjm05EBWF21zMytxSyqWQJT6GefD3KeLXT2lDQhDTd1DooMEO0vQ26yTCLIj+qRVAXJ oXRSADTUXObSa7sRsU9AbeKzE6mBXVcDFQk1yeqDWBy86+T7KcKdTI5zC5mE/tADWTzN sUBvt9vqRi5OQOF/FEB+qa+33XCBhNe8AwPZ4cixfERRtCEOe+YIQifmpfkFuk3YrNRP kLsQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:date:subject:cc:to:from :dkim-signature; bh=i6GhLaflHxtAwL6Ad6Dr/C5ELNhP+vqOwXCPihJeLM8=; b=0HihOBT4k+IrF6X9KWYtZzPegXHWY0y74TsS5qTRj4WXrfQNygwU21/PqsVIUI5VW1 dxV7n2XsuwkCNUp1mzScH8I4/w3UMjv9kAmYdyvcT6TCSMln404nvDRm34RUQ571ykYa kceip/MF3uIBhEVJk6MrHcbzgVT6iFJNcSI6GjxVcLg4XqRvTfXIwYOe0l5Dm6W94acD Uesz0PQ4drtQ1OROeZqfbbqB7AtPcC8gd+2gZMljvrQnyWoiNWL290wh9Ms0AQXAKjiK I0uOzJENb0g+CZq1agcZ51pX02UBJAipyt+pOsXGO3HjvNL73IrGNrP2N3S3PdqSFFNk 4QpA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="mF/ELEtx"; 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=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id q16si13392826pgi.222.2019.06.11.14.49.11; Tue, 11 Jun 2019 14:49: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; dkim=pass header.i=@linaro.org header.s=google header.b="mF/ELEtx"; 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=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2436632AbfFKVtK (ORCPT + 30 others); Tue, 11 Jun 2019 17:49:10 -0400 Received: from mail-lf1-f66.google.com ([209.85.167.66]:46700 "EHLO mail-lf1-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2405081AbfFKVtK (ORCPT ); Tue, 11 Jun 2019 17:49:10 -0400 Received: by mail-lf1-f66.google.com with SMTP id z15so7754969lfh.13 for ; Tue, 11 Jun 2019 14:49:09 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id; bh=i6GhLaflHxtAwL6Ad6Dr/C5ELNhP+vqOwXCPihJeLM8=; b=mF/ELEtx8NPOPG3GZNMj3xXssQs8CPSw6r9xXfmVWR6vI50hpVCFF8E++nxCQxBQty w1mqcgctM/qAYXwueTcmLS9XTrg9obZ0X9Z327VRyQK40aEuuqUysUhpRYW8PawxNHNy fzt9hcqJPCgMwkqup/JcNPCQt5Kq9clL6C7j6HhdRs+oH8OV2VgTQBC5eTjbGd/WN/tq vjw2gTYLwvqmwZDH6qYhRzUcNvSHLV7aRINd+jsgUmp2DSI0V6XgOwjNKJ+rdsrTc/jQ kLHDaBT3/z1E41YMfT7XPfdK57pKtlKK/9UsVkmWZgW0DRN9UIY4dQf5zKQv93moT2ZT vAfA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=i6GhLaflHxtAwL6Ad6Dr/C5ELNhP+vqOwXCPihJeLM8=; b=jOuf3z8FuEJLf69aNZgqGJAVmV46G92ET2PEPXZFaj0KoS/w75tcnH5Fz/PsfX17xF wG9jtsRMce1qfaxbQ2rkQJMMhNJHvRyMPjT9365sAMSirQ+ILGJ4ksdwm7M/lQqpvGp/ T9V7kt1PzAvRT9I6NCQZc/2Y6VQ+4OqZ7iaY81qt0Qb2BwixED/LTMz0dRDX48OqLo4j anvFQSUL2GjUG42ZAZamsiKHjmAdWOXsymLvPhBb6nVl9QZI9BtEKiaKoc2T2boOh4o9 sJ/Be2DYRDPgvHEQ1m+IMYnrJLrpGlj8ILcqVa622Pat7kZ/leEL/xZEYPUjxBb8OgBX 1m1g== X-Gm-Message-State: APjAAAW2K00LqHlPQhsKu/z6vd1DyuyO1e4HtPNO36mIEUKCHq/R+ds+ CTgfI/eG8IHCj6Md801dP89U5g== X-Received: by 2002:ac2:514b:: with SMTP id q11mr5226108lfd.33.1560289748726; Tue, 11 Jun 2019 14:49:08 -0700 (PDT) Received: from localhost.localdomain (59-201-94-178.pool.ukrtel.net. [178.94.201.59]) by smtp.gmail.com with ESMTPSA id e26sm2787342ljl.33.2019.06.11.14.49.07 (version=TLS1_3 cipher=AEAD-AES256-GCM-SHA384 bits=256/256); Tue, 11 Jun 2019 14:49:08 -0700 (PDT) From: Ivan Khoronzhuk To: grygorii.strashko@ti.com, davem@davemloft.net Cc: linux-omap@vger.kernel.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org, Ivan Khoronzhuk Subject: [PATCH net-next] net: ethernet: ti: cpsw: use cpsw as drv data Date: Wed, 12 Jun 2019 00:49:03 +0300 Message-Id: <20190611214903.32146-1-ivan.khoronzhuk@linaro.org> X-Mailer: git-send-email 2.17.1 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org No need to set ndev for drvdata when mainly cpsw reference is needed, so correct this legacy decision. Reviewed-by: Grygorii Strashko Signed-off-by: Ivan Khoronzhuk --- Based on net-next/master drivers/net/ethernet/ti/cpsw.c | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) -- 2.17.1 diff --git a/drivers/net/ethernet/ti/cpsw.c b/drivers/net/ethernet/ti/cpsw.c index 6d3f1f3f90cb..3430503e1053 100644 --- a/drivers/net/ethernet/ti/cpsw.c +++ b/drivers/net/ethernet/ti/cpsw.c @@ -2265,8 +2265,7 @@ static int cpsw_probe_dt(struct cpsw_platform_data *data, static void cpsw_remove_dt(struct platform_device *pdev) { - struct net_device *ndev = platform_get_drvdata(pdev); - struct cpsw_common *cpsw = ndev_to_cpsw(ndev); + struct cpsw_common *cpsw = platform_get_drvdata(pdev); struct cpsw_platform_data *data = &cpsw->data; struct device_node *node = pdev->dev.of_node; struct device_node *slave_node; @@ -2477,7 +2476,7 @@ static int cpsw_probe(struct platform_device *pdev) goto clean_cpts; } - platform_set_drvdata(pdev, ndev); + platform_set_drvdata(pdev, cpsw); priv = netdev_priv(ndev); priv->cpsw = cpsw; priv->ndev = ndev; @@ -2570,9 +2569,8 @@ static int cpsw_probe(struct platform_device *pdev) static int cpsw_remove(struct platform_device *pdev) { - struct net_device *ndev = platform_get_drvdata(pdev); - struct cpsw_common *cpsw = ndev_to_cpsw(ndev); - int ret; + struct cpsw_common *cpsw = platform_get_drvdata(pdev); + int i, ret; ret = pm_runtime_get_sync(&pdev->dev); if (ret < 0) { @@ -2580,9 +2578,9 @@ static int cpsw_remove(struct platform_device *pdev) return ret; } - if (cpsw->data.dual_emac) - unregister_netdev(cpsw->slaves[1].ndev); - unregister_netdev(ndev); + for (i = 0; i < cpsw->data.slaves; i++) + if (cpsw->slaves[i].ndev) + unregister_netdev(cpsw->slaves[i].ndev); cpts_release(cpsw->cpts); cpdma_ctlr_destroy(cpsw->dma);