Netdev List
 help / color / mirror / Atom feed
From: Vivien Didelot <vivien.didelot@savoirfairelinux.com>
To: netdev@vger.kernel.org
Cc: linux-kernel@vger.kernel.org, kernel@savoirfairelinux.com,
	"David S. Miller" <davem@davemloft.net>,
	Florian Fainelli <f.fainelli@gmail.com>,
	Andrew Lunn <andrew@lunn.ch>,
	Vivien Didelot <vivien.didelot@savoirfairelinux.com>
Subject: [PATCH net-next v2 1/7] net: dsa: use port's cpu_dp when creating a slave
Date: Mon, 16 Oct 2017 11:12:13 -0400	[thread overview]
Message-ID: <20171016151219.22023-2-vivien.didelot@savoirfairelinux.com> (raw)
In-Reply-To: <20171016151219.22023-1-vivien.didelot@savoirfairelinux.com>

When dsa_slave_create is called, the related port already has a CPU port
assigned to it, available in its cpu_dp member. Use it instead of the
unique tree cpu_dp.

Signed-off-by: Vivien Didelot <vivien.didelot@savoirfairelinux.com>
Reviewed-by: Florian Fainelli <f.fainelli@gmail.com>
---
 net/dsa/slave.c | 7 ++-----
 1 file changed, 2 insertions(+), 5 deletions(-)

diff --git a/net/dsa/slave.c b/net/dsa/slave.c
index 45f4ea845c07..c6f4829645bf 100644
--- a/net/dsa/slave.c
+++ b/net/dsa/slave.c
@@ -1117,16 +1117,13 @@ int dsa_slave_resume(struct net_device *slave_dev)
 int dsa_slave_create(struct dsa_port *port, const char *name)
 {
 	struct dsa_notifier_register_info rinfo = { };
+	struct dsa_port *cpu_dp = port->cpu_dp;
+	struct net_device *master = cpu_dp->netdev;
 	struct dsa_switch *ds = port->ds;
-	struct net_device *master;
 	struct net_device *slave_dev;
 	struct dsa_slave_priv *p;
-	struct dsa_port *cpu_dp;
 	int ret;
 
-	cpu_dp = ds->dst->cpu_dp;
-	master = cpu_dp->netdev;
-
 	if (!ds->num_tx_queues)
 		ds->num_tx_queues = 1;
 
-- 
2.14.2

  reply	other threads:[~2017-10-16 15:12 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-10-16 15:12 [PATCH net-next v2 0/7] net: dsa: master and slave helpers Vivien Didelot
2017-10-16 15:12 ` Vivien Didelot [this message]
2017-10-16 15:12 ` [PATCH net-next v2 2/7] net: dsa: add slave notify helper Vivien Didelot
2017-10-16 15:12 ` [PATCH net-next v2 3/7] net: dsa: add slave to port helper Vivien Didelot
2017-10-16 15:12 ` [PATCH net-next v2 4/7] net: dsa: add slave to master helper Vivien Didelot
2017-10-16 15:12 ` [PATCH net-next v2 5/7] net: dsa: rename dsa_master_get_slave Vivien Didelot
2017-10-16 15:12 ` [PATCH net-next v2 6/7] net: dsa: split dsa_port's netdev member Vivien Didelot
2017-10-16 15:12 ` [PATCH net-next v2 7/7] net: dsa: add dsa_to_port helper Vivien Didelot
2017-10-18 11:24 ` [PATCH net-next v2 0/7] net: dsa: master and slave helpers David Miller

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20171016151219.22023-2-vivien.didelot@savoirfairelinux.com \
    --to=vivien.didelot@savoirfairelinux.com \
    --cc=andrew@lunn.ch \
    --cc=davem@davemloft.net \
    --cc=f.fainelli@gmail.com \
    --cc=kernel@savoirfairelinux.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox