2007-06-27 17:42:19

by Yinghai Lu

[permalink] [raw]
Subject: [PATCH] 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

Signed-off-by: Yinghai Lu <[email protected]>

diff --git a/arch/x86_64/kernel/pci-calgary.c b/arch/x86_64/kernel/pci-calgary.c
index 5bd20b5..8e03399 100644
--- a/arch/x86_64/kernel/pci-calgary.c
+++ b/arch/x86_64/kernel/pci-calgary.c
@@ -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;
diff --git a/arch/x86_64/kernel/pci-nommu.c b/arch/x86_64/kernel/pci-nommu.c
index 6dade0c..2a34c6c 100644
--- a/arch/x86_64/kernel/pci-nommu.c
+++ b/arch/x86_64/kernel/pci-nommu.c
@@ -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)
{
}
diff --git a/arch/x86_64/kernel/pci-gart.c b/arch/x86_64/kernel/pci-gart.c
index ae091cd..4918c57 100644
--- a/arch/x86_64/kernel/pci-gart.c
+++ b/arch/x86_64/kernel/pci-gart.c
@@ -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;


2007-06-27 20:21:28

by Muli Ben-Yehuda

[permalink] [raw]
Subject: Re: [PATCH] x86_64: change _map_single to static in pci_gart.c etc

On Wed, Jun 27, 2007 at 10:41:21AM -0700, 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

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

Cheers,
Muli

2007-06-27 20:22:49

by Andi Kleen

[permalink] [raw]
Subject: Re: [PATCH] x86_64: change _map_single to static in pci_gart.c etc

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

2007-06-27 20:25:25

by Yinghai Lu

[permalink] [raw]
Subject: Re: [PATCH] x86_64: change _map_single to static in pci_gart.c etc

On 6/27/07, Andi Kleen <[email protected]> wrote:
> 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

2007-06-27 20:26:39

by Andi Kleen

[permalink] [raw]
Subject: Re: [PATCH] x86_64: change _map_single to static in pci_gart.c etc

On Wednesday 27 June 2007 22:25:11 Yinghai Lu wrote:
> On 6/27/07, Andi Kleen <[email protected]> wrote:
> > 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

2007-06-27 20:29:55

by Yinghai Lu

[permalink] [raw]
Subject: Re: [PATCH] x86_64: change _map_single to static in pci_gart.c etc

On 6/27/07, Andi Kleen <[email protected]> wrote:
> On Wednesday 27 June 2007 22:25:11 Yinghai Lu wrote:
> > On 6/27/07, Andi Kleen <[email protected]> wrote:
> > > 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.

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

YH

2007-06-27 20:30:35

by Muli Ben-Yehuda

[permalink] [raw]
Subject: Re: [PATCH] x86_64: change _map_single to static in pci_gart.c etc

On Wed, Jun 27, 2007 at 04:21:10PM -0400, Muli Ben-Yehuda wrote:
> On Wed, Jun 27, 2007 at 10:41:21AM -0700, 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
>
> 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

2007-06-27 20:32:30

by Yinghai Lu

[permalink] [raw]
Subject: Re: [PATCH] x86_64: change _map_single to static in pci_gart.c etc

On 6/27/07, Muli Ben-Yehuda <[email protected]> wrote:
> On Wed, Jun 27, 2007 at 04:21:10PM -0400, Muli Ben-Yehuda wrote:
> > On Wed, Jun 27, 2007 at 10:41:21AM -0700, 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
> >
> > 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

2007-06-27 20:33:17

by Muli Ben-Yehuda

[permalink] [raw]
Subject: Re: [PATCH] x86_64: change _map_single to static in pci_gart.c etc

On Wed, Jun 27, 2007 at 01:29:46PM -0700, Yinghai Lu wrote:
> On 6/27/07, Andi Kleen <[email protected]> wrote:
> >On Wednesday 27 June 2007 22:25:11 Yinghai Lu wrote:
> >> On 6/27/07, Andi Kleen <[email protected]> wrote:
> >> > 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.
>
> 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