Skip to contentSkip to conversation

drop a few unused DMA exports

PATCH In review Christoph Hellwig 2 participants 6 messages Sep 8, 2020 – Sep 10, 2020 DMA mapping helpers

lore
Share & tools
lore
#1 lore raw

PATCH 1/2 dma-mapping: remove the dma_dummy_ops export

dma_dummy_ops is only used by the ACPI code, which can't be modular.

---
 kernel/dma/dummy.c | 1 -
 1 file changed, 1 deletion(-)
kernel/dma/dummy.c +0 -1
index 05607642c888d9..6974b1bd7d0b88 100644
@@ -36,4 +36,3 @@ const struct dma_map_ops dma_dummy_ops = {
 	.map_sg                 = dma_dummy_map_sg,
 	.dma_supported          = dma_dummy_supported,
 };
-EXPORT_SYMBOL(dma_dummy_ops);
Signature · 6 lines
2.28.0

_______________________________________________
iommu mailing list
[email protected]
https://lists.linuxfoundation.org/mailman/listinfo/iommu
reviewer Reviewed-by on v1 1/2
#2 lore raw

Re: [PATCH 1/2] dma-mapping: remove the dma_dummy_ops export

Quoted 1 line · Christoph Hellwig

dma_dummy_ops is only used by the ACPI code, which can't be modular.

Quoted 11 lines
---
  kernel/dma/dummy.c | 1 -
  1 file changed, 1 deletion(-)
kernel/dma/dummy.c +0 -0
index 05607642c888d9..6974b1bd7d0b88 100644

kernel/dma/dummy.c const struct dma_map_ops dma_dummy_ops = { · line 39

Quoted 4 lines
kernel/dma/dummy.c +0 -1
@@ -36,4 +36,3 @@ const struct dma_map_ops dma_dummy_ops = {
  	.map_sg                 = dma_dummy_map_sg,
  	.dma_supported          = dma_dummy_supported,
  };
-EXPORT_SYMBOL(dma_dummy_ops);

_______________________________________________
iommu mailing list
[email protected]
https://lists.linuxfoundation.org/mailman/listinfo/iommu

#3 lore raw

PATCH 2/2 dma-debug: remove all exports

In reply to Christoph Hellwig

Now that the main dma mapping entry points are out of line none of these functions can be called from modular code.

---
 kernel/dma/debug.c | 12 ------------
 1 file changed, 12 deletions(-)
kernel/dma/debug.c +0 -12
index 8e9f7b301c6d39..9e5370e3700c08 100644
@@ -1199,7 +1199,6 @@ void debug_dma_map_single(struct device *dev, const void *addr,
 		err_printk(dev, NULL, "device driver maps memory from vmalloc area [addr=%p] [len=%lu]\n",
 			   addr, len);
 }
-EXPORT_SYMBOL(debug_dma_map_single);
 
 void debug_dma_map_page(struct device *dev, struct page *page, size_t offset,
 			size_t size, int direction, dma_addr_t dma_addr)
@@ -1235,7 +1234,6 @@ void debug_dma_map_page(struct device *dev, struct page *page, size_t offset,
 
 	add_dma_entry(entry);
 }
-EXPORT_SYMBOL(debug_dma_map_page);
 
 void debug_dma_mapping_error(struct device *dev, dma_addr_t dma_addr)
 {
@@ -1273,7 +1271,6 @@ void debug_dma_mapping_error(struct device *dev, dma_addr_t dma_addr)
 
 	put_hash_bucket(bucket, flags);
 }
-EXPORT_SYMBOL(debug_dma_mapping_error);
 
 void debug_dma_unmap_page(struct device *dev, dma_addr_t addr,
 			  size_t size, int direction)
@@ -1290,7 +1287,6 @@ void debug_dma_unmap_page(struct device *dev, dma_addr_t addr,
 		return;
 	check_unmap(&ref);
 }
-EXPORT_SYMBOL(debug_dma_unmap_page);
 
 void debug_dma_map_sg(struct device *dev, struct scatterlist *sg,
 		      int nents, int mapped_ents, int direction)
@@ -1328,7 +1324,6 @@ void debug_dma_map_sg(struct device *dev, struct scatterlist *sg,
 		add_dma_entry(entry);
 	}
 }
-EXPORT_SYMBOL(debug_dma_map_sg);
 
 static int get_nr_mapped_entries(struct device *dev,
 				 struct dma_debug_entry *ref)
@@ -1380,7 +1375,6 @@ void debug_dma_unmap_sg(struct device *dev, struct scatterlist *sglist,
 		check_unmap(&ref);
 	}
 }
-EXPORT_SYMBOL(debug_dma_unmap_sg);
 
 void debug_dma_alloc_coherent(struct device *dev, size_t size,
 			      dma_addr_t dma_addr, void *virt)
