[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20220216141543.dnrnuvei4zck6xts@skbuf>
Date: Wed, 16 Feb 2022 16:15:43 +0200
From: Vladimir Oltean <olteanv@...il.com>
To: Måns Rullgård <mans@...sr.com>
Cc: Florian Fainelli <f.fainelli@...il.com>, netdev@...r.kernel.org,
Egil Hjelmeland <privat@...l-hjelmeland.no>,
Andrew Lunn <andrew@...n.ch>,
Juergen Borleis <jbe@...gutronix.de>,
Grygorii Strashko <grygorii.strashko@...com>,
lorenzo@...nel.org
Subject: Re: DSA using cpsw and lan9303
On Wed, Feb 16, 2022 at 01:17:47PM +0000, Måns Rullgård wrote:
> > Some complaints about accessing the CPU port as dsa_to_port(chip->ds, 0),
> > but it's not the first place in this driver where that is done.
>
> What would be the proper way to do it?
Generally speaking:
struct dsa_port *cpu_dp;
dsa_switch_for_each_cpu_port(cpu_dp, ds)
break;
// use cpu_dp
If your code runs after dsa_tree_setup_default_cpu(), which contains the
"DSA: tree %d has no CPU port\n" check, you don't even need to check
whether cpu_dp was found or not - it surely was. Everything that runs
after dsa_register_switch() has completed successfully - for example the
DSA ->setup() method - qualifies here.
Powered by blists - more mailing lists