Skip to content

Commit cf8e29e

Browse files
author
Lijo Lazar
committed
drm/amdgpu: Show vram vendor only if available
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>
1 parent dbaa6dd commit cf8e29e

File tree

1 file changed

+16
-1
lines changed

1 file changed

+16
-1
lines changed

drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -216,9 +216,24 @@ static const struct attribute *amdgpu_vram_mgr_attributes[] = {
216216
NULL
217217
};
218218

219+
static umode_t amdgpu_vram_attrs_is_visible(struct kobject *kobj,
220+
struct attribute *attr, int i)
221+
{
222+
struct device *dev = kobj_to_dev(kobj);
223+
struct drm_device *ddev = dev_get_drvdata(dev);
224+
struct amdgpu_device *adev = drm_to_adev(ddev);
225+
226+
if (attr == &dev_attr_mem_info_vram_vendor.attr &&
227+
!adev->gmc.vram_vendor)
228+
return 0;
229+
230+
return attr->mode;
231+
}
232+
219233
#ifdef HAVE_PCI_DRIVER_DEV_GROUPS
220234
const struct attribute_group amdgpu_vram_mgr_attr_group = {
221-
.attrs = amdgpu_vram_mgr_attributes
235+
.attrs = amdgpu_vram_mgr_attributes,
236+
.is_visible = amdgpu_vram_attrs_is_visible
222237
};
223238
#endif
224239

0 commit comments

Comments
 (0)