Skip to contentSkip to conversation

drm/ttm: fix unused function warning

PATCH In review Arnd Bergmann 3 participants 4 messages Dec 4, 2020 – Dec 16, 2020

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 drm/ttm: fix unused function warning

From: Arnd Bergmann <[email protected]>

ttm_pool_type_count() is not used when debugfs is disabled:

drivers/gpu/drm/ttm/ttm_pool.c:243:21: error: unused function 'ttm_pool_type_count' [-Werror,-Wunused-function] static unsigned int ttm_pool_type_count(struct ttm_pool_type *pt)

Move the definition into the #ifdef block.

Fixes d099fc8f540a ("drm/ttm: new TT backend allocation pool v3")
---
 drivers/gpu/drm/ttm/ttm_pool.c | 29 ++++++++++++++---------------
 1 file changed, 14 insertions(+), 15 deletions(-)
drivers/gpu/drm/ttm/ttm_pool.c +14 -15
index 5455b2044759..7b2f60616750 100644
@@ -239,21 +239,6 @@ static struct page *ttm_pool_type_take(struct ttm_pool_type *pt)
 	return p;
 }
 
-/* Count the number of pages available in a pool_type */
-static unsigned int ttm_pool_type_count(struct ttm_pool_type *pt)
-{
-	unsigned int count = 0;
-	struct page *p;
-
-	spin_lock(&pt->lock);
-	/* Only used for debugfs, the overhead doesn't matter */
-	list_for_each_entry(p, &pt->pages, lru)
-		++count;
-	spin_unlock(&pt->lock);
-
-	return count;
-}
-
 /* Initialize and add a pool type to the global shrinker list */
 static void ttm_pool_type_init(struct ttm_pool_type *pt, struct ttm_pool *pool,
 			       enum ttm_caching caching, unsigned int order)
@@ -543,6 +528,20 @@ void ttm_pool_fini(struct ttm_pool *pool)
 EXPORT_SYMBOL(ttm_pool_fini);
 
 #ifdef CONFIG_DEBUG_FS
+/* Count the number of pages available in a pool_type */
+static unsigned int ttm_pool_type_count(struct ttm_pool_type *pt)
+{
+	unsigned int count = 0;
+	struct page *p;
+
+	spin_lock(&pt->lock);
+	/* Only used for debugfs, the overhead doesn't matter */
+	list_for_each_entry(p, &pt->pages, lru)
+		++count;
+	spin_unlock(&pt->lock);
+
+	return count;
+}
 
 /* Dump information about the different pool types */
 static void ttm_pool_debugfs_orders(struct ttm_pool_type *pt,
Signature · 6 lines
2.27.0

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
Reviewed-by on v1 1/1
#1 lore raw
Quoted 11 lines · Arnd Bergmann

From: Arnd Bergmann <[email protected]>

ttm_pool_type_count() is not used when debugfs is disabled:

drivers/gpu/drm/ttm/ttm_pool.c:243:21: error: unused function 'ttm_pool_type_count' [-Werror,-Wunused-function] static unsigned int ttm_pool_type_count(struct ttm_pool_type *pt)

Move the definition into the #ifdef block.

Fixes d099fc8f540a ("drm/ttm: new TT backend allocation pool v3")

Thanks Arnd! The patch looks good to me:

Quoted 52 lines
---
  drivers/gpu/drm/ttm/ttm_pool.c | 29 ++++++++++++++---------------
  1 file changed, 14 insertions(+), 15 deletions(-)
drivers/gpu/drm/ttm/ttm_pool.c +14 -15
index 5455b2044759..7b2f60616750 100644
@@ -239,21 +239,6 @@ static struct page *ttm_pool_type_take(struct ttm_pool_type *pt)
  	return p;
  }
 
-/* Count the number of pages available in a pool_type */
-static unsigned int ttm_pool_type_count(struct ttm_pool_type *pt)
-{
-	unsigned int count = 0;
-	struct page *p;
-
-	spin_lock(&pt->lock);
-	/* Only used for debugfs, the overhead doesn't matter */
-	list_for_each_entry(p, &pt->pages, lru)
-		++count;
-	spin_unlock(&pt->lock);
-
-	return count;
-}
-
  /* Initialize and add a pool type to the global shrinker list */
  static void ttm_pool_type_init(struct ttm_pool_type *pt, struct ttm_pool *pool,
  			       enum ttm_caching caching, unsigned int order)
@@ -543,6 +528,20 @@ void ttm_pool_fini(struct ttm_pool *pool)
  EXPORT_SYMBOL(ttm_pool_fini);
 
  #ifdef CONFIG_DEBUG_FS
+/* Count the number of pages available in a pool_type */
+static unsigned int ttm_pool_type_count(struct ttm_pool_type *pt)
+{
+	unsigned int count = 0;
+	struct page *p;
+
+	spin_lock(&pt->lock);
+	/* Only used for debugfs, the overhead doesn't matter */
+	list_for_each_entry(p, &pt->pages, lru)
+		++count;
+	spin_unlock(&pt->lock);
+
+	return count;
+}
 
  /* Dump information about the different pool types */
  static void ttm_pool_debugfs_orders(struct ttm_pool_type *pt,
Reviewed-by
#2 lore raw

Am 08.12.20 um 09:18 schrieb Martin Peres:

Quoted 8 lines · Arnd Bergmann
Quoted 7 lines

From: Arnd Bergmann <[email protected]>

ttm_pool_type_count() is not used when debugfs is disabled:

drivers/gpu/drm/ttm/ttm_pool.c:243:21: error: unused function 'ttm_pool_type_count' [-Werror,-Wunused-function] static unsigned int ttm_pool_type_count(struct ttm_pool_type *pt)

Quoted 8 lines
Quoted 4 lines

Move the definition into the #ifdef block.

Fixes d099fc8f540a ("drm/ttm: new TT backend allocation pool v3")

Thanks Arnd! The patch looks good to me:

Quoted 43 lines
Quoted 43 lines

---
  drivers/gpu/drm/ttm/ttm_pool.c | 29 ++++++++++++++---------------

  1 file changed, 14 insertions(+), 15 deletions(-)
drivers/gpu/drm/ttm/ttm_pool.c +0 -0
index 5455b2044759..7b2f60616750 100644
@@ -239,21 +239,6 @@ static struct page *ttm_pool_type_take(struct 
 ttm_pool_type *pt)
       return p;
   }

  -/* Count the number of pages available in a pool_type */

