6c61023cad1a28866c3cb4171c5afc2928e60d38
[openwrt/openwrt.git] / target / linux / bcm27xx / patches-4.19 / 950-0599-staging-vc-sm-cma-Fix-the-few-remaining-coding-style.patch
1 From 38ae4957840ff9578a497422a8ca758549f734d5 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] staging: vc-sm-cma: Fix the few remaining coding
5 style issues
6
7 Fix a few minor checkpatch complaints to make the driver clean
8
9 Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.org>
10 ---
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(-)
14
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);
19 }
20
21 -
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
26 }
27
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 =
31 + block + i;
32
33 if (op->invalidate_mode == VC_SM_CACHE_OP_NOP)
34 continue;
35 @@ -1637,8 +1637,6 @@ err_remove_misc_dev:
36 err_remove_debugfs:
37 debugfs_remove_recursive(sm_state->dir_root);
38 vc_sm_cma_vchi_stop(&sm_state->sm_handle);
39 -
40 - return;
41 }
42
43 /* Driver loading. */
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
47 if (svc_use)
48 vchi_service_release(instance->vchi_handle[0]);
49 svc_use = 0;
50 - if (!wait_for_completion_interruptible(&instance->io_cmplt)) {
51 - vchi_service_use(instance->vchi_handle[0]);
52 - svc_use = 1;
53 -
54 - do {
55 - /*
56 - * Get new command and move it to response list
57 - */
58 - mutex_lock(&instance->lock);
59 - if (list_empty(&instance->cmd_list)) {
60 - /* no more commands to process */
61 - mutex_unlock(&instance->lock);
62 - break;
63 - }
64 - cmd =
65 - list_first_entry(&instance->cmd_list,
66 - struct sm_cmd_rsp_blk,
67 - head);
68 - list_move(&cmd->head, &instance->rsp_list);
69 - cmd->sent = 1;
70 - mutex_unlock(&instance->lock);
71
72 - /* Send the command */
73 - status = bcm2835_vchi_msg_queue(
74 - instance->vchi_handle[0],
75 - cmd->msg, cmd->length);
76 - if (status) {
77 - pr_err("%s: failed to queue message (%d)",
78 - __func__, status);
79 - }
80 -
81 - /* If no reply is needed then we're done */
82 - if (!cmd->wait) {
83 - mutex_lock(&instance->lock);
84 - list_del(&cmd->head);
85 - mutex_unlock(&instance->lock);
86 - vc_vchi_cmd_delete(instance, cmd);
87 - continue;
88 - }
89 -
90 - if (status) {
91 - complete(&cmd->cmplt);
92 - continue;
93 - }
94 -
95 - } while (1);
96 -
97 - while (!vchi_msg_peek(instance->vchi_handle[0],
98 - (void **)&reply, &reply_len,
99 - VCHI_FLAGS_NONE)) {
100 - if (reply->trans_id & 0x80000000) {
101 - /* Async event or cmd from the VPU */
102 - if (instance->vpu_event)
103 - instance->vpu_event(
104 - instance, reply,
105 - reply_len);
106 - } else {
107 - vc_sm_cma_vchi_rx_ack(instance, cmd,
108 - reply, reply_len);
109 - }
110 + if (wait_for_completion_interruptible(&instance->io_cmplt))
111 + continue;
112
113 - vchi_msg_remove(instance->vchi_handle[0]);
114 - }
115 + vchi_service_use(instance->vchi_handle[0]);
116 + svc_use = 1;
117
118 - /* Go through the dead list and free them */
119 + do {
120 + /*
121 + * Get new command and move it to response list
122 + */
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);
129 + break;
130 + }
131 + cmd = list_first_entry(&instance->cmd_list,
132 + struct sm_cmd_rsp_blk, head);
133 + list_move(&cmd->head, &instance->rsp_list);
134 + cmd->sent = 1;
135 + mutex_unlock(&instance->lock);
136 +
137 + /* Send the command */
138 + status =
139 + bcm2835_vchi_msg_queue(instance->vchi_handle[0],
140 + cmd->msg, cmd->length);
141 + if (status) {
142 + pr_err("%s: failed to queue message (%d)",
143 + __func__, status);
144 + }
145 +
146 + /* If no reply is needed then we're done */
147 + if (!cmd->wait) {
148 + mutex_lock(&instance->lock);
149 list_del(&cmd->head);
150 + mutex_unlock(&instance->lock);
151 vc_vchi_cmd_delete(instance, cmd);
152 + continue;
153 }
154 - mutex_unlock(&instance->lock);
155 +
156 + if (status) {
157 + complete(&cmd->cmplt);
158 + continue;
159 + }
160 +
161 + } while (1);
162 +
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,
169 + reply_len);
170 + } else {
171 + vc_sm_cma_vchi_rx_ack(instance, cmd, reply,
172 + reply_len);
173 + }
174 +
175 + vchi_msg_remove(instance->vchi_handle[0]);
176 + }
177 +
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,
181 + head) {
182 + list_del(&cmd->head);
183 + vc_vchi_cmd_delete(instance, cmd);
184 }
185 + mutex_unlock(&instance->lock);
186 }
187
188 return 0;