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

@@ -33,6 +33,7 @@
#include "platform_gk20a.h"
#include "ioctl_as.h"
#include "ioctl_channel.h"
#include "ioctl.h"
#include "os_linux.h"
static u32 gk20a_as_translate_as_alloc_space_flags(struct gk20a *g, u32 flags)
@@ -308,7 +309,7 @@ int gk20a_as_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);
nvgpu_log_fn(g, " ");