diff options
Diffstat (limited to 'drivers/gpu/nvgpu/common/linux/ioctl.c')
-rw-r--r-- | drivers/gpu/nvgpu/common/linux/ioctl.c | 74 |
1 files changed, 39 insertions, 35 deletions
diff --git a/drivers/gpu/nvgpu/common/linux/ioctl.c b/drivers/gpu/nvgpu/common/linux/ioctl.c index 5a2753a5..8262c326 100644 --- a/drivers/gpu/nvgpu/common/linux/ioctl.c +++ b/drivers/gpu/nvgpu/common/linux/ioctl.c | |||
@@ -28,6 +28,8 @@ | |||
28 | #include "ioctl_ctrl.h" | 28 | #include "ioctl_ctrl.h" |
29 | #include "ioctl_as.h" | 29 | #include "ioctl_as.h" |
30 | #include "ioctl_tsg.h" | 30 | #include "ioctl_tsg.h" |
31 | #include "module.h" | ||
32 | #include "os_linux.h" | ||
31 | 33 | ||
32 | #define GK20A_NUM_CDEVS 7 | 34 | #define GK20A_NUM_CDEVS 7 |
33 | 35 | ||
@@ -162,49 +164,50 @@ static int gk20a_create_device( | |||
162 | void gk20a_user_deinit(struct device *dev, struct class *class) | 164 | void gk20a_user_deinit(struct device *dev, struct class *class) |
163 | { | 165 | { |
164 | struct gk20a *g = gk20a_from_dev(dev); | 166 | struct gk20a *g = gk20a_from_dev(dev); |
167 | struct nvgpu_os_linux *l = nvgpu_os_linux_from_gk20a(g); | ||
165 | 168 | ||
166 | if (g->channel.node) { | 169 | if (l->channel.node) { |
167 | device_destroy(class, g->channel.cdev.dev); | 170 | device_destroy(class, l->channel.cdev.dev); |
168 | cdev_del(&g->channel.cdev); | 171 | cdev_del(&l->channel.cdev); |
169 | } | 172 | } |
170 | 173 | ||
171 | if (g->as_dev.node) { | 174 | if (l->as_dev.node) { |
172 | device_destroy(class, g->as_dev.cdev.dev); | 175 | device_destroy(class, l->as_dev.cdev.dev); |
173 | cdev_del(&g->as_dev.cdev); | 176 | cdev_del(&l->as_dev.cdev); |
174 | } | 177 | } |
175 | 178 | ||
176 | if (g->ctrl.node) { | 179 | if (l->ctrl.node) { |
177 | device_destroy(class, g->ctrl.cdev.dev); | 180 | device_destroy(class, l->ctrl.cdev.dev); |
178 | cdev_del(&g->ctrl.cdev); | 181 | cdev_del(&l->ctrl.cdev); |
179 | } | 182 | } |
180 | 183 | ||
181 | if (g->dbg.node) { | 184 | if (l->dbg.node) { |
182 | device_destroy(class, g->dbg.cdev.dev); | 185 | device_destroy(class, l->dbg.cdev.dev); |
183 | cdev_del(&g->dbg.cdev); | 186 | cdev_del(&l->dbg.cdev); |
184 | } | 187 | } |
185 | 188 | ||
186 | if (g->prof.node) { | 189 | if (l->prof.node) { |
187 | device_destroy(class, g->prof.cdev.dev); | 190 | device_destroy(class, l->prof.cdev.dev); |
188 | cdev_del(&g->prof.cdev); | 191 | cdev_del(&l->prof.cdev); |
189 | } | 192 | } |
190 | 193 | ||
191 | if (g->tsg.node) { | 194 | if (l->tsg.node) { |
192 | device_destroy(class, g->tsg.cdev.dev); | 195 | device_destroy(class, l->tsg.cdev.dev); |
193 | cdev_del(&g->tsg.cdev); | 196 | cdev_del(&l->tsg.cdev); |
194 | } | 197 | } |
195 | 198 | ||
196 | if (g->ctxsw.node) { | 199 | if (l->ctxsw.node) { |
197 | device_destroy(class, g->ctxsw.cdev.dev); | 200 | device_destroy(class, l->ctxsw.cdev.dev); |
198 | cdev_del(&g->ctxsw.cdev); | 201 | cdev_del(&l->ctxsw.cdev); |
199 | } | 202 | } |
200 | 203 | ||
201 | if (g->sched.node) { | 204 | if (l->sched.node) { |
202 | device_destroy(class, g->sched.cdev.dev); | 205 | device_destroy(class, l->sched.cdev.dev); |
203 | cdev_del(&g->sched.cdev); | 206 | cdev_del(&l->sched.cdev); |
204 | } | 207 | } |
205 | 208 | ||
206 | if (g->cdev_region) | 209 | if (l->cdev_region) |
207 | unregister_chrdev_region(g->cdev_region, GK20A_NUM_CDEVS); | 210 | unregister_chrdev_region(l->cdev_region, GK20A_NUM_CDEVS); |
208 | } | 211 | } |
209 | 212 | ||
210 | int gk20a_user_init(struct device *dev, const char *interface_name, | 213 | int gk20a_user_init(struct device *dev, const char *interface_name, |
@@ -213,51 +216,52 @@ int gk20a_user_init(struct device *dev, const char *interface_name, | |||
213 | int err; | 216 | int err; |
214 | dev_t devno; | 217 | dev_t devno; |
215 | struct gk20a *g = gk20a_from_dev(dev); | 218 | struct gk20a *g = gk20a_from_dev(dev); |
219 | struct nvgpu_os_linux *l = nvgpu_os_linux_from_gk20a(g); | ||
216 | 220 | ||
217 | err = alloc_chrdev_region(&devno, 0, GK20A_NUM_CDEVS, dev_name(dev)); | 221 | err = alloc_chrdev_region(&devno, 0, GK20A_NUM_CDEVS, dev_name(dev)); |
218 | if (err) { | 222 | if (err) { |
219 | dev_err(dev, "failed to allocate devno\n"); | 223 | dev_err(dev, "failed to allocate devno\n"); |
220 | goto fail; | 224 | goto fail; |
221 | } | 225 | } |
222 | g->cdev_region = devno; | 226 | l->cdev_region = devno; |
223 | 227 | ||
224 | err = gk20a_create_device(dev, devno++, interface_name, "", | 228 | err = gk20a_create_device(dev, devno++, interface_name, "", |
225 | &g->channel.cdev, &g->channel.node, | 229 | &l->channel.cdev, &l->channel.node, |
226 | &gk20a_channel_ops, | 230 | &gk20a_channel_ops, |
227 | class); | 231 | class); |
228 | if (err) | 232 | if (err) |
229 | goto fail; | 233 | goto fail; |
230 | 234 | ||
231 | err = gk20a_create_device(dev, devno++, interface_name, "-as", | 235 | err = gk20a_create_device(dev, devno++, interface_name, "-as", |
232 | &g->as_dev.cdev, &g->as_dev.node, | 236 | &l->as_dev.cdev, &l->as_dev.node, |
233 | &gk20a_as_ops, | 237 | &gk20a_as_ops, |
234 | class); | 238 | class); |
235 | if (err) | 239 | if (err) |
236 | goto fail; | 240 | goto fail; |
237 | 241 | ||
238 | err = gk20a_create_device(dev, devno++, interface_name, "-ctrl", | 242 | err = gk20a_create_device(dev, devno++, interface_name, "-ctrl", |
239 | &g->ctrl.cdev, &g->ctrl.node, | 243 | &l->ctrl.cdev, &l->ctrl.node, |
240 | &gk20a_ctrl_ops, | 244 | &gk20a_ctrl_ops, |
241 | class); | 245 | class); |
242 | if (err) | 246 | if (err) |
243 | goto fail; | 247 | goto fail; |
244 | 248 | ||
245 | err = gk20a_create_device(dev, devno++, interface_name, "-dbg", | 249 | err = gk20a_create_device(dev, devno++, interface_name, "-dbg", |
246 | &g->dbg.cdev, &g->dbg.node, | 250 | &l->dbg.cdev, &l->dbg.node, |
247 | &gk20a_dbg_ops, | 251 | &gk20a_dbg_ops, |
248 | class); | 252 | class); |
249 | if (err) | 253 | if (err) |
250 | goto fail; | 254 | goto fail; |
251 | 255 | ||
252 | err = gk20a_create_device(dev, devno++, interface_name, "-prof", | 256 | err = gk20a_create_device(dev, devno++, interface_name, "-prof", |
253 | &g->prof.cdev, &g->prof.node, | 257 | &l->prof.cdev, &l->prof.node, |
254 | &gk20a_prof_ops, | 258 | &gk20a_prof_ops, |
255 | class); | 259 | class); |
256 | if (err) | 260 | if (err) |
257 | goto fail; | 261 | goto fail; |
258 | 262 | ||
259 | err = gk20a_create_device(dev, devno++, interface_name, "-tsg", | 263 | err = gk20a_create_device(dev, devno++, interface_name, "-tsg", |
260 | &g->tsg.cdev, &g->tsg.node, | 264 | &l->tsg.cdev, &l->tsg.node, |
261 | &gk20a_tsg_ops, | 265 | &gk20a_tsg_ops, |
262 | class); | 266 | class); |
263 | if (err) | 267 | if (err) |
@@ -265,7 +269,7 @@ int gk20a_user_init(struct device *dev, const char *interface_name, | |||
265 | 269 | ||
266 | #ifdef CONFIG_GK20A_CTXSW_TRACE | 270 | #ifdef CONFIG_GK20A_CTXSW_TRACE |
267 | err = gk20a_create_device(dev, devno++, interface_name, "-ctxsw", | 271 | err = gk20a_create_device(dev, devno++, interface_name, "-ctxsw", |
268 | &g->ctxsw.cdev, &g->ctxsw.node, | 272 | &l->ctxsw.cdev, &l->ctxsw.node, |
269 | &gk20a_ctxsw_ops, | 273 | &gk20a_ctxsw_ops, |
270 | class); | 274 | class); |
271 | if (err) | 275 | if (err) |
@@ -273,7 +277,7 @@ int gk20a_user_init(struct device *dev, const char *interface_name, | |||
273 | #endif | 277 | #endif |
274 | 278 | ||
275 | err = gk20a_create_device(dev, devno++, interface_name, "-sched", | 279 | err = gk20a_create_device(dev, devno++, interface_name, "-sched", |
276 | &g->sched.cdev, &g->sched.node, | 280 | &l->sched.cdev, &l->sched.node, |
277 | &gk20a_sched_ops, | 281 | &gk20a_sched_ops, |
278 | class); | 282 | class); |
279 | if (err) | 283 | if (err) |