Received: by 2002:ab2:710b:0:b0:1ef:a325:1205 with SMTP id z11csp1093605lql; Tue, 12 Mar 2024 07:13:30 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCWrifhYXXmcpQeeVZO1qNSGq/sftYFdl8OypYFdbNT4CBzeDd9X+xF/8uG2ee0Y8UYGujU8HEj+uy4mXrz1cGQuFFzPXnLMbAtgdHPxHg== X-Google-Smtp-Source: AGHT+IE4PuDgOBXWqaEWudmg3IA2q2xPfxIfPnL6deXChigxCDBKRzw8Jcobgc0FbtfQJzcDvqsW X-Received: by 2002:a17:906:ba82:b0:a44:4d9b:9069 with SMTP id cu2-20020a170906ba8200b00a444d9b9069mr7347365ejd.49.1710252810579; Tue, 12 Mar 2024 07:13:30 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1710252810; cv=pass; d=google.com; s=arc-20160816; b=TNSZIrSYFsNDZghWAWWaSq4oAGV7PDDNShkyUuJNDCu3gjnLGWkZC8V3ftZfw+H29t oW5DsLvStYxV8fU3V0XHTLMUwt+kZJlBkgM1ahBhBY2ZA+vnxGmldSsbSkWv0sZgn08g /zaXmb7V0rak4q4z+a/4QakbTZA4o/HFB/QA9PoBEwev8y05vlht3ewPXRTdxvOHRmBO wR6klydJA1lNPK5NhpaP69TMxZCzjQjyxmxrbA+7vbxUqbekw2GxB55S52BcX7kDhidN S8aNKW98/nVSq4DOwSCuMB3owfnYYuzWi4RrF2PC7zEv2ZeimGntEeDPr00DZRVHrZxe nAZA== 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=zY+Hta8GF6+Mj+WTrpf/p7nZHx45DXLTQ+dam/2L3U8=; fh=PKov2v7mtZqWrG2ToL14QCqscLF6oofVifdomTnOWI8=; b=qjbcoDp44nNUn6svFQcToGrEyh2T/RQnWCqbZ8zew1OZGVo3R8UvnLSN4NdG9xrADV js4DYTilUMz7P5sq7OvDzeYM6rXFbQV4heyFBCMg9MfyG+p5Pte1FCB+b2Ozy1VrnELH DZvmmAZ6cTnryUtdK7qZOiHwoQ9g1IsQWQaMCpnAjCF0NJ+NT0BtKsiX9JRV1m3q8t7K xGNr8CQTS447BfXOtxOyE+TEVoWr6W+s93rq0xzzWmXJDF4Rd6c3k0SGAbIyhNImOHbb snvadog/S6iEVR6NPfN4xCG0qj4ffmv5cqdyj5TvCFd9VXKHMbwhkSVxtCikcoMDEEuj arOg==; 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-100328-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-100328-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [147.75.80.249]) by mx.google.com with ESMTPS id qf11-20020a1709077f0b00b00a45feec7a07si3488896ejc.541.2024.03.12.07.13.30 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 12 Mar 2024 07:13:30 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-100328-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) client-ip=147.75.80.249; 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-100328-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-100328-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 am.mirrors.kernel.org (Postfix) with ESMTPS id 4FF2A1F21B98 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 A51397BAF6; Tue, 12 Mar 2024 14:12:49 +0000 (UTC) Received: from szxga04-in.huawei.com (szxga04-in.huawei.com [45.249.212.190]) (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 A701E7A72F; Tue, 12 Mar 2024 14:12:45 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=45.249.212.190 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1710252769; cv=none; b=uYgZnROnDaPfAVPxp2gjJLkuy4x2d0u7CurYUjX74WqguMExG044YZ1lTfp28y4lJ4G5tTK+uK6S8ihXGVEQImDF9KWYyISIgV//sULqwYOOHfgMN2N8G9jtC3w6TOlCw0R5par2sQAKQvZr7TV2NOHPJMaL0Sy6Xv62m/phCOg= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1710252769; c=relaxed/simple; bh=WthfU5rqb52QnJaMPjT5KVgI3MToYZAyP8nlAgfk3BE=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=cFVNEHHQHwh4ZMrPdoNFrOkSEKnPnlKkPsv6GVR6bPI8PmyF+sl9fle4AcETDtqUuKG1SlRXuiYLG8D/gGiQtm6GMnmd0KDAQDoB2JMePq26Gji8opda5APkB15hr1S6azdqd0Qt4INq7HrmiPa9DW0MbGA2VRx8JYu+RMisB+g= 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.190 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.163.17]) by szxga04-in.huawei.com (SkyGuard) with ESMTP id 4TvFtB30szz1xqkf; Tue, 12 Mar 2024 22:10:58 +0800 (CST) Received: from dggpemd100001.china.huawei.com (unknown [7.185.36.94]) by mail.maildlp.com (Postfix) with ESMTPS id C3F3B1A0172; 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 2/4] scsi: libsas: Move sas_add_parent_port() to sas_expander.c Date: Tue, 12 Mar 2024 14:11:01 +0000 Message-ID: <20240312141103.31358-3-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) Move sas_add_parent_port() to sas_expander.c and rename it to sas_ex_add_parent_port() as it is only used in this file. Signed-off-by: Xingui Yang Reviewed-by: John Garry --- drivers/scsi/libsas/sas_expander.c | 19 +++++++++++++++++-- drivers/scsi/libsas/sas_internal.h | 15 --------------- 2 files changed, 17 insertions(+), 17 deletions(-) diff --git a/drivers/scsi/libsas/sas_expander.c b/drivers/scsi/libsas/sas_expander.c index c8d4aef2f567..f28a83803947 100644 --- a/drivers/scsi/libsas/sas_expander.c +++ b/drivers/scsi/libsas/sas_expander.c @@ -33,6 +33,21 @@ static void sas_port_add_ex_phy(struct sas_port *port, struct ex_phy *ex_phy) ex_phy->phy_state = PHY_DEVICE_DISCOVERED; } +static void sas_ex_add_parent_port(struct domain_device *dev, int phy_id) +{ + struct expander_device *ex = &dev->ex_dev; + struct ex_phy *ex_phy = &ex->ex_phy[phy_id]; + + if (!ex->parent_port) { + ex->parent_port = sas_port_alloc(&dev->rphy->dev, phy_id); + /* FIXME: error handling */ + BUG_ON(!ex->parent_port); + BUG_ON(sas_port_add(ex->parent_port)); + sas_port_mark_backlink(ex->parent_port); + } + sas_port_add_phy(ex->parent_port, ex_phy->phy); +} + /* ---------- SMP task management ---------- */ /* Give it some long enough timeout. In seconds. */ @@ -978,11 +993,11 @@ static int sas_ex_discover_dev(struct domain_device *dev, int phy_id) /* Parent and domain coherency */ if (!dev->parent && sas_phy_match_port_addr(dev->port, ex_phy)) { - sas_add_parent_port(dev, phy_id); + sas_ex_add_parent_port(dev, phy_id); return 0; } if (dev->parent && sas_phy_match_dev_addr(dev->parent, ex_phy)) { - sas_add_parent_port(dev, phy_id); + sas_ex_add_parent_port(dev, phy_id); if (ex_phy->routing_attr == TABLE_ROUTING) sas_configure_phy(dev, phy_id, dev->port->sas_addr, 1); return 0; diff --git a/drivers/scsi/libsas/sas_internal.h b/drivers/scsi/libsas/sas_internal.h index 3804aef165ad..85948963fb97 100644 --- a/drivers/scsi/libsas/sas_internal.h +++ b/drivers/scsi/libsas/sas_internal.h @@ -189,21 +189,6 @@ static inline void sas_phy_set_target(struct asd_sas_phy *p, struct domain_devic } } -static inline void sas_add_parent_port(struct domain_device *dev, int phy_id) -{ - struct expander_device *ex = &dev->ex_dev; - struct ex_phy *ex_phy = &ex->ex_phy[phy_id]; - - if (!ex->parent_port) { - ex->parent_port = sas_port_alloc(&dev->rphy->dev, phy_id); - /* FIXME: error handling */ - BUG_ON(!ex->parent_port); - BUG_ON(sas_port_add(ex->parent_port)); - sas_port_mark_backlink(ex->parent_port); - } - sas_port_add_phy(ex->parent_port, ex_phy->phy); -} - static inline struct domain_device *sas_alloc_device(void) { struct domain_device *dev = kzalloc(sizeof(*dev), GFP_KERNEL); -- 2.17.1