From 5e5ac92aee7ce1dc8c15acd4fa91af285816cce2 Mon Sep 17 00:00:00 2001 From: Sagar Kamble Date: Thu, 15 Oct 2020 23:07:38 +0530 Subject: [PATCH] gpu: nvgpu: create symbolic link for gpu device under /sys/devices/ In linux kernel v4.14 and below gpu sysfs node is created under /sys/devices. In linux kernel v5.x it is created under /sys/devices/platform. Create symbolic link for the gpu device ("17000000.gv11b") under /sys/devices/ as various tests and scripts expect it to be there. Bug 200659872 Change-Id: I071177176d45c6c45d60cf9935dd33a6577dd11d Signed-off-by: Sagar Kamble Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvgpu/+/2428623 Reviewed-by: automaticguardword Reviewed-by: Deepak Nibade Reviewed-by: mobile promotions GVS: Gerrit_Virtual_Submit Tested-by: mobile promotions --- drivers/gpu/nvgpu/os/linux/sysfs.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/gpu/nvgpu/os/linux/sysfs.c b/drivers/gpu/nvgpu/os/linux/sysfs.c index f49229229..7173090d7 100644 --- a/drivers/gpu/nvgpu/os/linux/sysfs.c +++ b/drivers/gpu/nvgpu/os/linux/sysfs.c @@ -1116,6 +1116,7 @@ void nvgpu_remove_sysfs(struct device *dev) parent = container_of((kobj->parent), struct device, kobj); sysfs_remove_link(&parent->kobj, "gpu.0"); + sysfs_remove_link(&parent->kobj, dev_name(dev)); #endif } } @@ -1181,6 +1182,8 @@ int nvgpu_create_sysfs(struct device *dev) struct device, kobj); error |= sysfs_create_link(&parent->kobj, &dev->kobj, "gpu.0"); + error |= sysfs_create_link(&parent->kobj, + &dev->kobj, dev_name(dev)); #endif }