Commit b34c04fd authored by Xingui Yang's avatar Xingui Yang Committed by xia-bing1
Browse files

scsi: libsas: Add helper for port add ex_phy

mainline inclusion
from mainline-v6.10-rc1
commit 888ea1b12b06906da717b5aceabfaf0a84d1766b
category: bugfix
bugzilla: https://gitee.com/openeuler/kernel/issues/IB5FF2
CVE: NA
Reference: https://git.kernel.org/pub/scm/linux/kernel/git/rdma/rdma.git/commit/?id=888ea1b12b06906da717b5aceabfaf0a84d1766b



---------------------------------------------------------------------

This moves the process of adding ex_phy to a port into a new helper.

Signed-off-by: default avatarXingui Yang <yangxingui@huawei.com>
Link: https://lore.kernel.org/r/20240312141103.31358-2-yangxingui@huawei.com


Reviewed-by: default avatarJohn Garry <john.g.garry@oracle.com>
Signed-off-by: default avatarMartin K. Petersen <martin.petersen@oracle.com>
parent b91870b1
Loading
Loading
Loading
Loading
+8 −3
Original line number Diff line number Diff line
@@ -26,6 +26,13 @@ static int sas_configure_phy(struct domain_device *dev, int phy_id,
			     u8 *sas_addr, int include);
static int sas_disable_routing(struct domain_device *dev,  u8 *sas_addr);

static void sas_port_add_ex_phy(struct sas_port *port, struct ex_phy *ex_phy)
{
	sas_port_add_phy(port, ex_phy->phy);
	ex_phy->port = port;
	ex_phy->phy_state = PHY_DEVICE_DISCOVERED;
}

/* ---------- SMP task management ---------- */

/* Give it some long enough timeout. In seconds. */
@@ -856,9 +863,7 @@ static bool sas_ex_join_wide_port(struct domain_device *parent, int phy_id)

		if (!memcmp(phy->attached_sas_addr, ephy->attached_sas_addr,
			    SAS_ADDR_SIZE) && ephy->port) {
			sas_port_add_phy(ephy->port, phy->phy);
			phy->port = ephy->port;
			phy->phy_state = PHY_DEVICE_DISCOVERED;
			sas_port_add_ex_phy(ephy->port, phy);
			return true;
		}
	}