diff options
author | Terje Bergstrom <tbergstrom@nvidia.com> | 2017-04-06 13:36:30 -0400 |
---|---|---|
committer | mobile promotions <svcmobile_promotions@nvidia.com> | 2017-04-07 16:48:00 -0400 |
commit | 6022b4cf6b5ba9d63a5888c7bd944e4e1e11b604 (patch) | |
tree | 7d323bd0f17de44a24f6b215fb5ab8c8a3b52ccd /drivers | |
parent | 71fc7829149007437a56745e7f05d218c9ed27cc (diff) |
gpu: nvgpu: common: linux: Use new error macros
gk20a_err() and gk20a_warn() require a struct device pointer,
which is not portable across operating systems. The new nvgpu_err()
and nvgpu_warn() macros take struct gk20a pointer. Convert code
to use the more portable macros.
JIRA NVGPU-16
Change-Id: Ic5a48ca066712b14140909a34e639c1d2b99554b
Signed-off-by: Terje Bergstrom <tbergstrom@nvidia.com>
Reviewed-on: http://git-master/r/1457342
Reviewed-by: Automatic_Commit_Validation_User
Reviewed-by: Alex Waterman <alexw@nvidia.com>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/gpu/nvgpu/common/linux/ioctl_channel.c | 25 | ||||
-rw-r--r-- | drivers/gpu/nvgpu/common/linux/ioctl_tsg.c | 19 | ||||
-rw-r--r-- | drivers/gpu/nvgpu/common/linux/kmem.c | 2 |
3 files changed, 22 insertions, 24 deletions
diff --git a/drivers/gpu/nvgpu/common/linux/ioctl_channel.c b/drivers/gpu/nvgpu/common/linux/ioctl_channel.c index 0d7c05de..0e121aa7 100644 --- a/drivers/gpu/nvgpu/common/linux/ioctl_channel.c +++ b/drivers/gpu/nvgpu/common/linux/ioctl_channel.c | |||
@@ -25,6 +25,7 @@ | |||
25 | #include <nvgpu/semaphore.h> | 25 | #include <nvgpu/semaphore.h> |
26 | #include <nvgpu/timers.h> | 26 | #include <nvgpu/timers.h> |
27 | #include <nvgpu/kmem.h> | 27 | #include <nvgpu/kmem.h> |
28 | #include <nvgpu/log.h> | ||
28 | 29 | ||
29 | #include "gk20a/gk20a.h" | 30 | #include "gk20a/gk20a.h" |
30 | #include "gk20a/debug_gk20a.h" | 31 | #include "gk20a/debug_gk20a.h" |
@@ -182,7 +183,6 @@ static int gk20a_channel_set_wdt_status(struct channel_gk20a *ch, | |||
182 | static int gk20a_init_error_notifier(struct channel_gk20a *ch, | 183 | static int gk20a_init_error_notifier(struct channel_gk20a *ch, |
183 | struct nvgpu_set_error_notifier *args) | 184 | struct nvgpu_set_error_notifier *args) |
184 | { | 185 | { |
185 | struct device *dev = dev_from_gk20a(ch->g); | ||
186 | struct dma_buf *dmabuf; | 186 | struct dma_buf *dmabuf; |
187 | void *va; | 187 | void *va; |
188 | u64 end = args->offset + sizeof(struct nvgpu_notification); | 188 | u64 end = args->offset + sizeof(struct nvgpu_notification); |
@@ -203,7 +203,7 @@ static int gk20a_init_error_notifier(struct channel_gk20a *ch, | |||
203 | 203 | ||
204 | if (end > dmabuf->size || end < sizeof(struct nvgpu_notification)) { | 204 | if (end > dmabuf->size || end < sizeof(struct nvgpu_notification)) { |
205 | dma_buf_put(dmabuf); | 205 | dma_buf_put(dmabuf); |
206 | gk20a_err(dev, "gk20a_init_error_notifier: invalid offset\n"); | 206 | nvgpu_err(ch->g, "gk20a_init_error_notifier: invalid offset\n"); |
207 | return -EINVAL; | 207 | return -EINVAL; |
208 | } | 208 | } |
209 | 209 | ||
@@ -255,7 +255,7 @@ int gk20a_channel_release(struct inode *inode, struct file *filp) | |||
255 | 255 | ||
256 | err = gk20a_busy(g); | 256 | err = gk20a_busy(g); |
257 | if (err) { | 257 | if (err) { |
258 | gk20a_err(dev_from_gk20a(g), "failed to release a channel!"); | 258 | nvgpu_err(g, "failed to release a channel!"); |
259 | goto channel_release; | 259 | goto channel_release; |
260 | } | 260 | } |
261 | 261 | ||
@@ -295,14 +295,14 @@ static int __gk20a_channel_open(struct gk20a *g, | |||
295 | 295 | ||
296 | err = gk20a_busy(g); | 296 | err = gk20a_busy(g); |
297 | if (err) { | 297 | if (err) { |
298 | gk20a_err(dev_from_gk20a(g), "failed to power on, %d", err); | 298 | nvgpu_err(g, "failed to power on, %d", err); |
299 | goto fail_busy; | 299 | goto fail_busy; |
300 | } | 300 | } |
301 | /* All the user space channel should be non privilege */ | 301 | /* All the user space channel should be non privilege */ |
302 | ch = gk20a_open_new_channel(g, runlist_id, false); | 302 | ch = gk20a_open_new_channel(g, runlist_id, false); |
303 | gk20a_idle(g); | 303 | gk20a_idle(g); |
304 | if (!ch) { | 304 | if (!ch) { |
305 | gk20a_err(dev_from_gk20a(g), | 305 | nvgpu_err(g, |
306 | "failed to get f"); | 306 | "failed to get f"); |
307 | err = -ENOMEM; | 307 | err = -ENOMEM; |
308 | goto fail_busy; | 308 | goto fail_busy; |
@@ -388,7 +388,6 @@ static int gk20a_channel_wait_semaphore(struct channel_gk20a *ch, | |||
388 | ulong id, u32 offset, | 388 | ulong id, u32 offset, |
389 | u32 payload, long timeout) | 389 | u32 payload, long timeout) |
390 | { | 390 | { |
391 | struct device *dev = ch->g->dev; | ||
392 | struct dma_buf *dmabuf; | 391 | struct dma_buf *dmabuf; |
393 | void *data; | 392 | void *data; |
394 | u32 *semaphore; | 393 | u32 *semaphore; |
@@ -401,13 +400,13 @@ static int gk20a_channel_wait_semaphore(struct channel_gk20a *ch, | |||
401 | 400 | ||
402 | dmabuf = dma_buf_get(id); | 401 | dmabuf = dma_buf_get(id); |
403 | if (IS_ERR(dmabuf)) { | 402 | if (IS_ERR(dmabuf)) { |
404 | gk20a_err(dev, "invalid notifier nvmap handle 0x%lx", id); | 403 | nvgpu_err(ch->g, "invalid notifier nvmap handle 0x%lx", id); |
405 | return -EINVAL; | 404 | return -EINVAL; |
406 | } | 405 | } |
407 | 406 | ||
408 | data = dma_buf_kmap(dmabuf, offset >> PAGE_SHIFT); | 407 | data = dma_buf_kmap(dmabuf, offset >> PAGE_SHIFT); |
409 | if (!data) { | 408 | if (!data) { |
410 | gk20a_err(dev, "failed to map notifier memory"); | 409 | nvgpu_err(ch->g, "failed to map notifier memory"); |
411 | ret = -EINVAL; | 410 | ret = -EINVAL; |
412 | goto cleanup_put; | 411 | goto cleanup_put; |
413 | } | 412 | } |
@@ -433,8 +432,8 @@ cleanup_put: | |||
433 | static int gk20a_channel_wait(struct channel_gk20a *ch, | 432 | static int gk20a_channel_wait(struct channel_gk20a *ch, |
434 | struct nvgpu_wait_args *args) | 433 | struct nvgpu_wait_args *args) |
435 | { | 434 | { |
436 | struct device *d = dev_from_gk20a(ch->g); | ||
437 | struct dma_buf *dmabuf; | 435 | struct dma_buf *dmabuf; |
436 | struct gk20a *g = ch->g; | ||
438 | struct notification *notif; | 437 | struct notification *notif; |
439 | struct timespec tv; | 438 | struct timespec tv; |
440 | u64 jiffies; | 439 | u64 jiffies; |
@@ -462,20 +461,20 @@ static int gk20a_channel_wait(struct channel_gk20a *ch, | |||
462 | 461 | ||
463 | dmabuf = dma_buf_get(id); | 462 | dmabuf = dma_buf_get(id); |
464 | if (IS_ERR(dmabuf)) { | 463 | if (IS_ERR(dmabuf)) { |
465 | gk20a_err(d, "invalid notifier nvmap handle 0x%lx", | 464 | nvgpu_err(g, "invalid notifier nvmap handle 0x%lx", |
466 | id); | 465 | id); |
467 | return -EINVAL; | 466 | return -EINVAL; |
468 | } | 467 | } |
469 | 468 | ||
470 | if (end > dmabuf->size || end < sizeof(struct notification)) { | 469 | if (end > dmabuf->size || end < sizeof(struct notification)) { |
471 | dma_buf_put(dmabuf); | 470 | dma_buf_put(dmabuf); |
472 | gk20a_err(d, "invalid notifier offset\n"); | 471 | nvgpu_err(g, "invalid notifier offset\n"); |
473 | return -EINVAL; | 472 | return -EINVAL; |
474 | } | 473 | } |
475 | 474 | ||
476 | notif = dma_buf_vmap(dmabuf); | 475 | notif = dma_buf_vmap(dmabuf); |
477 | if (!notif) { | 476 | if (!notif) { |
478 | gk20a_err(d, "failed to map notifier memory"); | 477 | nvgpu_err(g, "failed to map notifier memory"); |
479 | return -ENOMEM; | 478 | return -ENOMEM; |
480 | } | 479 | } |
481 | 480 | ||
@@ -742,7 +741,7 @@ static int gk20a_channel_event_id_ctrl(struct channel_gk20a *ch, | |||
742 | break; | 741 | break; |
743 | 742 | ||
744 | default: | 743 | default: |
745 | gk20a_err(dev_from_gk20a(ch->g), | 744 | nvgpu_err(ch->g, |
746 | "unrecognized channel event id cmd: 0x%x", | 745 | "unrecognized channel event id cmd: 0x%x", |
747 | args->cmd); | 746 | args->cmd); |
748 | err = -EINVAL; | 747 | err = -EINVAL; |
diff --git a/drivers/gpu/nvgpu/common/linux/ioctl_tsg.c b/drivers/gpu/nvgpu/common/linux/ioctl_tsg.c index c98d9873..55a909dd 100644 --- a/drivers/gpu/nvgpu/common/linux/ioctl_tsg.c +++ b/drivers/gpu/nvgpu/common/linux/ioctl_tsg.c | |||
@@ -23,6 +23,7 @@ | |||
23 | #include <linux/anon_inodes.h> | 23 | #include <linux/anon_inodes.h> |
24 | 24 | ||
25 | #include <nvgpu/kmem.h> | 25 | #include <nvgpu/kmem.h> |
26 | #include <nvgpu/log.h> | ||
26 | 27 | ||
27 | #include "gk20a/gk20a.h" | 28 | #include "gk20a/gk20a.h" |
28 | #include "gk20a/tsg_gk20a.h" | 29 | #include "gk20a/tsg_gk20a.h" |
@@ -188,8 +189,7 @@ static int gk20a_tsg_event_id_ctrl(struct gk20a *g, struct tsg_gk20a *tsg, | |||
188 | break; | 189 | break; |
189 | 190 | ||
190 | default: | 191 | default: |
191 | gk20a_err(dev_from_gk20a(tsg->g), | 192 | nvgpu_err(tsg->g, "unrecognized tsg event id cmd: 0x%x", |
192 | "unrecognized tsg event id cmd: 0x%x", | ||
193 | args->cmd); | 193 | args->cmd); |
194 | err = -EINVAL; | 194 | err = -EINVAL; |
195 | break; | 195 | break; |
@@ -274,7 +274,7 @@ static int gk20a_tsg_ioctl_set_priority(struct gk20a *g, | |||
274 | 274 | ||
275 | err = gk20a_busy(g); | 275 | err = gk20a_busy(g); |
276 | if (err) { | 276 | if (err) { |
277 | gk20a_err(dev_from_gk20a(g), "failed to power on gpu"); | 277 | nvgpu_err(g, "failed to power on gpu"); |
278 | goto done; | 278 | goto done; |
279 | } | 279 | } |
280 | 280 | ||
@@ -301,7 +301,7 @@ static int gk20a_tsg_ioctl_set_runlist_interleave(struct gk20a *g, | |||
301 | } | 301 | } |
302 | err = gk20a_busy(g); | 302 | err = gk20a_busy(g); |
303 | if (err) { | 303 | if (err) { |
304 | gk20a_err(dev_from_gk20a(g), "failed to power on gpu"); | 304 | nvgpu_err(g, "failed to power on gpu"); |
305 | goto done; | 305 | goto done; |
306 | } | 306 | } |
307 | 307 | ||
@@ -328,7 +328,7 @@ static int gk20a_tsg_ioctl_set_timeslice(struct gk20a *g, | |||
328 | } | 328 | } |
329 | err = gk20a_busy(g); | 329 | err = gk20a_busy(g); |
330 | if (err) { | 330 | if (err) { |
331 | gk20a_err(dev_from_gk20a(g), "failed to power on gpu"); | 331 | nvgpu_err(g, "failed to power on gpu"); |
332 | goto done; | 332 | goto done; |
333 | } | 333 | } |
334 | err = gk20a_tsg_set_timeslice(tsg, arg->timeslice_us); | 334 | err = gk20a_tsg_set_timeslice(tsg, arg->timeslice_us); |
@@ -392,7 +392,7 @@ long nvgpu_ioctl_tsg_dev_ioctl(struct file *filp, unsigned int cmd, | |||
392 | { | 392 | { |
393 | err = gk20a_busy(g); | 393 | err = gk20a_busy(g); |
394 | if (err) { | 394 | if (err) { |
395 | gk20a_err(g->dev, | 395 | nvgpu_err(g, |
396 | "failed to host gk20a for ioctl cmd: 0x%x", cmd); | 396 | "failed to host gk20a for ioctl cmd: 0x%x", cmd); |
397 | return err; | 397 | return err; |
398 | } | 398 | } |
@@ -405,7 +405,7 @@ long nvgpu_ioctl_tsg_dev_ioctl(struct file *filp, unsigned int cmd, | |||
405 | { | 405 | { |
406 | err = gk20a_busy(g); | 406 | err = gk20a_busy(g); |
407 | if (err) { | 407 | if (err) { |
408 | gk20a_err(g->dev, | 408 | nvgpu_err(g, |
409 | "failed to host gk20a for ioctl cmd: 0x%x", cmd); | 409 | "failed to host gk20a for ioctl cmd: 0x%x", cmd); |
410 | return err; | 410 | return err; |
411 | } | 411 | } |
@@ -418,7 +418,7 @@ long nvgpu_ioctl_tsg_dev_ioctl(struct file *filp, unsigned int cmd, | |||
418 | { | 418 | { |
419 | err = gk20a_busy(g); | 419 | err = gk20a_busy(g); |
420 | if (err) { | 420 | if (err) { |
421 | gk20a_err(g->dev, | 421 | nvgpu_err(g, |
422 | "failed to host gk20a for ioctl cmd: 0x%x", cmd); | 422 | "failed to host gk20a for ioctl cmd: 0x%x", cmd); |
423 | return err; | 423 | return err; |
424 | } | 424 | } |
@@ -455,8 +455,7 @@ long nvgpu_ioctl_tsg_dev_ioctl(struct file *filp, unsigned int cmd, | |||
455 | } | 455 | } |
456 | 456 | ||
457 | default: | 457 | default: |
458 | gk20a_err(dev_from_gk20a(g), | 458 | nvgpu_err(g, "unrecognized tsg gpu ioctl cmd: 0x%x", |
459 | "unrecognized tsg gpu ioctl cmd: 0x%x", | ||
460 | cmd); | 459 | cmd); |
461 | err = -ENOTTY; | 460 | err = -ENOTTY; |
462 | break; | 461 | break; |
diff --git a/drivers/gpu/nvgpu/common/linux/kmem.c b/drivers/gpu/nvgpu/common/linux/kmem.c index 60e79348..86484888 100644 --- a/drivers/gpu/nvgpu/common/linux/kmem.c +++ b/drivers/gpu/nvgpu/common/linux/kmem.c | |||
@@ -751,7 +751,7 @@ void nvgpu_kmem_fini(struct gk20a *g, int flags) | |||
751 | if (flags & NVGPU_KMEM_FINI_WARN) { | 751 | if (flags & NVGPU_KMEM_FINI_WARN) { |
752 | WARN(1, "Letting %d allocs leak!!\n", count); | 752 | WARN(1, "Letting %d allocs leak!!\n", count); |
753 | } else if (flags & NVGPU_KMEM_FINI_BUG) { | 753 | } else if (flags & NVGPU_KMEM_FINI_BUG) { |
754 | gk20a_err(g->dev, "Letting %d allocs leak!!\n", count); | 754 | nvgpu_err(g, "Letting %d allocs leak!!\n", count); |
755 | BUG(); | 755 | BUG(); |
756 | } | 756 | } |
757 | } | 757 | } |