Subject: linux-next: build failure after merge of the hmm tree

From: Stephen Rothwell <[email-masked]>
Date: Mon, 23 Aug 2021 17:50:27 +1000

Hi all,

After merging the hmm tree, today's linux-next build (x86_64 allmodconfig)
failed like this:

drivers/gpu/drm/i915/gem/i915_gem_ttm.c: In function 'i915_ttm_tt_get_st':
drivers/gpu/drm/i915/gem/i915_gem_ttm.c:396:7: error: implicit declaration of function '__sg_alloc_table_from_pages'; did you mean 'sg_alloc_table_from_pages'? [-Werror=implicit-function-declaration]
  396 |  sg = __sg_alloc_table_from_pages
      |       ^~~~~~~~~~~~~~~~~~~~~~~~~~~
      |       sg_alloc_table_from_pages
drivers/gpu/drm/i915/gem/i915_gem_ttm.c:396:5: warning: assignment to 'struct scatterlist *' from 'int' makes pointer from integer without a cast [-Wint-conversion]
  396 |  sg = __sg_alloc_table_from_pages
      |     ^

Caused by commit

  fcbfe956561b ("lib/scatterlist: Provide a dedicated function to support table append")

interacting with commit

  213d50927763 ("drm/i915/ttm: Introduce a TTM i915 gem object backend")

from the drm tree.

I have applied the following merge resolution patch.

From: Stephen Rothwell <[email-masked]>
Date: Mon, 23 Aug 2021 17:46:27 +1000
Subject: [PATCH] drm/i915/ttm: fix up for "lib/scatterlist: Provide a
 dedicated function to support tableappend"

Signed-off-by: Stephen Rothwell <[email-masked]>
---
 drivers/gpu/drm/i915/gem/i915_gem_ttm.c | 9 ++++-----
 1 file changed, 4 insertions(+), 5 deletions(-)

diff --git a/drivers/gpu/drm/i915/gem/i915_gem_ttm.c b/drivers/gpu/drm/i915/gem/i915_gem_ttm.c
index 771eb2963123..d3d95934a047 100644
--- a/drivers/gpu/drm/i915/gem/i915_gem_ttm.c
+++ b/drivers/gpu/drm/i915/gem/i915_gem_ttm.c
@@ -382,7 +382,6 @@ i915_ttm_region(struct ttm_device *bdev, int ttm_mem_type)
 static struct sg_table *i915_ttm_tt_get_st(struct ttm_tt *ttm)
 {
 	struct i915_ttm_tt *i915_tt = container_of(ttm, typeof(*i915_tt), ttm);
-	struct scatterlist *sg;
 	struct sg_table *st;
 	int ret;
 
@@ -393,13 +392,13 @@ static struct sg_table *i915_ttm_tt_get_st(struct ttm_tt *ttm)
 	if (!st)
 		return ERR_PTR(-ENOMEM);
 
-	sg = __sg_alloc_table_from_pages
+	ret = sg_alloc_table_from_pages_segment
 		(st, ttm->pages, ttm->num_pages, 0,
 		 (unsigned long)ttm->num_pages << PAGE_SHIFT,
-		 i915_sg_segment_size(), NULL, 0, GFP_KERNEL);
-	if (IS_ERR(sg)) {
+		 i915_sg_segment_size(), GFP_KERNEL);
+	if (ret) {
 		kfree(st);
-		return ERR_CAST(sg);
+		return ERR_PTR(ret);
 	}
 
 	ret = dma_map_sgtable(i915_tt->dev, st, DMA_BIDIRECTIONAL, 0);
-- 
2.32.0

-- 
Cheers,
Stephen Rothwell