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/gpu/nvgpu/common/linux/ioctl_channel.c | |
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/gpu/nvgpu/common/linux/ioctl_channel.c')
-rw-r--r-- | drivers/gpu/nvgpu/common/linux/ioctl_channel.c | 25 |
1 files changed, 12 insertions, 13 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; |