drivers/gpu/drm/ttm/ttm_pool.c +0 -14
-static unsigned int ttm_pool_type_count(struct ttm_pool_type *pt)
-{
-    unsigned int count = 0;
-    struct page *p;
-
-    spin_lock(&pt->lock);
-    /* Only used for debugfs, the overhead doesn't matter */
-    list_for_each_entry(p, &pt->pages, lru)
-        ++count;
-    spin_unlock(&pt->lock);
-
-    return count;
-}
-

  /* Initialize and add a pool type to the global shrinker list */ static void ttm_pool_type_init(struct ttm_pool_type *pt, struct ttm_pool *pool, enum ttm_caching caching, unsigned int order)

drivers/gpu/drm/ttm/ttm_pool.c +9 -0
@@ -543,6 +528,20 @@ void ttm_pool_fini(struct ttm_pool *pool)
   EXPORT_SYMBOL(ttm_pool_fini);
     #ifdef CONFIG_DEBUG_FS
+/* Count the number of pages available in a pool_type */
+static unsigned int ttm_pool_type_count(struct ttm_pool_type *pt)
+{
+    unsigned int count = 0;
+    struct page *p;
+
+    spin_lock(&pt->lock);
+    /* Only used for debugfs, the overhead doesn't matter */
+    list_for_each_entry(p, &pt->pages, lru)
Quoted 8 lines

drivers/gpu/drm/ttm/ttm_pool.c void ttm_pool_fini(struct ttm_pool *pool)

Quoted 8 lines
drivers/gpu/drm/ttm/ttm_pool.c +5 -0
+        ++count;
+    spin_unlock(&pt->lock);
+
+    return count;
+}
     /* Dump information about the different pool types */
   static void ttm_pool_debugfs_orders(struct ttm_pool_type *pt,
 

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel

#3 lore raw

Am 08.12.20 um 10:43 schrieb Christian König:

Quoted 11 lines

Am 08.12.20 um 09:18 schrieb Martin Peres:

Quoted 10 lines · Arnd Bergmann
Quoted 9 lines

From: Arnd Bergmann <[email protected]>

ttm_pool_type_count() is not used when debugfs is disabled:

drivers/gpu/drm/ttm/ttm_pool.c:243:21: error: unused function 'ttm_pool_type_count' [-Werror,-Wunused-function] static unsigned int ttm_pool_type_count(struct ttm_pool_type *pt)

Move the definition into the #ifdef block.

Quoted 8 lines
Quoted 6 lines
Quoted 2 lines
Fixes d099fc8f540a ("drm/ttm: new TT backend allocation pool v3")

Thanks Arnd! The patch looks good to me:

I've just pushed that to drm-misc-next-fixes.

Christian.

Quoted 44 lines
Quoted 44 lines
Quoted 44 lines

---
  drivers/gpu/drm/ttm/ttm_pool.c | 29 ++++++++++++++---------------

  1 file changed, 14 insertions(+), 15 deletions(-)
drivers/gpu/drm/ttm/ttm_pool.c +0 -0
index 5455b2044759..7b2f60616750 100644
@@ -239,21 +239,6 @@ static struct page *ttm_pool_type_take(struct 
 ttm_pool_type *pt)
       return p;
   }

  -/* Count the number of pages available in a pool_type */

drivers/gpu/drm/ttm/ttm_pool.c +0 -14
-static unsigned int ttm_pool_type_count(struct ttm_pool_type *pt)
-{
-    unsigned int count = 0;
-    struct page *p;
-
-    spin_lock(&pt->lock);
-    /* Only used for debugfs, the overhead doesn't matter */
-    list_for_each_entry(p, &pt->pages, lru)
-        ++count;
-    spin_unlock(&pt->lock);
-
-    return count;
-}
-

  /* Initialize and add a pool type to the global shrinker list */ static void ttm_pool_type_init(struct ttm_pool_type *pt, struct ttm_pool *pool, enum ttm_caching caching, unsigned int order)

drivers/gpu/drm/ttm/ttm_pool.c +9 -0
@@ -543,6 +528,20 @@ void ttm_pool_fini(struct ttm_pool *pool)
   EXPORT_SYMBOL(ttm_pool_fini);
     #ifdef CONFIG_DEBUG_FS
+/* Count the number of pages available in a pool_type */
+static unsigned int ttm_pool_type_count(struct ttm_pool_type *pt)
+{
+    unsigned int count = 0;
+    struct page *p;
+
+    spin_lock(&pt->lock);
+    /* Only used for debugfs, the overhead doesn't matter */
+    list_for_each_entry(p, &pt->pages, lru)
Quoted 9 lines
Quoted 8 lines

drivers/gpu/drm/ttm/ttm_pool.c void ttm_pool_fini(struct ttm_pool *pool)

Quoted 8 lines
drivers/gpu/drm/ttm/ttm_pool.c +5 -0
+        ++count;
+    spin_unlock(&pt->lock);
+
+    return count;
+}
     /* Dump information about the different pool types */
   static void ttm_pool_debugfs_orders(struct ttm_pool_type *pt,
 

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel