First step towards overall PHY layering re-organization.
Allow a status return when a PHY is reset.
Signed-off-by: Divy Le Ray <divy@chelsio.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
        .power_down = ael1002_power_down,
 };
 
-void t3_ael1002_phy_prep(struct cphy *phy, struct adapter *adapter,
-                        int phy_addr, const struct mdio_ops *mdio_ops)
+int t3_ael1002_phy_prep(struct cphy *phy, struct adapter *adapter,
+                       int phy_addr, const struct mdio_ops *mdio_ops)
 {
        cphy_init(phy, adapter, phy_addr, &ael1002_ops, mdio_ops);
        ael100x_txon(phy);
+       return 0;
 }
 
 static int ael1006_reset(struct cphy *phy, int wait)
        .power_down = ael1006_power_down,
 };
 
-void t3_ael1006_phy_prep(struct cphy *phy, struct adapter *adapter,
-                        int phy_addr, const struct mdio_ops *mdio_ops)
+int t3_ael1006_phy_prep(struct cphy *phy, struct adapter *adapter,
+                            int phy_addr, const struct mdio_ops *mdio_ops)
 {
        cphy_init(phy, adapter, phy_addr, &ael1006_ops, mdio_ops);
        ael100x_txon(phy);
+       return 0;
 }
 
 static struct cphy_ops qt2045_ops = {
        .power_down = ael1006_power_down,
 };
 
-void t3_qt2045_phy_prep(struct cphy *phy, struct adapter *adapter,
-                       int phy_addr, const struct mdio_ops *mdio_ops)
+int t3_qt2045_phy_prep(struct cphy *phy, struct adapter *adapter,
+                      int phy_addr, const struct mdio_ops *mdio_ops)
 {
        unsigned int stat;
 
        if (!phy_addr && !mdio_read(phy, MDIO_DEV_PMA_PMD, MII_BMSR, &stat) &&
            stat == 0xffff)
                phy->addr = 1;
+       return 0;
 }
 
 static int xaui_direct_reset(struct cphy *phy, int wait)
        .power_down = xaui_direct_power_down,
 };
 
-void t3_xaui_direct_phy_prep(struct cphy *phy, struct adapter *adapter,
-                            int phy_addr, const struct mdio_ops *mdio_ops)
+int t3_xaui_direct_phy_prep(struct cphy *phy, struct adapter *adapter,
+                           int phy_addr, const struct mdio_ops *mdio_ops)
 {
        cphy_init(phy, adapter, phy_addr, &xaui_direct_ops, mdio_ops);
+       return 0;
 }
 
 };
 
 struct port_type_info {
-       void (*phy_prep)(struct cphy *phy, struct adapter *adapter,
-                        int phy_addr, const struct mdio_ops *ops);
+       int (*phy_prep)(struct cphy *phy, struct adapter *adapter,
+                       int phy_addr, const struct mdio_ops *ops);
        unsigned int caps;
        const char *desc;
 };
 int t3_sge_cqcntxt_op(struct adapter *adapter, unsigned int id, unsigned int op,
                      unsigned int credits);
 
-void t3_vsc8211_phy_prep(struct cphy *phy, struct adapter *adapter,
-                        int phy_addr, const struct mdio_ops *mdio_ops);
-void t3_ael1002_phy_prep(struct cphy *phy, struct adapter *adapter,
-                        int phy_addr, const struct mdio_ops *mdio_ops);
-void t3_ael1006_phy_prep(struct cphy *phy, struct adapter *adapter,
-                        int phy_addr, const struct mdio_ops *mdio_ops);
-void t3_qt2045_phy_prep(struct cphy *phy, struct adapter *adapter, int phy_addr,
-                       const struct mdio_ops *mdio_ops);
-void t3_xaui_direct_phy_prep(struct cphy *phy, struct adapter *adapter,
-                            int phy_addr, const struct mdio_ops *mdio_ops);
+int t3_vsc8211_phy_prep(struct cphy *phy, struct adapter *adapter,
+                       int phy_addr, const struct mdio_ops *mdio_ops);
+int t3_ael1002_phy_prep(struct cphy *phy, struct adapter *adapter,
+                       int phy_addr, const struct mdio_ops *mdio_ops);
+int t3_ael1006_phy_prep(struct cphy *phy, struct adapter *adapter,
+                       int phy_addr, const struct mdio_ops *mdio_ops);
+int t3_qt2045_phy_prep(struct cphy *phy, struct adapter *adapter, int phy_addr,
+                      const struct mdio_ops *mdio_ops);
+int t3_xaui_direct_phy_prep(struct cphy *phy, struct adapter *adapter,
+                           int phy_addr, const struct mdio_ops *mdio_ops);
 #endif                         /* __CHELSIO_COMMON_H */
 
                        ++j;
 
                p->port_type = &port_types[adapter->params.vpd.port_type[j]];
-               p->port_type->phy_prep(&p->phy, adapter, ai->phy_base_addr + j,
-                                      ai->mdio_ops);
+               ret = p->port_type->phy_prep(&p->phy, adapter,
+                                            ai->phy_base_addr + j,
+                                            ai->mdio_ops);
+               if (ret)
+                       return ret;
                mac_prep(&p->mac, adapter, j);
                ++j;
 
                while (!adapter->params.vpd.port_type[j])
                        ++j;
 
-               p->port_type->phy_prep(&p->phy, adapter, ai->phy_base_addr + j,
-                                       ai->mdio_ops);
-
+               ret = p->port_type->phy_prep(&p->phy, adapter,
+                                            ai->phy_base_addr + j,
+                                            ai->mdio_ops);
+               if (ret)
+                       return ret;
                p->phy.ops->power_down(&p->phy, 1);
                ++j;
        }
 
        .power_down = vsc8211_power_down,
 };
 
-void t3_vsc8211_phy_prep(struct cphy *phy, struct adapter *adapter,
-                        int phy_addr, const struct mdio_ops *mdio_ops)
+int t3_vsc8211_phy_prep(struct cphy *phy, struct adapter *adapter,
+                       int phy_addr, const struct mdio_ops *mdio_ops)
 {
        cphy_init(phy, adapter, phy_addr, &vsc8211_ops, mdio_ops);
+       return 0;
 }