Skip to content

Commit

Permalink
drm/amdgpu: Show vram vendor only if available
Browse files Browse the repository at this point in the history
Ony if vram vendor info is available, show in sysfs.

Signed-off-by: Lijo Lazar <lijo.lazar@amd.com>
Reviewed-by: Hawking Zhang <Hawking.Zhang@amd.com>
  • Loading branch information
Lijo Lazar committed Jan 24, 2024
1 parent dbaa6dd commit cf8e29e
Showing 1 changed file with 16 additions and 1 deletion.
17 changes: 16 additions & 1 deletion drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c
Original file line number Diff line number Diff line change
Expand Up @@ -216,9 +216,24 @@ static const struct attribute *amdgpu_vram_mgr_attributes[] = {
NULL
};

static umode_t amdgpu_vram_attrs_is_visible(struct kobject *kobj,
struct attribute *attr, int i)
{
struct device *dev = kobj_to_dev(kobj);
struct drm_device *ddev = dev_get_drvdata(dev);
struct amdgpu_device *adev = drm_to_adev(ddev);

if (attr == &dev_attr_mem_info_vram_vendor.attr &&
!adev->gmc.vram_vendor)
return 0;

return attr->mode;
}

#ifdef HAVE_PCI_DRIVER_DEV_GROUPS
const struct attribute_group amdgpu_vram_mgr_attr_group = {
.attrs = amdgpu_vram_mgr_attributes
.attrs = amdgpu_vram_mgr_attributes,
.is_visible = amdgpu_vram_attrs_is_visible
};
#endif

Expand Down

0 comments on commit cf8e29e

Please sign in to comment.