aboutsummaryrefslogtreecommitdiffstats
path: root/target/linux/bcm27xx/patches-4.19/950-0599-staging-vc-sm-cma-Fix-the-few-remaining-coding-style.patch
blob: 6c61023cad1a28866c3cb4171c5afc2928e60d38 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
From 38ae4957840ff9578a497422a8ca758549f734d5 Mon Sep 17 00:00:00 2001
From: Dave Stevenson <dave.stevenson@raspberrypi.org>
Date: Tue, 2 Jul 2019 17:19:04 +0100
Subject: [PATCH] staging: vc-sm-cma: Fix the few remaining coding
 style issues

Fix a few minor checkpatch complaints to make the driver clean

Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.org>
---
 .../staging/vc04_services/vc-sm-cma/vc_sm.c   |   6 +-
 .../vc04_services/vc-sm-cma/vc_sm_cma_vchi.c  | 128 +++++++++---------
 2 files changed, 65 insertions(+), 69 deletions(-)

--- a/drivers/staging/vc04_services/vc-sm-cma/vc_sm.c
+++ b/drivers/staging/vc04_services/vc-sm-cma/vc_sm.c
@@ -325,7 +325,6 @@ static void vc_sm_release_resource(struc
 				  buffer->cookie, buffer->dma_addr);
 	}
 
-
 	/* Free our buffer. Start by removing it from the list */
 	mutex_lock(&sm_state->map_lock);
 	list_del(&buffer->global_buffer_list);
@@ -1365,7 +1364,8 @@ static int vc_sm_cma_clean_invalid2(unsi
 	}
 
 	for (i = 0; i < ioparam.op_count; i++) {
-		const struct vc_sm_cma_ioctl_clean_invalid_block * const op = block + i;
+		const struct vc_sm_cma_ioctl_clean_invalid_block * const op =
+								block + i;
 
 		if (op->invalidate_mode == VC_SM_CACHE_OP_NOP)
 			continue;
@@ -1637,8 +1637,6 @@ err_remove_misc_dev:
 err_remove_debugfs:
 	debugfs_remove_recursive(sm_state->dir_root);
 	vc_sm_cma_vchi_stop(&sm_state->sm_handle);
-
-	return;
 }
 
 /* Driver loading. */
--- a/drivers/staging/vc04_services/vc-sm-cma/vc_sm_cma_vchi.c
+++ b/drivers/staging/vc04_services/vc-sm-cma/vc_sm_cma_vchi.c
@@ -188,79 +188,77 @@ static int vc_sm_cma_vchi_videocore_io(v
 		if (svc_use)
 			vchi_service_release(instance->vchi_handle[0]);
 		svc_use = 0;
-		if (!wait_for_completion_interruptible(&instance->io_cmplt)) {
-			vchi_service_use(instance->vchi_handle[0]);
-			svc_use = 1;
-
-			do {
-				/*
-				 * Get new command and move it to response list
-				 */
-				mutex_lock(&instance->lock);
-				if (list_empty(&instance->cmd_list)) {
-					/* no more commands to process */
-					mutex_unlock(&instance->lock);
-					break;
-				}
-				cmd =
-				    list_first_entry(&instance->cmd_list,
-						     struct sm_cmd_rsp_blk,
-						     head);
-				list_move(&cmd->head, &instance->rsp_list);
-				cmd->sent = 1;
-				mutex_unlock(&instance->lock);
 
-				/* Send the command */
-				status = bcm2835_vchi_msg_queue(
-						instance->vchi_handle[0],
-						cmd->msg, cmd->length);
-				if (status) {
-					pr_err("%s: failed to queue message (%d)",
-					       __func__, status);
-				}
-
-				/* If no reply is needed then we're done */
-				if (!cmd->wait) {
-					mutex_lock(&instance->lock);
-					list_del(&cmd->head);
-					mutex_unlock(&instance->lock);
-					vc_vchi_cmd_delete(instance, cmd);
-					continue;
-				}
-
-				if (status) {
-					complete(&cmd->cmplt);
-					continue;
-				}
-
-			} while (1);
-
-			while (!vchi_msg_peek(instance->vchi_handle[0],
-					      (void **)&reply, &reply_len,
-					      VCHI_FLAGS_NONE)) {
-				if (reply->trans_id & 0x80000000) {
-					/* Async event or cmd from the VPU */
-					if (instance->vpu_event)
-						instance->vpu_event(
-							instance, reply,
-							reply_len);
-				} else {
-					vc_sm_cma_vchi_rx_ack(instance, cmd,
-							      reply, reply_len);
-				}
+		if (wait_for_completion_interruptible(&instance->io_cmplt))
+			continue;
 
-				vchi_msg_remove(instance->vchi_handle[0]);
-			}
+		vchi_service_use(instance->vchi_handle[0]);
+		svc_use = 1;
 
-			/* Go through the dead list and free them */
+		do {
+			/*
+			 * Get new command and move it to response list
+			 */
 			mutex_lock(&instance->lock);
-			list_for_each_entry_safe(cmd, cmd_tmp,
-						 &instance->dead_list, head) {
+			if (list_empty(&instance->cmd_list)) {
+				/* no more commands to process */
+				mutex_unlock(&instance->lock);
+				break;
+			}
+			cmd = list_first_entry(&instance->cmd_list,
+					       struct sm_cmd_rsp_blk, head);
+			list_move(&cmd->head, &instance->rsp_list);
+			cmd->sent = 1;
+			mutex_unlock(&instance->lock);
+
+			/* Send the command */
+			status =
+				bcm2835_vchi_msg_queue(instance->vchi_handle[0],
+						       cmd->msg, cmd->length);
+			if (status) {
+				pr_err("%s: failed to queue message (%d)",
+				       __func__, status);
+			}
+
+			/* If no reply is needed then we're done */
+			if (!cmd->wait) {
+				mutex_lock(&instance->lock);
 				list_del(&cmd->head);
+				mutex_unlock(&instance->lock);
 				vc_vchi_cmd_delete(instance, cmd);
+				continue;
 			}
-			mutex_unlock(&instance->lock);
+
+			if (status) {
+				complete(&cmd->cmplt);
+				continue;
+			}
+
+		} while (1);
+
+		while (!vchi_msg_peek(instance->vchi_handle[0], (void **)&reply,
+				      &reply_len, VCHI_FLAGS_NONE)) {
+			if (reply->trans_id & 0x80000000) {
+				/* Async event or cmd from the VPU */
+				if (instance->vpu_event)
+					instance->vpu_event(instance, reply,
+							    reply_len);
+			} else {
+				vc_sm_cma_vchi_rx_ack(instance, cmd, reply,
+						      reply_len);
+			}
+
+			vchi_msg_remove(instance->vchi_handle[0]);
+		}
+
+		/* Go through the dead list and free them */
+		mutex_lock(&instance->lock);
+		list_for_each_entry_safe(cmd, cmd_tmp, &instance->dead_list,
+					 head) {
+			list_del(&cmd->head);
+			vc_vchi_cmd_delete(instance, cmd);
 		}
+		mutex_unlock(&instance->lock);
 	}
 
 	return 0;