aboutsummaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@woody.linux-foundation.org>2007-10-29 07:49:10 -0700
committerLinus Torvalds <torvalds@woody.linux-foundation.org>2007-10-29 07:49:10 -0700
commit20dc9f01a867318ac0bc3ea9185d71f05076aeb0 (patch)
treef8e9528f1fd926b9f7fba9618b602d711cbfcaa8 /include
parent93400708dba888d45b4da01e1753a3a743f44496 (diff)
parente1efa2a3ea266e093f690c20af7522d95540f74f (diff)
Merge branch 'sg' of git://git.kernel.dk/linux-2.6-block
* 'sg' of git://git.kernel.dk/linux-2.6-block: Correction of "Update drivers to use sg helpers" patch for IMXMMC driver sg_init_table() should use unsigned loop index variable sg_last() should use unsigned loop index variable Initialise scatter/gather list in sg driver Initialise scatter/gather list in ata_sg_setup x86: fix pci-gart failure handling SG: s390-scsi: missing size parameter in zfcp_address_to_sg() SG: clear termination bit in sg_chain()
Diffstat (limited to 'include')
-rw-r--r--include/linux/scatterlist.h10
1 files changed, 7 insertions, 3 deletions
diff --git a/include/linux/scatterlist.h b/include/linux/scatterlist.h
index 45712317138..32326c293d7 100644
--- a/include/linux/scatterlist.h
+++ b/include/linux/scatterlist.h
@@ -150,7 +150,7 @@ static inline struct scatterlist *sg_last(struct scatterlist *sgl,
struct scatterlist *ret = &sgl[nents - 1];
#else
struct scatterlist *sg, *ret = NULL;
- int i;
+ unsigned int i;
for_each_sg(sgl, sg, nents, i)
ret = sg;
@@ -179,7 +179,11 @@ static inline void sg_chain(struct scatterlist *prv, unsigned int prv_nents,
#ifndef ARCH_HAS_SG_CHAIN
BUG();
#endif
- prv[prv_nents - 1].page_link = (unsigned long) sgl | 0x01;
+ /*
+ * Set lowest bit to indicate a link pointer, and make sure to clear
+ * the termination bit if it happens to be set.
+ */
+ prv[prv_nents - 1].page_link = ((unsigned long) sgl | 0x01) & ~0x02;
}
/**
@@ -239,7 +243,7 @@ static inline void sg_init_table(struct scatterlist *sgl, unsigned int nents)
sg_mark_end(sgl, nents);
#ifdef CONFIG_DEBUG_SG
{
- int i;
+ unsigned int i;
for (i = 0; i < nents; i++)
sgl[i].sg_magic = SG_MAGIC;
}