public inbox for linux-ia64@vger.kernel.org
 help / color / mirror / Atom feed
From: Akinobu Mita <akinobu.mita@gmail.com>
To: linux-kernel@vger.kernel.org, akpm@linux-foundation.org
Cc: Akinobu Mita <akinobu.mita@gmail.com>,
	Tony Luck <tony.luck@intel.com>,
	Fenghua Yu <fenghua.yu@intel.com>,
	linux-ia64@vger.kernel.org, linux-altix@sgi.com
Subject: [PATCH 7/8] ia64: Use bitmap_find_next_zero_area
Date: Fri, 09 Oct 2009 08:29:20 +0000	[thread overview]
Message-ID: <1255076961-21325-7-git-send-email-akinobu.mita@gmail.com> (raw)
In-Reply-To: <1255076961-21325-6-git-send-email-akinobu.mita@gmail.com>

Cc: Tony Luck <tony.luck@intel.com>
Cc: Fenghua Yu <fenghua.yu@intel.com>
Cc: linux-ia64@vger.kernel.org
Cc: linux-altix@sgi.com
Signed-off-by: Akinobu Mita <akinobu.mita@gmail.com>
---
 arch/ia64/sn/pci/tioca_provider.c |   19 +++++--------------
 1 files changed, 5 insertions(+), 14 deletions(-)

diff --git a/arch/ia64/sn/pci/tioca_provider.c b/arch/ia64/sn/pci/tioca_provider.c
index 35b2a27..efb4545 100644
--- a/arch/ia64/sn/pci/tioca_provider.c
+++ b/arch/ia64/sn/pci/tioca_provider.c
@@ -9,6 +9,7 @@
 #include <linux/types.h>
 #include <linux/interrupt.h>
 #include <linux/pci.h>
+#include <linux/bitmap.h>
 #include <asm/sn/sn_sal.h>
 #include <asm/sn/addrs.h>
 #include <asm/sn/io.h>
@@ -369,7 +370,7 @@ tioca_dma_d48(struct pci_dev *pdev, u64 paddr)
 static dma_addr_t
 tioca_dma_mapped(struct pci_dev *pdev, unsigned long paddr, size_t req_size)
 {
-	int i, ps, ps_shift, entry, entries, mapsize, last_entry;
+	int ps, ps_shift, entry, entries, mapsize;
 	u64 xio_addr, end_xio_addr;
 	struct tioca_common *tioca_common;
 	struct tioca_kernel *tioca_kern;
@@ -410,23 +411,13 @@ tioca_dma_mapped(struct pci_dev *pdev, unsigned long paddr, size_t req_size)
 	map = tioca_kern->ca_pcigart_pagemap;
 	mapsize = tioca_kern->ca_pcigart_entries;
 
-	entry = find_first_zero_bit(map, mapsize);
-	while (entry < mapsize) {
-		last_entry = find_next_bit(map, mapsize, entry);
-
-		if (last_entry - entry >= entries)
-			break;
-
-		entry = find_next_zero_bit(map, mapsize, last_entry);
-	}
-
-	if (entry > mapsize) {
+	entry = bitmap_find_next_zero_area(map, mapsize, 0, entries, 0);
+	if (entry >= mapsize) {
 		kfree(ca_dmamap);
 		goto map_return;
 	}
 
-	for (i = 0; i < entries; i++)
-		set_bit(entry + i, map);
+	bitmap_set(map, entry, entries);
 
 	bus_addr = tioca_kern->ca_pciap_base + (entry * ps);
 
-- 
1.5.4.3


  parent reply	other threads:[~2009-10-09  8:29 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <1255076961-21325-1-git-send-email-akinobu.mita@gmail.com>
2009-10-09  8:29 ` [PATCH 2/8] bitmap: Introduce bitmap_set, bitmap_clear, bitmap_find_next_zero_area Akinobu Mita
     [not found]   ` <1255076961-21325-3-git-send-email-akinobu.mita@gmail.com>
     [not found]     ` <1255076961-21325-4-git-send-email-akinobu.mita@gmail.com>
     [not found]       ` <1255076961-21325-5-git-send-email-akinobu.mita@gmail.com>
     [not found]         ` <1255076961-21325-6-git-send-email-akinobu.mita@gmail.com>
2009-10-09  8:29           ` Akinobu Mita [this message]
2009-10-09 23:41   ` [PATCH 2/8] bitmap: Introduce bitmap_set, bitmap_clear, Andrew Morton
2009-10-13  2:18     ` Akinobu Mita
2009-10-13  9:10       ` Akinobu Mita
2009-10-13 21:54         ` Michael Ellerman
2009-10-14  3:39           ` Akinobu Mita
2009-10-14  3:22         ` [PATCH -mmotm] Fix Akinobu Mita
2009-10-15  6:07           ` [PATCH -mmotm -v2] Fix Akinobu Mita
2009-10-17 13:43         ` [PATCH 2/8] bitmap: Introduce bitmap_set, bitmap_clear, FUJITA Tomonori
2009-10-17 14:43           ` Akinobu Mita
2009-10-17 14:51             ` FUJITA Tomonori
2009-10-17 15:42               ` Akinobu Mita

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1255076961-21325-7-git-send-email-akinobu.mita@gmail.com \
    --to=akinobu.mita@gmail.com \
    --cc=akpm@linux-foundation.org \
    --cc=fenghua.yu@intel.com \
    --cc=linux-altix@sgi.com \
    --cc=linux-ia64@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=tony.luck@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox