mirror of
git://nv-tegra.nvidia.com/linux-nvgpu.git
synced 2025-12-22 09:12:24 +03:00
gpu: nvgpu: create symbolic link gpu.0 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 gpu.0 under /sys/devices/ as various tests and scripts expect it to be there. Bug 200665782 Change-Id: I807ce72fad94438f927df25e829082e771b72543 Signed-off-by: Sagar Kamble <skamble@nvidia.com> Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvgpu/+/2426544 Tested-by: mobile promotions <svcmobile_promotions@nvidia.com> Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
This commit is contained in:
committed by
Alex Waterman
parent
d003fa57df
commit
8cf5391330
@@ -17,6 +17,7 @@
|
||||
#include <linux/device.h>
|
||||
#include <linux/pm_runtime.h>
|
||||
#include <linux/fb.h>
|
||||
#include <linux/version.h>
|
||||
|
||||
#include <nvgpu/kmem.h>
|
||||
#include <nvgpu/nvhost.h>
|
||||
@@ -1109,6 +1110,13 @@ void nvgpu_remove_sysfs(struct device *dev)
|
||||
struct device *parent = container_of((kobj->parent),
|
||||
struct device, kobj);
|
||||
sysfs_remove_link(&parent->kobj, "gpu.0");
|
||||
|
||||
#if LINUX_VERSION_CODE > KERNEL_VERSION(4, 14, 0)
|
||||
kobj = &parent->kobj;
|
||||
parent = container_of((kobj->parent),
|
||||
struct device, kobj);
|
||||
sysfs_remove_link(&parent->kobj, "gpu.0");
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1161,6 +1169,19 @@ int nvgpu_create_sysfs(struct device *dev)
|
||||
struct device, kobj);
|
||||
error |= sysfs_create_link(&parent->kobj,
|
||||
&dev->kobj, "gpu.0");
|
||||
|
||||
#if LINUX_VERSION_CODE > KERNEL_VERSION(4, 14, 0)
|
||||
/*
|
||||
* Create symbolic link under /sys/devices/ as various tests
|
||||
* expect it to be there. Above sysfs_create_link creates
|
||||
* it under /sys/devices/platform/ from kernels after v4.14.
|
||||
*/
|
||||
kobj = &parent->kobj;
|
||||
parent = container_of((kobj->parent),
|
||||
struct device, kobj);
|
||||
error |= sysfs_create_link(&parent->kobj,
|
||||
&dev->kobj, "gpu.0");
|
||||
#endif
|
||||
}
|
||||
|
||||
if (error)
|
||||
|
||||
Reference in New Issue
Block a user