Skip to contentSkip to conversation

drm/amdgpu: fix debugfs creation/removal, again

PATCH Applied Arnd Bergmann 3 participants 3 messages Dec 3, 2020 – Dec 4, 2020

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

PATCH 1/1 drm/amdgpu: fix debugfs creation/removal, again

From: Arnd Bergmann <[email protected]>

There is still a warning when CONFIG_DEBUG_FS is disabled:

drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c:1145:13: error: 'amdgpu_ras_debugfs_create_ctrl_node' defined but not used [-Werror=unused-function]
1145 | static void amdgpu_ras_debugfs_create_ctrl_node(struct amdgpu_device *adev)

Change the code again to make the compiler actually drop this code but not warn about it.

Fixes ae2bf61ff39e ("drm/amdgpu: guard ras debugfs creation/removal based on CONFIG_DEBUG_FS")
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c | 13 +++++--------
 drivers/gpu/drm/amd/amdgpu/amdgpu_ras.h |  6 ------
 2 files changed, 5 insertions(+), 14 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c +5 -8
index 9d11b847e6ef..c136bd449744 100644
@@ -1167,7 +1167,7 @@ static void amdgpu_ras_debugfs_create_ctrl_node(struct amdgpu_device *adev)
 			con->dir, &con->disable_ras_err_cnt_harvest);
 }
 
