summaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@woody.linux-foundation.org>2007-11-03 12:43:21 -0700
committerLinus Torvalds <torvalds@woody.linux-foundation.org>2007-11-03 12:43:21 -0700
commit160acc2e899f26356bde92bc257253b7ca78f0c3 (patch)
treec60782685ac0fdf4b2d6278c4be639181dd65126 /include
parenta7e1e001f432d5960b929787a2a261cf5a7ddac5 (diff)
parentc46f2334c84c2b26baa64d42d75ddc5fab38c3dc (diff)
downloadlinux-160acc2e899f26356bde92bc257253b7ca78f0c3.tar.bz2
Merge branch 'sg' of git://git.kernel.dk/linux-2.6-block
* 'sg' of git://git.kernel.dk/linux-2.6-block: [SG] Get rid of __sg_mark_end() cleanup asm/scatterlist.h includes SG: Make sg_init_one() use general table init functions
Diffstat (limited to 'include')
-rw-r--r--include/linux/scatterlist.h60
-rw-r--r--include/net/esp.h2
-rw-r--r--include/rdma/ib_verbs.h2
-rw-r--r--include/scsi/libsas.h2
4 files changed, 32 insertions, 34 deletions
diff --git a/include/linux/scatterlist.h b/include/linux/scatterlist.h
index 32326c293d7b..259735044148 100644
--- a/include/linux/scatterlist.h
+++ b/include/linux/scatterlist.h
@@ -188,43 +188,23 @@ static inline void sg_chain(struct scatterlist *prv, unsigned int prv_nents,
/**
* sg_mark_end - Mark the end of the scatterlist
- * @sgl: Scatterlist
- * @nents: Number of entries in sgl
+ * @sg: SG entryScatterlist
*
* Description:
- * Marks the last entry as the termination point for sg_next()
+ * Marks the passed in sg entry as the termination point for the sg
+ * table. A call to sg_next() on this entry will return NULL.
*
**/
-static inline void sg_mark_end(struct scatterlist *sgl, unsigned int nents)
+static inline void sg_mark_end(struct scatterlist *sg)
{
- sgl[nents - 1].page_link = 0x02;
-}
-
-static inline void __sg_mark_end(struct scatterlist *sg)
-{
- sg->page_link |= 0x02;
-}
-
-/**
- * sg_init_one - Initialize a single entry sg list
- * @sg: SG entry
- * @buf: Virtual address for IO
- * @buflen: IO length
- *
- * Notes:
- * This should not be used on a single entry that is part of a larger
- * table. Use sg_init_table() for that.
- *
- **/
-static inline void sg_init_one(struct scatterlist *sg, const void *buf,
- unsigned int buflen)
-{
- memset(sg, 0, sizeof(*sg));
#ifdef CONFIG_DEBUG_SG
- sg->sg_magic = SG_MAGIC;
+ BUG_ON(sg->sg_magic != SG_MAGIC);
#endif
- sg_mark_end(sg, 1);
- sg_set_buf(sg, buf, buflen);
+ /*
+ * Set termination bit, clear potential chain bit
+ */
+ sg->page_link |= 0x02;
+ sg->page_link &= ~0x01;
}
/**
@@ -240,7 +220,6 @@ static inline void sg_init_one(struct scatterlist *sg, const void *buf,
static inline void sg_init_table(struct scatterlist *sgl, unsigned int nents)
{
memset(sgl, 0, sizeof(*sgl) * nents);
- sg_mark_end(sgl, nents);
#ifdef CONFIG_DEBUG_SG
{
unsigned int i;
@@ -248,6 +227,25 @@ static inline void sg_init_table(struct scatterlist *sgl, unsigned int nents)
sgl[i].sg_magic = SG_MAGIC;
}
#endif
+ sg_mark_end(&sgl[nents - 1]);
+}
+
+/**
+ * sg_init_one - Initialize a single entry sg list
+ * @sg: SG entry
+ * @buf: Virtual address for IO
+ * @buflen: IO length
+ *
+ * Notes:
+ * This should not be used on a single entry that is part of a larger
+ * table. Use sg_init_table() for that.
+ *
+ **/
+static inline void sg_init_one(struct scatterlist *sg, const void *buf,
+ unsigned int buflen)
+{
+ sg_init_table(sg, 1);
+ sg_set_buf(sg, buf, buflen);
}
/**
diff --git a/include/net/esp.h b/include/net/esp.h
index c1bc529809da..c05f529bff28 100644
--- a/include/net/esp.h
+++ b/include/net/esp.h
@@ -3,7 +3,7 @@
#include <linux/crypto.h>
#include <net/xfrm.h>
-#include <asm/scatterlist.h>
+#include <linux/scatterlist.h>
#define ESP_NUM_FAST_SG 4
diff --git a/include/rdma/ib_verbs.h b/include/rdma/ib_verbs.h
index 4bea182d7116..11f39606e7d9 100644
--- a/include/rdma/ib_verbs.h
+++ b/include/rdma/ib_verbs.h
@@ -48,9 +48,9 @@
#include <linux/kref.h>
#include <linux/list.h>
#include <linux/rwsem.h>
+#include <linux/scatterlist.h>
#include <asm/atomic.h>
-#include <asm/scatterlist.h>
#include <asm/uaccess.h>
union ib_gid {
diff --git a/include/scsi/libsas.h b/include/scsi/libsas.h
index 8dda2d66b5b9..a466c2cb8955 100644
--- a/include/scsi/libsas.h
+++ b/include/scsi/libsas.h
@@ -36,7 +36,7 @@
#include <scsi/scsi_device.h>
#include <scsi/scsi_cmnd.h>
#include <scsi/scsi_transport_sas.h>
-#include <asm/scatterlist.h>
+#include <linux/scatterlist.h>
struct block_device;