OSDN Git Service

net: dsa: qca8k: fix EEE init
authorVivien Didelot <vivien.didelot@savoirfairelinux.com>
Tue, 1 Aug 2017 20:32:32 +0000 (16:32 -0400)
committerDavid S. Miller <davem@davemloft.net>
Wed, 2 Aug 2017 03:09:09 +0000 (20:09 -0700)
The qca8k obviously copied code from the sf2 driver as how to set EEE:

    if (e->eee_enabled) {
        p->eee_enabled = qca8k_eee_init(ds, port, phydev);
        if (!p->eee_enabled)
            ret = -EOPNOTSUPP;
    }

But it did not use the same logic for the EEE init routine, which is
"Returns 0 if EEE was not enabled, or 1 otherwise". This results in
returning -EOPNOTSUPP on success and caching EEE enabled on failure.

This patch fixes the returned value of qca8k_eee_init.

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

index b3bee7e..e076ab2 100644 (file)
@@ -666,11 +666,11 @@ qca8k_eee_init(struct dsa_switch *ds, int port,
 
        ret = phy_init_eee(phy, 0);
        if (ret)
-               return ret;
+               return 0;
 
        qca8k_eee_enable_set(ds, port, true);
 
-       return 0;
+       return 1;
 }
 
 static int