2019-01-03 11:04:46

by Huaisheng Ye

[permalink] [raw]
Subject: [PATCH] dma-mapping: remove unused attrs parameter to dma_common_get_sgtable

From: Huaisheng Ye <[email protected]>

dma_common_get_sgtable has parameter attrs which is not used at all.
Remove it.

Signed-off-by: Huaisheng Ye <[email protected]>
---
drivers/xen/swiotlb-xen.c | 2 +-
include/linux/dma-mapping.h | 5 ++---
kernel/dma/mapping.c | 3 +--
3 files changed, 4 insertions(+), 6 deletions(-)

diff --git a/drivers/xen/swiotlb-xen.c b/drivers/xen/swiotlb-xen.c
index 2a7f545..2dc17a5 100644
--- a/drivers/xen/swiotlb-xen.c
+++ b/drivers/xen/swiotlb-xen.c
@@ -697,7 +697,7 @@ static void xen_swiotlb_unmap_page(struct device *hwdev, dma_addr_t dev_addr,
handle, size, attrs);
}
#endif
- return dma_common_get_sgtable(dev, sgt, cpu_addr, handle, size, attrs);
+ return dma_common_get_sgtable(dev, sgt, cpu_addr, handle, size);
}

static int xen_swiotlb_mapping_error(struct device *dev, dma_addr_t dma_addr)
diff --git a/include/linux/dma-mapping.h b/include/linux/dma-mapping.h
index d327bdd..bbfad44 100644
--- a/include/linux/dma-mapping.h
+++ b/include/linux/dma-mapping.h
@@ -483,7 +483,7 @@ void *dma_common_pages_remap(struct page **pages, size_t size,

int
dma_common_get_sgtable(struct device *dev, struct sg_table *sgt, void *cpu_addr,
- dma_addr_t dma_addr, size_t size, unsigned long attrs);
+ dma_addr_t dma_addr, size_t size);

