mirror of
https://github.com/Fishwaldo/linux-bl808.git
synced 2025-06-17 20:25:19 +00:00
net: dsa: remove copy of master ethtool_ops
There is no need to store a copy of the master ethtool ops, storing the original pointer in DSA and the new one in the master netdev itself is enough. In the meantime, set orig_ethtool_ops to NULL when restoring the master ethtool ops and check the presence of the master original ethtool ops as well as its needed functions before calling them. Signed-off-by: Vivien Didelot <vivien.didelot@savoirfairelinux.com> Reviewed-by: Florian Fainelli <f.fainelli@gmail.com> Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
parent
69e33b2754
commit
f561986659
3 changed files with 15 additions and 13 deletions
|
@ -124,11 +124,10 @@ int dsa_cpu_port_ethtool_setup(struct dsa_port *cpu_dp)
|
|||
if (!cpu_ops)
|
||||
return -ENOMEM;
|
||||
|
||||
memcpy(&cpu_dp->ethtool_ops, master->ethtool_ops,
|
||||
sizeof(struct ethtool_ops));
|
||||
cpu_dp->orig_ethtool_ops = master->ethtool_ops;
|
||||
memcpy(cpu_ops, &cpu_dp->ethtool_ops,
|
||||
sizeof(struct ethtool_ops));
|
||||
if (cpu_dp->orig_ethtool_ops)
|
||||
memcpy(cpu_ops, cpu_dp->orig_ethtool_ops, sizeof(*cpu_ops));
|
||||
|
||||
dsa_cpu_port_ethtool_init(cpu_ops);
|
||||
master->ethtool_ops = cpu_ops;
|
||||
|
||||
|
@ -138,6 +137,7 @@ int dsa_cpu_port_ethtool_setup(struct dsa_port *cpu_dp)
|
|||
void dsa_cpu_port_ethtool_restore(struct dsa_port *cpu_dp)
|
||||
{
|
||||
cpu_dp->netdev->ethtool_ops = cpu_dp->orig_ethtool_ops;
|
||||
cpu_dp->orig_ethtool_ops = NULL;
|
||||
}
|
||||
|
||||
void dsa_cpu_dsa_destroy(struct dsa_port *port)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue