From 92c43deefca150854193c6720717d56b61989c23 Mon Sep 17 00:00:00 2001 From: Terje Bergstrom Date: Tue, 20 Jun 2017 12:18:47 -0700 Subject: 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 Reviewed-on: http://git-master/r/1505927 Reviewed-by: mobile promotions Tested-by: mobile promotions --- drivers/gpu/nvgpu/gk20a/ctxsw_trace_gk20a.c | 6 ++-- drivers/gpu/nvgpu/gk20a/dbg_gpu_gk20a.c | 12 +++++--- drivers/gpu/nvgpu/gk20a/gk20a.h | 47 ----------------------------- drivers/gpu/nvgpu/gk20a/sched_gk20a.c | 8 +++-- 4 files changed, 16 insertions(+), 57 deletions(-) (limited to 'drivers/gpu/nvgpu/gk20a') diff --git a/drivers/gpu/nvgpu/gk20a/ctxsw_trace_gk20a.c b/drivers/gpu/nvgpu/gk20a/ctxsw_trace_gk20a.c index ceee1ae9..c189a00c 100644 --- a/drivers/gpu/nvgpu/gk20a/ctxsw_trace_gk20a.c +++ b/drivers/gpu/nvgpu/gk20a/ctxsw_trace_gk20a.c @@ -25,6 +25,7 @@ #include "gk20a.h" #include "platform_gk20a.h" #include "gr_gk20a.h" +#include "common/linux/os_linux.h" #include #include @@ -266,6 +267,7 @@ static int gk20a_ctxsw_dev_ioctl_poll(struct gk20a_ctxsw_dev *dev) int gk20a_ctxsw_dev_open(struct inode *inode, struct file *filp) { + struct nvgpu_os_linux *l; struct gk20a *g; struct gk20a_ctxsw_trace *trace; struct gk20a_ctxsw_dev *dev; @@ -276,8 +278,8 @@ int gk20a_ctxsw_dev_open(struct inode *inode, struct file *filp) /* only one VM for now */ const int vmid = 0; - g = container_of(inode->i_cdev, struct gk20a, ctxsw.cdev); - g = gk20a_get(g); + l = container_of(inode->i_cdev, struct nvgpu_os_linux, ctxsw.cdev); + g = gk20a_get(&l->g); if (!g) return -ENODEV; diff --git a/drivers/gpu/nvgpu/gk20a/dbg_gpu_gk20a.c b/drivers/gpu/nvgpu/gk20a/dbg_gpu_gk20a.c index 77890da8..84edacbb 100644 --- a/drivers/gpu/nvgpu/gk20a/dbg_gpu_gk20a.c +++ b/drivers/gpu/nvgpu/gk20a/dbg_gpu_gk20a.c @@ -32,6 +32,7 @@ #include "gr_gk20a.h" #include "dbg_gpu_gk20a.h" #include "regops_gk20a.h" +#include "common/linux/os_linux.h" #include #include @@ -115,6 +116,7 @@ static int alloc_profiler(struct gk20a *g, static int gk20a_dbg_gpu_do_dev_open(struct inode *inode, struct file *filp, bool is_profiler) { + struct nvgpu_os_linux *l; struct dbg_session_gk20a *dbg_session; struct gk20a *g; @@ -123,12 +125,12 @@ static int gk20a_dbg_gpu_do_dev_open(struct inode *inode, int err; if (!is_profiler) - g = container_of(inode->i_cdev, - struct gk20a, dbg.cdev); + l = container_of(inode->i_cdev, + struct nvgpu_os_linux, dbg.cdev); else - g = container_of(inode->i_cdev, - struct gk20a, prof.cdev); - g = gk20a_get(g); + l = container_of(inode->i_cdev, + struct nvgpu_os_linux, prof.cdev); + g = gk20a_get(&l->g); if (!g) return -ENODEV; diff --git a/drivers/gpu/nvgpu/gk20a/gk20a.h b/drivers/gpu/nvgpu/gk20a/gk20a.h index 5acc1074..cda70249 100644 --- a/drivers/gpu/nvgpu/gk20a/gk20a.h +++ b/drivers/gpu/nvgpu/gk20a/gk20a.h @@ -37,7 +37,6 @@ struct nvgpu_cpu_time_correlation_sample; #include #include -#include #ifdef CONFIG_DEBUG_FS #include #endif @@ -1157,53 +1156,11 @@ struct gk20a { struct nvgpu_gpu_characteristics gpu_characteristics; - struct { - struct cdev cdev; - struct device *node; - } channel; - struct gk20a_as as; - struct { - struct cdev cdev; - struct device *node; - } ctrl; - - struct { - struct cdev cdev; - struct device *node; - } as_dev; - - struct { - struct cdev cdev; - struct device *node; - } dbg; - - struct { - struct cdev cdev; - struct device *node; - } prof; - - struct { - struct cdev cdev; - struct device *node; - } tsg; - - struct { - struct cdev cdev; - struct device *node; - } ctxsw; - - struct { - struct cdev cdev; - struct device *node; - } sched; - struct nvgpu_mutex client_lock; int client_refcount; /* open channels and ctrl nodes */ - dev_t cdev_region; - struct gpu_ops ops; int irqs_enabled; @@ -1518,10 +1475,6 @@ static inline u32 scale_ptimer(u32 timeout , u32 scale10x) return (timeout * 10) / scale10x; } -extern struct class nvgpu_class; - -#define INTERFACE_NAME "nvhost%s-gpu" - int gk20a_prepare_poweroff(struct gk20a *g); int gk20a_finalize_poweron(struct gk20a *g); diff --git a/drivers/gpu/nvgpu/gk20a/sched_gk20a.c b/drivers/gpu/nvgpu/gk20a/sched_gk20a.c index 3f3119af..014848ba 100644 --- a/drivers/gpu/nvgpu/gk20a/sched_gk20a.c +++ b/drivers/gpu/nvgpu/gk20a/sched_gk20a.c @@ -25,6 +25,7 @@ #include "gk20a.h" #include "gr_gk20a.h" #include "sched_gk20a.h" +#include "common/linux/os_linux.h" #include #include @@ -370,12 +371,13 @@ static int gk20a_sched_dev_ioctl_put_tsg(struct gk20a_sched_ctrl *sched, int gk20a_sched_dev_open(struct inode *inode, struct file *filp) { - struct gk20a *g = container_of(inode->i_cdev, - struct gk20a, sched.cdev); + struct nvgpu_os_linux *l = container_of(inode->i_cdev, + struct nvgpu_os_linux, sched.cdev); + struct gk20a *g; struct gk20a_sched_ctrl *sched; int err = 0; - g = gk20a_get(g); + g = gk20a_get(&l->g); if (!g) return -ENODEV; sched = &g->sched_ctrl; -- cgit v1.2.2