summaryrefslogtreecommitdiffstats
path: root/drivers/gpu/nvgpu/common/linux/ioctl_ctrl.c
diff options
context:
space:
mode:
authorTerje Bergstrom <tbergstrom@nvidia.com>2017-06-20 15:18:47 -0400
committermobile promotions <svcmobile_promotions@nvidia.com>2017-06-21 20:34:49 -0400
commit92c43deefca150854193c6720717d56b61989c23 (patch)
tree2dbfdcdb3a0809b80d4fc50e1d882326e54c7d17 /drivers/gpu/nvgpu/common/linux/ioctl_ctrl.c
parent2ffbdc50d884215ba043e8afd3c3bcbefd1e66f8 (diff)
gpu: nvgpu: Remove Linux devnode fields from gk20a
Move Linux devnode related fields to a new header file os_linux.h. The class structure is defined in module.c, so move its declaration to module.h. JIRA NVGPU-38 Change-Id: I5d8920169064f4289ff61004f7f81543a9aba221 Signed-off-by: Terje Bergstrom <tbergstrom@nvidia.com> Reviewed-on: http://git-master/r/1505927 Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com> Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
Diffstat (limited to 'drivers/gpu/nvgpu/common/linux/ioctl_ctrl.c')
-rw-r--r--drivers/gpu/nvgpu/common/linux/ioctl_ctrl.c14
1 files changed, 9 insertions, 5 deletions
diff --git a/drivers/gpu/nvgpu/common/linux/ioctl_ctrl.c b/drivers/gpu/nvgpu/common/linux/ioctl_ctrl.c
index caf8d309..5c5ac645 100644
--- a/drivers/gpu/nvgpu/common/linux/ioctl_ctrl.c
+++ b/drivers/gpu/nvgpu/common/linux/ioctl_ctrl.c
@@ -31,6 +31,7 @@
31#include "gk20a/gk20a.h" 31#include "gk20a/gk20a.h"
32#include "gk20a/platform_gk20a.h" 32#include "gk20a/platform_gk20a.h"
33#include "gk20a/fence_gk20a.h" 33#include "gk20a/fence_gk20a.h"
34#include "os_linux.h"
34 35
35#include <nvgpu/log.h> 36#include <nvgpu/log.h>
36 37
@@ -48,15 +49,16 @@ struct gk20a_ctrl_priv {
48 49
49int gk20a_ctrl_dev_open(struct inode *inode, struct file *filp) 50int gk20a_ctrl_dev_open(struct inode *inode, struct file *filp)
50{ 51{
52 struct nvgpu_os_linux *l;
51 struct gk20a *g; 53 struct gk20a *g;
52 struct gk20a_ctrl_priv *priv; 54 struct gk20a_ctrl_priv *priv;
53 int err = 0; 55 int err = 0;
54 56
55 gk20a_dbg_fn(""); 57 gk20a_dbg_fn("");
56 58
57 g = container_of(inode->i_cdev, 59 l = container_of(inode->i_cdev,
58 struct gk20a, ctrl.cdev); 60 struct nvgpu_os_linux, ctrl.cdev);
59 g = gk20a_get(g); 61 g = gk20a_get(&l->g);
60 if (!g) 62 if (!g)
61 return -ENODEV; 63 return -ENODEV;
62 64
@@ -199,6 +201,7 @@ static int gk20a_ctrl_alloc_as(
199 struct gk20a *g, 201 struct gk20a *g,
200 struct nvgpu_alloc_as_args *args) 202 struct nvgpu_alloc_as_args *args)
201{ 203{
204 struct nvgpu_os_linux *l = nvgpu_os_linux_from_gk20a(g);
202 struct gk20a_as_share *as_share; 205 struct gk20a_as_share *as_share;
203 int err; 206 int err;
204 int fd; 207 int fd;
@@ -212,7 +215,7 @@ static int gk20a_ctrl_alloc_as(
212 215
213 snprintf(name, sizeof(name), "nvhost-%s-fd%d", g->name, fd); 216 snprintf(name, sizeof(name), "nvhost-%s-fd%d", g->name, fd);
214 217
215 file = anon_inode_getfile(name, g->as_dev.cdev.ops, NULL, O_RDWR); 218 file = anon_inode_getfile(name, l->as_dev.cdev.ops, NULL, O_RDWR);
216 if (IS_ERR(file)) { 219 if (IS_ERR(file)) {
217 err = PTR_ERR(file); 220 err = PTR_ERR(file);
218 goto clean_up; 221 goto clean_up;
@@ -239,6 +242,7 @@ clean_up:
239static int gk20a_ctrl_open_tsg(struct gk20a *g, 242static int gk20a_ctrl_open_tsg(struct gk20a *g,
240 struct nvgpu_gpu_open_tsg_args *args) 243 struct nvgpu_gpu_open_tsg_args *args)
241{ 244{
245 struct nvgpu_os_linux *l = nvgpu_os_linux_from_gk20a(g);
242 int err; 246 int err;
243 int fd; 247 int fd;
244 struct file *file; 248 struct file *file;
@@ -251,7 +255,7 @@ static int gk20a_ctrl_open_tsg(struct gk20a *g,
251 255
252 snprintf(name, sizeof(name), "nvgpu-%s-tsg%d", g->name, fd); 256 snprintf(name, sizeof(name), "nvgpu-%s-tsg%d", g->name, fd);
253 257
254 file = anon_inode_getfile(name, g->tsg.cdev.ops, NULL, O_RDWR); 258 file = anon_inode_getfile(name, l->tsg.cdev.ops, NULL, O_RDWR);
255 if (IS_ERR(file)) { 259 if (IS_ERR(file)) {
256 err = PTR_ERR(file); 260 err = PTR_ERR(file);
257 goto clean_up; 261 goto clean_up;