]> git.kernelconcepts.de Git - karo-tx-linux.git/commitdiff
scatterlist: allow limited chaining without ARCH_HAS_SG_CHAIN
authorChristoph Hellwig <hch@lst.de>
Fri, 7 Aug 2015 16:15:11 +0000 (18:15 +0200)
committerJens Axboe <axboe@fb.com>
Mon, 17 Aug 2015 14:12:51 +0000 (08:12 -0600)
There are a couple of uses of struct scatterlist that never go to
the dma_map_sg() helper and thus don't care about ARCH_HAS_SG_CHAIN
which indicates that we can map chained S/G list.

The most important one is the crypto code, which currently has
to open code a few helpers to always allow chaining.  This patch
removes a few #ifdef ARCH_HAS_SG_CHAIN statements so that we can
switch the crypto code to these common helpers.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Jens Axboe <axboe@fb.com>
include/linux/scatterlist.h
lib/scatterlist.c

index 9b1ef0c820a72dab0fb8dea4658f26d9bc4ad6ab..698e906ca7307739265aa387be33277928c1f78b 100644 (file)
@@ -161,10 +161,6 @@ static inline void sg_set_buf(struct scatterlist *sg, const void *buf,
 static inline void sg_chain(struct scatterlist *prv, unsigned int prv_nents,
                            struct scatterlist *sgl)
 {
-#ifndef CONFIG_ARCH_HAS_SG_CHAIN
-       BUG();
-#endif
-
        /*
         * offset and length are unused for chain entry.  Clear them.
         */
index d105a9f56878e57e2587f2704121c0210b8fb941..bafa9933fa768d6f76e4ade1296c873a3c38c139 100644 (file)
@@ -105,16 +105,12 @@ EXPORT_SYMBOL(sg_nents_for_len);
  **/
 struct scatterlist *sg_last(struct scatterlist *sgl, unsigned int nents)
 {
-#ifndef CONFIG_ARCH_HAS_SG_CHAIN
-       struct scatterlist *ret = &sgl[nents - 1];
-#else
        struct scatterlist *sg, *ret = NULL;
        unsigned int i;
 
        for_each_sg(sgl, sg, nents, i)
                ret = sg;
 
-#endif
 #ifdef CONFIG_DEBUG_SG
        BUG_ON(sgl[0].sg_magic != SG_MAGIC);
        BUG_ON(!sg_is_last(ret));