Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>

authored by

Lijo Lazar and committed by
Alex Deucher
9c3f6e2c e0eb08dc

+16 -1
+16 -1
drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c
··· 221 221 NULL 222 222 }; 223 223 224 + static umode_t amdgpu_vram_attrs_is_visible(struct kobject *kobj, 225 + struct attribute *attr, int i) 226 + { 227 + struct device *dev = kobj_to_dev(kobj); 228 + struct drm_device *ddev = dev_get_drvdata(dev); 229 + struct amdgpu_device *adev = drm_to_adev(ddev); 230 + 231 + if (attr == &dev_attr_mem_info_vram_vendor.attr && 232 + !adev->gmc.vram_vendor) 233 + return 0; 234 + 235 + return attr->mode; 236 + } 237 + 224 238 const struct attribute_group amdgpu_vram_mgr_attr_group = { 225 - .attrs = amdgpu_vram_mgr_attributes 239 + .attrs = amdgpu_vram_mgr_attributes, 240 + .is_visible = amdgpu_vram_attrs_is_visible 226 241 }; 227 242 228 243 /**