@@ -1466,7 +1460,6 @@ void debug_dma_map_resource(struct device *dev, phys_addr_t addr, size_t size,
 
 	add_dma_entry(entry);
 }
-EXPORT_SYMBOL(debug_dma_map_resource);
 
 void debug_dma_unmap_resource(struct device *dev, dma_addr_t dma_addr,
 			      size_t size, int direction)
@@ -1484,7 +1477,6 @@ void debug_dma_unmap_resource(struct device *dev, dma_addr_t dma_addr,
 
 	check_unmap(&ref);
 }
-EXPORT_SYMBOL(debug_dma_unmap_resource);
 
 void debug_dma_sync_single_for_cpu(struct device *dev, dma_addr_t dma_handle,
 				   size_t size, int direction)
@@ -1503,7 +1495,6 @@ void debug_dma_sync_single_for_cpu(struct device *dev, dma_addr_t dma_handle,
 
 	check_sync(dev, &ref, true);
 }
-EXPORT_SYMBOL(debug_dma_sync_single_for_cpu);
 
 void debug_dma_sync_single_for_device(struct device *dev,
 				      dma_addr_t dma_handle, size_t size,
@@ -1523,7 +1514,6 @@ void debug_dma_sync_single_for_device(struct device *dev,
 
 	check_sync(dev, &ref, false);
 }
-EXPORT_SYMBOL(debug_dma_sync_single_for_device);
 
 void debug_dma_sync_sg_for_cpu(struct device *dev, struct scatterlist *sg,
 			       int nelems, int direction)
@@ -1556,7 +1546,6 @@ void debug_dma_sync_sg_for_cpu(struct device *dev, struct scatterlist *sg,
 		check_sync(dev, &ref, true);
 	}
 }
-EXPORT_SYMBOL(debug_dma_sync_sg_for_cpu);
 
 void debug_dma_sync_sg_for_device(struct device *dev, struct scatterlist *sg,
 				  int nelems, int direction)
@@ -1588,7 +1577,6 @@ void debug_dma_sync_sg_for_device(struct device *dev, struct scatterlist *sg,
 		check_sync(dev, &ref, false);
 	}
 }
-EXPORT_SYMBOL(debug_dma_sync_sg_for_device);
 
 static int __init dma_debug_driver_setup(char *str)
 {
Signature · 6 lines
2.28.0

_______________________________________________
iommu mailing list
[email protected]
https://lists.linuxfoundation.org/mailman/listinfo/iommu
reviewer Reviewed-by on v1 2/2
#4 lore raw

Re: [PATCH 2/2] dma-debug: remove all exports

Quoted 2 lines · Christoph Hellwig

Now that the main dma mapping entry points are out of line none of these functions can be called from modular code.

FWIW I did briefly look at how much of dma-debug we could drop from dma-mapping.h and make entirely private to kernel/dma/, but couldn't convince myself that an awkward split with a few calls still needing to be public would be worthwhile.

Quoted 10 lines
---
  kernel/dma/debug.c | 12 ------------
  1 file changed, 12 deletions(-)
kernel/dma/debug.c +0 -0
index 8e9f7b301c6d39..9e5370e3700c08 100644

kernel/dma/debug.c void debug_dma_map_single(struct device *dev, const void *addr, · line 1202

Quoted 4 lines
kernel/dma/debug.c +0 -1
@@ -1199,7 +1199,6 @@ void debug_dma_map_single(struct device *dev, const void *addr,
  		err_printk(dev, NULL, "device driver maps memory from vmalloc area [addr=%p] [len=%lu]\n",
  			   addr, len);
  }
-EXPORT_SYMBOL(debug_dma_map_single);

This is still called inline via dma_map_single_attrs(), no?

Quoted 11 lines
kernel/dma/debug.c +0 -1
  void debug_dma_map_page(struct device *dev, struct page *page, size_t offset,
  			size_t size, int direction, dma_addr_t dma_addr)
@@ -1235,7 +1234,6 @@ void debug_dma_map_page(struct device *dev, struct page *page, size_t offset,
 
  	add_dma_entry(entry);
  }
-EXPORT_SYMBOL(debug_dma_map_page);
 
  void debug_dma_mapping_error(struct device *dev, dma_addr_t dma_addr)
  {

kernel/dma/debug.c void debug_dma_mapping_error(struct device *dev, dma_addr_t dma_addr) · line 1276

Quoted 4 lines
kernel/dma/debug.c +0 -1
@@ -1273,7 +1271,6 @@ void debug_dma_mapping_error(struct device *dev, dma_addr_t dma_addr)
 
  	put_hash_bucket(bucket, flags);
  }
-EXPORT_SYMBOL(debug_dma_mapping_error);

Ditto this for dma_mapping_error(). We hardly want to discourage modules from calling that ;)

With those fixed (unless I've missed some other preceding change),

Cheers,
Robin.

Quoted 68 lines
kernel/dma/debug.c +0 -8
  void debug_dma_unmap_page(struct device *dev, dma_addr_t addr,
  			  size_t size, int direction)
@@ -1290,7 +1287,6 @@ void debug_dma_unmap_page(struct device *dev, dma_addr_t addr,
  		return;
  	check_unmap(&ref);
  }
-EXPORT_SYMBOL(debug_dma_unmap_page);
 
  void debug_dma_map_sg(struct device *dev, struct scatterlist *sg,
  		      int nents, int mapped_ents, int direction)
@@ -1328,7 +1324,6 @@ void debug_dma_map_sg(struct device *dev, struct scatterlist *sg,
  		add_dma_entry(entry);
  	}
  }
-EXPORT_SYMBOL(debug_dma_map_sg);
 
  static int get_nr_mapped_entries(struct device *dev,
  				 struct dma_debug_entry *ref)
@@ -1380,7 +1375,6 @@ void debug_dma_unmap_sg(struct device *dev, struct scatterlist *sglist,
  		check_unmap(&ref);
  	}
  }
