scsi: libsas: no need to join wide port again in sas_ex_discover_dev()
[linux-2.6-microblaze.git] / drivers / scsi / libsas / sas_expander.c
index 83f2fd7..fd16a3d 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0
 /*
  * Serial Attached SCSI (SAS) Expander discovery and configuration
  *
@@ -5,21 +6,6 @@
  * Copyright (C) 2005 Luben Tuikov <luben_tuikov@adaptec.com>
  *
  * This file is licensed under GPLv2.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation; either version 2 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
- *
  */
 
 #include <linux/scatterlist.h>
@@ -1104,7 +1090,7 @@ static int sas_ex_discover_dev(struct domain_device *dev, int phy_id)
                                 SAS_ADDR(dev->sas_addr),
                                 phy_id);
                        sas_ex_disable_phy(dev, phy_id);
-                       break;
+                       return res;
                } else
                        memcpy(dev->port->disc.fanout_sas_addr,
                               ex_phy->attached_sas_addr, SAS_ADDR_SIZE);
@@ -1116,27 +1102,9 @@ static int sas_ex_discover_dev(struct domain_device *dev, int phy_id)
                break;
        }
 
-       if (child) {
-               int i;
-
-               for (i = 0; i < ex->num_phys; i++) {
-                       if (ex->ex_phy[i].phy_state == PHY_VACANT ||
-                           ex->ex_phy[i].phy_state == PHY_NOT_PRESENT)
-                               continue;
-                       /*
-                        * Due to races, the phy might not get added to the
-                        * wide port, so we add the phy to the wide port here.
-                        */
-                       if (SAS_ADDR(ex->ex_phy[i].attached_sas_addr) ==
-                           SAS_ADDR(child->sas_addr)) {
-                               ex->ex_phy[i].phy_state= PHY_DEVICE_DISCOVERED;
-                               if (sas_ex_join_wide_port(dev, i))
-                                       pr_debug("Attaching ex phy%02d to wide port %016llx\n",
-                                                i, SAS_ADDR(ex->ex_phy[i].attached_sas_addr));
-                       }
-               }
-       }
-
+       if (!child)
+               pr_notice("ex %016llx phy%02d failed to discover\n",
+                         SAS_ADDR(dev->sas_addr), phy_id);
        return res;
 }