gpu: nvgpu: add API to extract gk20a pointer from cdev

Add new API nvgpu_get_gk20a_from_cdev() that extracts gk20a pointer
from cdev pointer. This helps in keeping cdev related implementation
details in ioctl.c and away from other device ioctl files.

Also move struct nvgpu_cdev, nvgpu_class, and nvgpu_cdev_class_priv_data
from os_linux.h to ioctl.h since all of these structures are more IOCTL
related and better to keep them in ioctl specific header.

Jira NVGPU-5648

Change-Id: Ifad8454fd727ae2389ccf3d1ba492551ef1613ac
Signed-off-by: Deepak Nibade <dnibade@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvgpu/+/2435466
Reviewed-by: automaticguardword <automaticguardword@nvidia.com>
Reviewed-by: Lakshmanan M <lm@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
GVS: Gerrit_Virtual_Submit
This commit is contained in:
Deepak Nibade
2020-10-22 12:42:01 +05:30
committed by Alex Waterman
parent d0a1f30e66
commit be9271d721
11 changed files with 68 additions and 52 deletions

View File

@@ -32,6 +32,7 @@
#include "sched.h"
#include "os_linux.h"
#include "ioctl_tsg.h"
#include "ioctl.h"
ssize_t gk20a_sched_dev_read(struct file *filp, char __user *buf,
size_t size, loff_t *off)
@@ -394,7 +395,7 @@ int gk20a_sched_dev_open(struct inode *inode, struct file *filp)
struct nvgpu_cdev *cdev;
cdev = container_of(inode->i_cdev, struct nvgpu_cdev, cdev);
g = get_gk20a(cdev->node->parent);
g = nvgpu_get_gk20a_from_cdev(cdev);
g = nvgpu_get(g);
if (!g)