Skip to content

Commit 78c2f0b

Browse files
author
Jens Axboe
committed
[SG] Update crypto/ to sg helpers
Signed-off-by: Jens Axboe <jens.axboe@oracle.com>
1 parent 9b61764 commit 78c2f0b

File tree

6 files changed

+10
-9
lines changed

6 files changed

+10
-9
lines changed

crypto/digest.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ static int update2(struct hash_desc *desc,
4141
return 0;
4242

4343
for (;;) {
44-
struct page *pg = sg->page;
44+
struct page *pg = sg_page(sg);
4545
unsigned int offset = sg->offset;
4646
unsigned int l = sg->length;
4747

crypto/hmac.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -159,7 +159,8 @@ static int hmac_digest(struct hash_desc *pdesc, struct scatterlist *sg,
159159
desc.flags = pdesc->flags & CRYPTO_TFM_REQ_MAY_SLEEP;
160160

161161
sg_set_buf(sg1, ipad, bs);
162-
sg1[1].page = (void *)sg;
162+
163+
sg_set_page(&sg[1], (void *) sg);
163164
sg1[1].length = 0;
164165
sg_set_buf(sg2, opad, bs + ds);
165166

crypto/scatterwalk.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ static void scatterwalk_pagedone(struct scatter_walk *walk, int out,
5454
if (out) {
5555
struct page *page;
5656

57-
page = walk->sg->page + ((walk->offset - 1) >> PAGE_SHIFT);
57+
page = sg_page(walk->sg) + ((walk->offset - 1) >> PAGE_SHIFT);
5858
flush_dcache_page(page);
5959
}
6060

crypto/scatterwalk.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,13 +22,13 @@
2222

2323
static inline struct scatterlist *scatterwalk_sg_next(struct scatterlist *sg)
2424
{
25-
return (++sg)->length ? sg : (void *)sg->page;
25+
return (++sg)->length ? sg : (void *) sg_page(sg);
2626
}
2727

2828
static inline unsigned long scatterwalk_samebuf(struct scatter_walk *walk_in,
2929
struct scatter_walk *walk_out)
3030
{
31-
return !(((walk_in->sg->page - walk_out->sg->page) << PAGE_SHIFT) +
31+
return !(((sg_page(walk_in->sg) - sg_page(walk_out->sg)) << PAGE_SHIFT) +
3232
(int)(walk_in->offset - walk_out->offset));
3333
}
3434

@@ -60,7 +60,7 @@ static inline unsigned int scatterwalk_aligned(struct scatter_walk *walk,
6060

6161
static inline struct page *scatterwalk_page(struct scatter_walk *walk)
6262
{
63-
return walk->sg->page + (walk->offset >> PAGE_SHIFT);
63+
return sg_page(walk->sg) + (walk->offset >> PAGE_SHIFT);
6464
}
6565

6666
static inline void scatterwalk_unmap(void *vaddr, int out)

crypto/tcrypt.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -317,7 +317,7 @@ static void test_cipher(char *algo, int enc,
317317
goto out;
318318
}
319319

320-
q = kmap(sg[0].page) + sg[0].offset;
320+
q = kmap(sg_page(&sg[0])) + sg[0].offset;
321321
hexdump(q, cipher_tv[i].rlen);
322322

323323
printk("%s\n",
@@ -390,7 +390,7 @@ static void test_cipher(char *algo, int enc,
390390
temp = 0;
391391
for (k = 0; k < cipher_tv[i].np; k++) {
392392
printk("page %u\n", k);
393-
q = kmap(sg[k].page) + sg[k].offset;
393+
q = kmap(sg_page(&sg[k])) + sg[k].offset;
394394
hexdump(q, cipher_tv[i].tap[k]);
395395
printk("%s\n",
396396
memcmp(q, cipher_tv[i].result + temp,

crypto/xcbc.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,7 @@ static int crypto_xcbc_digest_update2(struct hash_desc *pdesc,
120120

121121
do {
122122

123-
struct page *pg = sg[i].page;
123+
struct page *pg = sg_page(&sg[i]);
124124
unsigned int offset = sg[i].offset;
125125
unsigned int slen = sg[i].length;
126126

0 commit comments

Comments
 (0)