diff options
author | Ben Skeggs <bskeggs@redhat.com> | 2020-01-15 06:34:22 +1000 |
---|---|---|
committer | Ben Skeggs <bskeggs@redhat.com> | 2020-01-15 10:50:29 +1000 |
commit | 2d063981d710391cdea4e8c6483d94b519b1cde2 (patch) | |
tree | fdce3ceeedc915752c86cd6822352f3737a6fda1 /drivers/gpu/drm/nouveau | |
parent | 77b1ab61fd1c08c7364ee6e184887202995a71e4 (diff) | |
download | linux-2d063981d710391cdea4e8c6483d94b519b1cde2.tar.gz linux-2d063981d710391cdea4e8c6483d94b519b1cde2.tar.bz2 linux-2d063981d710391cdea4e8c6483d94b519b1cde2.zip |
drm/nouveau/flcn/msgq: drop nvkm_msgqueue argument to functions
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
Diffstat (limited to 'drivers/gpu/drm/nouveau')
-rw-r--r-- | drivers/gpu/drm/nouveau/nvkm/falcon/msgq.c | 45 |
1 files changed, 19 insertions, 26 deletions
diff --git a/drivers/gpu/drm/nouveau/nvkm/falcon/msgq.c b/drivers/gpu/drm/nouveau/nvkm/falcon/msgq.c index 7fdd81bf3858..1c7dab86af80 100644 --- a/drivers/gpu/drm/nouveau/nvkm/falcon/msgq.c +++ b/drivers/gpu/drm/nouveau/nvkm/falcon/msgq.c @@ -23,18 +23,16 @@ #include "qmgr.h" static void -msg_queue_open(struct nvkm_msgqueue *priv, struct nvkm_msgqueue_queue *queue) +msg_queue_open(struct nvkm_msgqueue_queue *queue) { - struct nvkm_falcon *falcon = priv->falcon; mutex_lock(&queue->mutex); - queue->position = nvkm_falcon_rd32(falcon, queue->tail_reg); + queue->position = nvkm_falcon_rd32(queue->qmgr->falcon, queue->tail_reg); } static void -msg_queue_close(struct nvkm_msgqueue *priv, struct nvkm_msgqueue_queue *queue, - bool commit) +msg_queue_close(struct nvkm_msgqueue_queue *queue, bool commit) { - struct nvkm_falcon *falcon = priv->falcon; + struct nvkm_falcon *falcon = queue->qmgr->falcon; if (commit) nvkm_falcon_wr32(falcon, queue->tail_reg, queue->position); @@ -43,19 +41,17 @@ msg_queue_close(struct nvkm_msgqueue *priv, struct nvkm_msgqueue_queue *queue, } static bool -msg_queue_empty(struct nvkm_msgqueue *priv, struct nvkm_msgqueue_queue *queue) +msg_queue_empty(struct nvkm_msgqueue_queue *queue) { - struct nvkm_falcon *falcon = priv->falcon; - u32 head = nvkm_falcon_rd32(falcon, queue->head_reg); - u32 tail = nvkm_falcon_rd32(falcon, queue->tail_reg); + u32 head = nvkm_falcon_rd32(queue->qmgr->falcon, queue->head_reg); + u32 tail = nvkm_falcon_rd32(queue->qmgr->falcon, queue->tail_reg); return head == tail; } static int -msg_queue_pop(struct nvkm_msgqueue *priv, struct nvkm_msgqueue_queue *queue, - void *data, u32 size) +msg_queue_pop(struct nvkm_msgqueue_queue *queue, void *data, u32 size) { - struct nvkm_falcon *falcon = priv->falcon; + struct nvkm_falcon *falcon = queue->qmgr->falcon; u32 head, tail, available; head = nvkm_falcon_rd32(falcon, queue->head_reg); @@ -72,23 +68,22 @@ msg_queue_pop(struct nvkm_msgqueue *priv, struct nvkm_msgqueue_queue *queue, return -EINVAL; } - nvkm_falcon_read_dmem(priv->falcon, tail, size, 0, data); + nvkm_falcon_read_dmem(falcon, tail, size, 0, data); queue->position += ALIGN(size, QUEUE_ALIGNMENT); return 0; } static int -msg_queue_read(struct nvkm_msgqueue *priv, struct nvkm_msgqueue_queue *queue, - struct nv_falcon_msg *hdr) +msg_queue_read(struct nvkm_msgqueue_queue *queue, struct nv_falcon_msg *hdr) { int ret = 0; - msg_queue_open(priv, queue); + msg_queue_open(queue); - if (msg_queue_empty(priv, queue)) + if (msg_queue_empty(queue)) goto close; - ret = msg_queue_pop(priv, queue, hdr, HDR_SIZE); + ret = msg_queue_pop(queue, hdr, HDR_SIZE); if (ret) { FLCNQ_ERR(queue, "failed to read message header"); goto close; @@ -103,7 +98,7 @@ msg_queue_read(struct nvkm_msgqueue *priv, struct nvkm_msgqueue_queue *queue, if (hdr->size > HDR_SIZE) { u32 read_size = hdr->size - HDR_SIZE; - ret = msg_queue_pop(priv, queue, (hdr + 1), read_size); + ret = msg_queue_pop(queue, (hdr + 1), read_size); if (ret) { FLCNQ_ERR(queue, "failed to read message data"); goto close; @@ -112,14 +107,12 @@ msg_queue_read(struct nvkm_msgqueue *priv, struct nvkm_msgqueue_queue *queue, ret = 1; close: - msg_queue_close(priv, queue, (ret >= 0)); + msg_queue_close(queue, (ret >= 0)); return ret; } static int -msgqueue_msg_handle(struct nvkm_msgqueue *priv, - struct nvkm_falcon_msgq *msgq, - struct nv_falcon_msg *hdr) +msgqueue_msg_handle(struct nvkm_falcon_msgq *msgq, struct nv_falcon_msg *hdr) { struct nvkm_falcon_qmgr_seq *seq; @@ -197,8 +190,8 @@ nvkm_msgqueue_process_msgs(struct nvkm_msgqueue *priv, if (!ret) priv->init_msg_received = true; } else { - while (msg_queue_read(priv, queue, hdr) > 0) - msgqueue_msg_handle(priv, queue, hdr); + while (msg_queue_read(queue, hdr) > 0) + msgqueue_msg_handle(queue, hdr); } } |