[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date: Tue, 6 Jun 2017 11:12:59 -0700
From: Florian Fainelli <f.fainelli@...il.com>
To: Vivien Didelot <vivien.didelot@...oirfairelinux.com>,
netdev@...r.kernel.org
Cc: andrew@...n.ch, john@...ozen.org, davem@...emloft.net
Subject: Re: [PATCH net-next 5/5] net: dsa: Stop accessing ds->dst->cpu_dp in
drivers
On 06/06/2017 11:09 AM, Vivien Didelot wrote:
> Florian Fainelli <f.fainelli@...il.com> writes:
>
>> - phy_mode = of_get_phy_mode(ds->dst->cpu_dp->dn);
>> + phy_mode = of_get_phy_mode(ds->ports[QCA8K_CPU_PORT].dn);
>
> Is it necessary to use QCA8K_CPU_PORT?
>
>> +static inline struct dsa_port *dsa_ds_get_cpu_dp(struct dsa_switch *ds)
>> +{
>> + return &ds->ports[fls(ds->cpu_port_mask) - 1];
>> +}
>
> Wouldn't it be better to return the CPU port for a given port?
> Something like return ds->ports[port].cpu_dp, so that we ease the
> introduction of multiple CPU port a bit more?
ds->ports[port].cpu_dp only gets assigned at dsa_slave_create() time,
which is after ops->setup() has been called, hence this helper function
in case you need it earlier (e.g: like mv88e6060).
--
Florian
Powered by blists - more mailing lists