-EXPORT_SYMBOL(debug_dma_unmap_sg);
 
  void debug_dma_alloc_coherent(struct device *dev, size_t size,
  			      dma_addr_t dma_addr, void *virt)
@@ -1466,7 +1460,6 @@ void debug_dma_map_resource(struct device *dev, phys_addr_t addr, size_t size,
 
  	add_dma_entry(entry);
  }
-EXPORT_SYMBOL(debug_dma_map_resource);
 
  void debug_dma_unmap_resource(struct device *dev, dma_addr_t dma_addr,
  			      size_t size, int direction)
@@ -1484,7 +1477,6 @@ void debug_dma_unmap_resource(struct device *dev, dma_addr_t dma_addr,
 
  	check_unmap(&ref);
  }
-EXPORT_SYMBOL(debug_dma_unmap_resource);
 
  void debug_dma_sync_single_for_cpu(struct device *dev, dma_addr_t dma_handle,
  				   size_t size, int direction)
@@ -1503,7 +1495,6 @@ void debug_dma_sync_single_for_cpu(struct device *dev, dma_addr_t dma_handle,
 
  	check_sync(dev, &ref, true);
  }
-EXPORT_SYMBOL(debug_dma_sync_single_for_cpu);
 
  void debug_dma_sync_single_for_device(struct device *dev,
  				      dma_addr_t dma_handle, size_t size,
@@ -1523,7 +1514,6 @@ void debug_dma_sync_single_for_device(struct device *dev,
 
  	check_sync(dev, &ref, false);
  }
-EXPORT_SYMBOL(debug_dma_sync_single_for_device);
 
  void debug_dma_sync_sg_for_cpu(struct device *dev, struct scatterlist *sg,
  			       int nelems, int direction)
@@ -1556,7 +1546,6 @@ void debug_dma_sync_sg_for_cpu(struct device *dev, struct scatterlist *sg,
  		check_sync(dev, &ref, true);
  	}
  }
-EXPORT_SYMBOL(debug_dma_sync_sg_for_cpu);
 
  void debug_dma_sync_sg_for_device(struct device *dev, struct scatterlist *sg,
  				  int nelems, int direction)

kernel/dma/debug.c void debug_dma_sync_sg_for_device(struct device *dev, struct scatterlist *sg, · line 1582

Quoted 7 lines
kernel/dma/debug.c +0 -1
@@ -1588,7 +1577,6 @@ void debug_dma_sync_sg_for_device(struct device *dev, struct scatterlist *sg,
  		check_sync(dev, &ref, false);
  	}
  }
-EXPORT_SYMBOL(debug_dma_sync_sg_for_device);
 
  static int __init dma_debug_driver_setup(char *str)
  {

_______________________________________________
iommu mailing list
[email protected]
https://lists.linuxfoundation.org/mailman/listinfo/iommu

#5 lore raw

Re: [PATCH 2/2] dma-debug: remove all exports

Quoted 4 lines · Robin Murphy

FWIW I did briefly look at how much of dma-debug we could drop from dma-mapping.h and make entirely private to kernel/dma/, but couldn't convince myself that an awkward split with a few calls still needing to be public would be worthwhile.

I've stared to look into a major dma header reshuffle, basically have dma-mapping.h only contain the API needed by consumer of the DMA API, a new linux/dma-map-ops.h for providers, and everyting else under kernel/dma/. The initial prototype looks nice, but I need to finish off a few lose ends.

Quoted 11 lines
Quoted 1 line

-EXPORT_SYMBOL(debug_dma_map_single);

This is still called inline via dma_map_single_attrs(), no?

Quoted 2 lines

}
-EXPORT_SYMBOL(debug_dma_mapping_error);

