Received: by 2002:a05:6359:c8b:b0:c7:702f:21d4 with SMTP id go11csp321253rwb; Mon, 26 Sep 2022 19:51:59 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6X167eAy7Cs3UF4e4QaGBxnt8m0+BoV10kFiIqF6JBc53RcH0JuyuWY5HB4l1PvISmRrNr X-Received: by 2002:a17:906:eec7:b0:733:189f:b07a with SMTP id wu7-20020a170906eec700b00733189fb07amr21739449ejb.230.1664247119186; Mon, 26 Sep 2022 19:51:59 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1664247119; cv=none; d=google.com; s=arc-20160816; b=Q46AmzaBcOGEZB2uVdBbAZtwS5wky6UK1DIAkuzlTH3sRl2vIWTk5kdNRtuWx6O5ej F0XAHAHdj01ilojzL8X10DX7zH0TP3dhMv2LPqOwFzMZ1LS35aMjSFjPBaqzpu6wEm0k +8DXNnKa6l4YBryoIFgzDkRYEOvkHMkaQAgBs2WXQupXUEDg2htVFnUCF6nW9z4nvMvY 0WGkiw67x0Q27GNf63izuEBRsvYX7dGH+5KK32jMZwS5/QwStiDs+vibWAUCDPq+8gED cj1VyalheCPC6I5aX7XvljzOL0RZcmQ5WbOGFM1BSiENeWAJzwvkVfPDr6bNfPh77M+h jOEg== 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=klmhOUlAn6SJTZmzIgL8LNZk4JOIDsQPY+VlVwTS3cw=; b=MF99TLW9YcnqgQECIklJRQhVZT8usmz6gjdcKSfnf0bV1Vply3N4luILkhjybwkAbZ btbyWYLRv4vw+Zv+XYkfwG4MbPDTfMKcSqKCP4DyxOQdljKcxzT89hMvLahfReApzKYo 7cxUgzRH3lPbcGck5aexXMuWHjwEIwSIejIPKZLmqxIx2zod+A6hvWLZ4BfFN3KHH1/D pGcDIxWACKdWZvNkx1Rs+QjZs/b4o5Px3MHuZdiopTeeand3GaCxBx4KS3lZOotqc8Ey 3EbBuxVOHmA3eVoD3UqebEsOaueuQSgmoglWjZ6tSMvQqDDmIS6qaoSyS0B1r+2ImCfM CVwg== 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 qb33-20020a1709077ea100b007821d14f2a8si120906ejc.398.2022.09.26.19.51.31; Mon, 26 Sep 2022 19:51:59 -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 S229936AbiI0CTR (ORCPT + 99 others); Mon, 26 Sep 2022 22:19:17 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60786 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229706AbiI0CTI (ORCPT ); Mon, 26 Sep 2022 22:19:08 -0400 Received: from szxga03-in.huawei.com (szxga03-in.huawei.com [45.249.212.189]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 01D3D93233; Mon, 26 Sep 2022 19:19:06 -0700 (PDT) Received: from canpemm500004.china.huawei.com (unknown [172.30.72.54]) by szxga03-in.huawei.com (SkyGuard) with ESMTP id 4Mc3Cj0VmjzHq6C; Tue, 27 Sep 2022 10:16:49 +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; Tue, 27 Sep 2022 10:19:04 +0800 From: Jason Yan To: , CC: , , , , , , , Jason Yan Subject: [PATCH v3 1/8] scsi: libsas: introduce sas address comparation helpers Date: Tue, 27 Sep 2022 10:29:34 +0800 Message-ID: <20220927022941.4029476-2-yanaijie@huawei.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20220927022941.4029476-1-yanaijie@huawei.com> References: <20220927022941.4029476-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: dggems702-chm.china.huawei.com (10.3.19.179) 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..3384429b7eb0 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_match(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