Received: by 2002:a05:7412:b10a:b0:f3:1519:9f41 with SMTP id az10csp2671156rdb; Mon, 4 Dec 2023 04:33:05 -0800 (PST) X-Google-Smtp-Source: AGHT+IGeRKHhaAL8CgHfT6xoyhr0keh+QwaIpMAlL3JuvOJvQGA3MVI+eOxXfDXPDxJlgY539MfN X-Received: by 2002:a05:6a00:180f:b0:6ce:2757:7858 with SMTP id y15-20020a056a00180f00b006ce27577858mr4472642pfa.19.1701693185019; Mon, 04 Dec 2023 04:33:05 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1701693185; cv=none; d=google.com; s=arc-20160816; b=tNZ1M6FsIul2AkyiLpm3feLugk77oNzDy5/pKOQWbNdqoszsFdCtkfsISbqSiUvDWL 8+TN9Q3FRxi0Vi6YWuPcpp1gNWoJ9BRCeMrAJLLexUKmolB8gBzyLwCa1zYeEr8TQ9KO 9WFpcg+ghyoc3qEnSTsH6GmaVzDoXtuYfTIKDWGuNNTS81lIwYnKD0zlgcId1/nB4UDm zuXkc+gtrAUGPW+l4BQJ/ttr/nWROpHmoVIKey4ZMgTTp354O6lze0fOLrGdsB12Mmta f8uhf4TfpiVf/VnspIfoZWg/dVykUcafwfyk36xKdZdV7u+mMqh9ZLAO7CiS3iHZkIOr 3nSQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:references:in-reply-to:message-id :date:subject:cc:to:from; bh=kgC5S62Xp64R2ULP+dfpoOKjv65ga+Ud4sgnDp4pvG4=; fh=PKov2v7mtZqWrG2ToL14QCqscLF6oofVifdomTnOWI8=; b=LUqxBgnfVPSZf1zqLVHJEo6HUpbOLkVyb/IXixyk7GwL5qcoqy1Sqc3jl/RukVMX9a HQerPUfeRVHZMWxBEiGWmWKr50Kc4Cl/zOjjPflgChZ18PiwSLE6Bk12p7h+tOQeAbVV YZ/zeFZ3RECbXimsRLhFnF3gaYXpnyWBoIwolbWtQ2HBKdjRxTW8dt9FwB3ZShCnjaTw HVaMM9yMBXykLW3C1uR3rCVayWeHESG0yII+bb9TwdME1yZzWOCMRKMETSKYg3HTQZgX F7XUZKHcJcb4LcrXUNm3eSYBeyX1LKvcZHefp6QfFuUiPzTh+Ye4P6nhhY/zqoVHGp1I 9b5A== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:4 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Return-Path: Received: from howler.vger.email (howler.vger.email. [2620:137:e000::3:4]) by mx.google.com with ESMTPS id ka26-20020a056a00939a00b006ce5cbb30e3si704325pfb.373.2023.12.04.04.33.04 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 04 Dec 2023 04:33:05 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:4 as permitted sender) client-ip=2620:137:e000::3:4; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:4 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by howler.vger.email (Postfix) with ESMTP id 55C488051B36; Mon, 4 Dec 2023 04:33:02 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at howler.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235387AbjLDMcd (ORCPT + 99 others); Mon, 4 Dec 2023 07:32:33 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48396 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232380AbjLDMc2 (ORCPT ); Mon, 4 Dec 2023 07:32:28 -0500 Received: from szxga08-in.huawei.com (szxga08-in.huawei.com [45.249.212.255]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 917CBC0; Mon, 4 Dec 2023 04:32:34 -0800 (PST) Received: from dggpemd100001.china.huawei.com (unknown [172.30.72.54]) by szxga08-in.huawei.com (SkyGuard) with ESMTP id 4SkNHz6LXWz1P9HV; Mon, 4 Dec 2023 20:28:47 +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_128_GCM_SHA256) id 15.2.1258.28; Mon, 4 Dec 2023 20:32:32 +0800 From: Xingui Yang To: , , , , CC: , , , , , Subject: [PATCH v5 1/3] scsi: libsas: Add helper for port add ex_phy Date: Mon, 4 Dec 2023 12:29:30 +0000 Message-ID: <20231204122932.55741-2-yangxingui@huawei.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20231204122932.55741-1-yangxingui@huawei.com> References: <20231204122932.55741-1-yangxingui@huawei.com> MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [10.50.165.33] X-ClientProxiedBy: dggems704-chm.china.huawei.com (10.3.19.181) To dggpemd100001.china.huawei.com (7.185.36.94) X-CFilter-Loop: Reflected X-Spam-Status: No, score=-0.8 required=5.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on howler.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (howler.vger.email [0.0.0.0]); Mon, 04 Dec 2023 04:33:02 -0800 (PST) This moves the process of adding ex_phy to a port into a new helper. Signed-off-by: Xingui Yang --- 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 a2204674b680..1257f90130fb 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. */ @@ -857,9 +864,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