Commit 160acc2e authored by Linus Torvalds's avatar Linus Torvalds

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
parents a7e1e001 c46f2334
...@@ -1369,7 +1369,7 @@ int blk_rq_map_sg(struct request_queue *q, struct request *rq, ...@@ -1369,7 +1369,7 @@ int blk_rq_map_sg(struct request_queue *q, struct request *rq,
} /* segments in rq */ } /* segments in rq */
if (sg) if (sg)
__sg_mark_end(sg); sg_mark_end(sg);
return nsegs; return nsegs;
} }
......
...@@ -33,7 +33,6 @@ ...@@ -33,7 +33,6 @@
#include <linux/module.h> #include <linux/module.h>
#include <linux/mm.h> #include <linux/mm.h>
#include <asm/byteorder.h> #include <asm/byteorder.h>
#include <asm/scatterlist.h>
#include <linux/crypto.h> #include <linux/crypto.h>
#include <linux/types.h> #include <linux/types.h>
......
...@@ -20,7 +20,6 @@ ...@@ -20,7 +20,6 @@
#include <linux/module.h> #include <linux/module.h>
#include <linux/mm.h> #include <linux/mm.h>
#include <asm/byteorder.h> #include <asm/byteorder.h>
#include <asm/scatterlist.h>
#include <linux/crypto.h> #include <linux/crypto.h>
#include <linux/types.h> #include <linux/types.h>
......
...@@ -14,7 +14,6 @@ ...@@ -14,7 +14,6 @@
#include <linux/types.h> #include <linux/types.h>
#include <linux/crypto.h> #include <linux/crypto.h>
#include <linux/errno.h> #include <linux/errno.h>
#include <asm/scatterlist.h>
#include <linux/string.h> #include <linux/string.h>
#include "internal.h" #include "internal.h"
......
...@@ -19,7 +19,6 @@ ...@@ -19,7 +19,6 @@
#include <linux/init.h> #include <linux/init.h>
#include <linux/module.h> #include <linux/module.h>
#include <linux/mm.h> #include <linux/mm.h>
#include <asm/scatterlist.h>
#include <linux/crypto.h> #include <linux/crypto.h>
#include <linux/string.h> #include <linux/string.h>
......
...@@ -23,7 +23,6 @@ ...@@ -23,7 +23,6 @@
#include <linux/module.h> #include <linux/module.h>
#include <linux/mm.h> #include <linux/mm.h>
#include <asm/byteorder.h> #include <asm/byteorder.h>
#include <asm/scatterlist.h>
#include <linux/crypto.h> #include <linux/crypto.h>
#include <linux/types.h> #include <linux/types.h>
......
...@@ -23,7 +23,6 @@ ...@@ -23,7 +23,6 @@
#include <linux/cryptohash.h> #include <linux/cryptohash.h>
#include <linux/types.h> #include <linux/types.h>
#include <crypto/sha.h> #include <crypto/sha.h>
#include <asm/scatterlist.h>
#include <asm/byteorder.h> #include <asm/byteorder.h>
struct sha1_ctx { struct sha1_ctx {
......
...@@ -22,7 +22,6 @@ ...@@ -22,7 +22,6 @@
#include <linux/crypto.h> #include <linux/crypto.h>
#include <linux/types.h> #include <linux/types.h>
#include <crypto/sha.h> #include <crypto/sha.h>
#include <asm/scatterlist.h>
#include <asm/byteorder.h> #include <asm/byteorder.h>
struct sha256_ctx { struct sha256_ctx {
......
...@@ -19,7 +19,6 @@ ...@@ -19,7 +19,6 @@
#include <linux/types.h> #include <linux/types.h>
#include <crypto/sha.h> #include <crypto/sha.h>
#include <asm/scatterlist.h>
#include <asm/byteorder.h> #include <asm/byteorder.h>
struct sha512_ctx { struct sha512_ctx {
......
...@@ -23,7 +23,6 @@ ...@@ -23,7 +23,6 @@
#include <linux/module.h> #include <linux/module.h>
#include <linux/mm.h> #include <linux/mm.h>
#include <asm/byteorder.h> #include <asm/byteorder.h>
#include <asm/scatterlist.h>
#include <linux/crypto.h> #include <linux/crypto.h>
#include <linux/types.h> #include <linux/types.h>
......
...@@ -25,7 +25,6 @@ ...@@ -25,7 +25,6 @@
#include <linux/module.h> #include <linux/module.h>
#include <linux/mm.h> #include <linux/mm.h>
#include <asm/byteorder.h> #include <asm/byteorder.h>
#include <asm/scatterlist.h>
#include <linux/crypto.h> #include <linux/crypto.h>
#include <linux/types.h> #include <linux/types.h>
......
...@@ -23,7 +23,6 @@ ...@@ -23,7 +23,6 @@
#include <linux/module.h> #include <linux/module.h>
#include <linux/mm.h> #include <linux/mm.h>
#include <asm/byteorder.h> #include <asm/byteorder.h>
#include <asm/scatterlist.h>
#include <linux/crypto.h> #include <linux/crypto.h>
#include <linux/types.h> #include <linux/types.h>
......
...@@ -2,7 +2,6 @@ ...@@ -2,7 +2,6 @@
#include <linux/device.h> #include <linux/device.h>
#include <linux/mm.h> #include <linux/mm.h>
#include <asm/io.h> /* Needed for i386 to build */ #include <asm/io.h> /* Needed for i386 to build */
#include <asm/scatterlist.h> /* Needed for i386 to build */
#include <linux/dma-mapping.h> #include <linux/dma-mapping.h>
#include <linux/dmapool.h> #include <linux/dmapool.h>
#include <linux/slab.h> #include <linux/slab.h>
......
...@@ -71,11 +71,11 @@ ...@@ -71,11 +71,11 @@
#include <linux/types.h> #include <linux/types.h>
#include <linux/wait.h> #include <linux/wait.h>
#include <linux/workqueue.h> #include <linux/workqueue.h>
#include <linux/scatterlist.h>
#include <asm/byteorder.h> #include <asm/byteorder.h>
#include <asm/errno.h> #include <asm/errno.h>
#include <asm/param.h> #include <asm/param.h>
#include <asm/scatterlist.h>
#include <asm/system.h> #include <asm/system.h>
#include <asm/types.h> #include <asm/types.h>
......
...@@ -36,7 +36,7 @@ ...@@ -36,7 +36,7 @@
#include <linux/pci.h> #include <linux/pci.h>
#include <linux/input.h> #include <linux/input.h>
#include <linux/mutex.h> #include <linux/mutex.h>
#include <asm/scatterlist.h> #include <linux/scatterlist.h>
#include <asm/io.h> #include <asm/io.h>
#include <media/v4l2-common.h> #include <media/v4l2-common.h>
......
...@@ -19,7 +19,6 @@ ...@@ -19,7 +19,6 @@
#include <linux/pagemap.h> #include <linux/pagemap.h>
#include <linux/err.h> #include <linux/err.h>
#include <linux/leds.h> #include <linux/leds.h>
#include <asm/scatterlist.h>
#include <linux/scatterlist.h> #include <linux/scatterlist.h>
#include <linux/mmc/card.h> #include <linux/mmc/card.h>
......
...@@ -10,7 +10,6 @@ ...@@ -10,7 +10,6 @@
*/ */
#include <linux/types.h> #include <linux/types.h>
#include <asm/scatterlist.h>
#include <linux/scatterlist.h> #include <linux/scatterlist.h>
#include <linux/mmc/host.h> #include <linux/mmc/host.h>
......
...@@ -10,7 +10,6 @@ ...@@ -10,7 +10,6 @@
*/ */
#include <linux/types.h> #include <linux/types.h>
#include <asm/scatterlist.h>
#include <linux/scatterlist.h> #include <linux/scatterlist.h>
#include <linux/mmc/host.h> #include <linux/mmc/host.h>
......
...@@ -9,7 +9,6 @@ ...@@ -9,7 +9,6 @@
* your option) any later version. * your option) any later version.
*/ */
#include <asm/scatterlist.h>
#include <linux/scatterlist.h> #include <linux/scatterlist.h>
#include <linux/mmc/host.h> #include <linux/mmc/host.h>
......
...@@ -33,7 +33,6 @@ ...@@ -33,7 +33,6 @@
#include <asm/ip32/ip32_ints.h> #include <asm/ip32/ip32_ints.h>
#include <asm/io.h> #include <asm/io.h>
#include <asm/scatterlist.h>
#include "meth.h" #include "meth.h"
......
...@@ -785,7 +785,7 @@ struct scatterlist *scsi_alloc_sgtable(struct scsi_cmnd *cmd, gfp_t gfp_mask) ...@@ -785,7 +785,7 @@ struct scatterlist *scsi_alloc_sgtable(struct scsi_cmnd *cmd, gfp_t gfp_mask)
* end-of-list * end-of-list
*/ */
if (!left) if (!left)
sg_mark_end(sgl, this); sg_mark_end(&sgl[this - 1]);
/* /*
* don't allow subsequent mempool allocs to sleep, it would * don't allow subsequent mempool allocs to sleep, it would
......
...@@ -11,7 +11,6 @@ ...@@ -11,7 +11,6 @@
#include <linux/device.h> #include <linux/device.h>
#include <linux/mm.h> #include <linux/mm.h>
#include <asm/io.h> #include <asm/io.h>
#include <asm/scatterlist.h>
#include <linux/dma-mapping.h> #include <linux/dma-mapping.h>
#include <linux/dmapool.h> #include <linux/dmapool.h>
#include <linux/usb.h> #include <linux/usb.h>
......
...@@ -30,7 +30,6 @@ ...@@ -30,7 +30,6 @@
#include <linux/utsname.h> #include <linux/utsname.h>
#include <linux/mm.h> #include <linux/mm.h>
#include <asm/io.h> #include <asm/io.h>
#include <asm/scatterlist.h>
#include <linux/device.h> #include <linux/device.h>
#include <linux/dma-mapping.h> #include <linux/dma-mapping.h>
#include <linux/mutex.h> #include <linux/mutex.h>
......
...@@ -36,7 +36,7 @@ ...@@ -36,7 +36,7 @@
#include <linux/workqueue.h> #include <linux/workqueue.h>
#include <asm/io.h> #include <asm/io.h>
#include <asm/scatterlist.h> #include <linux/scatterlist.h>
#include <linux/mm.h> #include <linux/mm.h>
#include <linux/dma-mapping.h> #include <linux/dma-mapping.h>
......
...@@ -43,7 +43,7 @@ ...@@ -43,7 +43,7 @@
#include <linux/file.h> #include <linux/file.h>
#include <linux/namei.h> #include <linux/namei.h>
#include <asm/uaccess.h> #include <asm/uaccess.h>
#include <asm/scatterlist.h> #include <linux/scatterlist.h>
#include <linux/crypto.h> #include <linux/crypto.h>
#include <linux/sched.h> #include <linux/sched.h>
......
...@@ -188,43 +188,23 @@ static inline void sg_chain(struct scatterlist *prv, unsigned int prv_nents, ...@@ -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 * sg_mark_end - Mark the end of the scatterlist
* @sgl: Scatterlist * @sg: SG entryScatterlist
* @nents: Number of entries in sgl
* *
* Description: * 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 #ifdef CONFIG_DEBUG_SG
sg->sg_magic = SG_MAGIC; BUG_ON(sg->sg_magic != SG_MAGIC);
#endif #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, ...@@ -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) static inline void sg_init_table(struct scatterlist *sgl, unsigned int nents)
{ {
memset(sgl, 0, sizeof(*sgl) * nents); memset(sgl, 0, sizeof(*sgl) * nents);
sg_mark_end(sgl, nents);
#ifdef CONFIG_DEBUG_SG #ifdef CONFIG_DEBUG_SG
{ {
unsigned int i; unsigned int i;
...@@ -248,6 +227,25 @@ static inline void sg_init_table(struct scatterlist *sgl, unsigned int nents) ...@@ -248,6 +227,25 @@ static inline void sg_init_table(struct scatterlist *sgl, unsigned int nents)
sgl[i].sg_magic = SG_MAGIC; sgl[i].sg_magic = SG_MAGIC;
} }
#endif #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);
} }
/** /**
......
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
#include <linux/crypto.h> #include <linux/crypto.h>
#include <net/xfrm.h> #include <net/xfrm.h>
#include <asm/scatterlist.h> #include <linux/scatterlist.h>
#define ESP_NUM_FAST_SG 4 #define ESP_NUM_FAST_SG 4
......
...@@ -48,9 +48,9 @@ ...@@ -48,9 +48,9 @@
#include <linux/kref.h> #include <linux/kref.h>
#include <linux/list.h> #include <linux/list.h>
#include <linux/rwsem.h> #include <linux/rwsem.h>
#include <linux/scatterlist.h>
#include <asm/atomic.h> #include <asm/atomic.h>
#include <asm/scatterlist.h>
#include <asm/uaccess.h> #include <asm/uaccess.h>
union ib_gid { union ib_gid {
......
...@@ -36,7 +36,7 @@ ...@@ -36,7 +36,7 @@
#include <scsi/scsi_device.h> #include <scsi/scsi_device.h>
#include <scsi/scsi_cmnd.h> #include <scsi/scsi_cmnd.h>
#include <scsi/scsi_transport_sas.h> #include <scsi/scsi_transport_sas.h>
#include <asm/scatterlist.h> #include <linux/scatterlist.h>
struct block_device; struct block_device;
......
...@@ -2095,7 +2095,7 @@ int skb_to_sgvec(struct sk_buff *skb, struct scatterlist *sg, int offset, int le ...@@ -2095,7 +2095,7 @@ int skb_to_sgvec(struct sk_buff *skb, struct scatterlist *sg, int offset, int le
{ {
int nsg = __skb_to_sgvec(skb, sg, offset, len); int nsg = __skb_to_sgvec(skb, sg, offset, len);
__sg_mark_end(&sg[nsg - 1]); sg_mark_end(&sg[nsg - 1]);
return nsg; return nsg;
} }
......
...@@ -25,7 +25,6 @@ ...@@ -25,7 +25,6 @@
#include <net/ieee80211.h> #include <net/ieee80211.h>
#include <linux/crypto.h> #include <linux/crypto.h>
#include <asm/scatterlist.h>
MODULE_AUTHOR("Jouni Malinen"); MODULE_AUTHOR("Jouni Malinen");
MODULE_DESCRIPTION("Host AP crypt: CCMP"); MODULE_DESCRIPTION("Host AP crypt: CCMP");
......
...@@ -8,7 +8,6 @@ ...@@ -8,7 +8,6 @@
#include <linux/spinlock.h> #include <linux/spinlock.h>
#include <net/icmp.h> #include <net/icmp.h>
#include <net/protocol.h> #include <net/protocol.h>
#include <asm/scatterlist.h>
/* Clear mutable options and find final destination to substitute /* Clear mutable options and find final destination to substitute
......
...@@ -14,7 +14,6 @@ ...@@ -14,7 +14,6 @@
* - Adaptive compression. * - Adaptive compression.
*/ */
#include <linux/module.h> #include <linux/module.h>
#include <asm/scatterlist.h>
#include <asm/semaphore.h> #include <asm/semaphore.h>
#include <linux/crypto.h> #include <linux/crypto.h>
#include <linux/pfkeyv2.h> #include <linux/pfkeyv2.h>
......
...@@ -1083,7 +1083,7 @@ static int tcp_v4_do_calc_md5_hash(char *md5_hash, struct tcp_md5sig_key *key, ...@@ -1083,7 +1083,7 @@ static int tcp_v4_do_calc_md5_hash(char *md5_hash, struct tcp_md5sig_key *key,
sg_set_buf(&sg[block++], key->key, key->keylen); sg_set_buf(&sg[block++], key->key, key->keylen);
nbytes += key->keylen; nbytes += key->keylen;
__sg_mark_end(&sg[block - 1]); sg_mark_end(&sg[block - 1]);
/* Now store the Hash into the packet */ /* Now store the Hash into the packet */
err = crypto_hash_init(desc); err = crypto_hash_init(desc);
......
...@@ -35,7 +35,6 @@ ...@@ -35,7 +35,6 @@
#include <net/ipv6.h> #include <net/ipv6.h>
#include <net/protocol.h> #include <net/protocol.h>
#include <net/xfrm.h> #include <net/xfrm.h>
#include <asm/scatterlist.h>
static int zero_out_mutable_opts(struct ipv6_opt_hdr *opthdr) static int zero_out_mutable_opts(struct ipv6_opt_hdr *opthdr)
{ {
......
...@@ -34,7 +34,6 @@ ...@@ -34,7 +34,6 @@
#include <net/ip.h> #include <net/ip.h>
#include <net/xfrm.h> #include <net/xfrm.h>
#include <net/ipcomp.h> #include <net/ipcomp.h>
#include <asm/scatterlist.h>
#include <asm/semaphore.h> #include <asm/semaphore.h>
#include <linux/crypto.h> #include <linux/crypto.h>
#include <linux/pfkeyv2.h> #include <linux/pfkeyv2.h>
......
...@@ -781,7 +781,7 @@ static int tcp_v6_do_calc_md5_hash(char *md5_hash, struct tcp_md5sig_key *key, ...@@ -781,7 +781,7 @@ static int tcp_v6_do_calc_md5_hash(char *md5_hash, struct tcp_md5sig_key *key,
sg_set_buf(&sg[block++], key->key, key->keylen); sg_set_buf(&sg[block++], key->key, key->keylen);
nbytes += key->keylen; nbytes += key->keylen;
__sg_mark_end(&sg[block - 1]); sg_mark_end(&sg[block - 1]);
/* Now store the hash into the packet */ /* Now store the hash into the packet */
err = crypto_hash_init(desc); err = crypto_hash_init(desc);
......
...@@ -11,7 +11,6 @@ ...@@ -11,7 +11,6 @@
#include <linux/types.h> #include <linux/types.h>
#include <linux/crypto.h> #include <linux/crypto.h>
#include <linux/err.h> #include <linux/err.h>
#include <asm/scatterlist.h>
#include <net/mac80211.h> #include <net/mac80211.h>
#include "ieee80211_key.h" #include "ieee80211_key.h"
......
...@@ -702,7 +702,7 @@ static void rxkad_sg_set_buf2(struct scatterlist sg[2], ...@@ -702,7 +702,7 @@ static void rxkad_sg_set_buf2(struct scatterlist sg[2],
nsg++; nsg++;
} }
__sg_mark_end(&sg[nsg - 1]); sg_mark_end(&sg[nsg - 1]);
ASSERTCMP(sg[0].length + sg[1].length, ==, buflen); ASSERTCMP(sg[0].length + sg[1].length, ==, buflen);
} }
......
...@@ -211,8 +211,8 @@ encryptor(struct scatterlist *sg, void *data) ...@@ -211,8 +211,8 @@ encryptor(struct scatterlist *sg, void *data)
if (thislen == 0) if (thislen == 0)
return 0; return 0;
__sg_mark_end(&desc->infrags[desc->fragno - 1]); sg_mark_end(&desc->infrags[desc->fragno - 1]);
__sg_mark_end(&desc->outfrags[desc->fragno - 1]); sg_mark_end(&desc->outfrags[desc->fragno - 1]);
ret = crypto_blkcipher_encrypt_iv(&desc->desc, desc->outfrags, ret = crypto_blkcipher_encrypt_iv(&desc->desc, desc->outfrags,
desc->infrags, thislen); desc->infrags, thislen);
...@@ -293,7 +293,7 @@ decryptor(struct scatterlist *sg, void *data) ...@@ -293,7 +293,7 @@ decryptor(struct scatterlist *sg, void *data)
if (thislen == 0) if (thislen == 0)
return 0; return 0;
__sg_mark_end(&desc->frags[desc->fragno - 1]); sg_mark_end(&desc->frags[desc->fragno - 1]);
ret = crypto_blkcipher_decrypt_iv(&desc->desc, desc->frags, ret = crypto_blkcipher_decrypt_iv(&desc->desc, desc->frags,
desc->frags, thislen); desc->frags, thislen);
......
...@@ -63,7 +63,6 @@ ...@@ -63,7 +63,6 @@
#include <linux/jiffies.h> #include <linux/jiffies.h>
#include <linux/sunrpc/gss_krb5.h> #include <linux/sunrpc/gss_krb5.h>
#include <linux/random.h> #include <linux/random.h>
#include <asm/scatterlist.h>
#include <linux/crypto.h> #include <linux/crypto.h>
#ifdef RPC_DEBUG #ifdef RPC_DEBUG
......
...@@ -4,7 +4,6 @@ ...@@ -4,7 +4,6 @@
#include <linux/sunrpc/gss_krb5.h> #include <linux/sunrpc/gss_krb5.h>
#include <linux/random.h> #include <linux/random.h>
#include <linux/pagemap.h> #include <linux/pagemap.h>
#include <asm/scatterlist.h>
#include <linux/crypto.h> #include <linux/crypto.h>
#ifdef RPC_DEBUG #ifdef RPC_DEBUG
......
...@@ -21,7 +21,6 @@ ...@@ -21,7 +21,6 @@
#if defined(CONFIG_INET_ESP) || defined(CONFIG_INET_ESP_MODULE) || defined(CONFIG_INET6_ESP) || defined(CONFIG_INET6_ESP_MODULE) #if defined(CONFIG_INET_ESP) || defined(CONFIG_INET_ESP_MODULE) || defined(CONFIG_INET6_ESP) || defined(CONFIG_INET6_ESP_MODULE)
#include <net/esp.h> #include <net/esp.h>
#endif #endif
#include <asm/scatterlist.h>
/* /*
* Algorithms supported by IPsec. These entries contain properties which * Algorithms supported by IPsec. These entries contain properties which
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment