[PATCH 09/12] drm/amdgpu: define one macro for RAS's sysfs/debugfs name

Christian König christian.koenig at amd.com
Tue Jul 28 07:55:21 UTC 2020


Am 28.07.20 um 09:49 schrieb Guchun Chen:
> Add one definition for the RAS module's FS name. It's used
> in both debugfs and sysfs case.

Maybe better do this with a "static const char*".

Christian.

>
> Signed-off-by: Guchun Chen <guchun.chen at amd.com>
> ---
>   drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c | 13 ++++++++-----
>   1 file changed, 8 insertions(+), 5 deletions(-)
>
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c
> index 2cc09aa67423..c1ed0074a52b 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c
> @@ -34,6 +34,8 @@
>   #include "amdgpu_xgmi.h"
>   #include "ivsrcid/nbio/irqsrcs_nbif_7_4.h"
>   
> +#define AMDGPU_RAS_FS_NAME "ras"
> +
>   const char *ras_error_string[] = {
>   	"none",
>   	"parity",
> @@ -1037,7 +1039,7 @@ static int amdgpu_ras_sysfs_create_feature_node(struct amdgpu_device *adev)
>   		NULL
>   	};
>   	struct attribute_group group = {
> -		.name = "ras",
> +		.name = AMDGPU_RAS_FS_NAME,
>   		.attrs = attrs,
>   #if defined(HAVE_ATTRIBUTE_GROUP_BIN_ATTRS)
>   		.bin_attrs = bin_attrs,
> @@ -1080,7 +1082,7 @@ static int amdgpu_ras_sysfs_remove_feature_node(struct amdgpu_device *adev)
>   		NULL
>   	};
>   	struct attribute_group group = {
> -		.name = "ras",
> +		.name = AMDGPU_RAS_FS_NAME,
>   		.attrs = attrs,
>   #if defined(HAVE_ATTRIBUTE_GROUP_BIN_ATTRS)
>   		.bin_attrs = bin_attrs,
> @@ -1117,7 +1119,7 @@ int amdgpu_ras_sysfs_create(struct amdgpu_device *adev,
>   
>   	if (sysfs_add_file_to_group(&adev->dev->kobj,
>   				&obj->sysfs_attr.attr,
> -				"ras")) {
> +				AMDGPU_RAS_FS_NAME)) {
>   		put_obj(obj);
>   		return -EINVAL;
>   	}
> @@ -1137,7 +1139,7 @@ int amdgpu_ras_sysfs_remove(struct amdgpu_device *adev,
>   
>   	sysfs_remove_file_from_group(&adev->dev->kobj,
>   				&obj->sysfs_attr.attr,
> -				"ras");
> +				AMDGPU_RAS_FS_NAME);
>   	obj->attr_inuse = 0;
>   	put_obj(obj);
>   
> @@ -1183,7 +1185,8 @@ static void amdgpu_ras_debugfs_create_ctrl_node(struct amdgpu_device *adev)
>   	struct amdgpu_ras *con = amdgpu_ras_get_context(adev);
>   	struct drm_minor *minor = adev->ddev->primary;
>   
> -	con->dir = debugfs_create_dir("ras", minor->debugfs_root);
> +	con->dir = debugfs_create_dir(AMDGPU_RAS_FS_NAME,
> +					minor->debugfs_root);
>   	debugfs_create_file("ras_ctrl", S_IWUGO | S_IRUGO, con->dir,
>   				adev, &amdgpu_ras_debugfs_ctrl_ops);
>   	debugfs_create_file("ras_eeprom_reset", S_IWUGO | S_IRUGO, con->dir,



More information about the amd-gfx mailing list