+
+ /* check if we're attaching to the switch twice */
+ pdev = pdev->bus->phy_map[0];
+ if (!pdev) {
+ kfree(priv);
+ return 0;
+ }
+
+ /* switch device has not been initialized, reuse priv */
+ if (!pdev->priv) {
+ priv->port4_phy = true;
+ pdev->priv = priv;
+ return 0;
+ }
+
+ kfree(priv);
+
+ /* switch device has been initialized, reinit */
+ priv = pdev->priv;
+ priv->dev.ports = (AR8216_NUM_PORTS - 1);
+ priv->initialized = false;
+ priv->port4_phy = true;
+ ar8316_hw_init(priv);
+ return 0;