diff options
author | Linus Torvalds <torvalds@woody.linux-foundation.org> | 2007-10-23 11:53:41 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@woody.linux-foundation.org> | 2007-10-23 11:53:41 -0400 |
commit | ba1c28a94322865457ad59f80474615156065123 (patch) | |
tree | a1de9e1b7aba07583e49ff1c3f1c495cf148475a | |
parent | 101e4d91f5e8c78d64970c03323d942d6706320f (diff) | |
parent | cb92ae81509eb5ddaea53884b60437502c837405 (diff) |
Merge branch 'sg' of git://git.kernel.dk/linux-2.6-block
* 'sg' of git://git.kernel.dk/linux-2.6-block:
sparc64: zero out dma_length
fvr32: fixup dma-mapping for new sg layout
sh/sh64: fixup dma-mapping for new sg layout
Fix sctp compile
m68knommu: remove sg_address()
frv: update comment in scatterlist to reflect new setup
blackfin: remove sg_address()
arm: sg fallout
mips: sg_page() fallout
alpha: sg_virt() fallout
intel-iommu: fix sg_page()
parisc: fix sg_page() fallout
ide: build fix
net: fix xfrm build - missing scatterlist.h include
[BLOCK] blk_rq_map_sg: force clear termination bit
[BLOCK] Don't clear sg_dma_len/addr() in blk_rq_map_sg()
s390 zfcp: sg fixups
powerpc: Fix fallout from sg_page() changes
IB/ehca: Fix sg_page() fallout
arm: build fix
26 files changed, 70 insertions, 51 deletions
diff --git a/arch/alpha/kernel/pci_iommu.c b/arch/alpha/kernel/pci_iommu.c index ee07dceae1d4..2d00a08d3f08 100644 --- a/arch/alpha/kernel/pci_iommu.c +++ b/arch/alpha/kernel/pci_iommu.c | |||
@@ -7,6 +7,7 @@ | |||
7 | #include <linux/pci.h> | 7 | #include <linux/pci.h> |
8 | #include <linux/slab.h> | 8 | #include <linux/slab.h> |
9 | #include <linux/bootmem.h> | 9 | #include <linux/bootmem.h> |
10 | #include <linux/scatterlist.h> | ||
10 | #include <linux/log2.h> | 11 | #include <linux/log2.h> |
11 | 12 | ||
12 | #include <asm/io.h> | 13 | #include <asm/io.h> |
diff --git a/arch/arm/common/dmabounce.c b/arch/arm/common/dmabounce.c index 9d371e476552..52fc6a883281 100644 --- a/arch/arm/common/dmabounce.c +++ b/arch/arm/common/dmabounce.c | |||
@@ -29,6 +29,7 @@ | |||
29 | #include <linux/dma-mapping.h> | 29 | #include <linux/dma-mapping.h> |
30 | #include <linux/dmapool.h> | 30 | #include <linux/dmapool.h> |
31 | #include <linux/list.h> | 31 | #include <linux/list.h> |
32 | #include <linux/scatterlist.h> | ||
32 | 33 | ||
33 | #include <asm/cacheflush.h> | 34 | #include <asm/cacheflush.h> |
34 | 35 | ||
diff --git a/arch/mips/mm/dma-default.c b/arch/mips/mm/dma-default.c index b0b034c4654f..b1b40527658b 100644 --- a/arch/mips/mm/dma-default.c +++ b/arch/mips/mm/dma-default.c | |||
@@ -13,6 +13,7 @@ | |||
13 | #include <linux/mm.h> | 13 | #include <linux/mm.h> |
14 | #include <linux/module.h> | 14 | #include <linux/module.h> |
15 | #include <linux/string.h> | 15 | #include <linux/string.h> |
16 | #include <linux/scatterlist.h> | ||
16 | 17 | ||
17 | #include <asm/cache.h> | 18 | #include <asm/cache.h> |
18 | #include <asm/io.h> | 19 | #include <asm/io.h> |
diff --git a/arch/parisc/kernel/pci-dma.c b/arch/parisc/kernel/pci-dma.c index 41f8e321e34c..9448d4e91142 100644 --- a/arch/parisc/kernel/pci-dma.c +++ b/arch/parisc/kernel/pci-dma.c | |||
@@ -25,6 +25,7 @@ | |||
25 | #include <linux/slab.h> | 25 | #include <linux/slab.h> |
26 | #include <linux/string.h> | 26 | #include <linux/string.h> |
27 | #include <linux/types.h> | 27 | #include <linux/types.h> |
28 | #include <linux/scatterlist.h> | ||
28 | 29 | ||
29 | #include <asm/cacheflush.h> | 30 | #include <asm/cacheflush.h> |
30 | #include <asm/dma.h> /* for DMA_CHUNK_SIZE */ | 31 | #include <asm/dma.h> /* for DMA_CHUNK_SIZE */ |
diff --git a/arch/sparc64/kernel/iommu_common.c b/arch/sparc64/kernel/iommu_common.c index 78e8277df655..b70324e0d83d 100644 --- a/arch/sparc64/kernel/iommu_common.c +++ b/arch/sparc64/kernel/iommu_common.c | |||
@@ -233,6 +233,11 @@ unsigned long prepare_sg(struct scatterlist *sg, int nents) | |||
233 | dma_sg->dma_address = dent_addr; | 233 | dma_sg->dma_address = dent_addr; |
234 | dma_sg->dma_length = dent_len; | 234 | dma_sg->dma_length = dent_len; |
235 | 235 | ||
236 | if (dma_sg != sg) { | ||
237 | dma_sg = next_sg(dma_sg); | ||
238 | dma_sg->dma_length = 0; | ||
239 | } | ||
240 | |||
236 | return ((unsigned long) dent_addr + | 241 | return ((unsigned long) dent_addr + |
237 | (unsigned long) dent_len + | 242 | (unsigned long) dent_len + |
238 | (IO_PAGE_SIZE - 1UL)) >> IO_PAGE_SHIFT; | 243 | (IO_PAGE_SIZE - 1UL)) >> IO_PAGE_SHIFT; |
diff --git a/block/ll_rw_blk.c b/block/ll_rw_blk.c index 61c2e396f2fa..de5ba479c224 100644 --- a/block/ll_rw_blk.c +++ b/block/ll_rw_blk.c | |||
@@ -1351,11 +1351,21 @@ int blk_rq_map_sg(struct request_queue *q, struct request *rq, | |||
1351 | new_segment: | 1351 | new_segment: |
1352 | if (!sg) | 1352 | if (!sg) |
1353 | sg = sglist; | 1353 | sg = sglist; |
1354 | else | 1354 | else { |
1355 | /* | ||
1356 | * If the driver previously mapped a shorter | ||
1357 | * list, we could see a termination bit | ||
1358 | * prematurely unless it fully inits the sg | ||
1359 | * table on each mapping. We KNOW that there | ||
1360 | * must be more entries here or the driver | ||
1361 | * would be buggy, so force clear the | ||
1362 | * termination bit to avoid doing a full | ||
1363 | * sg_init_table() in drivers for each command. | ||
1364 | */ | ||
1365 | sg->page_link &= ~0x02; | ||
1355 | sg = sg_next(sg); | 1366 | sg = sg_next(sg); |
1367 | } | ||
1356 | 1368 | ||
1357 | sg_dma_len(sg) = 0; | ||
1358 | sg_dma_address(sg) = 0; | ||
1359 | sg_set_page(sg, bvec->bv_page); | 1369 | sg_set_page(sg, bvec->bv_page); |
1360 | sg->length = nbytes; | 1370 | sg->length = nbytes; |
1361 | sg->offset = bvec->bv_offset; | 1371 | sg->offset = bvec->bv_offset; |
diff --git a/drivers/ide/ide-probe.c b/drivers/ide/ide-probe.c index ec55a173c08a..6a6f2e066b46 100644 --- a/drivers/ide/ide-probe.c +++ b/drivers/ide/ide-probe.c | |||
@@ -47,6 +47,7 @@ | |||
47 | #include <linux/spinlock.h> | 47 | #include <linux/spinlock.h> |
48 | #include <linux/kmod.h> | 48 | #include <linux/kmod.h> |
49 | #include <linux/pci.h> | 49 | #include <linux/pci.h> |
50 | #include <linux/scatterlist.h> | ||
50 | 51 | ||
51 | #include <asm/byteorder.h> | 52 | #include <asm/byteorder.h> |
52 | #include <asm/irq.h> | 53 | #include <asm/irq.h> |
diff --git a/drivers/infiniband/hw/ehca/ehca_mrmw.c b/drivers/infiniband/hw/ehca/ehca_mrmw.c index da88738265ed..ead7230d7738 100644 --- a/drivers/infiniband/hw/ehca/ehca_mrmw.c +++ b/drivers/infiniband/hw/ehca/ehca_mrmw.c | |||
@@ -1776,7 +1776,7 @@ static int ehca_set_pagebuf_user1(struct ehca_mr_pginfo *pginfo, | |||
1776 | list_for_each_entry_continue( | 1776 | list_for_each_entry_continue( |
1777 | chunk, (&(pginfo->u.usr.region->chunk_list)), list) { | 1777 | chunk, (&(pginfo->u.usr.region->chunk_list)), list) { |
1778 | for (i = pginfo->u.usr.next_nmap; i < chunk->nmap; ) { | 1778 | for (i = pginfo->u.usr.next_nmap; i < chunk->nmap; ) { |
1779 | pgaddr = page_to_pfn(chunk->page_list[i].page) | 1779 | pgaddr = page_to_pfn(sg_page(&chunk->page_list[i])) |
1780 | << PAGE_SHIFT ; | 1780 | << PAGE_SHIFT ; |
1781 | *kpage = phys_to_abs(pgaddr + | 1781 | *kpage = phys_to_abs(pgaddr + |
1782 | (pginfo->next_hwpage * | 1782 | (pginfo->next_hwpage * |
@@ -1832,7 +1832,7 @@ static int ehca_check_kpages_per_ate(struct scatterlist *page_list, | |||
1832 | { | 1832 | { |
1833 | int t; | 1833 | int t; |
1834 | for (t = start_idx; t <= end_idx; t++) { | 1834 | for (t = start_idx; t <= end_idx; t++) { |
1835 | u64 pgaddr = page_to_pfn(page_list[t].page) << PAGE_SHIFT; | 1835 | u64 pgaddr = page_to_pfn(sg_page(&page_list[t])) << PAGE_SHIFT; |
1836 | ehca_gen_dbg("chunk_page=%lx value=%016lx", pgaddr, | 1836 | ehca_gen_dbg("chunk_page=%lx value=%016lx", pgaddr, |
1837 | *(u64 *)abs_to_virt(phys_to_abs(pgaddr))); | 1837 | *(u64 *)abs_to_virt(phys_to_abs(pgaddr))); |
1838 | if (pgaddr - PAGE_SIZE != *prev_pgaddr) { | 1838 | if (pgaddr - PAGE_SIZE != *prev_pgaddr) { |
@@ -1867,7 +1867,7 @@ static int ehca_set_pagebuf_user2(struct ehca_mr_pginfo *pginfo, | |||
1867 | chunk, (&(pginfo->u.usr.region->chunk_list)), list) { | 1867 | chunk, (&(pginfo->u.usr.region->chunk_list)), list) { |
1868 | for (i = pginfo->u.usr.next_nmap; i < chunk->nmap; ) { | 1868 | for (i = pginfo->u.usr.next_nmap; i < chunk->nmap; ) { |
1869 | if (nr_kpages == kpages_per_hwpage) { | 1869 | if (nr_kpages == kpages_per_hwpage) { |
1870 | pgaddr = ( page_to_pfn(chunk->page_list[i].page) | 1870 | pgaddr = ( page_to_pfn(sg_page(&chunk->page_list[i])) |
1871 | << PAGE_SHIFT ); | 1871 | << PAGE_SHIFT ); |
1872 | *kpage = phys_to_abs(pgaddr); | 1872 | *kpage = phys_to_abs(pgaddr); |
1873 | if ( !(*kpage) ) { | 1873 | if ( !(*kpage) ) { |
diff --git a/drivers/parisc/ccio-dma.c b/drivers/parisc/ccio-dma.c index b3c4dbff26b8..7c60cbd85dc8 100644 --- a/drivers/parisc/ccio-dma.c +++ b/drivers/parisc/ccio-dma.c | |||
@@ -42,6 +42,7 @@ | |||
42 | #include <linux/reboot.h> | 42 | #include <linux/reboot.h> |
43 | #include <linux/proc_fs.h> | 43 | #include <linux/proc_fs.h> |
44 | #include <linux/seq_file.h> | 44 | #include <linux/seq_file.h> |
45 | #include <linux/scatterlist.h> | ||
45 | 46 | ||
46 | #include <asm/byteorder.h> | 47 | #include <asm/byteorder.h> |
47 | #include <asm/cache.h> /* for L1_CACHE_BYTES */ | 48 | #include <asm/cache.h> /* for L1_CACHE_BYTES */ |
diff --git a/drivers/parisc/sba_iommu.c b/drivers/parisc/sba_iommu.c index e5c323936eae..e527a0e1d6c0 100644 --- a/drivers/parisc/sba_iommu.c +++ b/drivers/parisc/sba_iommu.c | |||
@@ -28,6 +28,7 @@ | |||
28 | #include <linux/mm.h> | 28 | #include <linux/mm.h> |
29 | #include <linux/string.h> | 29 | #include <linux/string.h> |
30 | #include <linux/pci.h> | 30 | #include <linux/pci.h> |
31 | #include <linux/scatterlist.h> | ||
31 | 32 | ||
32 | #include <asm/byteorder.h> | 33 | #include <asm/byteorder.h> |
33 | #include <asm/io.h> | 34 | #include <asm/io.h> |
diff --git a/drivers/pci/intel-iommu.c b/drivers/pci/intel-iommu.c index b3d70310af49..0c4ab3b07274 100644 --- a/drivers/pci/intel-iommu.c +++ b/drivers/pci/intel-iommu.c | |||
@@ -1962,7 +1962,7 @@ static void intel_free_coherent(struct device *hwdev, size_t size, | |||
1962 | free_pages((unsigned long)vaddr, order); | 1962 | free_pages((unsigned long)vaddr, order); |
1963 | } | 1963 | } |
1964 | 1964 | ||
1965 | #define SG_ENT_VIRT_ADDRESS(sg) (page_address((sg)->page) + (sg)->offset) | 1965 | #define SG_ENT_VIRT_ADDRESS(sg) (sg_virt((sg))) |
1966 | static void intel_unmap_sg(struct device *hwdev, struct scatterlist *sglist, | 1966 | static void intel_unmap_sg(struct device *hwdev, struct scatterlist *sglist, |
1967 | int nelems, int dir) | 1967 | int nelems, int dir) |
1968 | { | 1968 | { |
@@ -2010,7 +2010,7 @@ static int intel_nontranslate_map_sg(struct device *hddev, | |||
2010 | struct scatterlist *sg; | 2010 | struct scatterlist *sg; |
2011 | 2011 | ||
2012 | for_each_sg(sglist, sg, nelems, i) { | 2012 | for_each_sg(sglist, sg, nelems, i) { |
2013 | BUG_ON(!sg->page); | 2013 | BUG_ON(!sg_page(sg)); |
2014 | sg->dma_address = virt_to_bus(SG_ENT_VIRT_ADDRESS(sg)); | 2014 | sg->dma_address = virt_to_bus(SG_ENT_VIRT_ADDRESS(sg)); |
2015 | sg->dma_length = sg->length; | 2015 | sg->dma_length = sg->length; |
2016 | } | 2016 | } |
diff --git a/drivers/s390/scsi/zfcp_aux.c b/drivers/s390/scsi/zfcp_aux.c index 7507067351bd..fd5d0c1570df 100644 --- a/drivers/s390/scsi/zfcp_aux.c +++ b/drivers/s390/scsi/zfcp_aux.c | |||
@@ -559,6 +559,7 @@ zfcp_sg_list_alloc(struct zfcp_sg_list *sg_list, size_t size) | |||
559 | retval = -ENOMEM; | 559 | retval = -ENOMEM; |
560 | goto out; | 560 | goto out; |
561 | } | 561 | } |
562 | sg_init_table(sg_list->sg, sg_list->count); | ||
562 | 563 | ||
563 | for (i = 0, sg = sg_list->sg; i < sg_list->count; i++, sg++) { | 564 | for (i = 0, sg = sg_list->sg; i < sg_list->count; i++, sg++) { |
564 | sg->length = min(size, PAGE_SIZE); | 565 | sg->length = min(size, PAGE_SIZE); |
diff --git a/drivers/s390/scsi/zfcp_def.h b/drivers/s390/scsi/zfcp_def.h index 57cac7008e0b..326e7ee232cb 100644 --- a/drivers/s390/scsi/zfcp_def.h +++ b/drivers/s390/scsi/zfcp_def.h | |||
@@ -63,7 +63,7 @@ | |||
63 | static inline void * | 63 | static inline void * |
64 | zfcp_sg_to_address(struct scatterlist *list) | 64 | zfcp_sg_to_address(struct scatterlist *list) |
65 | { | 65 | { |
66 | return (void *) (page_address(list->page) + list->offset); | 66 | return sg_virt(list); |
67 | } | 67 | } |
68 | 68 | ||
69 | /** | 69 | /** |
@@ -74,7 +74,7 @@ zfcp_sg_to_address(struct scatterlist *list) | |||
74 | static inline void | 74 | static inline void |
75 | zfcp_address_to_sg(void *address, struct scatterlist *list) | 75 | zfcp_address_to_sg(void *address, struct scatterlist *list) |
76 | { | 76 | { |
77 | list->page = virt_to_page(address); | 77 | sg_set_page(list, virt_to_page(address)); |
78 | list->offset = ((unsigned long) address) & (PAGE_SIZE - 1); | 78 | list->offset = ((unsigned long) address) & (PAGE_SIZE - 1); |
79 | } | 79 | } |
80 | 80 | ||
diff --git a/drivers/s390/scsi/zfcp_erp.c b/drivers/s390/scsi/zfcp_erp.c index a6475a2bb8a7..9438d0b28799 100644 --- a/drivers/s390/scsi/zfcp_erp.c +++ b/drivers/s390/scsi/zfcp_erp.c | |||
@@ -308,13 +308,15 @@ zfcp_erp_adisc(struct zfcp_port *port) | |||
308 | if (send_els == NULL) | 308 | if (send_els == NULL) |
309 | goto nomem; | 309 | goto nomem; |
310 | 310 | ||
311 | send_els->req = kzalloc(sizeof(struct scatterlist), GFP_ATOMIC); | 311 | send_els->req = kmalloc(sizeof(struct scatterlist), GFP_ATOMIC); |
312 | if (send_els->req == NULL) | 312 | if (send_els->req == NULL) |
313 | goto nomem; | 313 | goto nomem; |
314 | sg_init_table(send_els->req, 1); | ||
314 | 315 | ||
315 | send_els->resp = kzalloc(sizeof(struct scatterlist), GFP_ATOMIC); | 316 | send_els->resp = kmalloc(sizeof(struct scatterlist), GFP_ATOMIC); |
316 | if (send_els->resp == NULL) | 317 | if (send_els->resp == NULL) |
317 | goto nomem; | 318 | goto nomem; |
319 | sg_init_table(send_els->resp, 1); | ||
318 | 320 | ||
319 | address = (void *) get_zeroed_page(GFP_ATOMIC); | 321 | address = (void *) get_zeroed_page(GFP_ATOMIC); |
320 | if (address == NULL) | 322 | if (address == NULL) |
@@ -363,7 +365,7 @@ zfcp_erp_adisc(struct zfcp_port *port) | |||
363 | retval = -ENOMEM; | 365 | retval = -ENOMEM; |
364 | freemem: | 366 | freemem: |
365 | if (address != NULL) | 367 | if (address != NULL) |
366 | __free_pages(send_els->req->page, 0); | 368 | __free_pages(sg_page(send_els->req), 0); |
367 | if (send_els != NULL) { | 369 | if (send_els != NULL) { |
368 | kfree(send_els->req); | 370 | kfree(send_els->req); |
369 | kfree(send_els->resp); | 371 | kfree(send_els->resp); |
@@ -437,7 +439,7 @@ zfcp_erp_adisc_handler(unsigned long data) | |||
437 | 439 | ||
438 | out: | 440 | out: |
439 | zfcp_port_put(port); | 441 | zfcp_port_put(port); |
440 | __free_pages(send_els->req->page, 0); | 442 | __free_pages(sg_page(send_els->req), 0); |
441 | kfree(send_els->req); | 443 | kfree(send_els->req); |
442 | kfree(send_els->resp); | 444 | kfree(send_els->resp); |
443 | kfree(send_els); | 445 | kfree(send_els); |
diff --git a/drivers/scsi/ps3rom.c b/drivers/scsi/ps3rom.c index 03f19b8d19c9..17b4a7c4618c 100644 --- a/drivers/scsi/ps3rom.c +++ b/drivers/scsi/ps3rom.c | |||
@@ -147,7 +147,7 @@ static int fetch_to_dev_buffer(struct scsi_cmnd *cmd, void *buf) | |||
147 | 147 | ||
148 | req_len = fin = 0; | 148 | req_len = fin = 0; |
149 | scsi_for_each_sg(cmd, sgpnt, scsi_sg_count(cmd), k) { | 149 | scsi_for_each_sg(cmd, sgpnt, scsi_sg_count(cmd), k) { |
150 | kaddr = kmap_atomic(sg_page(sgpnt->page), KM_IRQ0); | 150 | kaddr = kmap_atomic(sg_page(sgpnt), KM_IRQ0); |
151 | len = sgpnt->length; | 151 | len = sgpnt->length; |
152 | if ((req_len + len) > buflen) { | 152 | if ((req_len + len) > buflen) { |
153 | len = buflen - req_len; | 153 | len = buflen - req_len; |
diff --git a/include/asm-arm/dma-mapping.h b/include/asm-arm/dma-mapping.h index 1eb8aac43228..e99406a7bece 100644 --- a/include/asm-arm/dma-mapping.h +++ b/include/asm-arm/dma-mapping.h | |||
@@ -5,7 +5,7 @@ | |||
5 | 5 | ||
6 | #include <linux/mm.h> /* need struct page */ | 6 | #include <linux/mm.h> /* need struct page */ |
7 | 7 | ||
8 | #include <asm/scatterlist.h> | 8 | #include <linux/scatterlist.h> |
9 | 9 | ||
10 | /* | 10 | /* |
11 | * DMA-consistent mapping functions. These allocate/free a region of | 11 | * DMA-consistent mapping functions. These allocate/free a region of |
@@ -274,8 +274,8 @@ dma_map_sg(struct device *dev, struct scatterlist *sg, int nents, | |||
274 | for (i = 0; i < nents; i++, sg++) { | 274 | for (i = 0; i < nents; i++, sg++) { |
275 | char *virt; | 275 | char *virt; |
276 | 276 | ||
277 | sg->dma_address = page_to_dma(dev, sg->page) + sg->offset; | 277 | sg->dma_address = page_to_dma(dev, sg_page(sg)) + sg->offset; |
278 | virt = page_address(sg->page) + sg->offset; | 278 | virt = sg_virt(sg); |
279 | 279 | ||
280 | if (!arch_is_coherent()) | 280 | if (!arch_is_coherent()) |
281 | dma_cache_maint(virt, sg->length, dir); | 281 | dma_cache_maint(virt, sg->length, dir); |
@@ -371,7 +371,7 @@ dma_sync_sg_for_cpu(struct device *dev, struct scatterlist *sg, int nents, | |||
371 | int i; | 371 | int i; |
372 | 372 | ||
373 | for (i = 0; i < nents; i++, sg++) { | 373 | for (i = 0; i < nents; i++, sg++) { |
374 | char *virt = page_address(sg->page) + sg->offset; | 374 | char *virt = sg_virt(sg); |
375 | if (!arch_is_coherent()) | 375 | if (!arch_is_coherent()) |
376 | dma_cache_maint(virt, sg->length, dir); | 376 | dma_cache_maint(virt, sg->length, dir); |
377 | } | 377 | } |
@@ -384,7 +384,7 @@ dma_sync_sg_for_device(struct device *dev, struct scatterlist *sg, int nents, | |||
384 | int i; | 384 | int i; |
385 | 385 | ||
386 | for (i = 0; i < nents; i++, sg++) { | 386 | for (i = 0; i < nents; i++, sg++) { |
387 | char *virt = page_address(sg->page) + sg->offset; | 387 | char *virt = sg_virt(sg); |
388 | if (!arch_is_coherent()) | 388 | if (!arch_is_coherent()) |
389 | dma_cache_maint(virt, sg->length, dir); | 389 | dma_cache_maint(virt, sg->length, dir); |
390 | } | 390 | } |
diff --git a/include/asm-avr32/dma-mapping.h b/include/asm-avr32/dma-mapping.h index 81e342636ac4..a7131630c057 100644 --- a/include/asm-avr32/dma-mapping.h +++ b/include/asm-avr32/dma-mapping.h | |||
@@ -217,8 +217,8 @@ dma_map_sg(struct device *dev, struct scatterlist *sg, int nents, | |||
217 | for (i = 0; i < nents; i++) { | 217 | for (i = 0; i < nents; i++) { |
218 | char *virt; | 218 | char *virt; |
219 | 219 | ||
220 | sg[i].dma_address = page_to_bus(sg[i].page) + sg[i].offset; | 220 | sg[i].dma_address = page_to_bus(sg_page(&sg[i])) + sg[i].offset; |
221 | virt = page_address(sg[i].page) + sg[i].offset; | 221 | virt = sg_virt(&sg[i]); |
222 | dma_cache_sync(dev, virt, sg[i].length, direction); | 222 | dma_cache_sync(dev, virt, sg[i].length, direction); |
223 | } | 223 | } |
224 | 224 | ||
@@ -327,8 +327,7 @@ dma_sync_sg_for_device(struct device *dev, struct scatterlist *sg, | |||
327 | int i; | 327 | int i; |
328 | 328 | ||
329 | for (i = 0; i < nents; i++) { | 329 | for (i = 0; i < nents; i++) { |
330 | dma_cache_sync(dev, page_address(sg[i].page) + sg[i].offset, | 330 | dma_cache_sync(dev, sg_virt(&sg[i]), sg[i].length, direction); |
331 | sg[i].length, direction); | ||
332 | } | 331 | } |
333 | } | 332 | } |
334 | 333 | ||
diff --git a/include/asm-blackfin/scatterlist.h b/include/asm-blackfin/scatterlist.h index 32128d53469b..04f448711cd0 100644 --- a/include/asm-blackfin/scatterlist.h +++ b/include/asm-blackfin/scatterlist.h | |||
@@ -20,7 +20,6 @@ struct scatterlist { | |||
20 | * returns, or alternatively stop on the first sg_dma_len(sg) which | 20 | * returns, or alternatively stop on the first sg_dma_len(sg) which |
21 | * is 0. | 21 | * is 0. |
22 | */ | 22 | */ |
23 | #define sg_address(sg) (page_address((sg)->page) + (sg)->offset) | ||
24 | #define sg_dma_address(sg) ((sg)->dma_address) | 23 | #define sg_dma_address(sg) ((sg)->dma_address) |
25 | #define sg_dma_len(sg) ((sg)->length) | 24 | #define sg_dma_len(sg) ((sg)->length) |
26 | 25 | ||
diff --git a/include/asm-frv/scatterlist.h b/include/asm-frv/scatterlist.h index f7da007b763c..99ba76edc42a 100644 --- a/include/asm-frv/scatterlist.h +++ b/include/asm-frv/scatterlist.h | |||
@@ -4,19 +4,19 @@ | |||
4 | #include <asm/types.h> | 4 | #include <asm/types.h> |
5 | 5 | ||
6 | /* | 6 | /* |
7 | * Drivers must set either ->address or (preferred) ->page and ->offset | 7 | * Drivers must set either ->address or (preferred) page and ->offset |
8 | * to indicate where data must be transferred to/from. | 8 | * to indicate where data must be transferred to/from. |
9 | * | 9 | * |
10 | * Using ->page is recommended since it handles highmem data as well as | 10 | * Using page is recommended since it handles highmem data as well as |
11 | * low mem. ->address is restricted to data which has a virtual mapping, and | 11 | * low mem. ->address is restricted to data which has a virtual mapping, and |
12 | * it will go away in the future. Updating to ->page can be automated very | 12 | * it will go away in the future. Updating to page can be automated very |
13 | * easily -- something like | 13 | * easily -- something like |
14 | * | 14 | * |
15 | * sg->address = some_ptr; | 15 | * sg->address = some_ptr; |
16 | * | 16 | * |
17 | * can be rewritten as | 17 | * can be rewritten as |
18 | * | 18 | * |
19 | * sg->page = virt_to_page(some_ptr); | 19 | * sg_set_page(virt_to_page(some_ptr)); |
20 | * sg->offset = (unsigned long) some_ptr & ~PAGE_MASK; | 20 | * sg->offset = (unsigned long) some_ptr & ~PAGE_MASK; |
21 | * | 21 | * |
22 | * and that's it. There's no excuse for not highmem enabling YOUR driver. /jens | 22 | * and that's it. There's no excuse for not highmem enabling YOUR driver. /jens |
diff --git a/include/asm-m68knommu/scatterlist.h b/include/asm-m68knommu/scatterlist.h index 10942840e88f..afc4788b0d2c 100644 --- a/include/asm-m68knommu/scatterlist.h +++ b/include/asm-m68knommu/scatterlist.h | |||
@@ -14,7 +14,6 @@ struct scatterlist { | |||
14 | unsigned int length; | 14 | unsigned int length; |
15 | }; | 15 | }; |
16 | 16 | ||
17 | #define sg_address(sg) (page_address((sg)->page) + (sg)->offset) | ||
18 | #define sg_dma_address(sg) ((sg)->dma_address) | 17 | #define sg_dma_address(sg) ((sg)->dma_address) |
19 | #define sg_dma_len(sg) ((sg)->length) | 18 | #define sg_dma_len(sg) ((sg)->length) |
20 | 19 | ||
diff --git a/include/asm-parisc/scatterlist.h b/include/asm-parisc/scatterlist.h index cd3cfdf82289..62269b31ebf4 100644 --- a/include/asm-parisc/scatterlist.h +++ b/include/asm-parisc/scatterlist.h | |||
@@ -18,7 +18,7 @@ struct scatterlist { | |||
18 | __u32 iova_length; /* bytes mapped */ | 18 | __u32 iova_length; /* bytes mapped */ |
19 | }; | 19 | }; |
20 | 20 | ||
21 | #define sg_virt_addr(sg) ((unsigned long)(page_address(sg->page) + sg->offset)) | 21 | #define sg_virt_addr(sg) ((unsigned long)sg_virt(sg)) |
22 | #define sg_dma_address(sg) ((sg)->iova) | 22 | #define sg_dma_address(sg) ((sg)->iova) |
23 | #define sg_dma_len(sg) ((sg)->iova_length) | 23 | #define sg_dma_len(sg) ((sg)->iova_length) |
24 | 24 | ||
diff --git a/include/asm-powerpc/dma-mapping.h b/include/asm-powerpc/dma-mapping.h index 65be95dd03a5..ff52013c0e2d 100644 --- a/include/asm-powerpc/dma-mapping.h +++ b/include/asm-powerpc/dma-mapping.h | |||
@@ -285,9 +285,9 @@ dma_map_sg(struct device *dev, struct scatterlist *sgl, int nents, | |||
285 | BUG_ON(direction == DMA_NONE); | 285 | BUG_ON(direction == DMA_NONE); |
286 | 286 | ||
287 | for_each_sg(sgl, sg, nents, i) { | 287 | for_each_sg(sgl, sg, nents, i) { |
288 | BUG_ON(!sg->page); | 288 | BUG_ON(!sg_page(sg)); |
289 | __dma_sync_page(sg->page, sg->offset, sg->length, direction); | 289 | __dma_sync_page(sg_page(sg), sg->offset, sg->length, direction); |
290 | sg->dma_address = page_to_bus(sg->page) + sg->offset; | 290 | sg->dma_address = page_to_bus(sg_page(sg)) + sg->offset; |
291 | } | 291 | } |
292 | 292 | ||
293 | return nents; | 293 | return nents; |
@@ -328,7 +328,7 @@ static inline void dma_sync_sg_for_cpu(struct device *dev, | |||
328 | BUG_ON(direction == DMA_NONE); | 328 | BUG_ON(direction == DMA_NONE); |
329 | 329 | ||
330 | for_each_sg(sgl, sg, nents, i) | 330 | for_each_sg(sgl, sg, nents, i) |
331 | __dma_sync_page(sg->page, sg->offset, sg->length, direction); | 331 | __dma_sync_page(sg_page(sg), sg->offset, sg->length, direction); |
332 | } | 332 | } |
333 | 333 | ||
334 | static inline void dma_sync_sg_for_device(struct device *dev, | 334 | static inline void dma_sync_sg_for_device(struct device *dev, |
@@ -341,7 +341,7 @@ static inline void dma_sync_sg_for_device(struct device *dev, | |||
341 | BUG_ON(direction == DMA_NONE); | 341 | BUG_ON(direction == DMA_NONE); |
342 | 342 | ||
343 | for_each_sg(sgl, sg, nents, i) | 343 | for_each_sg(sgl, sg, nents, i) |
344 | __dma_sync_page(sg->page, sg->offset, sg->length, direction); | 344 | __dma_sync_page(sg_page(sg), sg->offset, sg->length, direction); |
345 | } | 345 | } |
346 | 346 | ||
347 | static inline int dma_mapping_error(dma_addr_t dma_addr) | 347 | static inline int dma_mapping_error(dma_addr_t dma_addr) |
diff --git a/include/asm-sh/dma-mapping.h b/include/asm-sh/dma-mapping.h index 84fefdaa01a5..fcea067f7a9c 100644 --- a/include/asm-sh/dma-mapping.h +++ b/include/asm-sh/dma-mapping.h | |||
@@ -2,7 +2,7 @@ | |||
2 | #define __ASM_SH_DMA_MAPPING_H | 2 | #define __ASM_SH_DMA_MAPPING_H |
3 | 3 | ||
4 | #include <linux/mm.h> | 4 | #include <linux/mm.h> |
5 | #include <asm/scatterlist.h> | 5 | #include <linux/scatterlist.h> |
6 | #include <asm/cacheflush.h> | 6 | #include <asm/cacheflush.h> |
7 | #include <asm/io.h> | 7 | #include <asm/io.h> |
8 | 8 | ||
@@ -85,10 +85,9 @@ static inline int dma_map_sg(struct device *dev, struct scatterlist *sg, | |||
85 | 85 | ||
86 | for (i = 0; i < nents; i++) { | 86 | for (i = 0; i < nents; i++) { |
87 | #if !defined(CONFIG_PCI) || defined(CONFIG_SH_PCIDMA_NONCOHERENT) | 87 | #if !defined(CONFIG_PCI) || defined(CONFIG_SH_PCIDMA_NONCOHERENT) |
88 | dma_cache_sync(dev, page_address(sg[i].page) + sg[i].offset, | 88 | dma_cache_sync(dev, sg_virt(&sg[i]), sg[i].length, dir); |
89 | sg[i].length, dir); | ||
90 | #endif | 89 | #endif |
91 | sg[i].dma_address = page_to_phys(sg[i].page) + sg[i].offset; | 90 | sg[i].dma_address = sg_phys(&sg[i]); |
92 | } | 91 | } |
93 | 92 | ||
94 | return nents; | 93 | return nents; |
@@ -138,10 +137,9 @@ static inline void dma_sync_sg(struct device *dev, struct scatterlist *sg, | |||
138 | 137 | ||
139 | for (i = 0; i < nelems; i++) { | 138 | for (i = 0; i < nelems; i++) { |
140 | #if !defined(CONFIG_PCI) || defined(CONFIG_SH_PCIDMA_NONCOHERENT) | 139 | #if !defined(CONFIG_PCI) || defined(CONFIG_SH_PCIDMA_NONCOHERENT) |
141 | dma_cache_sync(dev, page_address(sg[i].page) + sg[i].offset, | 140 | dma_cache_sync(dev, sg_virt(&sg[i]), sg[i].length, dir); |
142 | sg[i].length, dir); | ||
143 | #endif | 141 | #endif |
144 | sg[i].dma_address = page_to_phys(sg[i].page) + sg[i].offset; | 142 | sg[i].dma_address = sg_phys(&sg[i]); |
145 | } | 143 | } |
146 | } | 144 | } |
147 | 145 | ||
diff --git a/include/asm-sh64/dma-mapping.h b/include/asm-sh64/dma-mapping.h index e661857f98dc..1438b763a5ea 100644 --- a/include/asm-sh64/dma-mapping.h +++ b/include/asm-sh64/dma-mapping.h | |||
@@ -2,7 +2,7 @@ | |||
2 | #define __ASM_SH_DMA_MAPPING_H | 2 | #define __ASM_SH_DMA_MAPPING_H |
3 | 3 | ||
4 | #include <linux/mm.h> | 4 | #include <linux/mm.h> |
5 | #include <asm/scatterlist.h> | 5 | #include <linux/scatterlist.h> |
6 | #include <asm/io.h> | 6 | #include <asm/io.h> |
7 | 7 | ||
8 | struct pci_dev; | 8 | struct pci_dev; |
@@ -71,10 +71,9 @@ static inline int dma_map_sg(struct device *dev, struct scatterlist *sg, | |||
71 | 71 | ||
72 | for (i = 0; i < nents; i++) { | 72 | for (i = 0; i < nents; i++) { |
73 | #if !defined(CONFIG_PCI) || defined(CONFIG_SH_PCIDMA_NONCOHERENT) | 73 | #if !defined(CONFIG_PCI) || defined(CONFIG_SH_PCIDMA_NONCOHERENT) |
74 | dma_cache_sync(dev, page_address(sg[i].page) + sg[i].offset, | 74 | dma_cache_sync(dev, sg_virt(&sg[i]), sg[i].length, dir); |
75 | sg[i].length, dir); | ||
76 | #endif | 75 | #endif |
77 | sg[i].dma_address = page_to_phys(sg[i].page) + sg[i].offset; | 76 | sg[i].dma_address = sg_phys(&sg[i]); |
78 | } | 77 | } |
79 | 78 | ||
80 | return nents; | 79 | return nents; |
@@ -124,10 +123,9 @@ static inline void dma_sync_sg(struct device *dev, struct scatterlist *sg, | |||
124 | 123 | ||
125 | for (i = 0; i < nelems; i++) { | 124 | for (i = 0; i < nelems; i++) { |
126 | #if !defined(CONFIG_PCI) || defined(CONFIG_SH_PCIDMA_NONCOHERENT) | 125 | #if !defined(CONFIG_PCI) || defined(CONFIG_SH_PCIDMA_NONCOHERENT) |
127 | dma_cache_sync(dev, page_address(sg[i].page) + sg[i].offset, | 126 | dma_cache_sync(dev, sg_virt(&sg[i]), sg[i].length, dir); |
128 | sg[i].length, dir); | ||
129 | #endif | 127 | #endif |
130 | sg[i].dma_address = page_to_phys(sg[i].page) + sg[i].offset; | 128 | sg[i].dma_address = sg_phys(&sg[i]); |
131 | } | 129 | } |
132 | } | 130 | } |
133 | 131 | ||
diff --git a/net/sctp/sm_make_chunk.c b/net/sctp/sm_make_chunk.c index d5a9785a158b..658476c4d587 100644 --- a/net/sctp/sm_make_chunk.c +++ b/net/sctp/sm_make_chunk.c | |||
@@ -56,7 +56,7 @@ | |||
56 | #include <linux/ipv6.h> | 56 | #include <linux/ipv6.h> |
57 | #include <linux/net.h> | 57 | #include <linux/net.h> |
58 | #include <linux/inet.h> | 58 | #include <linux/inet.h> |
59 | #include <asm/scatterlist.h> | 59 | #include <linux/scatterlist.h> |
60 | #include <linux/crypto.h> | 60 | #include <linux/crypto.h> |
61 | #include <net/sock.h> | 61 | #include <net/sock.h> |
62 | 62 | ||
diff --git a/net/xfrm/xfrm_algo.c b/net/xfrm/xfrm_algo.c index fb2220a719bd..313d4bed3aa9 100644 --- a/net/xfrm/xfrm_algo.c +++ b/net/xfrm/xfrm_algo.c | |||
@@ -13,6 +13,7 @@ | |||
13 | #include <linux/kernel.h> | 13 | #include <linux/kernel.h> |
14 | #include <linux/pfkeyv2.h> | 14 | #include <linux/pfkeyv2.h> |
15 | #include <linux/crypto.h> | 15 | #include <linux/crypto.h> |
16 | #include <linux/scatterlist.h> | ||
16 | #include <net/xfrm.h> | 17 | #include <net/xfrm.h> |
17 | #if defined(CONFIG_INET_AH) || defined(CONFIG_INET_AH_MODULE) || defined(CONFIG_INET6_AH) || defined(CONFIG_INET6_AH_MODULE) | 18 | #if defined(CONFIG_INET_AH) || defined(CONFIG_INET_AH_MODULE) || defined(CONFIG_INET6_AH) || defined(CONFIG_INET6_AH_MODULE) |
18 | #include <net/ah.h> | 19 | #include <net/ah.h> |