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>
This commit is contained in:
Terje Bergstrom
2017-04-06 10:36:30 -07:00
committed by mobile promotions
parent 71fc782914
commit 6022b4cf6b
3 changed files with 22 additions and 24 deletions

View File

@@ -25,6 +25,7 @@
#include <nvgpu/semaphore.h>
#include <nvgpu/timers.h>
#include <nvgpu/kmem.h>
#include <nvgpu/log.h>
#include "gk20a/gk20a.h"
#include "gk20a/debug_gk20a.h"
@@ -182,7 +183,6 @@ static int gk20a_channel_set_wdt_status(struct channel_gk20a *ch,
static int gk20a_init_error_notifier(struct channel_gk20a *ch,
struct nvgpu_set_error_notifier *args)
{
struct device *dev = dev_from_gk20a(ch->g);
struct dma_buf *dmabuf;
void *va;
u64 end = args->offset + sizeof(struct nvgpu_notification);
@@ -203,7 +203,7 @@ static int gk20a_init_error_notifier(struct channel_gk20a *ch,
if (end > dmabuf->size || end < sizeof(struct nvgpu_notification)) {
dma_buf_put(dmabuf);
gk20a_err(dev, "gk20a_init_error_notifier: invalid offset\n");
nvgpu_err(ch->g, "gk20a_init_error_notifier: invalid offset\n");
return -EINVAL;
}
@@ -255,7 +255,7 @@ int gk20a_channel_release(struct inode *inode, struct file *filp)
err = gk20a_busy(g);
if (err) {
gk20a_err(dev_from_gk20a(g), "failed to release a channel!");
nvgpu_err(g, "failed to release a channel!");
goto channel_release;
}
@@ -295,14 +295,14 @@ static int __gk20a_channel_open(struct gk20a *g,
err = gk20a_busy(g);
if (err) {
gk20a_err(dev_from_gk20a(g), "failed to power on, %d", err);
nvgpu_err(g, "failed to power on, %d", err);
goto fail_busy;
}
/* All the user space channel should be non privilege */
ch = gk20a_open_new_channel(g, runlist_id, false);
gk20a_idle(g);
if (!ch) {
gk20a_err(dev_from_gk20a(g),
nvgpu_err(g,
"failed to get f");
err = -ENOMEM;
goto fail_busy;
@@ -388,7 +388,6 @@ static int gk20a_channel_wait_semaphore(struct channel_gk20a *ch,
ulong id, u32 offset,
u32 payload, long timeout)
{
struct device *dev = ch->g->dev;
struct dma_buf *dmabuf;
void *data;
u32 *semaphore;
@@ -401,13 +400,13 @@ static int gk20a_channel_wait_semaphore(struct channel_gk20a *ch,
dmabuf = dma_buf_get(id);
if (IS_ERR(dmabuf)) {
gk20a_err(dev, "invalid notifier nvmap handle 0x%lx", id);
nvgpu_err(ch->g, "invalid notifier nvmap handle 0x%lx", id);
return -EINVAL;
}
data = dma_buf_kmap(dmabuf, offset >> PAGE_SHIFT);
if (!data) {
gk20a_err(dev, "failed to map notifier memory");
nvgpu_err(ch->g, "failed to map notifier memory");
ret = -EINVAL;
goto cleanup_put;
}
@@ -433,8 +432,8 @@ cleanup_put:
static int gk20a_channel_wait(struct channel_gk20a *ch,
struct nvgpu_wait_args *args)
{
struct device *d = dev_from_gk20a(ch->g);
struct dma_buf *dmabuf;
struct gk20a *g = ch->g;
struct notification *notif;
struct timespec tv;
u64 jiffies;
@@ -462,20 +461,20 @@ static int gk20a_channel_wait(struct channel_gk20a *ch,
dmabuf = dma_buf_get(id);
if (IS_ERR(dmabuf)) {
gk20a_err(d, "invalid notifier nvmap handle 0x%lx",
nvgpu_err(g, "invalid notifier nvmap handle 0x%lx",
id);
return -EINVAL;
}
if (end > dmabuf->size || end < sizeof(struct notification)) {
dma_buf_put(dmabuf);
gk20a_err(d, "invalid notifier offset\n");
nvgpu_err(g, "invalid notifier offset\n");
return -EINVAL;
}
notif = dma_buf_vmap(dmabuf);
if (!notif) {
gk20a_err(d, "failed to map notifier memory");
nvgpu_err(g, "failed to map notifier memory");
return -ENOMEM;
}
@@ -742,7 +741,7 @@ static int gk20a_channel_event_id_ctrl(struct channel_gk20a *ch,
break;
default:
gk20a_err(dev_from_gk20a(ch->g),
nvgpu_err(ch->g,
"unrecognized channel event id cmd: 0x%x",
args->cmd);
err = -EINVAL;

View File

@@ -23,6 +23,7 @@
#include <linux/anon_inodes.h>
#include <nvgpu/kmem.h>
#include <nvgpu/log.h>
#include "gk20a/gk20a.h"
#include "gk20a/tsg_gk20a.h"
@@ -188,8 +189,7 @@ static int gk20a_tsg_event_id_ctrl(struct gk20a *g, struct tsg_gk20a *tsg,
break;
default:
gk20a_err(dev_from_gk20a(tsg->g),
"unrecognized tsg event id cmd: 0x%x",
nvgpu_err(tsg->g, "unrecognized tsg event id cmd: 0x%x",
args->cmd);
err = -EINVAL;
break;
@@ -274,7 +274,7 @@ static int gk20a_tsg_ioctl_set_priority(struct gk20a *g,
err = gk20a_busy(g);
if (err) {
gk20a_err(dev_from_gk20a(g), "failed to power on gpu");
nvgpu_err(g, "failed to power on gpu");
goto done;
}
@@ -301,7 +301,7 @@ static int gk20a_tsg_ioctl_set_runlist_interleave(struct gk20a *g,
}
err = gk20a_busy(g);
if (err) {
gk20a_err(dev_from_gk20a(g), "failed to power on gpu");
nvgpu_err(g, "failed to power on gpu");
goto done;
}
@@ -328,7 +328,7 @@ static int gk20a_tsg_ioctl_set_timeslice(struct gk20a *g,
}
err = gk20a_busy(g);
if (err) {
gk20a_err(dev_from_gk20a(g), "failed to power on gpu");
nvgpu_err(g, "failed to power on gpu");
goto done;
}
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,
{
err = gk20a_busy(g);
if (err) {
gk20a_err(g->dev,
nvgpu_err(g,
"failed to host gk20a for ioctl cmd: 0x%x", cmd);
return err;
}
@@ -405,7 +405,7 @@ long nvgpu_ioctl_tsg_dev_ioctl(struct file *filp, unsigned int cmd,
{
err = gk20a_busy(g);
if (err) {
gk20a_err(g->dev,
nvgpu_err(g,
"failed to host gk20a for ioctl cmd: 0x%x", cmd);
return err;
}
@@ -418,7 +418,7 @@ long nvgpu_ioctl_tsg_dev_ioctl(struct file *filp, unsigned int cmd,
{
err = gk20a_busy(g);
if (err) {
gk20a_err(g->dev,
nvgpu_err(g,
"failed to host gk20a for ioctl cmd: 0x%x", cmd);
return err;
}
@@ -455,8 +455,7 @@ long nvgpu_ioctl_tsg_dev_ioctl(struct file *filp, unsigned int cmd,
}
default:
gk20a_err(dev_from_gk20a(g),
"unrecognized tsg gpu ioctl cmd: 0x%x",
nvgpu_err(g, "unrecognized tsg gpu ioctl cmd: 0x%x",
cmd);
err = -ENOTTY;
break;

View File

@@ -751,7 +751,7 @@ void nvgpu_kmem_fini(struct gk20a *g, int flags)
if (flags & NVGPU_KMEM_FINI_WARN) {
WARN(1, "Letting %d allocs leak!!\n", count);
} else if (flags & NVGPU_KMEM_FINI_BUG) {
gk20a_err(g->dev, "Letting %d allocs leak!!\n", count);
nvgpu_err(g, "Letting %d allocs leak!!\n", count);
BUG();
}
}