Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id D8377C6379F for ; Tue, 21 Feb 2023 14:07:09 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233922AbjBUOHI (ORCPT ); Tue, 21 Feb 2023 09:07:08 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58332 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233202AbjBUOHG (ORCPT ); Tue, 21 Feb 2023 09:07:06 -0500 Received: from frasgout12.his.huawei.com (frasgout12.his.huawei.com [14.137.139.154]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 57D0BA270 for ; Tue, 21 Feb 2023 06:06:43 -0800 (PST) Received: from mail02.huawei.com (unknown [172.18.147.228]) by frasgout12.his.huawei.com (SkyGuard) with ESMTP id 4PLgpk0ZN2z9xFrF for ; Tue, 21 Feb 2023 21:57:50 +0800 (CST) Received: from huaweicloud.com (unknown [10.81.218.48]) by APP2 (Coremail) with SMTP id GxC2BwAn913fz_Rj5Fo8AQ--.7877S2; Tue, 21 Feb 2023 15:06:29 +0100 (CET) From: Petr Tesarik To: patchwork@huawei.com, Christoph Hellwig , Marek Szyprowski , Robin Murphy , iommu@lists.linux.dev (open list:DMA MAPPING HELPERS), linux-kernel@vger.kernel.org (open list) Cc: roberto.sassu@huawei.com Subject: [PATCH] swiotlb: remove unnecessary function swiotlb_max_segment() Date: Tue, 21 Feb 2023 15:06:09 +0100 Message-Id: <20230221140609.386-1-petrtesarik@huaweicloud.com> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-CM-TRANSID: GxC2BwAn913fz_Rj5Fo8AQ--.7877S2 X-Coremail-Antispam: 1UD129KBjvJXoW7Ar1kZr1fAF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: X-Mailing-List: linux-kernel@vger.kernel.org From: Petr Tesarik It is difficult to imagine how this function should be used by drivers. The last in-tree user was removed by commit d3f6bacfca86 ("drm/i915: stop abusing swiotlb_max_segment"), and even this user had been abusing it to achieve a different goal. Let's remove this function now, as already suggested by Chris Hellwig about a year ago in commit a2daa27c0c61 ("swiotlb: simplify swiotlb_max_segment"). Signed-off-by: Petr Tesarik --- include/linux/swiotlb.h | 5 ----- kernel/dma/swiotlb.c | 8 -------- 2 files changed, 13 deletions(-) diff --git a/include/linux/swiotlb.h b/include/linux/swiotlb.h index 35bc4e281c21..bcef10e20ea4 100644 --- a/include/linux/swiotlb.h +++ b/include/linux/swiotlb.h @@ -121,7 +121,6 @@ static inline bool is_swiotlb_force_bounce(struct device *dev) void swiotlb_init(bool addressing_limited, unsigned int flags); void __init swiotlb_exit(void); -unsigned int swiotlb_max_segment(void); size_t swiotlb_max_mapping_size(struct device *dev); bool is_swiotlb_active(struct device *dev); void __init swiotlb_adjust_size(unsigned long size); @@ -140,10 +139,6 @@ static inline bool is_swiotlb_force_bounce(struct device *dev) static inline void swiotlb_exit(void) { } -static inline unsigned int swiotlb_max_segment(void) -{ - return 0; -} static inline size_t swiotlb_max_mapping_size(struct device *dev) { return SIZE_MAX; diff --git a/kernel/dma/swiotlb.c b/kernel/dma/swiotlb.c index a34c38bbe28f..f35d934f6e58 100644 --- a/kernel/dma/swiotlb.c +++ b/kernel/dma/swiotlb.c @@ -156,14 +156,6 @@ setup_io_tlb_npages(char *str) } early_param("swiotlb", setup_io_tlb_npages); -unsigned int swiotlb_max_segment(void) -{ - if (!io_tlb_default_mem.nslabs) - return 0; - return rounddown(io_tlb_default_mem.nslabs << IO_TLB_SHIFT, PAGE_SIZE); -} -EXPORT_SYMBOL_GPL(swiotlb_max_segment); - unsigned long swiotlb_size_or_default(void) { return default_nslabs << IO_TLB_SHIFT; -- 2.25.1