Re: [net-next PATCH v3 01/14] net: dsa: qca8k: cache match data to speed up access

From: Vladimir Oltean
Date: Sun Jul 24 2022 - 19:18:54 EST


On Sun, Jul 24, 2022 at 10:42:20PM +0200, Christian Marangi wrote:
> Sure, it was just a stupid idea to set everything not strictly neeeded
> only after verifying that we have a correct switch... But it doesn't
> make sense as qca8k_priv is freed anyway if that's the case.

I don't understand what you're saying. With your proposed logic,
of_device_get_match_data() will be called anyway in qca8k_read_switch_id(),
and if the switch id is valid, it will be called once more in qca8k_sw_probe().
With my proposed logic, of_device_get_match_data() will be called exactly
once, to populate priv->info *before* the first instance of when it's
going to be needed.