Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp1335368rwd; Thu, 25 May 2023 11:04:07 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ6C7nd6B22T+m/TT+1tptebWKASj4Ee+F8/S2NTC17Z3zYdxqZFwqWrxN6SZ7rqimhIUAKI X-Received: by 2002:a17:902:7e05:b0:1a6:54ce:4311 with SMTP id b5-20020a1709027e0500b001a654ce4311mr2153677plm.43.1685037846769; Thu, 25 May 2023 11:04:06 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1685037846; cv=none; d=google.com; s=arc-20160816; b=KyFyOqbyKh+CX45KYF0P83ZT411XKEiAY7ttquHsdu/qhg8f12+uM6KJdvlSbNqe2f EKbQGsZl/LcSEpaAlZUMCdVJL28YrPwCe6nRY4kVRZHrWOernrZ0R/CjzR0dNPzjbS3n Jkme1sERn9uWcwnn22rTOOrIH859+wH6LEo3FoosflJZLPzVej+6K7UoOBntheCkqxUP AP1Jnku5U95ZV0wnsJFPPFtzXuiihMLlTl/PK8AkohL4fsgE8i5+VhyAdahElVeQEfkk WIyejJh3znCoST9xsidr+0iUayemY/HeiB/SkMLhSAmUm5hZeP0dH0PH02cfOBSp5P2a aimw== 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=9tmlcKlv8TUCyOC0O/0Og4oNss+e/8lPWQcKW/Ghcf8=; b=qzSZIvxeDSEDR6qnrg2TdN0/0gHiaXWtsuGGOrVjfEcC20iSxL1U9JSyo2shttUa/M fpod4eZMdf21Gtja+BCq+P9FfP8Okzb13SD3tvVL+sXFDZZ4szaf6gG0/8tAHyA6i+bB cbeB6GsDK6UClkCwF75AGjjdC1HAQ+A/zJUlGYMSFPbYZD317/6gDQXxk7Vx6Q+uJLrp NdrIg2elJmNOR4rx02sDM23VfrX6xzfdw1KhgTy14r7FKrRVRci9hGBoFHZsJeqEHhq9 CYiQYRQ5uJVJ3BxmiHhH5SMfteAncrJ9TjUOSfiHmOKwWZLNBjZJZ7S2DwKAFmlB6MUn UwHA== 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=NONE sp=NONE dis=NONE) header.from=arm.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id d16-20020a170902ced000b001ae40e07fb3si2090253plg.563.2023.05.25.11.03.54; Thu, 25 May 2023 11:04:06 -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=NONE sp=NONE dis=NONE) header.from=arm.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234112AbjEYRqx (ORCPT + 99 others); Thu, 25 May 2023 13:46:53 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52922 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240624AbjEYRqo (ORCPT ); Thu, 25 May 2023 13:46:44 -0400 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 79BE410B for ; Thu, 25 May 2023 10:46:36 -0700 (PDT) Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 5CF881042; Thu, 25 May 2023 10:47:21 -0700 (PDT) Received: from e121345-lin.cambridge.arm.com (e121345-lin.cambridge.arm.com [10.1.196.40]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id 5D1233F6C4; Thu, 25 May 2023 10:46:35 -0700 (PDT) From: Robin Murphy To: hch@infradead.org Cc: m.szyprowski@samsung.com, iommu@lists.linux.dev, catalin.marinas@arm.com, linux-kernel@vger.kernel.org, logang@deltatee.com Subject: [PATCH] dma-mapping: Name SG DMA flag helpers consistently Date: Thu, 25 May 2023 18:46:31 +0100 Message-Id: X-Mailer: git-send-email 2.39.2.101.g768bb238c484.dirty MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_MED, SPF_HELO_NONE,SPF_NONE,T_SCC_BODY_TEXT_LINE 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 sg_is_dma_bus_address() is inconsistent with the naming pattern of its corresponding setters and its own kerneldoc, so take the majority vote and rename it sg_dma_is_bus_address() (and fix up the missing underscores in the kerneldoc too). This gives us a nice clear pattern where SG DMA flags are SG_DMA_, and the helpers for acting on them are sg_dma__(). Signed-off-by: Robin Murphy --- drivers/iommu/dma-iommu.c | 8 ++++---- drivers/iommu/iommu.c | 2 +- include/linux/scatterlist.h | 8 ++++---- kernel/dma/direct.c | 2 +- 4 files changed, 10 insertions(+), 10 deletions(-) diff --git a/drivers/iommu/dma-iommu.c b/drivers/iommu/dma-iommu.c index 7a9f0b0bddbd..b8bba4aa196f 100644 --- a/drivers/iommu/dma-iommu.c +++ b/drivers/iommu/dma-iommu.c @@ -1080,7 +1080,7 @@ static int __finalise_sg(struct device *dev, struct scatterlist *sg, int nents, sg_dma_address(s) = DMA_MAPPING_ERROR; sg_dma_len(s) = 0; - if (sg_is_dma_bus_address(s)) { + if (sg_dma_is_bus_address(s)) { if (i > 0) cur = sg_next(cur); @@ -1136,7 +1136,7 @@ static void __invalidate_sg(struct scatterlist *sg, int nents) int i; for_each_sg(sg, s, nents, i) { - if (sg_is_dma_bus_address(s)) { + if (sg_dma_is_bus_address(s)) { sg_dma_unmark_bus_address(s); } else { if (sg_dma_address(s) != DMA_MAPPING_ERROR) @@ -1329,7 +1329,7 @@ static void iommu_dma_unmap_sg(struct device *dev, struct scatterlist *sg, * just have to be determined. */ for_each_sg(sg, tmp, nents, i) { - if (sg_is_dma_bus_address(tmp)) { + if (sg_dma_is_bus_address(tmp)) { sg_dma_unmark_bus_address(tmp); continue; } @@ -1343,7 +1343,7 @@ static void iommu_dma_unmap_sg(struct device *dev, struct scatterlist *sg, nents -= i; for_each_sg(tmp, tmp, nents, i) { - if (sg_is_dma_bus_address(tmp)) { + if (sg_dma_is_bus_address(tmp)) { sg_dma_unmark_bus_address(tmp); continue; } diff --git a/drivers/iommu/iommu.c b/drivers/iommu/iommu.c index f1dcfa3f1a1b..eb620552967b 100644 --- a/drivers/iommu/iommu.c +++ b/drivers/iommu/iommu.c @@ -2567,7 +2567,7 @@ ssize_t iommu_map_sg(struct iommu_domain *domain, unsigned long iova, len = 0; } - if (sg_is_dma_bus_address(sg)) + if (sg_dma_is_bus_address(sg)) goto next; if (len) { diff --git a/include/linux/scatterlist.h b/include/linux/scatterlist.h index 375a5e90d86a..d1ed52d083da 100644 --- a/include/linux/scatterlist.h +++ b/include/linux/scatterlist.h @@ -259,7 +259,7 @@ static inline void sg_unmark_end(struct scatterlist *sg) #define SG_DMA_BUS_ADDRESS (1 << 0) /** - * sg_dma_is_bus address - Return whether a given segment was marked + * sg_dma_is_bus_address - Return whether a given segment was marked * as a bus address * @sg: SG entry * @@ -267,13 +267,13 @@ static inline void sg_unmark_end(struct scatterlist *sg) * Returns true if sg_dma_mark_bus_address() has been called on * this segment. **/ -static inline bool sg_is_dma_bus_address(struct scatterlist *sg) +static inline bool sg_dma_is_bus_address(struct scatterlist *sg) { return sg->dma_flags & SG_DMA_BUS_ADDRESS; } /** - * sg_dma_mark_bus address - Mark the scatterlist entry as a bus address + * sg_dma_mark_bus_address - Mark the scatterlist entry as a bus address * @sg: SG entry * * Description: @@ -301,7 +301,7 @@ static inline void sg_dma_unmark_bus_address(struct scatterlist *sg) #else -static inline bool sg_is_dma_bus_address(struct scatterlist *sg) +static inline bool sg_dma_is_bus_address(struct scatterlist *sg) { return false; } diff --git a/kernel/dma/direct.c b/kernel/dma/direct.c index 5595d1d5cdcc..d29cade048db 100644 --- a/kernel/dma/direct.c +++ b/kernel/dma/direct.c @@ -463,7 +463,7 @@ void dma_direct_unmap_sg(struct device *dev, struct scatterlist *sgl, int i; for_each_sg(sgl, sg, nents, i) { - if (sg_is_dma_bus_address(sg)) + if (sg_dma_is_bus_address(sg)) sg_dma_unmark_bus_address(sg); else dma_direct_unmap_page(dev, sg->dma_address, -- 2.39.2.101.g768bb238c484.dirty