Received: by 2002:a05:6359:c8b:b0:c7:702f:21d4 with SMTP id go11csp1989281rwb; Sat, 24 Sep 2022 00:34:05 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7hxiF++Rr4ZTXHQi0bu1c6S4XyJ0YW2XeLDbkH9R2kY0Wo0Gz2WR37pKdimSbGs6syT7mW X-Received: by 2002:a17:907:1608:b0:77d:7906:6578 with SMTP id hb8-20020a170907160800b0077d79066578mr9533725ejc.533.1664004845110; Sat, 24 Sep 2022 00:34:05 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1664004845; cv=none; d=google.com; s=arc-20160816; b=AXEwatkm1lmFJdz0ITTpeEPmY3bm8i2+kQqRQyWbXKyT11ffqabTha54KtN8STQQwI wfU5eVrxrSxIeK2kOWOCUv51zZ+zLNfpGO1xDMvV2rAs5/t3m1BXf6ntXSHGwQZF/1/x L2Yg7gAhbheKYYN/F/P1Zt+d4L+wluqnWB4kPia5XkYE6XP0/zy7iCKJMCcKEjdcUhiB /hhwTp9g5QXLli47qjgnn9wrFjUbRModWgMyuaR8h9NNvzpn1qTYNPdznolBpGL+R4tn bMdDEutfQUnaE1kgqirkIxlDu9DIlQy3/WNu/IYXgqnM4DZKwyQgoDwPr5SepWyJw+/Q 95zQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=r+kjW2bqfCsKWpgSMBS1saMM2rEzm0XtOrNpHWj0dsA=; b=SpbovGClRLQ2MAAlMjsUaLsQJlkMljmwUHm6nuj70w5+aODY72Z6TjIcw/lrCEhsqQ 7hbOrBZYUU056V2qn7ryMBV90ZjNL2YQHIIIzccE4BrjXrckGSM9x51zo4Ga0/hGwxkI R/ESNK7H3YaOukCNh1tF7va1NLZzKrVwEMuK0X7zfTgdgZHtKIJDjVJxLp0khumk7APx sqUf2mEXYHGjgHZ6ppUqc1QU4VYicB5Y4kK+Z/nONhlYcf0XTbEcUYQ+HoRCqzmM2vE6 /ul013gxgK0gN/bm+zmDXVIJqumZKCK63LGXJZKZYVsodRHDVuOkysDV6wFj7WptMIyk wjUg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id ds10-20020a0564021cca00b00456964d3369si3193212edb.230.2022.09.24.00.33.38; Sat, 24 Sep 2022 00:34:05 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233480AbiIXHYu (ORCPT + 99 others); Sat, 24 Sep 2022 03:24:50 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57634 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233436AbiIXHYW (ORCPT ); Sat, 24 Sep 2022 03:24:22 -0400 Received: from szxga01-in.huawei.com (szxga01-in.huawei.com [45.249.212.187]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4353E13E7D2; Sat, 24 Sep 2022 00:24:21 -0700 (PDT) Received: from canpemm500004.china.huawei.com (unknown [172.30.72.57]) by szxga01-in.huawei.com (SkyGuard) with ESMTP id 4MZL534Zw6zlWb4; Sat, 24 Sep 2022 15:20:07 +0800 (CST) Received: from huawei.com (10.175.127.227) by canpemm500004.china.huawei.com (7.192.104.92) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.31; Sat, 24 Sep 2022 15:24:18 +0800 From: Jason Yan To: , CC: , , , , , , , Jason Yan Subject: [PATCH v2 5/8] scsi: libsas: introduce sas address comparation helpers Date: Sat, 24 Sep 2022 15:34:52 +0800 Message-ID: <20220924073455.2186805-6-yanaijie@huawei.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20220924073455.2186805-1-yanaijie@huawei.com> References: <20220924073455.2186805-1-yanaijie@huawei.com> MIME-Version: 1.0 Content-Transfer-Encoding: 7BIT Content-Type: text/plain; charset=US-ASCII X-Originating-IP: [10.175.127.227] X-ClientProxiedBy: dggems704-chm.china.huawei.com (10.3.19.181) To canpemm500004.china.huawei.com (7.192.104.92) X-CFilter-Loop: Reflected X-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_MED, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Sas address comparation is widely used in libsas. However they are all opencoded and to avoid the line spill over 80 columns, are mostly split into multi-lines. Introduce some helpers to prepare some refactor. Signed-off-by: Jason Yan --- drivers/scsi/libsas/sas_internal.h | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/drivers/scsi/libsas/sas_internal.h b/drivers/scsi/libsas/sas_internal.h index 8d0ad3abc7b5..171ffad514ca 100644 --- a/drivers/scsi/libsas/sas_internal.h +++ b/drivers/scsi/libsas/sas_internal.h @@ -111,6 +111,23 @@ static inline void sas_smp_host_handler(struct bsg_job *job, } #endif +static inline bool sas_phy_match_dev_addr(struct domain_device *dev, + struct ex_phy *phy) +{ + return SAS_ADDR(dev->sas_addr) == SAS_ADDR(phy->attached_sas_addr); +} + +static inline bool sas_phy_match_port_addr(struct asd_sas_port *port, + struct ex_phy *phy) +{ + return SAS_ADDR(port->sas_addr) == SAS_ADDR(phy->attached_sas_addr); +} + +static inline bool sas_phy_addr_same(struct ex_phy *p1, struct ex_phy *p2) +{ + return SAS_ADDR(p1->attached_sas_addr) == SAS_ADDR(p2->attached_sas_addr); +} + static inline void sas_fail_probe(struct domain_device *dev, const char *func, int err) { pr_warn("%s: for %s device %016llx returned %d\n", -- 2.31.1