Received: by 2002:ab2:710b:0:b0:1ef:a325:1205 with SMTP id z11csp1094358lql; Tue, 12 Mar 2024 07:14:29 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCWYPoN1RTK4TEcuEku1tzy4kDnMPZqDuhOP2hDF7VoJKs+heyWuZZQ1tRbjmQQ4rPvBr7T8CRCaFnNNEHCffjpU7j8R+hvtUEa+bYH0Dw== X-Google-Smtp-Source: AGHT+IExfFQDPkqekE1S/mKaWgwF0Uzh1614SfgA1JyUJotsa0MJbxD7ZEq3JZ+c+WXFWI87whUw X-Received: by 2002:a05:6a21:3a42:b0:1a3:10a8:9d57 with SMTP id zu2-20020a056a213a4200b001a310a89d57mr9804808pzb.36.1710252868827; Tue, 12 Mar 2024 07:14:28 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1710252868; cv=pass; d=google.com; s=arc-20160816; b=KZaW/1iyBMvnriSH1/HMHFuT2OXbMU+aXbOJedda7ie0iKbYsyglpD63iBduMZJJ47 ji0yewY/DbuHquWKZo6qLkk57TimRbOx1Wd4W2W+uI0ahLZsGhfhxk2p5+y+Zy+Rtf6t DPa0urovqX5k7mlqfRWLT5PPhgZ34aCC4fy4HaAM3DBGFJWO7e65/NcQFZ6NuJBnu5l1 gqLmhJZmhYygS1GifPaRxYRNFych6aN+bRBGcskZ3v4y2Ubt8Se5cMQQmiO627Ut2RbR 6U0+6Hduhpuz5ptZQcCLh9gFlhWgRtFlYevQDOawRtGmhId8C/5G7Vw7Ly2lcdwKTkL3 D8fg== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=mime-version:list-unsubscribe:list-subscribe:list-id:precedence :references:in-reply-to:message-id:date:subject:cc:to:from; bh=ZFufCp4xcXk6XvcS/mkKwagRIPTa8gk3U2sDV62UwoQ=; fh=PKov2v7mtZqWrG2ToL14QCqscLF6oofVifdomTnOWI8=; b=NM6SAKgJm4+GcKc2PVC3dVqFZhliGYZPjIeJBx+Qr/dnxbgFi47GWva2+GPa/XDyba EhvdRwj0z5MkTGYmWkVM2dSklN9zI3xHURoLBCnifmy8uH4Bn3Pt52YzssQq6PWnmCC3 B9zohQBrH/TY+LL0WTwDRlNgoP4xK/tQ+hbh4B0qHIICz6YSg4JjYEZeKGKPswVl63eX +H//Ne/L2946VtJEhhgcvmneu0jjpkvyo7rOFSD4wDLyK2D7yxH5Ph2rgg8xzoqeeOaM pzRf5K4/CQpHBbPMm5LK/dy/4ZNECQdezFQTyljorLdwFJJdKOQhGKCJS/NrfPJpD8RC XXgw==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; arc=pass (i=1 spf=pass spfdomain=huawei.com dmarc=pass fromdomain=huawei.com); spf=pass (google.com: domain of linux-kernel+bounces-100329-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-100329-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [139.178.88.99]) by mx.google.com with ESMTPS id t21-20020a056a00139500b006e69f473918si2171255pfg.167.2024.03.12.07.14.28 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 12 Mar 2024 07:14:28 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-100329-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) client-ip=139.178.88.99; Authentication-Results: mx.google.com; arc=pass (i=1 spf=pass spfdomain=huawei.com dmarc=pass fromdomain=huawei.com); spf=pass (google.com: domain of linux-kernel+bounces-100329-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-100329-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id 77E41286AF2 for ; Tue, 12 Mar 2024 14:13:30 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id AFF347BAF9; Tue, 12 Mar 2024 14:12:49 +0000 (UTC) Received: from szxga07-in.huawei.com (szxga07-in.huawei.com [45.249.212.35]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 5DC707A72C; Tue, 12 Mar 2024 14:12:45 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=45.249.212.35 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1710252769; cv=none; b=PWc4LrhyAMs9YwRjvgV0Xe8LtOfxvGlLy/baUmMLIaMm6vZAlMOMJdpQTqFJxHN8ML/ZjUyi+N9IgxnTUq6JFQgm8ciyWxVeQ7w6F2cJ7zqDMuku5qb0WQDaE9MIs19O0749C0AHYpcengOLW/G192yGAnviICEQl9kGMGm31EM= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1710252769; c=relaxed/simple; bh=0bX+OS5NnVGCnM0RrD8Kuci2Q6DddH1OHEL9F4Qbbok=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=K6lh3LsFklckMxhOX3PftJkVDIuBL1UqyobMrDPShNcyURzKJCIA16CI4nKvvL6mjJiJOSbZF3Sn1H6uBzbBi4KsPI/maF7nnT+OIlHn6yT9jc2eMoL4s4baz8vi9gk/p2Vd7Sk4ZZ5NhJUP+aeb2OCD1ob2e2FUOevFiS/MT6Q= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=huawei.com; spf=pass smtp.mailfrom=huawei.com; arc=none smtp.client-ip=45.249.212.35 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=huawei.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=huawei.com Received: from mail.maildlp.com (unknown [172.19.88.234]) by szxga07-in.huawei.com (SkyGuard) with ESMTP id 4TvFsM5Vw9z1Z1ZM; Tue, 12 Mar 2024 22:10:15 +0800 (CST) Received: from dggpemd100001.china.huawei.com (unknown [7.185.36.94]) by mail.maildlp.com (Postfix) with ESMTPS id 9DB83140155; Tue, 12 Mar 2024 22:12:42 +0800 (CST) Received: from localhost.localdomain (10.50.165.33) by dggpemd100001.china.huawei.com (7.185.36.94) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1258.28; Tue, 12 Mar 2024 22:12:42 +0800 From: Xingui Yang To: , , , , CC: , , , , , Subject: [PATCH v6 1/4] scsi: libsas: Add helper for port add ex_phy Date: Tue, 12 Mar 2024 14:11:00 +0000 Message-ID: <20240312141103.31358-2-yangxingui@huawei.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20240312141103.31358-1-yangxingui@huawei.com> References: <20240312141103.31358-1-yangxingui@huawei.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain X-ClientProxiedBy: dggems704-chm.china.huawei.com (10.3.19.181) To dggpemd100001.china.huawei.com (7.185.36.94) This moves the process of adding ex_phy to a port into a new helper. Signed-off-by: Xingui Yang Reviewed-by: John Garry --- drivers/scsi/libsas/sas_expander.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/drivers/scsi/libsas/sas_expander.c b/drivers/scsi/libsas/sas_expander.c index ee3808bfd534..c8d4aef2f567 100644 --- a/drivers/scsi/libsas/sas_expander.c +++ b/drivers/scsi/libsas/sas_expander.c @@ -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. */ @@ -867,9 +874,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; } } -- 2.17.1