Skip to content

Commit 2cbc277

Browse files
Christoph Hellwigkonradwilk
Christoph Hellwig
authored andcommitted
swiotlb: remove swiotlb_nr_tbl
All callers just use it to check if swiotlb is active at all, for which they can just use is_swiotlb_active. In the longer run drivers need to stop using is_swiotlb_active as well, but let's do the simple step first. Signed-off-by: Christoph Hellwig <[email protected]> Signed-off-by: Konrad Rzeszutek Wilk <[email protected]>
1 parent 2d29960 commit 2cbc277

File tree

5 files changed

+4
-10
lines changed

5 files changed

+4
-10
lines changed

drivers/gpu/drm/i915/gem/i915_gem_internal.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ static int i915_gem_object_get_pages_internal(struct drm_i915_gem_object *obj)
4242

4343
max_order = MAX_ORDER;
4444
#ifdef CONFIG_SWIOTLB
45-
if (swiotlb_nr_tbl()) {
45+
if (is_swiotlb_active()) {
4646
unsigned int max_segment;
4747

4848
max_segment = swiotlb_max_segment();

drivers/gpu/drm/nouveau/nouveau_ttm.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -321,7 +321,7 @@ nouveau_ttm_init(struct nouveau_drm *drm)
321321
}
322322

323323
#if IS_ENABLED(CONFIG_SWIOTLB) && IS_ENABLED(CONFIG_X86)
324-
need_swiotlb = !!swiotlb_nr_tbl();
324+
need_swiotlb = is_swiotlb_active();
325325
#endif
326326

327327
ret = ttm_bo_device_init(&drm->ttm.bdev, &nouveau_bo_driver,

drivers/pci/xen-pcifront.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -693,7 +693,7 @@ static int pcifront_connect_and_init_dma(struct pcifront_device *pdev)
693693

694694
spin_unlock(&pcifront_dev_lock);
695695

696-
if (!err && !swiotlb_nr_tbl()) {
696+
if (!err && !is_swiotlb_active()) {
697697
err = pci_xen_swiotlb_init_late();
698698
if (err)
699699
dev_err(&pdev->xdev->dev, "Could not setup SWIOTLB!\n");

include/linux/swiotlb.h

-1
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,6 @@ enum swiotlb_force {
3737

3838
extern void swiotlb_init(int verbose);
3939
int swiotlb_init_with_tbl(char *tlb, unsigned long nslabs, int verbose);
40-
extern unsigned long swiotlb_nr_tbl(void);
4140
unsigned long swiotlb_size_or_default(void);
4241
extern int swiotlb_late_init_with_tbl(char *tlb, unsigned long nslabs);
4342
extern int swiotlb_late_init_with_default_size(size_t default_size);

kernel/dma/swiotlb.c

+1-6
Original file line numberDiff line numberDiff line change
@@ -94,12 +94,6 @@ setup_io_tlb_npages(char *str)
9494
}
9595
early_param("swiotlb", setup_io_tlb_npages);
9696

97-
unsigned long swiotlb_nr_tbl(void)
98-
{
99-
return io_tlb_default_mem ? io_tlb_default_mem->nslabs : 0;
100-
}
101-
EXPORT_SYMBOL_GPL(swiotlb_nr_tbl);
102-
10397
unsigned int swiotlb_max_segment(void)
10498
{
10599
return io_tlb_default_mem ? max_segment : 0;
@@ -652,6 +646,7 @@ bool is_swiotlb_active(void)
652646
{
653647
return io_tlb_default_mem != NULL;
654648
}
649+
EXPORT_SYMBOL_GPL(is_swiotlb_active);
655650

656651
#ifdef CONFIG_DEBUG_FS
657652

0 commit comments

Comments
 (0)