iommu.lists.linux-foundation.org archive mirror
 help / color / mirror / Atom feed
* Re: [PATCH 0/1] arm: dma-iommu: Clean up redundant variable
       [not found] ` <1400511859-22286-1-git-send-email-ritesh.harjani-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
@ 2014-05-19 15:07   ` Ritesh Harjani
  0 siblings, 0 replies; 2+ messages in thread
From: Ritesh Harjani @ 2014-05-19 15:07 UTC (permalink / raw)
  To: Marek Szyprowski, Catalin Marinas
  Cc: iommu-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA@public.gmane.org,
	Will Deacon, Laurent Pinchart,
	linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org

++ mailing lists

On Mon, May 19, 2014 at 8:34 PM,  <ritesh.harjani-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:
> From: Ritesh Harjani <ritesh.harjani-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
>
> This redundant variable was identified by Will (cc'd) in below mentioned
> thread [1].
> It was discussed earlier that this variable will be cleaned up as part of
> dma-iommu refractoring code, but currently it has taken longer time then
> expected.
>
> So, submitting this small patch for review before we forget about it.
> [1]: http://www.spinics.net/lists/arm-kernel/msg324224.html
>
> Ritesh Harjani (1):
>   arm: dma-iommu: Clean up redundant variable
>
>  arch/arm/include/asm/dma-iommu.h |  1 -
>  arch/arm/mm/dma-mapping.c        | 11 ++++++-----
>  2 files changed, 6 insertions(+), 6 deletions(-)
>
> --
> 1.8.1.3
>

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH 1/1] arm: dma-iommu: Clean up redundant variable
       [not found]   ` <1400511859-22286-2-git-send-email-ritesh.harjani-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
@ 2014-05-19 15:07     ` Ritesh Harjani
  0 siblings, 0 replies; 2+ messages in thread
From: Ritesh Harjani @ 2014-05-19 15:07 UTC (permalink / raw)
  To: Marek Szyprowski, Catalin Marinas
  Cc: iommu-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA@public.gmane.org,
	Will Deacon, Laurent Pinchart,
	linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org

++ mailing lists

On Mon, May 19, 2014 at 8:34 PM,  <ritesh.harjani-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:
> From: Ritesh Harjani <ritesh.harjani-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
>
> mapping->size can be derived from mapping->bits << PAGE_SHIFT
> which makes mapping->size as redundant.
>
> Clean this up.
>
> Signed-off-by: Ritesh Harjani <ritesh.harjani-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
> ---
>  arch/arm/include/asm/dma-iommu.h |  1 -
>  arch/arm/mm/dma-mapping.c        | 11 ++++++-----
>  2 files changed, 6 insertions(+), 6 deletions(-)
>
> diff --git a/arch/arm/include/asm/dma-iommu.h b/arch/arm/include/asm/dma-iommu.h
> index eec0a12..8e3fcb9 100644
> --- a/arch/arm/include/asm/dma-iommu.h
> +++ b/arch/arm/include/asm/dma-iommu.h
> @@ -18,7 +18,6 @@ struct dma_iommu_mapping {
>         unsigned int            extensions;
>         size_t                  bitmap_size;    /* size of a single bitmap */
>         size_t                  bits;           /* per bitmap */
> -       unsigned int            size;           /* per bitmap */
>         dma_addr_t              base;
>
>         spinlock_t              lock;
> diff --git a/arch/arm/mm/dma-mapping.c b/arch/arm/mm/dma-mapping.c
> index 6b00be1..ec3373c 100644
> --- a/arch/arm/mm/dma-mapping.c
> +++ b/arch/arm/mm/dma-mapping.c
> @@ -1074,6 +1074,7 @@ static inline dma_addr_t __alloc_iova(struct dma_iommu_mapping *mapping,
>         unsigned int order = get_order(size);
>         unsigned int align = 0;
>         unsigned int count, start;
> +       unsigned int mapping_size = mapping->bits << PAGE_SHIFT;
>         unsigned long flags;
>         dma_addr_t iova;
>         int i;
> @@ -1119,7 +1120,7 @@ static inline dma_addr_t __alloc_iova(struct dma_iommu_mapping *mapping,
>         }
>         spin_unlock_irqrestore(&mapping->lock, flags);
>
> -       iova = mapping->base + (mapping->size * i);
> +       iova = mapping->base + (mapping_size * i);
>         iova += start << PAGE_SHIFT;
>
>         return iova;
> @@ -1129,6 +1130,7 @@ static inline void __free_iova(struct dma_iommu_mapping *mapping,
>                                dma_addr_t addr, size_t size)
>  {
>         unsigned int start, count;
> +       unsigned int mapping_size = mapping->bits << PAGE_SHIFT;
>         unsigned long flags;
>         dma_addr_t bitmap_base;
>         u32 bitmap_index;
> @@ -1136,14 +1138,14 @@ static inline void __free_iova(struct dma_iommu_mapping *mapping,
>         if (!size)
>                 return;
>
> -       bitmap_index = (u32) (addr - mapping->base) / (u32) mapping->size;
> +       bitmap_index = (u32) (addr - mapping->base) / (u32) mapping_size;
>         BUG_ON(addr < mapping->base || bitmap_index > mapping->extensions);
>
> -       bitmap_base = mapping->base + mapping->size * bitmap_index;
> +       bitmap_base = mapping->base + mapping_size * bitmap_index;
>
>         start = (addr - bitmap_base) >> PAGE_SHIFT;
>
> -       if (addr + size > bitmap_base + mapping->size) {
> +       if (addr + size > bitmap_base + mapping_size) {
>                 /*
>                  * The address range to be freed reaches into the iova
>                  * range of the next bitmap. This should not happen as
> @@ -1964,7 +1966,6 @@ arm_iommu_create_mapping(struct bus_type *bus, dma_addr_t base, size_t size)
>         mapping->extensions = extensions;
>         mapping->base = base;
>         mapping->bits = BITS_PER_BYTE * bitmap_size;
> -       mapping->size = mapping->bits << PAGE_SHIFT;
>
>         spin_lock_init(&mapping->lock);
>
> --
> 1.8.1.3
>

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2014-05-19 15:07 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <1400511859-22286-1-git-send-email-ritesh.harjani@gmail.com>
     [not found] ` <1400511859-22286-1-git-send-email-ritesh.harjani-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2014-05-19 15:07   ` [PATCH 0/1] arm: dma-iommu: Clean up redundant variable Ritesh Harjani
     [not found] ` <1400511859-22286-2-git-send-email-ritesh.harjani@gmail.com>
     [not found]   ` <1400511859-22286-2-git-send-email-ritesh.harjani-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2014-05-19 15:07     ` [PATCH 1/1] " Ritesh Harjani

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).