* [PATCH] drm/amdgpu: fix debugfs creation/removal, again
@ 2020-12-03 23:06 Arnd Bergmann
2020-12-04 6:17 ` Zhou1, Tao
0 siblings, 1 reply; 3+ messages in thread
From: Arnd Bergmann @ 2020-12-03 23:06 UTC (permalink / raw)
To: Alex Deucher, Christian König, David Airlie, Daniel Vetter,
Dennis Li, Tao Zhou, Guchun Chen
Cc: Arnd Bergmann, Hawking Zhang, John Clements, Stanley.Yang, Le Ma,
amd-gfx, dri-devel, linux-kernel
From: Arnd Bergmann <arnd@arndb.de>
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")
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
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(-)
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c
index 9d11b847e6ef..c136bd449744 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c
@@ -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;
}
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_ras.h b/drivers/gpu/drm/amd/amdgpu/amdgpu_ras.h
index 4667cce38582..762f5e46c007 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_ras.h
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_ras.h
@@ -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);
--
2.27.0
^ permalink raw reply related [flat|nested] 3+ messages in thread
* RE: [PATCH] drm/amdgpu: fix debugfs creation/removal, again
2020-12-03 23:06 [PATCH] drm/amdgpu: fix debugfs creation/removal, again Arnd Bergmann
@ 2020-12-04 6:17 ` Zhou1, Tao
2020-12-04 20:48 ` Alex Deucher
0 siblings, 1 reply; 3+ messages in thread
From: Zhou1, Tao @ 2020-12-04 6:17 UTC (permalink / raw)
To: Arnd Bergmann, Deucher, Alexander, Koenig, Christian,
David Airlie, Daniel Vetter, Li, Dennis, Chen, Guchun
Cc: Arnd Bergmann, Zhang, Hawking, Clements, John, Yang, Stanley, Ma,
Le, amd-gfx, dri-devel, linux-kernel
[AMD Public Use]
Reviewed-by: Tao Zhou <tao.zhou1@amd.com>
> -----Original Message-----
> From: Arnd Bergmann <arnd@kernel.org>
> Sent: Friday, December 4, 2020 7:07 AM
> To: Deucher, Alexander <Alexander.Deucher@amd.com>; Koenig, Christian
> <Christian.Koenig@amd.com>; David Airlie <airlied@linux.ie>; Daniel Vetter
> <daniel@ffwll.ch>; Li, Dennis <Dennis.Li@amd.com>; Zhou1, Tao
> <Tao.Zhou1@amd.com>; Chen, Guchun <Guchun.Chen@amd.com>
> Cc: Arnd Bergmann <arnd@arndb.de>; Zhang, Hawking
> <Hawking.Zhang@amd.com>; Clements, John <John.Clements@amd.com>;
> Yang, Stanley <Stanley.Yang@amd.com>; Ma, Le <Le.Ma@amd.com>; amd-
> gfx@lists.freedesktop.org; dri-devel@lists.freedesktop.org; linux-
> kernel@vger.kernel.org
> Subject: [PATCH] drm/amdgpu: fix debugfs creation/removal, again
>
> From: Arnd Bergmann <arnd@arndb.de>
>
> 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")
> Signed-off-by: Arnd Bergmann <arnd@arndb.de>
> ---
> 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(-)
>
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c
> b/drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c
> index 9d11b847e6ef..c136bd449744 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c
> @@ -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;
> }
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_ras.h
> b/drivers/gpu/drm/amd/amdgpu/amdgpu_ras.h
> index 4667cce38582..762f5e46c007 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_ras.h
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_ras.h
> @@ -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);
>
> --
> 2.27.0
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] drm/amdgpu: fix debugfs creation/removal, again
2020-12-04 6:17 ` Zhou1, Tao
@ 2020-12-04 20:48 ` Alex Deucher
0 siblings, 0 replies; 3+ messages in thread
From: Alex Deucher @ 2020-12-04 20:48 UTC (permalink / raw)
To: Zhou1, Tao
Cc: Arnd Bergmann, Deucher, Alexander, Koenig, Christian,
David Airlie, Daniel Vetter, Li, Dennis, Chen, Guchun,
Arnd Bergmann, linux-kernel, amd-gfx, Ma, Le, Yang, Stanley,
dri-devel, Clements, John, Zhang, Hawking
On Fri, Dec 4, 2020 at 1:17 AM Zhou1, Tao <Tao.Zhou1@amd.com> wrote:
>
> [AMD Public Use]
>
> Reviewed-by: Tao Zhou <tao.zhou1@amd.com>
Applied. Thanks!
Alex
>
> > -----Original Message-----
> > From: Arnd Bergmann <arnd@kernel.org>
> > Sent: Friday, December 4, 2020 7:07 AM
> > To: Deucher, Alexander <Alexander.Deucher@amd.com>; Koenig, Christian
> > <Christian.Koenig@amd.com>; David Airlie <airlied@linux.ie>; Daniel Vetter
> > <daniel@ffwll.ch>; Li, Dennis <Dennis.Li@amd.com>; Zhou1, Tao
> > <Tao.Zhou1@amd.com>; Chen, Guchun <Guchun.Chen@amd.com>
> > Cc: Arnd Bergmann <arnd@arndb.de>; Zhang, Hawking
> > <Hawking.Zhang@amd.com>; Clements, John <John.Clements@amd.com>;
> > Yang, Stanley <Stanley.Yang@amd.com>; Ma, Le <Le.Ma@amd.com>; amd-
> > gfx@lists.freedesktop.org; dri-devel@lists.freedesktop.org; linux-
> > kernel@vger.kernel.org
> > Subject: [PATCH] drm/amdgpu: fix debugfs creation/removal, again
> >
> > From: Arnd Bergmann <arnd@arndb.de>
> >
> > 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")
> > Signed-off-by: Arnd Bergmann <arnd@arndb.de>
> > ---
> > 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(-)
> >
> > diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c
> > b/drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c
> > index 9d11b847e6ef..c136bd449744 100644
> > --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c
> > +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c
> > @@ -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;
> > }
> > diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_ras.h
> > b/drivers/gpu/drm/amd/amdgpu/amdgpu_ras.h
> > index 4667cce38582..762f5e46c007 100644
> > --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_ras.h
> > +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_ras.h
> > @@ -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);
> >
> > --
> > 2.27.0
> _______________________________________________
> dri-devel mailing list
> dri-devel@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/dri-devel
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2020-12-04 20:49 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-12-03 23:06 [PATCH] drm/amdgpu: fix debugfs creation/removal, again Arnd Bergmann
2020-12-04 6:17 ` Zhou1, Tao
2020-12-04 20:48 ` Alex Deucher
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).