Ditto this for dma_mapping_error(). We hardly want to discourage modules from calling that ;)

With those fixed (unless I've missed some other preceding change),

Also yes. I actually fixed it up locall this morning, this is what I have now:

---
From 8a310506789611f7a9426e270a8bac647d6f4b1b Mon Sep 17 00:00:00 2001
From: Christoph Hellwig <[email protected]>
Date: Tue, 8 Sep 2020 18:35:24 +0200
Subject: dma-debug: remove most exports

Now that the main dma mapping entry points are out of line most of the symbols in dma-debug.c can only be called from built-in code. Remove the unused exports.

---
 kernel/dma/debug.c | 10 ----------
 1 file changed, 10 deletions(-)
kernel/dma/debug.c +0 -10
index 8e9f7b301c6d39..6f53c2e03aa4f8 100644
@@ -1235,7 +1235,6 @@ void debug_dma_map_page(struct device *dev, struct page *page, size_t offset,
 
 	add_dma_entry(entry);
 }
-EXPORT_SYMBOL(debug_dma_map_page);
 
 void debug_dma_mapping_error(struct device *dev, dma_addr_t dma_addr)
 {
@@ -1290,7 +1289,6 @@ void debug_dma_unmap_page(struct device *dev, dma_addr_t addr,
 		return;
 	check_unmap(&ref);
 }
-EXPORT_SYMBOL(debug_dma_unmap_page);
 
 void debug_dma_map_sg(struct device *dev, struct scatterlist *sg,
 		      int nents, int mapped_ents, int direction)
@@ -1328,7 +1326,6 @@ void debug_dma_map_sg(struct device *dev, struct scatterlist *sg,
 		add_dma_entry(entry);
 	}
 }
-EXPORT_SYMBOL(debug_dma_map_sg);
 
 static int get_nr_mapped_entries(struct device *dev,
 				 struct dma_debug_entry *ref)
@@ -1380,7 +1377,6 @@ void debug_dma_unmap_sg(struct device *dev, struct scatterlist *sglist,
 		check_unmap(&ref);
 	}
 }
-EXPORT_SYMBOL(debug_dma_unmap_sg);
 
 void debug_dma_alloc_coherent(struct device *dev, size_t size,
 			      dma_addr_t dma_addr, void *virt)
@@ -1466,7 +1462,6 @@ void debug_dma_map_resource(struct device *dev, phys_addr_t addr, size_t size,
 
 	add_dma_entry(entry);
 }
-EXPORT_SYMBOL(debug_dma_map_resource);
 
 void debug_dma_unmap_resource(struct device *dev, dma_addr_t dma_addr,
 			      size_t size, int direction)
@@ -1484,7 +1479,6 @@ void debug_dma_unmap_resource(struct device *dev, dma_addr_t dma_addr,
 
 	check_unmap(&ref);
 }
-EXPORT_SYMBOL(debug_dma_unmap_resource);
 
 void debug_dma_sync_single_for_cpu(struct device *dev, dma_addr_t dma_handle,
 				   size_t size, int direction)
@@ -1503,7 +1497,6 @@ void debug_dma_sync_single_for_cpu(struct device *dev, dma_addr_t dma_handle,
 
 	check_sync(dev, &ref, true);
 }
-EXPORT_SYMBOL(debug_dma_sync_single_for_cpu);
 
 void debug_dma_sync_single_for_device(struct device *dev,
 				      dma_addr_t dma_handle, size_t size,
@@ -1523,7 +1516,6 @@ void debug_dma_sync_single_for_device(struct device *dev,
 
 	check_sync(dev, &ref, false);
 }
-EXPORT_SYMBOL(debug_dma_sync_single_for_device);
 
 void debug_dma_sync_sg_for_cpu(struct device *dev, struct scatterlist *sg,
 			       int nelems, int direction)
@@ -1556,7 +1548,6 @@ void debug_dma_sync_sg_for_cpu(struct device *dev, struct scatterlist *sg,
 		check_sync(dev, &ref, true);
 	}
 }
-EXPORT_SYMBOL(debug_dma_sync_sg_for_cpu);
 
 void debug_dma_sync_sg_for_device(struct device *dev, struct scatterlist *sg,
 				  int nelems, int direction)
@@ -1588,7 +1579,6 @@ void debug_dma_sync_sg_for_device(struct device *dev, struct scatterlist *sg,
 		check_sync(dev, &ref, false);
 	}
 }
-EXPORT_SYMBOL(debug_dma_sync_sg_for_device);
 
 static int __init dma_debug_driver_setup(char *str)
 {
Signature · 6 lines
2.28.0

_______________________________________________
iommu mailing list
[email protected]
https://lists.linuxfoundation.org/mailman/listinfo/iommu