net: dsa: qca8k: enable EEE once
authorVivien Didelot <vivien.didelot@savoirfairelinux.com>
Tue, 1 Aug 2017 20:32:33 +0000 (16:32 -0400)
committerDavid S. Miller <davem@davemloft.net>
Wed, 2 Aug 2017 03:09:09 +0000 (20:09 -0700)
If EEE is queried enabled, qca8k_set_eee calls qca8k_eee_enable_set
twice (because it is already called in qca8k_eee_init). Fix that.

Signed-off-by: Vivien Didelot <vivien.didelot@savoirfairelinux.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/dsa/qca8k.c

index e076ab23d4df319a704150978df93dc5e752443f..9d6b5d2f7a4aa03157b0ad6f2d8a14d62a733b0d 100644 (file)
@@ -684,12 +684,13 @@ qca8k_set_eee(struct dsa_switch *ds, int port,
 
        p->eee_enabled = e->eee_enabled;
 
-       if (e->eee_enabled) {
+       if (!p->eee_enabled) {
+               qca8k_eee_enable_set(ds, port, false);
+       } else {
                p->eee_enabled = qca8k_eee_init(ds, port, phydev);
                if (!p->eee_enabled)
                        ret = -EOPNOTSUPP;
        }
-       qca8k_eee_enable_set(ds, port, p->eee_enabled);
 
        return ret;
 }