aboutsummaryrefslogtreecommitdiffstats
path: root/arch
diff options
context:
space:
mode:
authorAkinobu Mita <akinobu.mita@gmail.com>2009-12-15 19:48:30 -0500
committerLinus Torvalds <torvalds@linux-foundation.org>2009-12-16 10:20:21 -0500
commit81f6527bd322ef1f3a58c2c438b9ded3bd8f606a (patch)
tree0318a64f7545e4f995cbe67b263adf7f4d7bab44 /arch
parente756fd8080622998007b592bd33f86cecf56587a (diff)
ia64: use bitmap_find_next_zero_area
Signed-off-by: Akinobu Mita <akinobu.mita@gmail.com> Cc: Tony Luck <tony.luck@intel.com> Cc: Fenghua Yu <fenghua.yu@intel.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'arch')
-rw-r--r--arch/ia64/sn/pci/tioca_provider.c19
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 35b2a27d2e7..efb454534e5 100644
--- a/arch/ia64/sn/pci/tioca_provider.c
+++ b/arch/ia64/sn/pci/tioca_provider.c
@@ -9,6 +9,7 @@
9#include <linux/types.h> 9#include <linux/types.h>
10#include <linux/interrupt.h> 10#include <linux/interrupt.h>
11#include <linux/pci.h> 11#include <linux/pci.h>
12#include <linux/bitmap.h>
12#include <asm/sn/sn_sal.h> 13#include <asm/sn/sn_sal.h>
13#include <asm/sn/addrs.h> 14#include <asm/sn/addrs.h>
14#include <asm/sn/io.h> 15#include <asm/sn/io.h>
@@ -369,7 +370,7 @@ tioca_dma_d48(struct pci_dev *pdev, u64 paddr)
369static dma_addr_t 370static dma_addr_t
370tioca_dma_mapped(struct pci_dev *pdev, unsigned long paddr, size_t req_size) 371tioca_dma_mapped(struct pci_dev *pdev, unsigned long paddr, size_t req_size)
371{ 372{
372 int i, ps, ps_shift, entry, entries, mapsize, last_entry; 373 int ps, ps_shift, entry, entries, mapsize;
373 u64 xio_addr, end_xio_addr; 374 u64 xio_addr, end_xio_addr;
374 struct tioca_common *tioca_common; 375 struct tioca_common *tioca_common;
375 struct tioca_kernel *tioca_kern; 376 struct tioca_kernel *tioca_kern;
@@ -410,23 +411,13 @@ tioca_dma_mapped(struct pci_dev *pdev, unsigned long paddr, size_t req_size)
410 map = tioca_kern->ca_pcigart_pagemap; 411 map = tioca_kern->ca_pcigart_pagemap;
411 mapsize = tioca_kern->ca_pcigart_entries; 412 mapsize = tioca_kern->ca_pcigart_entries;
412 413
413 entry = find_first_zero_bit(map, mapsize); 414 entry = bitmap_find_next_zero_area(map, mapsize, 0, entries, 0);
414 while (entry < mapsize) { 415 if (entry >= mapsize) {
415 last_entry = find_next_bit(map, mapsize, entry);
416
417 if (last_entry - entry >= entries)
418 break;
419
420 entry = find_next_zero_bit(map, mapsize, last_entry);
421 }
422
423 if (entry > mapsize) {
424 kfree(ca_dmamap); 416 kfree(ca_dmamap);
425 goto map_return; 417 goto map_return;
426 } 418 }
427 419
428 for (i = 0; i < entries; i++) 420 bitmap_set(map, entry, entries);
429 set_bit(entry + i, map);
430 421
431 bus_addr = tioca_kern->ca_pciap_base + (entry * ps); 422 bus_addr = tioca_kern->ca_pciap_base + (entry * ps);
432 423