Skip to contentSkip to conversation

x86_64: change _map_single to static in pci_gart.c etc

PATCH In review Yinghai Lu 4 participants 9 messages Jun 27, 2007

lore
Share & tools
lore

Yinghai Lu

author
#0 lore raw

PATCH 1/1 x86_64: change _map_single to static in pci_gart.c etc

[PATCH] x86_64: change _map_single to static in pci_gart.c etc

there function is called via dma_ops->.., so change it to static

arch/x86_64/kernel/pci-calgary.c +4 -4
index 5bd20b5..8e03399 100644
@@ -385,7 +385,7 @@ static int calgary_nontranslate_map_sg(struct device* dev,
 	return nelems;
 }
 
-int calgary_map_sg(struct device *dev, struct scatterlist *sg,
+static int calgary_map_sg(struct device *dev, struct scatterlist *sg,
 	int nelems, int direction)
 {
 	struct iommu_table *tbl = to_pci_dev(dev)->bus->self->sysdata;
@@ -436,7 +436,7 @@ error:
 	return 0;
 }
 
-dma_addr_t calgary_map_single(struct device *dev, void *vaddr,
+static dma_addr_t calgary_map_single(struct device *dev, void *vaddr,
 	size_t size, int direction)
 {
 	dma_addr_t dma_handle = bad_dma_address;
@@ -455,7 +455,7 @@ dma_addr_t calgary_map_single(struct device *dev, void *vaddr,
 	return dma_handle;
 }
 
-void calgary_unmap_single(struct device *dev, dma_addr_t dma_handle,
+static void calgary_unmap_single(struct device *dev, dma_addr_t dma_handle,
 	size_t size, int direction)
 {
 	struct iommu_table *tbl = to_pci_dev(dev)->bus->self->sysdata;
@@ -468,7 +468,7 @@ void calgary_unmap_single(struct device *dev, dma_addr_t dma_handle,
 	iommu_free(tbl, dma_handle, npages);
 }
 
-void* calgary_alloc_coherent(struct device *dev, size_t size,
+static void* calgary_alloc_coherent(struct device *dev, size_t size,
 	dma_addr_t *dma_handle, gfp_t flag)
 {
 	void *ret = NULL;
arch/x86_64/kernel/pci-nommu.c +3 -3
index 6dade0c..2a34c6c 100644
@@ -34,7 +34,7 @@ nommu_map_single(struct device *hwdev, void *ptr, size_t size,
 	return bus;
 }
 
-void nommu_unmap_single(struct device *dev, dma_addr_t addr,size_t size,
+static void nommu_unmap_single(struct device *dev, dma_addr_t addr,size_t size,
 			int direction)
 {
 }
@@ -54,7 +54,7 @@ void nommu_unmap_single(struct device *dev, dma_addr_t addr,size_t size,
  * Device ownership issues as mentioned above for pci_map_single are
  * the same here.
  */
-int nommu_map_sg(struct device *hwdev, struct scatterlist *sg,
+static int nommu_map_sg(struct device *hwdev, struct scatterlist *sg,
 	       int nents, int direction)
 {
 	int i;
@@ -74,7 +74,7 @@ int nommu_map_sg(struct device *hwdev, struct scatterlist *sg,
  * Again, cpu read rules concerning calls here are the same as for
  * pci_unmap_single() above.
  */
-void nommu_unmap_sg(struct device *dev, struct scatterlist *sg,
+static void nommu_unmap_sg(struct device *dev, struct scatterlist *sg,
 		  int nents, int dir)
 {
 }
arch/x86_64/kernel/pci-gart.c +3 -3
index ae091cd..4918c57 100644
@@ -235,7 +236,7 @@ static dma_addr_t gart_map_simple(struct device *dev, char *buf,
 }
 
 /* Map a single area into the IOMMU */
-dma_addr_t gart_map_single(struct device *dev, void *addr, size_t size, int dir)
+static dma_addr_t gart_map_single(struct device *dev, void *addr, size_t size, int dir)
 {
 	unsigned long phys_mem, bus;
 
@@ -253,7 +254,7 @@ dma_addr_t gart_map_single(struct device *dev, void *addr, size_t size, int dir)
 /*
  * Free a DMA mapping.
  */
-void gart_unmap_single(struct device *dev, dma_addr_t dma_addr,
+static void gart_unmap_single(struct device *dev, dma_addr_t dma_addr,
 		      size_t size, int direction)
 {
 	unsigned long iommu_page;
@@ -275,7 +276,7 @@ void gart_unmap_single(struct device *dev, dma_addr_t dma_addr,
 /*
  * Wrapper for pci_unmap_single working with scatterlists.
  */
-void gart_unmap_sg(struct device *dev, struct scatterlist *sg, int nents, int dir)
+static void gart_unmap_sg(struct device *dev, struct scatterlist *sg, int nents, int dir)
 {
 	int i;
 
#1 lore raw
Quoted 3 lines · Yinghai Lu

[PATCH] x86_64: change _map_single to static in pci_gart.c etc

there function is called via dma_ops->.., so change it to static

Thanks, mostly looks good - will verify and push via the next set of Calgary updates.

Cheers,
Muli

#2 lore raw
Quoted 7 lines · Muli Ben-Yehuda
Quoted 3 lines · Yinghai Lu

[PATCH] x86_64: change _map_single to static in pci_gart.c etc

there function is called via dma_ops->.., so change it to static

Thanks, mostly looks good - will verify and push via the next set of Calgary updates.

Sorry, should've read the patch more carefully - above applies to Calgary bits only.

Chers,
Muli

#3 lore raw
Quoted 11 lines · Muli Ben-Yehuda
Quoted 7 lines · Muli Ben-Yehuda
Quoted 3 lines · Yinghai Lu

[PATCH] x86_64: change _map_single to static in pci_gart.c etc

there function is called via dma_ops->.., so change it to static

Thanks, mostly looks good - will verify and push via the next set of Calgary updates.

Sorry, should've read the patch more carefully - above applies to Calgary bits only.

arch/x86_64/kernel/pci-calgary.c |    8 ++++----
arch/x86_64/kernel/pci-gart.c    |    6 +++---
arch/x86_64/kernel/pci-nommu.c   |    6 +++---
3 files changed, 10 insertions(+), 10 deletions(-

YH

#4 lore raw
In reply to Yinghai Lu
Quoted 3 lines · On Wednesday 27 June 2007 19:41:21 Yinghai Lu wrote:

[PATCH] x86_64: change _map_single to static in pci_gart.c etc

there function is called via dma_ops->.., so change it to static

Actually all these functions shouldn't be inline in the first place.

-Andi

#5 lore raw
Quoted 6 lines · Andi Kleen
Quoted 3 lines · On Wednesday 27 June 2007 19:41:21 Yinghai Lu wrote:

[PATCH] x86_64: change _map_single to static in pci_gart.c etc

there function is called via dma_ops->.., so change it to static

Actually all these functions shouldn't be inline in the first place.

do you mean pci_map_single==>dma_map_single==>gart_map_single?

YH

#6 lore raw
Quoted 9 lines · On Wednesday 27 June 2007 22:25:11 Yinghai Lu wrote:
Quoted 6 lines · Andi Kleen
Quoted 3 lines · On Wednesday 27 June 2007 19:41:21 Yinghai Lu wrote:

[PATCH] x86_64: change _map_single to static in pci_gart.c etc

there function is called via dma_ops->.., so change it to static

Actually all these functions shouldn't be inline in the first place.

do you mean pci_map_single==>dma_map_single==>gart_map_single?

dma_map_single. pci_map_single is ok because it doesn't really change anything.

-Andi

#7 lore raw
Quoted 5 lines · Andi Kleen
Quoted 4 lines · On Wednesday 27 June 2007 22:25:11 Yinghai Lu wrote:
Quoted 3 lines · Andi Kleen
Quoted 2 lines · On Wednesday 27 June 2007 19:41:21 Yinghai Lu wrote:

[PATCH] x86_64: change _map_single to static in pci_gart.c etc

Quoted 8 lines
Quoted 5 lines
Quoted 3 lines
Quoted 1 line

there function is called via dma_ops->.., so change it to static

Actually all these functions shouldn't be inline in the first place.

do you mean pci_map_single==>dma_map_single==>gart_map_single?

dma_map_single. pci_map_single is ok because it doesn't really change anything.

move dma_map_single from include/asm-x86_64/dma_mapping.h to arch/x86_64/pci-dma.c?

YH

#8 lore raw
Quoted 10 lines · Yinghai Lu
Quoted 9 lines · Andi Kleen
Quoted 8 lines · On Wednesday 27 June 2007 22:25:11 Yinghai Lu wrote:
Quoted 6 lines · Andi Kleen
Quoted 3 lines · On Wednesday 27 June 2007 19:41:21 Yinghai Lu wrote:

[PATCH] x86_64: change _map_single to static in pci_gart.c etc

there function is called via dma_ops->.., so change it to static

Actually all these functions shouldn't be inline in the first place.

Quoted 7 lines
Quoted 4 lines
Quoted 1 line

do you mean pci_map_single==>dma_map_single==>gart_map_single?

dma_map_single. pci_map_single is ok because it doesn't really change anything.

move dma_map_single from include/asm-x86_64/dma_mapping.h to arch/x86_64/pci-dma.c?

If yes, why? it's not exactly a big function:

static inline dma_addr_t
dma_map_single(struct device *hwdev, void *ptr, size_t size,
int direction)

{
	BUG_ON(!valid_dma_direction(direction));
	return dma_ops->map_single(hwdev, ptr, size, direction);
}

I'd rather we not make it out-of-line without a compelling (numerical) reason.

Cheers,
Muli