Skip to content

Commit e01caa2

Browse files
suijingfengakpm00
authored andcommitted
lib/scatterlist: use sg_phys() helper
This shorten the length of code in horizential direction, therefore is easier to read. Link: https://lkml.kernel.org/r/[email protected] Signed-off-by: Sui Jingfeng <[email protected]> Signed-off-by: Andrew Morton <[email protected]>
1 parent 2f07b65 commit e01caa2

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

lib/scatterlist.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -474,14 +474,14 @@ int sg_alloc_append_table_from_pages(struct sg_append_table *sgt_append,
474474
return -EOPNOTSUPP;
475475

476476
if (sgt_append->prv) {
477-
unsigned long next_pfn = (page_to_phys(sg_page(sgt_append->prv)) +
478-
sgt_append->prv->offset + sgt_append->prv->length) / PAGE_SIZE;
477+
unsigned long next_pfn;
479478

480479
if (WARN_ON(offset))
481480
return -EINVAL;
482481

483482
/* Merge contiguous pages into the last SG */
484483
prv_len = sgt_append->prv->length;
484+
next_pfn = (sg_phys(sgt_append->prv) + prv_len) / PAGE_SIZE;
485485
if (page_to_pfn(pages[0]) == next_pfn) {
486486
last_pg = pfn_to_page(next_pfn - 1);
487487
while (n_pages && pages_are_mergeable(pages[0], last_pg)) {

0 commit comments

Comments
 (0)