-void amdgpu_ras_debugfs_create(struct amdgpu_device *adev,
+static void amdgpu_ras_debugfs_create(struct amdgpu_device *adev,
 		struct ras_fs_if *head)
 {
 	struct amdgpu_ras *con = amdgpu_ras_get_context(adev);
@@ -1189,7 +1189,6 @@ void amdgpu_ras_debugfs_create(struct amdgpu_device *adev,
 
 void amdgpu_ras_debugfs_create_all(struct amdgpu_device *adev)
 {
-#if defined(CONFIG_DEBUG_FS)
 	struct amdgpu_ras *con = amdgpu_ras_get_context(adev);
 	struct ras_manager *obj;
 	struct ras_fs_if fs_info;
@@ -1198,7 +1197,7 @@ void amdgpu_ras_debugfs_create_all(struct amdgpu_device *adev)
 	 * it won't be called in resume path, no need to check
 	 * suspend and gpu reset status
 	 */
-	if (!con)
+	if (!IS_ENABLED(CONFIG_DEBUG_FS) || !con)
 		return;
 
 	amdgpu_ras_debugfs_create_ctrl_node(adev);
@@ -1212,10 +1211,9 @@ void amdgpu_ras_debugfs_create_all(struct amdgpu_device *adev)
 			amdgpu_ras_debugfs_create(adev, &fs_info);
 		}
 	}
-#endif
 }
 
-void amdgpu_ras_debugfs_remove(struct amdgpu_device *adev,
+static void amdgpu_ras_debugfs_remove(struct amdgpu_device *adev,
 		struct ras_common_if *head)
 {
 	struct ras_manager *obj = amdgpu_ras_find_obj(adev, head);
@@ -1229,7 +1227,6 @@ void amdgpu_ras_debugfs_remove(struct amdgpu_device *adev,
 
 static void amdgpu_ras_debugfs_remove_all(struct amdgpu_device *adev)
 {
-#if defined(CONFIG_DEBUG_FS)
 	struct amdgpu_ras *con = amdgpu_ras_get_context(adev);
 	struct ras_manager *obj, *tmp;
 
@@ -1238,7 +1235,6 @@ static void amdgpu_ras_debugfs_remove_all(struct amdgpu_device *adev)
 	}
 
 	con->dir = NULL;
-#endif
 }
 /* debugfs end */
 
@@ -1286,7 +1282,8 @@ static int amdgpu_ras_fs_init(struct amdgpu_device *adev)
 
 static int amdgpu_ras_fs_fini(struct amdgpu_device *adev)
 {
-	amdgpu_ras_debugfs_remove_all(adev);
+	if (IS_ENABLED(CONFIG_DEBUG_FS))
+		amdgpu_ras_debugfs_remove_all(adev);
 	amdgpu_ras_sysfs_remove_all(adev);
 	return 0;
 }
drivers/gpu/drm/amd/amdgpu/amdgpu_ras.h +0 -6
index 4667cce38582..762f5e46c007 100644
@@ -592,14 +592,8 @@ int amdgpu_ras_sysfs_create(struct amdgpu_device *adev,
 int amdgpu_ras_sysfs_remove(struct amdgpu_device *adev,
 		struct ras_common_if *head);
 
-void amdgpu_ras_debugfs_create(struct amdgpu_device *adev,
-		struct ras_fs_if *head);
-
 void amdgpu_ras_debugfs_create_all(struct amdgpu_device *adev);
 
-void amdgpu_ras_debugfs_remove(struct amdgpu_device *adev,
-		struct ras_common_if *head);
-
 int amdgpu_ras_error_query(struct amdgpu_device *adev,
 		struct ras_query_if *info);
 
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

[AMD Public Use]

Quoted 128 lines

-----Original Message-----
From: Arnd Bergmann <[email protected]>
Sent: Friday, December 4, 2020 7:07 AM
To: Deucher, Alexander <[email protected]>; Koenig, Christian <[email protected]>; David Airlie <[email protected]>; Daniel Vetter <[email protected]>; Li, Dennis <[email protected]>; Zhou1, Tao <[email protected]>; Chen, Guchun <[email protected]>
Cc: Arnd Bergmann <[email protected]>; Zhang, Hawking <[email protected]>; Clements, John <[email protected]>; Yang, Stanley <[email protected]>; Ma, Le <[email protected]>; amd- [email protected]; [email protected]; linux- [email protected]
Subject: [PATCH] drm/amdgpu: fix debugfs creation/removal, again

From: Arnd Bergmann <[email protected]>

There is still a warning when CONFIG_DEBUG_FS is disabled:

drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c:1145:13: error:
'amdgpu_ras_debugfs_create_ctrl_node' defined but not used [- Werror=unused-function]
1145 | static void amdgpu_ras_debugfs_create_ctrl_node(struct
amdgpu_device *adev)

Change the code again to make the compiler actually drop this code but not warn about it.

Fixes ae2bf61ff39e ("drm/amdgpu: guard ras debugfs creation/removal based

on CONFIG_DEBUG_FS")

---
 drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c | 13 +++++--------
drivers/gpu/drm/amd/amdgpu/amdgpu_ras.h |  6 ------
 2 files changed, 5 insertions(+), 14 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c +1 -1
index 9d11b847e6ef..c136bd449744 100644
@@ -1167,7 +1167,7 @@ static void
 amdgpu_ras_debugfs_create_ctrl_node(struct amdgpu_device *adev)
 			con->dir, &con->disable_ras_err_cnt_harvest);
 }
 
-void amdgpu_ras_debugfs_create(struct amdgpu_device *adev,
+static void amdgpu_ras_debugfs_create(struct amdgpu_device *adev,
 		struct ras_fs_if *head)
 {

struct amdgpu_ras *con = amdgpu_ras_get_context(adev); @@ -1189,7
+1189,6 @@ void amdgpu_ras_debugfs_create(struct amdgpu_device *adev,

void amdgpu_ras_debugfs_create_all(struct amdgpu_device *adev) { -#if
defined(CONFIG_DEBUG_FS)

drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c +1 -1
 	struct amdgpu_ras *con = amdgpu_ras_get_context(adev);
 	struct ras_manager *obj;
 	struct ras_fs_if fs_info;
@@ -1198,7 +1197,7 @@ void amdgpu_ras_debugfs_create_all(struct
 amdgpu_device *adev)
 	 * it won't be called in resume path, no need to check
 	 * suspend and gpu reset status
 	 */
-	if (!con)
+	if (!IS_ENABLED(CONFIG_DEBUG_FS) || !con)
 		return;
 
drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c +1 -2
 	amdgpu_ras_debugfs_create_ctrl_node(adev);
@@ -1212,10 +1211,9 @@ void amdgpu_ras_debugfs_create_all(struct
 amdgpu_device *adev)
 			amdgpu_ras_debugfs_create(adev, &fs_info);
 		}
 	}
-#endif
 }
 
-void amdgpu_ras_debugfs_remove(struct amdgpu_device *adev,
+static void amdgpu_ras_debugfs_remove(struct amdgpu_device *adev,
 		struct ras_common_if *head)
 {

struct ras_manager *obj = amdgpu_ras_find_obj(adev, head); @@ -
1229,7 +1227,6 @@ void amdgpu_ras_debugfs_remove(struct amdgpu_device *adev,

static void amdgpu_ras_debugfs_remove_all(struct amdgpu_device *adev) { -
#if defined(CONFIG_DEBUG_FS)

drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c +2 -2
 	struct amdgpu_ras *con = amdgpu_ras_get_context(adev);
 	struct ras_manager *obj, *tmp;
@@ -1238,7 +1235,6 @@ static void amdgpu_ras_debugfs_remove_all(struct
 amdgpu_device *adev)
 	}
 
 	con->dir = NULL;
-#endif
 }
 /* debugfs end */
@@ -1286,7 +1282,8 @@ static int amdgpu_ras_fs_init(struct amdgpu_device
 *adev)
 
 static int amdgpu_ras_fs_fini(struct amdgpu_device *adev)  {
-	amdgpu_ras_debugfs_remove_all(adev);
+	if (IS_ENABLED(CONFIG_DEBUG_FS))
+		amdgpu_ras_debugfs_remove_all(adev);
 	amdgpu_ras_sysfs_remove_all(adev);
 	return 0;
 }
drivers/gpu/drm/amd/amdgpu/amdgpu_ras.h +0 -7
index 4667cce38582..762f5e46c007 100644
@@ -592,14 +592,8 @@ int amdgpu_ras_sysfs_create(struct amdgpu_device
 *adev,  int amdgpu_ras_sysfs_remove(struct amdgpu_device *adev,
 		struct ras_common_if *head);
 
-void amdgpu_ras_debugfs_create(struct amdgpu_device *adev,
-		struct ras_fs_if *head);
-
 void amdgpu_ras_debugfs_create_all(struct amdgpu_device *adev);
 
-void amdgpu_ras_debugfs_remove(struct amdgpu_device *adev,
-		struct ras_common_if *head);
-
 int amdgpu_ras_error_query(struct amdgpu_device *adev,
 		struct ras_query_if *info);
 
--
Quoted 1 line

2.27.0

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

Applied
#2 lore raw
Quoted 4 lines · Tao

[AMD Public Use]

Applied. Thanks!

Alex

Quoted 128 lines
Quoted 128 lines

-----Original Message-----
From: Arnd Bergmann <[email protected]>
Sent: Friday, December 4, 2020 7:07 AM
To: Deucher, Alexander <[email protected]>; Koenig, Christian <[email protected]>; David Airlie <[email protected]>; Daniel Vetter <[email protected]>; Li, Dennis <[email protected]>; Zhou1, Tao <[email protected]>; Chen, Guchun <[email protected]>
Cc: Arnd Bergmann <[email protected]>; Zhang, Hawking <[email protected]>; Clements, John <[email protected]>; Yang, Stanley <[email protected]>; Ma, Le <[email protected]>; amd- [email protected]; [email protected]; linux- [email protected]
Subject: [PATCH] drm/amdgpu: fix debugfs creation/removal, again

From: Arnd Bergmann <[email protected]>

There is still a warning when CONFIG_DEBUG_FS is disabled:

drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c:1145:13: error:
'amdgpu_ras_debugfs_create_ctrl_node' defined but not used [- Werror=unused-function]
1145 | static void amdgpu_ras_debugfs_create_ctrl_node(struct
amdgpu_device *adev)

Change the code again to make the compiler actually drop this code but not warn about it.

Fixes ae2bf61ff39e ("drm/amdgpu: guard ras debugfs creation/removal based

on CONFIG_DEBUG_FS")

---
 drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c | 13 +++++--------
drivers/gpu/drm/amd/amdgpu/amdgpu_ras.h |  6 ------
 2 files changed, 5 insertions(+), 14 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c +1 -1
index 9d11b847e6ef..c136bd449744 100644
@@ -1167,7 +1167,7 @@ static void
 amdgpu_ras_debugfs_create_ctrl_node(struct amdgpu_device *adev)
                      con->dir, &con->disable_ras_err_cnt_harvest);
 }
 
-void amdgpu_ras_debugfs_create(struct amdgpu_device *adev,
+static void amdgpu_ras_debugfs_create(struct amdgpu_device *adev,
              struct ras_fs_if *head)
 {
      struct amdgpu_ras *con = amdgpu_ras_get_context(adev); @@ -1189,7

+1189,6 @@ void amdgpu_ras_debugfs_create(struct amdgpu_device *adev,

void amdgpu_ras_debugfs_create_all(struct amdgpu_device *adev) { -#if
defined(CONFIG_DEBUG_FS)

      struct amdgpu_ras *con = amdgpu_ras_get_context(adev);
      struct ras_manager *obj;
      struct ras_fs_if fs_info;
drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c +1 -1
@@ -1198,7 +1197,7 @@ void amdgpu_ras_debugfs_create_all(struct
 amdgpu_device *adev)
       * it won't be called in resume path, no need to check
       * suspend and gpu reset status
       */
-     if (!con)
+     if (!IS_ENABLED(CONFIG_DEBUG_FS) || !con)
              return;
 
      amdgpu_ras_debugfs_create_ctrl_node(adev);
drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c +1 -2
@@ -1212,10 +1211,9 @@ void amdgpu_ras_debugfs_create_all(struct
 amdgpu_device *adev)
                      amdgpu_ras_debugfs_create(adev, &fs_info);
              }
      }
-#endif
 }
 
-void amdgpu_ras_debugfs_remove(struct amdgpu_device *adev,
+static void amdgpu_ras_debugfs_remove(struct amdgpu_device *adev,
              struct ras_common_if *head)
 {

struct ras_manager *obj = amdgpu_ras_find_obj(adev, head); @@ -
1229,7 +1227,6 @@ void amdgpu_ras_debugfs_remove(struct amdgpu_device *adev,

static void amdgpu_ras_debugfs_remove_all(struct amdgpu_device *adev) { -

#if defined(CONFIG_DEBUG_FS)
      struct amdgpu_ras *con = amdgpu_ras_get_context(adev);
      struct ras_manager *obj, *tmp;
drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c +2 -2
@@ -1238,7 +1235,6 @@ static void amdgpu_ras_debugfs_remove_all(struct
 amdgpu_device *adev)
      }
 
      con->dir = NULL;
-#endif
 }
 /* debugfs end */
@@ -1286,7 +1282,8 @@ static int amdgpu_ras_fs_init(struct amdgpu_device
 *adev)
 
 static int amdgpu_ras_fs_fini(struct amdgpu_device *adev)  {
-     amdgpu_ras_debugfs_remove_all(adev);
+     if (IS_ENABLED(CONFIG_DEBUG_FS))
+             amdgpu_ras_debugfs_remove_all(adev);
      amdgpu_ras_sysfs_remove_all(adev);
      return 0;
 }
drivers/gpu/drm/amd/amdgpu/amdgpu_ras.h +0 -6
index 4667cce38582..762f5e46c007 100644
@@ -592,14 +592,8 @@ int amdgpu_ras_sysfs_create(struct amdgpu_device
 *adev,  int amdgpu_ras_sysfs_remove(struct amdgpu_device *adev,
              struct ras_common_if *head);
 
-void amdgpu_ras_debugfs_create(struct amdgpu_device *adev,
-             struct ras_fs_if *head);
-
 void amdgpu_ras_debugfs_create_all(struct amdgpu_device *adev);
 
-void amdgpu_ras_debugfs_remove(struct amdgpu_device *adev,
-             struct ras_common_if *head);
-
 int amdgpu_ras_error_query(struct amdgpu_device *adev,
              struct ras_query_if *info);
 
Quoted 6 lines
Quoted 2 lines

--
2.27.0

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

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