aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@woody.linux-foundation.org>2007-10-25 18:44:54 -0400
committerLinus Torvalds <torvalds@woody.linux-foundation.org>2007-10-25 18:44:54 -0400
commit7f1495745347bc2cb9cc4f50d0a889caeb71f1f1 (patch)
tree2402b7e52fec57cdbf16d52e5fb467044589ec31 /include
parent2c7505570353af02e48c58ab4d109edd9bbbdd81 (diff)
parent85cdffcde0b6b831a06422413300d0f5c0e608c3 (diff)
Merge branch 'sg' of git://git.kernel.dk/linux-2.6-block
* 'sg' of git://git.kernel.dk/linux-2.6-block: fix sg_phys to use dma_addr_t ub: add sg_init_table for sense and read capacity commands x86: pci-gart fix blackfin: fix sg fallout xtensa: dma-mapping.h is using linux/scatterlist.h functions, so include it SG: audit of drivers that use blk_rq_map_sg() arch/um/drivers/ubd_kern.c: fix a building error SG: Change sg_set_page() to take length and offset argument AVR32: Fix sg_page breakage mmc: sg fallout m68k: sg fallout More SG build fixes sg: add missing sg_init_table calls to zfcp SG build fix
Diffstat (limited to 'include')
-rw-r--r--include/asm-avr32/dma-mapping.h2
-rw-r--r--include/asm-frv/scatterlist.h3
-rw-r--r--include/asm-xtensa/dma-mapping.h2
-rw-r--r--include/linux/scatterlist.h43
4 files changed, 34 insertions, 16 deletions
diff --git a/include/asm-avr32/dma-mapping.h b/include/asm-avr32/dma-mapping.h
index a7131630c057..57dc672bab8e 100644
--- a/include/asm-avr32/dma-mapping.h
+++ b/include/asm-avr32/dma-mapping.h
@@ -3,7 +3,7 @@
3 3
4#include <linux/mm.h> 4#include <linux/mm.h>
5#include <linux/device.h> 5#include <linux/device.h>
6#include <asm/scatterlist.h> 6#include <linux/scatterlist.h>
7#include <asm/processor.h> 7#include <asm/processor.h>
8#include <asm/cacheflush.h> 8#include <asm/cacheflush.h>
9#include <asm/io.h> 9#include <asm/io.h>
diff --git a/include/asm-frv/scatterlist.h b/include/asm-frv/scatterlist.h
index 99ba76edc42a..2e7143b5a7ad 100644
--- a/include/asm-frv/scatterlist.h
+++ b/include/asm-frv/scatterlist.h
@@ -16,8 +16,7 @@
16 * 16 *
17 * can be rewritten as 17 * can be rewritten as
18 * 18 *
19 * sg_set_page(virt_to_page(some_ptr)); 19 * sg_set_buf(sg, some_ptr, length);
20 * sg->offset = (unsigned long) some_ptr & ~PAGE_MASK;
21 * 20 *
22 * and that's it. There's no excuse for not highmem enabling YOUR driver. /jens 21 * and that's it. There's no excuse for not highmem enabling YOUR driver. /jens
23 */ 22 */
diff --git a/include/asm-xtensa/dma-mapping.h b/include/asm-xtensa/dma-mapping.h
index 8bd9d2c02a24..3c7d537dd15d 100644
--- a/include/asm-xtensa/dma-mapping.h
+++ b/include/asm-xtensa/dma-mapping.h
@@ -11,10 +11,10 @@
11#ifndef _XTENSA_DMA_MAPPING_H 11#ifndef _XTENSA_DMA_MAPPING_H
12#define _XTENSA_DMA_MAPPING_H 12#define _XTENSA_DMA_MAPPING_H
13 13
14#include <asm/scatterlist.h>
15#include <asm/cache.h> 14#include <asm/cache.h>
16#include <asm/io.h> 15#include <asm/io.h>
17#include <linux/mm.h> 16#include <linux/mm.h>
17#include <linux/scatterlist.h>
18 18
19/* 19/*
20 * DMA-consistent mapping functions. 20 * DMA-consistent mapping functions.
diff --git a/include/linux/scatterlist.h b/include/linux/scatterlist.h
index df7ddcee7c4b..457123171389 100644
--- a/include/linux/scatterlist.h
+++ b/include/linux/scatterlist.h
@@ -1,6 +1,7 @@
1#ifndef _LINUX_SCATTERLIST_H 1#ifndef _LINUX_SCATTERLIST_H
2#define _LINUX_SCATTERLIST_H 2#define _LINUX_SCATTERLIST_H
3 3
4#include <asm/types.h>
4#include <asm/scatterlist.h> 5#include <asm/scatterlist.h>
5#include <linux/mm.h> 6#include <linux/mm.h>
6#include <linux/string.h> 7#include <linux/string.h>
@@ -26,18 +27,16 @@
26#define SG_MAGIC 0x87654321 27#define SG_MAGIC 0x87654321
27 28
28/** 29/**
29 * sg_set_page - Set sg entry to point at given page 30 * sg_assign_page - Assign a given page to an SG entry
30 * @sg: SG entry 31 * @sg: SG entry
31 * @page: The page 32 * @page: The page
32 * 33 *
33 * Description: 34 * Description:
34 * Use this function to set an sg entry pointing at a page, never assign 35 * Assign page to sg entry. Also see sg_set_page(), the most commonly used
35 * the page directly. We encode sg table information in the lower bits 36 * variant.
36 * of the page pointer. See sg_page() for looking up the page belonging
37 * to an sg entry.
38 * 37 *
39 **/ 38 **/
40static inline void sg_set_page(struct scatterlist *sg, struct page *page) 39static inline void sg_assign_page(struct scatterlist *sg, struct page *page)
41{ 40{
42 unsigned long page_link = sg->page_link & 0x3; 41 unsigned long page_link = sg->page_link & 0x3;
43 42
@@ -52,6 +51,28 @@ static inline void sg_set_page(struct scatterlist *sg, struct page *page)
52 sg->page_link = page_link | (unsigned long) page; 51 sg->page_link = page_link | (unsigned long) page;
53} 52}
54 53
54/**
55 * sg_set_page - Set sg entry to point at given page
56 * @sg: SG entry
57 * @page: The page
58 * @len: Length of data
59 * @offset: Offset into page
60 *
61 * Description:
62 * Use this function to set an sg entry pointing at a page, never assign
63 * the page directly. We encode sg table information in the lower bits
64 * of the page pointer. See sg_page() for looking up the page belonging
65 * to an sg entry.
66 *
67 **/
68static inline void sg_set_page(struct scatterlist *sg, struct page *page,
69 unsigned int len, unsigned int offset)
70{
71 sg_assign_page(sg, page);
72 sg->offset = offset;
73 sg->length = len;
74}
75
55#define sg_page(sg) ((struct page *) ((sg)->page_link & ~0x3)) 76#define sg_page(sg) ((struct page *) ((sg)->page_link & ~0x3))
56 77
57/** 78/**
@@ -64,9 +85,7 @@ static inline void sg_set_page(struct scatterlist *sg, struct page *page)
64static inline void sg_set_buf(struct scatterlist *sg, const void *buf, 85static inline void sg_set_buf(struct scatterlist *sg, const void *buf,
65 unsigned int buflen) 86 unsigned int buflen)
66{ 87{
67 sg_set_page(sg, virt_to_page(buf)); 88 sg_set_page(sg, virt_to_page(buf), buflen, offset_in_page(buf));
68 sg->offset = offset_in_page(buf);
69 sg->length = buflen;
70} 89}
71 90
72/* 91/*
@@ -237,7 +256,7 @@ static inline void sg_init_table(struct scatterlist *sgl, unsigned int nents)
237 * on the sg page. 256 * on the sg page.
238 * 257 *
239 **/ 258 **/
240static inline unsigned long sg_phys(struct scatterlist *sg) 259static inline dma_addr_t sg_phys(struct scatterlist *sg)
241{ 260{
242 return page_to_phys(sg_page(sg)) + sg->offset; 261 return page_to_phys(sg_page(sg)) + sg->offset;
243} 262}