Received: by 2002:a05:6359:c8b:b0:c7:702f:21d4 with SMTP id go11csp342987rwb; Mon, 26 Sep 2022 20:20:24 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7pkcExx2v2D//bb4HLaThELk8UbWkrFzjTEC+AaETUhtlKJXn65/qt9g+aH0pg0WhtGeZJ X-Received: by 2002:a17:906:6a2a:b0:782:356e:4207 with SMTP id qw42-20020a1709066a2a00b00782356e4207mr21217138ejc.167.1664248824565; Mon, 26 Sep 2022 20:20:24 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1664248824; cv=none; d=google.com; s=arc-20160816; b=rCrm5asy4DHZD5bEaq5tixfMKPIFf6yLklkjHb2x91HOWBAHuEheQa57+youk65k/D wZGN67pRBGTqif0r5Orir5EMGR41XjFYlgISkSwLVsjD4xE3F7jVk2jJDmVCnovOYy34 15jSw5xBK+Kgd3N5UQSvZq9uv3+bDJWSEpu5K6/CI5cEGkpH7fJ1GPZ85+G4mS3Nr/sT fuaIZxxNo8qVfsWQPWX1ARkkPfsuGvOd0CASHqjbW1GC8SgommY4YkU/zzPkD8z5X1it dgXXFMjUPv0420QFv9Qaq9ZUefanKoTefqLyK0AcMy9H8d1tWI9Zhetz50cu0vRXctft zTUQ== 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 :message-id:date:subject:cc:to:from; bh=aLGEXhBQBoXvk4eO65zvJft4JQXnelVrKTm89CqP3Q8=; b=pK/6CNofsN4Y7ysY5zhK12us0/al1qYvXglaNaFckjZMZ5/DM87xeZkkLDL+ClzbA5 IFJTy5LKDI8kwUxt2O3dICRKuUz6MThB37znAMUVmGrOVTYVoK9ri1Z6N/n23cEQrjL7 UuV6uBsA9Y0LuTihcphFU1xSVyyxkm11Bjagks5cdRXC8sxdR3mfp/541UkW5mkKfwEc mbF7SHmbgW/yZf/bDh6eCq5JpOCdYN9EicMBYbh/tTrkFkXhR8C16WGKgyHgkthQ2IJf Hy2IwvUy54ouD98gFhyjgqBg8wM51riEEF9bWPolh6uj5D7WkrZKcS0HCA634NN0FFyx wiTQ== 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 ht21-20020a170907609500b0074172ed562dsi99022ejc.813.2022.09.26.20.19.57; Mon, 26 Sep 2022 20:20:24 -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 S231536AbiI0DRG (ORCPT + 99 others); Mon, 26 Sep 2022 23:17:06 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59238 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231274AbiI0DQB (ORCPT ); Mon, 26 Sep 2022 23:16:01 -0400 Received: from szxga08-in.huawei.com (szxga08-in.huawei.com [45.249.212.255]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6C3EB58514; Mon, 26 Sep 2022 20:15:37 -0700 (PDT) Received: from canpemm500004.china.huawei.com (unknown [172.30.72.53]) by szxga08-in.huawei.com (SkyGuard) with ESMTP id 4Mc4Qc5wnMz1P6gX; Tue, 27 Sep 2022 11:11:20 +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 11:15:28 +0800 From: Jason Yan To: , CC: , , , , , , , , Jason Yan Subject: [PATCH v4 0/8] scsi: libsas: sas address comparison refactor Date: Tue, 27 Sep 2022 11:25:57 +0800 Message-ID: <20220927032605.78103-1-yanaijie@huawei.com> X-Mailer: git-send-email 2.31.1 MIME-Version: 1.0 Content-Transfer-Encoding: 7BIT Content-Type: text/plain; charset=US-ASCII X-Originating-IP: [10.175.127.227] X-ClientProxiedBy: dggems701-chm.china.huawei.com (10.3.19.178) 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 conversion and comparison is widely used in libsas and drivers. However they are all opencoded and to avoid the line spill over 80 columns, are mostly split into multi-lines. To make the code easier to read, introduce some helpers with clearer semantics and replace the opencoded segments with them. v3->v4: Fix comparison typo. Fix test condition error in sas_check_parent_topology() of patch #6. v2->v3: Rename sas_phy_addr_same() to sas_phy_addr_match(). Rearrange patches, move patch #6 to #1 and directly use the helper sas_phy_match_dev_addr() in sas_find_attached_phy(). Add some review tags from Jack Wang. v1->v2: First factor out sas_find_attached_phy() and replace LLDDs's code with it. Remove three too simple helpers. Rename the helpers with 'sas_' prefix. Jason Yan (8): scsi: libsas: introduce sas address comparison helpers scsi: libsas: introduce sas_find_attached_phy() helper scsi: pm8001: use sas_find_attached_phy() instead of open coded scsi: mvsas: use sas_find_attached_phy() instead of open coded scsi: hisi_sas: use sas_find_attathed_phy() instead of open coded scsi: libsas: use sas_phy_match_dev_addr() instead of open coded scsi: libsas: use sas_phy_addr_match() instead of open coded scsi: libsas: use sas_phy_match_port_addr() instead of open coded drivers/scsi/hisi_sas/hisi_sas_main.c | 12 ++------ drivers/scsi/libsas/sas_expander.c | 40 ++++++++++++++++----------- drivers/scsi/libsas/sas_internal.h | 17 ++++++++++++ drivers/scsi/mvsas/mv_sas.c | 15 +++------- drivers/scsi/pm8001/pm8001_sas.c | 16 ++++------- include/scsi/libsas.h | 2 ++ 6 files changed, 54 insertions(+), 48 deletions(-) -- 2.31.1