net: dsa: add dsa_to_port helper
The dsa_port structure is part of DSA core data and must only be updated by the later. It is OK and sometimes necessary for the DSA drivers to access this data, but this has to be read only. For that purpose, add a dsa_to_port() helper which returns a const pointer to a dsa_port structure which must be used by DSA drivers from now on instead of digging into ds->ports[] themselves. Signed-off-by: Vivien Didelot <vivien.didelot@savoirfairelinux.com> Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:

committed by
David S. Miller

parent
f8b8b1cd5a
commit
c8652c83bc
@@ -782,7 +782,7 @@ mt7530_port_bridge_join(struct dsa_switch *ds, int port,
|
||||
* and not being setup until the port becomes enabled.
|
||||
*/
|
||||
if (ds->enabled_port_mask & BIT(i) && i != port) {
|
||||
if (ds->ports[i].bridge_dev != bridge)
|
||||
if (dsa_to_port(ds, i)->bridge_dev != bridge)
|
||||
continue;
|
||||
if (priv->ports[i].enable)
|
||||
mt7530_set(priv, MT7530_PCR_P(i),
|
||||
@@ -819,7 +819,7 @@ mt7530_port_bridge_leave(struct dsa_switch *ds, int port,
|
||||
* is kept and not being setup until the port becomes enabled.
|
||||
*/
|
||||
if (ds->enabled_port_mask & BIT(i) && i != port) {
|
||||
if (ds->ports[i].bridge_dev != bridge)
|
||||
if (dsa_to_port(ds, i)->bridge_dev != bridge)
|
||||
continue;
|
||||
if (priv->ports[i].enable)
|
||||
mt7530_clear(priv, MT7530_PCR_P(i),
|
||||
|
Reference in New Issue
Block a user