1 From d3075e61796e6748b238203d5c5c852a1a5727ea Mon Sep 17 00:00:00 2001
2 From: Dave Stevenson <dave.stevenson@raspberrypi.org>
3 Date: Tue, 2 Jul 2019 17:19:04 +0100
4 Subject: [PATCH 688/773] staging: vc-sm-cma: Fix the few remaining coding
7 Fix a few minor checkpatch complaints to make the driver clean
9 Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.org>
11 .../staging/vc04_services/vc-sm-cma/vc_sm.c | 6 +-
12 .../vc04_services/vc-sm-cma/vc_sm_cma_vchi.c | 128 +++++++++---------
13 2 files changed, 65 insertions(+), 69 deletions(-)
15 --- a/drivers/staging/vc04_services/vc-sm-cma/vc_sm.c
16 +++ b/drivers/staging/vc04_services/vc-sm-cma/vc_sm.c
17 @@ -325,7 +325,6 @@ static void vc_sm_release_resource(struc
18 buffer->cookie, buffer->dma_addr);
22 /* Free our buffer. Start by removing it from the list */
23 mutex_lock(&sm_state->map_lock);
24 list_del(&buffer->global_buffer_list);
25 @@ -1365,7 +1364,8 @@ static int vc_sm_cma_clean_invalid2(unsi
28 for (i = 0; i < ioparam.op_count; i++) {
29 - const struct vc_sm_cma_ioctl_clean_invalid_block * const op = block + i;
30 + const struct vc_sm_cma_ioctl_clean_invalid_block * const op =
33 if (op->invalidate_mode == VC_SM_CACHE_OP_NOP)
35 @@ -1637,8 +1637,6 @@ err_remove_misc_dev:
37 debugfs_remove_recursive(sm_state->dir_root);
38 vc_sm_cma_vchi_stop(&sm_state->sm_handle);
44 --- a/drivers/staging/vc04_services/vc-sm-cma/vc_sm_cma_vchi.c
45 +++ b/drivers/staging/vc04_services/vc-sm-cma/vc_sm_cma_vchi.c
46 @@ -188,79 +188,77 @@ static int vc_sm_cma_vchi_videocore_io(v
48 vchi_service_release(instance->vchi_handle[0]);
50 - if (!wait_for_completion_interruptible(&instance->io_cmplt)) {
51 - vchi_service_use(instance->vchi_handle[0]);
56 - * Get new command and move it to response list
58 - mutex_lock(&instance->lock);
59 - if (list_empty(&instance->cmd_list)) {
60 - /* no more commands to process */
61 - mutex_unlock(&instance->lock);
65 - list_first_entry(&instance->cmd_list,
66 - struct sm_cmd_rsp_blk,
68 - list_move(&cmd->head, &instance->rsp_list);
70 - mutex_unlock(&instance->lock);
72 - /* Send the command */
73 - status = bcm2835_vchi_msg_queue(
74 - instance->vchi_handle[0],
75 - cmd->msg, cmd->length);
77 - pr_err("%s: failed to queue message (%d)",
81 - /* If no reply is needed then we're done */
83 - mutex_lock(&instance->lock);
84 - list_del(&cmd->head);
85 - mutex_unlock(&instance->lock);
86 - vc_vchi_cmd_delete(instance, cmd);
91 - complete(&cmd->cmplt);
97 - while (!vchi_msg_peek(instance->vchi_handle[0],
98 - (void **)&reply, &reply_len,
100 - if (reply->trans_id & 0x80000000) {
101 - /* Async event or cmd from the VPU */
102 - if (instance->vpu_event)
103 - instance->vpu_event(
107 - vc_sm_cma_vchi_rx_ack(instance, cmd,
110 + if (wait_for_completion_interruptible(&instance->io_cmplt))
113 - vchi_msg_remove(instance->vchi_handle[0]);
115 + vchi_service_use(instance->vchi_handle[0]);
118 - /* Go through the dead list and free them */
121 + * Get new command and move it to response list
123 mutex_lock(&instance->lock);
124 - list_for_each_entry_safe(cmd, cmd_tmp,
125 - &instance->dead_list, head) {
126 + if (list_empty(&instance->cmd_list)) {
127 + /* no more commands to process */
128 + mutex_unlock(&instance->lock);
131 + cmd = list_first_entry(&instance->cmd_list,
132 + struct sm_cmd_rsp_blk, head);
133 + list_move(&cmd->head, &instance->rsp_list);
135 + mutex_unlock(&instance->lock);
137 + /* Send the command */
139 + bcm2835_vchi_msg_queue(instance->vchi_handle[0],
140 + cmd->msg, cmd->length);
142 + pr_err("%s: failed to queue message (%d)",
146 + /* If no reply is needed then we're done */
148 + mutex_lock(&instance->lock);
149 list_del(&cmd->head);
150 + mutex_unlock(&instance->lock);
151 vc_vchi_cmd_delete(instance, cmd);
154 - mutex_unlock(&instance->lock);
157 + complete(&cmd->cmplt);
163 + while (!vchi_msg_peek(instance->vchi_handle[0], (void **)&reply,
164 + &reply_len, VCHI_FLAGS_NONE)) {
165 + if (reply->trans_id & 0x80000000) {
166 + /* Async event or cmd from the VPU */
167 + if (instance->vpu_event)
168 + instance->vpu_event(instance, reply,
171 + vc_sm_cma_vchi_rx_ack(instance, cmd, reply,
175 + vchi_msg_remove(instance->vchi_handle[0]);
178 + /* Go through the dead list and free them */
179 + mutex_lock(&instance->lock);
180 + list_for_each_entry_safe(cmd, cmd_tmp, &instance->dead_list,
182 + list_del(&cmd->head);
183 + vc_vchi_cmd_delete(instance, cmd);
185 + mutex_unlock(&instance->lock);