static inline int
dma_get_sgtable_attrs(struct device *dev, struct sg_table *sgt, void *cpu_addr,
@@ -495,8 +495,7 @@ void *dma_common_pages_remap(struct page **pages, size_t size,
if (ops->get_sgtable)
return ops->get_sgtable(dev, sgt, cpu_addr, dma_addr, size,
attrs);
- return dma_common_get_sgtable(dev, sgt, cpu_addr, dma_addr, size,
- attrs);
+ return dma_common_get_sgtable(dev, sgt, cpu_addr, dma_addr, size);
}

#define dma_get_sgtable(d, t, v, h, s) dma_get_sgtable_attrs(d, t, v, h, s, 0)
diff --git a/kernel/dma/mapping.c b/kernel/dma/mapping.c
index 58dec7a..6b33f10 100644
--- a/kernel/dma/mapping.c
+++ b/kernel/dma/mapping.c
@@ -202,8 +202,7 @@ void dmam_release_declared_memory(struct device *dev)
* Create scatter-list for the already allocated DMA buffer.
*/
int dma_common_get_sgtable(struct device *dev, struct sg_table *sgt,
- void *cpu_addr, dma_addr_t dma_addr, size_t size,
- unsigned long attrs)
+ void *cpu_addr, dma_addr_t dma_addr, size_t size)
{
struct page *page;
int ret;
--
1.8.3.1




2019-01-03 23:41:27

by Stefano Stabellini

[permalink] [raw]
Subject: Re: [PATCH] dma-mapping: remove unused attrs parameter to dma_common_get_sgtable

On Thu, 3 Jan 2019, Huaisheng Ye wrote:
> From: Huaisheng Ye <[email protected]>
>
> dma_common_get_sgtable has parameter attrs which is not used at all.
> Remove it.
>
> Signed-off-by: Huaisheng Ye <[email protected]>

Acked-by: Stefano Stabellini <[email protected]>

FYI the patch doesn't apply cleanly to master.


> ---
> drivers/xen/swiotlb-xen.c | 2 +-
> include/linux/dma-mapping.h | 5 ++---
> kernel/dma/mapping.c | 3 +--
> 3 files changed, 4 insertions(+), 6 deletions(-)
>
> diff --git a/drivers/xen/swiotlb-xen.c b/drivers/xen/swiotlb-xen.c
> index 2a7f545..2dc17a5 100644
> --- a/drivers/xen/swiotlb-xen.c
> +++ b/drivers/xen/swiotlb-xen.c
> @@ -697,7 +697,7 @@ static void xen_swiotlb_unmap_page(struct device *hwdev, dma_addr_t dev_addr,
> handle, size, attrs);
> }
> #endif
> - return dma_common_get_sgtable(dev, sgt, cpu_addr, handle, size, attrs);
> + return dma_common_get_sgtable(dev, sgt, cpu_addr, handle, size);
> }
>
> static int xen_swiotlb_mapping_error(struct device *dev, dma_addr_t dma_addr)
> diff --git a/include/linux/dma-mapping.h b/include/linux/dma-mapping.h
> index d327bdd..bbfad44 100644
> --- a/include/linux/dma-mapping.h
> +++ b/include/linux/dma-mapping.h
> @@ -483,7 +483,7 @@ void *dma_common_pages_remap(struct page **pages, size_t size,
>
> int
> dma_common_get_sgtable(struct device *dev, struct sg_table *sgt, void *cpu_addr,
> - dma_addr_t dma_addr, size_t size, unsigned long attrs);
> + dma_addr_t dma_addr, size_t size);
>
> static inline int
> dma_get_sgtable_attrs(struct device *dev, struct sg_table *sgt, void *cpu_addr,
> @@ -495,8 +495,7 @@ void *dma_common_pages_remap(struct page **pages, size_t size,
> if (ops->get_sgtable)
> return ops->get_sgtable(dev, sgt, cpu_addr, dma_addr, size,
> attrs);
> - return dma_common_get_sgtable(dev, sgt, cpu_addr, dma_addr, size,
> - attrs);
> + return dma_common_get_sgtable(dev, sgt, cpu_addr, dma_addr, size);
> }
>
> #define dma_get_sgtable(d, t, v, h, s) dma_get_sgtable_attrs(d, t, v, h, s, 0)
> diff --git a/kernel/dma/mapping.c b/kernel/dma/mapping.c
> index 58dec7a..6b33f10 100644
> --- a/kernel/dma/mapping.c
> +++ b/kernel/dma/mapping.c
> @@ -202,8 +202,7 @@ void dmam_release_declared_memory(struct device *dev)
> * Create scatter-list for the already allocated DMA buffer.
> */
> int dma_common_get_sgtable(struct device *dev, struct sg_table *sgt,
> - void *cpu_addr, dma_addr_t dma_addr, size_t size,
> - unsigned long attrs)
> + void *cpu_addr, dma_addr_t dma_addr, size_t size)
> {
> struct page *page;
> int ret;
> --
> 1.8.3.1
>
>

2019-01-04 06:05:26

by Huaisheng HS1 Ye

[permalink] [raw]
Subject: Re: [PATCH] dma-mapping: remove unused attrs parameter to dma_common_get_sgtable

From: Stefano Stabellini <[email protected]>
Sent: Friday, January 04, 2019 1:55 AM
> On Thu, 3 Jan 2019, Huaisheng Ye wrote:
> > From: Huaisheng Ye <[email protected]>
> >
> > dma_common_get_sgtable has parameter attrs which is not used at all.
> > Remove it.
> >
> > Signed-off-by: Huaisheng Ye <[email protected]>
>
> Acked-by: Stefano Stabellini <[email protected]>
>
> FYI the patch doesn't apply cleanly to master.

Got it, I will rebase it to branch master and resend the patch later.

Cheers,
Huaisheng Ye

2019-01-04 08:34:14

by Christoph Hellwig

[permalink] [raw]
Subject: Re: [PATCH] dma-mapping: remove unused attrs parameter to dma_common_get_sgtable

On Fri, Jan 04, 2019 at 01:45:26AM +0000, Huaisheng HS1 Ye wrote:
> From: Stefano Stabellini <[email protected]>
> Sent: Friday, January 04, 2019 1:55 AM
> > On Thu, 3 Jan 2019, Huaisheng Ye wrote:
> > > From: Huaisheng Ye <[email protected]>
> > >
> > > dma_common_get_sgtable has parameter attrs which is not used at all.
> > > Remove it.
> > >
> > > Signed-off-by: Huaisheng Ye <[email protected]>
> >
> > Acked-by: Stefano Stabellini <[email protected]>
> >
> > FYI the patch doesn't apply cleanly to master.
>
> Got it, I will rebase it to branch master and resend the patch later.

I think we can skip it. For the next merge window I plan to remove
the fallbacks for get_sgtable and mmap and instead wire everything up
explicitly. And to be a possible method instance it will have to match
the prototype and thus keep the unused argument.