diff options
author | Seshendra Gadagottu <sgadagottu@nvidia.com> | 2015-11-12 12:25:19 -0500 |
---|---|---|
committer | Terje Bergstrom <tbergstrom@nvidia.com> | 2016-03-23 10:50:29 -0400 |
commit | 2e0770fecce3eb3d921722238dd14f00617c81e2 (patch) | |
tree | 433314e8374aee8d74430aec95b06a0f10e6f697 /drivers/gpu | |
parent | 1c40d09c4c9c011c1318c328c0b4b6b17d1f537e (diff) |
gpu: nvgpu: create generic name for sysfs module
Make gpu sysfs name same across different chips.
If gpu device name is different from "gpu.0", then
create symlink with generic name under same parent.
Generic gpu syfs module path: /sys/devices/gpu.0
Bug 200161014
Change-Id: I9a7d5971c069d5a33f8e5c811d4578231f710878
Signed-off-by: Seshendra Gadagottu <sgadagottu@nvidia.com>
Reviewed-on: http://git-master/r/840742
Reviewed-by: Automatic_Commit_Validation_User
GVS: Gerrit_Virtual_Submit
Reviewed-by: Terje Bergstrom <tbergstrom@nvidia.com>
Diffstat (limited to 'drivers/gpu')
-rw-r--r-- | drivers/gpu/nvgpu/gk20a/gk20a_sysfs.c | 21 |
1 files changed, 18 insertions, 3 deletions
diff --git a/drivers/gpu/nvgpu/gk20a/gk20a_sysfs.c b/drivers/gpu/nvgpu/gk20a/gk20a_sysfs.c index aabe572b..ca8b8bea 100644 --- a/drivers/gpu/nvgpu/gk20a/gk20a_sysfs.c +++ b/drivers/gpu/nvgpu/gk20a/gk20a_sysfs.c | |||
@@ -30,7 +30,6 @@ | |||
30 | #include "fifo_gk20a.h" | 30 | #include "fifo_gk20a.h" |
31 | #include "pmu_gk20a.h" | 31 | #include "pmu_gk20a.h" |
32 | 32 | ||
33 | |||
34 | #define PTIMER_FP_FACTOR 1000000 | 33 | #define PTIMER_FP_FACTOR 1000000 |
35 | 34 | ||
36 | #define ROOTRW (S_IRWXU|S_IRGRP|S_IROTH) | 35 | #define ROOTRW (S_IRWXU|S_IRGRP|S_IROTH) |
@@ -787,8 +786,15 @@ void gk20a_remove_sysfs(struct device *dev) | |||
787 | device_remove_file(dev, &dev_attr_allow_all); | 786 | device_remove_file(dev, &dev_attr_allow_all); |
788 | device_remove_file(dev, &dev_attr_tpc_fs_mask); | 787 | device_remove_file(dev, &dev_attr_tpc_fs_mask); |
789 | 788 | ||
790 | if (g->host1x_dev && (dev->parent != &g->host1x_dev->dev)) | 789 | if (g->host1x_dev && (dev->parent != &g->host1x_dev->dev)) { |
791 | sysfs_remove_link(&g->host1x_dev->dev.kobj, dev_name(dev)); | 790 | sysfs_remove_link(&g->host1x_dev->dev.kobj, dev_name(dev)); |
791 | if (strcmp(dev_name(dev), "gpu.0")) { | ||
792 | struct kobject *kobj = &dev->kobj; | ||
793 | struct device *parent = container_of((kobj->parent), | ||
794 | struct device, kobj); | ||
795 | sysfs_remove_link(&parent->kobj, "gpu.0"); | ||
796 | } | ||
797 | } | ||
792 | } | 798 | } |
793 | 799 | ||
794 | void gk20a_create_sysfs(struct platform_device *dev) | 800 | void gk20a_create_sysfs(struct platform_device *dev) |
@@ -820,10 +826,19 @@ void gk20a_create_sysfs(struct platform_device *dev) | |||
820 | error |= device_create_file(&dev->dev, &dev_attr_allow_all); | 826 | error |= device_create_file(&dev->dev, &dev_attr_allow_all); |
821 | error |= device_create_file(&dev->dev, &dev_attr_tpc_fs_mask); | 827 | error |= device_create_file(&dev->dev, &dev_attr_tpc_fs_mask); |
822 | 828 | ||
823 | if (g->host1x_dev && (dev->dev.parent != &g->host1x_dev->dev)) | 829 | if (g->host1x_dev && (dev->dev.parent != &g->host1x_dev->dev)) { |
824 | error |= sysfs_create_link(&g->host1x_dev->dev.kobj, | 830 | error |= sysfs_create_link(&g->host1x_dev->dev.kobj, |
825 | &dev->dev.kobj, | 831 | &dev->dev.kobj, |
826 | dev_name(&dev->dev)); | 832 | dev_name(&dev->dev)); |
833 | if (strcmp(dev_name(&dev->dev), "gpu.0")) { | ||
834 | struct kobject *kobj = &dev->dev.kobj; | ||
835 | struct device *parent = container_of((kobj->parent), | ||
836 | struct device, kobj); | ||
837 | error |= sysfs_create_link(&parent->kobj, | ||
838 | &dev->dev.kobj, "gpu.0"); | ||
839 | } | ||
840 | |||
841 | } | ||
827 | 842 | ||
828 | if (error) | 843 | if (error) |
829 | dev_err(&dev->dev, "Failed to create sysfs attributes!\n"); | 844 | dev_err(&dev->dev, "Failed to create sysfs attributes!\n"); |