Hi Florian,
Florian Fainelli <[email protected]> writes:
>> So as I said in v2, now that a driver is guaranteed that dp->cpu_dp is
>> correctly assigned at setup time, isn't better (especially for future
>> multi-CPU support) to provide an helper which returns the CPU port for a
>> given port? i.e. dsa_get_cpu_port(struct dsa_switch *ds, int port).
>>
>> Or is there something blocking? I might be wrong.
>
> mt7530.c needs access to the CPU port at ops->setup() time which is
> why this is still here.
Yes, mt7530 is the only one doing this and has an hardcoded CPU port. So
what I meant was, shouldn't we have this instead:
struct dsa_port *dsa_get_cpu_port(struct dsa_switch *ds, int port)
{
return ds->ports[port].cpu_dp;
}
And:
- dn = ds->dst->cpu_dp->netdev->dev.of_node->parent;
+ cpu_dp = dsa_get_cpu_port(ds, MT7530_CPU_PORT);
+ dn = cpu_dp->netdev->dev.of_node->parent;
Thanks,
Vivien