summaryrefslogtreecommitdiffstats
path: root/drivers/gpu/nvgpu/gk20a/tsg_gk20a.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/gpu/nvgpu/gk20a/tsg_gk20a.c')
-rw-r--r--drivers/gpu/nvgpu/gk20a/tsg_gk20a.c27
1 files changed, 22 insertions, 5 deletions
diff --git a/drivers/gpu/nvgpu/gk20a/tsg_gk20a.c b/drivers/gpu/nvgpu/gk20a/tsg_gk20a.c
index 073ae680..3342e3b9 100644
--- a/drivers/gpu/nvgpu/gk20a/tsg_gk20a.c
+++ b/drivers/gpu/nvgpu/gk20a/tsg_gk20a.c
@@ -55,7 +55,13 @@ static bool gk20a_is_channel_active(struct gk20a *g, struct channel_gk20a *ch)
55static int gk20a_tsg_bind_channel(struct tsg_gk20a *tsg, int ch_fd) 55static int gk20a_tsg_bind_channel(struct tsg_gk20a *tsg, int ch_fd)
56{ 56{
57 struct file *f = fget(ch_fd); 57 struct file *f = fget(ch_fd);
58 struct channel_gk20a *ch = f->private_data; 58 struct channel_gk20a *ch;
59
60 gk20a_dbg_fn("");
61
62 ch = gk20a_get_channel_from_file(ch_fd);
63 if (!ch)
64 return -EINVAL;
59 65
60 /* check if channel is already bound to some TSG */ 66 /* check if channel is already bound to some TSG */
61 if (gk20a_is_channel_marked_as_tsg(ch)) { 67 if (gk20a_is_channel_marked_as_tsg(ch)) {
@@ -82,6 +88,7 @@ static int gk20a_tsg_bind_channel(struct tsg_gk20a *tsg, int ch_fd)
82 88
83 fput(f); 89 fput(f);
84 90
91 gk20a_dbg_fn("done");
85 return 0; 92 return 0;
86} 93}
87 94
@@ -144,14 +151,11 @@ static struct tsg_gk20a *acquire_unused_tsg(struct fifo_gk20a *f)
144 return tsg; 151 return tsg;
145} 152}
146 153
147int gk20a_tsg_dev_open(struct inode *inode, struct file *filp) 154int gk20a_tsg_open(struct gk20a *g, struct file *filp)
148{ 155{
149 struct tsg_gk20a *tsg; 156 struct tsg_gk20a *tsg;
150 struct gk20a *g;
151 struct device *dev; 157 struct device *dev;
152 158
153 g = container_of(inode->i_cdev,
154 struct gk20a, tsg.cdev);
155 dev = dev_from_gk20a(g); 159 dev = dev_from_gk20a(g);
156 160
157 gk20a_dbg(gpu_dbg_fn, "tsg: %s", dev_name(dev)); 161 gk20a_dbg(gpu_dbg_fn, "tsg: %s", dev_name(dev));
@@ -174,6 +178,19 @@ int gk20a_tsg_dev_open(struct inode *inode, struct file *filp)
174 return 0; 178 return 0;
175} 179}
176 180
181int gk20a_tsg_dev_open(struct inode *inode, struct file *filp)
182{
183 struct gk20a *g;
184 int ret;
185
186 g = container_of(inode->i_cdev,
187 struct gk20a, tsg.cdev);
188 gk20a_dbg_fn("");
189 ret = gk20a_tsg_open(g, filp);
190 gk20a_dbg_fn("done");
191 return ret;
192}
193
177static void gk20a_tsg_release(struct kref *ref) 194static void gk20a_tsg_release(struct kref *ref)
178{ 195{
179 struct tsg_gk20a *tsg = container_of(ref, struct tsg_gk20a, refcount); 196 struct tsg_gk20a *tsg = container_of(ref, struct tsg_gk20a, refcount);