aboutsummaryrefslogtreecommitdiffstats
path: root/target/linux/brcm2708/patches-4.19/950-0289-video-bcm2708_fb-Clean-up-coding-style-issues.patch
blob: 43bb8cee3a5719b9e045c36279421b55aeab5ac5 (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
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
From 47f7687efaf3873fe8c0e47653515e9ada1b86da Mon Sep 17 00:00:00 2001
From: Dave Stevenson <dave.stevenson@raspberrypi.org>
Date: Fri, 25 Jan 2019 17:32:54 +0000
Subject: [PATCH] video: bcm2708_fb: Clean up coding style issues

Now checkpatch clean except for 2 long lines, missing
SPDX header, and no DT documentation.

Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.org>
---
 drivers/video/fbdev/bcm2708_fb.c | 96 ++++++++++++++------------------
 1 file changed, 42 insertions(+), 54 deletions(-)

--- a/drivers/video/fbdev/bcm2708_fb.c
+++ b/drivers/video/fbdev/bcm2708_fb.c
@@ -41,7 +41,7 @@
 #define MODULE_NAME "bcm2708_fb"
 
 #ifdef BCM2708_FB_DEBUG
-#define print_debug(fmt, ...) pr_debug("%s:%s:%d: "fmt, \
+#define print_debug(fmt, ...) pr_debug("%s:%s:%d: " fmt, \
 			MODULE_NAME, __func__, __LINE__, ##__VA_ARGS__)
 #else
 #define print_debug(fmt, ...)
@@ -57,7 +57,7 @@ static int fbheight = 480;	/* module par
 static int fbdepth = 32;	/* module parameter */
 static int fbswap;		/* module parameter */
 
-static u32 dma_busy_wait_threshold = 1<<15;
+static u32 dma_busy_wait_threshold = 1 << 15;
 module_param(dma_busy_wait_threshold, int, 0644);
 MODULE_PARM_DESC(dma_busy_wait_threshold, "Busy-wait for DMA completion below this area");
 
@@ -132,8 +132,8 @@ static int bcm2708_fb_debugfs_init(struc
 	fb->stats.regset.nregs = ARRAY_SIZE(stats_registers);
 	fb->stats.regset.base = &fb->stats;
 
-	if (!debugfs_create_regset32(
-		"stats", 0444, fb->debugfs_dir, &fb->stats.regset)) {
+	if (!debugfs_create_regset32("stats", 0444, fb->debugfs_dir,
+				     &fb->stats.regset)) {
 		pr_warn("%s: could not create statistics registers\n",
 			__func__);
 		goto fail;
@@ -223,25 +223,22 @@ static int bcm2708_fb_check_var(struct f
 {
 	/* info input, var output */
 	print_debug("%s(%p) %dx%d (%dx%d), %d, %d\n",
-		__func__,
-		info,
-		info->var.xres, info->var.yres, info->var.xres_virtual,
-		info->var.yres_virtual, (int)info->screen_size,
-		info->var.bits_per_pixel);
-	print_debug("%s(%p) %dx%d (%dx%d), %d\n", __func__, var,
-		var->xres, var->yres, var->xres_virtual, var->yres_virtual,
-		var->bits_per_pixel);
+		    __func__, info, info->var.xres, info->var.yres,
+		    info->var.xres_virtual, info->var.yres_virtual,
+		    (int)info->screen_size, info->var.bits_per_pixel);
+	print_debug("%s(%p) %dx%d (%dx%d), %d\n", __func__, var, var->xres,
+		    var->yres, var->xres_virtual, var->yres_virtual,
+		    var->bits_per_pixel);
 
 	if (!var->bits_per_pixel)
 		var->bits_per_pixel = 16;
 
 	if (bcm2708_fb_set_bitfields(var) != 0) {
 		pr_err("%s: invalid bits_per_pixel %d\n", __func__,
-		     var->bits_per_pixel);
+		       var->bits_per_pixel);
 		return -EINVAL;
 	}
 
-
 	if (var->xres_virtual < var->xres)
 		var->xres_virtual = var->xres;
 	/* use highest possible virtual resolution */
@@ -249,7 +246,7 @@ static int bcm2708_fb_check_var(struct f
 		var->yres_virtual = 480;
 
 		pr_err("%s: virtual resolution set to maximum of %dx%d\n",
-		     __func__, var->xres_virtual, var->yres_virtual);
+		       __func__, var->xres_virtual, var->yres_virtual);
 	}
 	if (var->yres_virtual < var->yres)
 		var->yres_virtual = var->yres;
@@ -294,9 +291,9 @@ static int bcm2708_fb_set_par(struct fb_
 	int ret;
 
 	print_debug("%s(%p) %dx%d (%dx%d), %d, %d\n", __func__, info,
-		info->var.xres, info->var.yres, info->var.xres_virtual,
-		info->var.yres_virtual, (int)info->screen_size,
-		info->var.bits_per_pixel);
+		    info->var.xres, info->var.yres, info->var.xres_virtual,
+		    info->var.yres_virtual, (int)info->screen_size,
+		    info->var.bits_per_pixel);
 
 	ret = rpi_firmware_property_list(fb->fw, &fbinfo, sizeof(fbinfo));
 	if (ret) {
@@ -328,12 +325,10 @@ static int bcm2708_fb_set_par(struct fb_
 		return -ENOMEM;
 	}
 
-	print_debug(
-	  "%s: start = %p,%p width=%d, height=%d, bpp=%d, pitch=%d size=%d\n",
-	  __func__,
-	  (void *)fb->fb.screen_base, (void *)fb->fb_bus_address,
-	  fbinfo.xres, fbinfo.yres, fbinfo.bpp,
-	  fbinfo.pitch, (int)fb->fb.screen_size);
+	print_debug("%s: start = %p,%p width=%d, height=%d, bpp=%d, pitch=%d size=%d\n",
+		    __func__, (void *)fb->fb.screen_base,
+		    (void *)fb->fb_bus_address, fbinfo.xres, fbinfo.yres,
+		    fbinfo.bpp, fbinfo.pitch, (int)fb->fb.screen_size);
 
 	return 0;
 }
@@ -345,7 +340,6 @@ static inline u32 convert_bitfield(int v
 	return (val >> (16 - bf->length) & mask) << bf->offset;
 }
 
-
 static int bcm2708_fb_setcolreg(unsigned int regno, unsigned int red,
 				unsigned int green, unsigned int blue,
 				unsigned int transp, struct fb_info *info)
@@ -379,11 +373,11 @@ static int bcm2708_fb_setcolreg(unsigned
 			packet->offset = 0;
 			packet->length = regno + 1;
 			memcpy(packet->cmap, fb->gpu_cmap,
-				sizeof(packet->cmap));
+			       sizeof(packet->cmap));
 			ret = rpi_firmware_property(fb->fw,
-					RPI_FIRMWARE_FRAMEBUFFER_SET_PALETTE,
-					packet,
-					(2 + packet->length) * sizeof(u32));
+						    RPI_FIRMWARE_FRAMEBUFFER_SET_PALETTE,
+						    packet,
+						    (2 + packet->length) * sizeof(u32));
 			if (ret || packet->offset)
 				dev_err(info->device,
 					"Failed to set palette (%d,%u)\n",
@@ -392,9 +386,9 @@ static int bcm2708_fb_setcolreg(unsigned
 		}
 	} else if (regno < 16) {
 		fb->cmap[regno] = convert_bitfield(transp, &fb->fb.var.transp) |
-		convert_bitfield(blue, &fb->fb.var.blue) |
-		convert_bitfield(green, &fb->fb.var.green) |
-		convert_bitfield(red, &fb->fb.var.red);
+				  convert_bitfield(blue, &fb->fb.var.blue) |
+				  convert_bitfield(green, &fb->fb.var.green) |
+				  convert_bitfield(red, &fb->fb.var.red);
 	}
 	return regno > 255;
 }
@@ -437,8 +431,8 @@ static int bcm2708_fb_pan_display(struct
 	info->var.yoffset = var->yoffset;
 	result = bcm2708_fb_set_par(info);
 	if (result != 0)
-		pr_err("%s(%d,%d) returns=%d\n", __func__,
-			var->xoffset, var->yoffset, result);
+		pr_err("%s(%d,%d) returns=%d\n", __func__, var->xoffset,
+		       var->yoffset, result);
 	return result;
 }
 
@@ -468,9 +462,8 @@ static void dma_memcpy(struct bcm2708_fb
 		cb->info |= BCM2708_DMA_INT_EN;
 		bcm_dma_start(fb->dma_chan_base, fb->cb_handle);
 		while (bcm_dma_is_busy(dma_chan)) {
-			wait_event_interruptible(
-				fb->dma_waitq,
-				!bcm_dma_is_busy(dma_chan));
+			wait_event_interruptible(fb->dma_waitq,
+						 !bcm_dma_is_busy(dma_chan));
 		}
 		fb->stats.dma_irqs++;
 	}
@@ -478,9 +471,9 @@ static void dma_memcpy(struct bcm2708_fb
 }
 
 /* address with no aliases */
-#define INTALIAS_NORMAL(x) ((x)&~0xc0000000)
+#define INTALIAS_NORMAL(x) ((x) & ~0xc0000000)
 /* cache coherent but non-allocating in L1 and L2 */
-#define INTALIAS_L1L2_NONALLOCATING(x) (((x)&~0xc0000000)|0x80000000)
+#define INTALIAS_L1L2_NONALLOCATING(x) (((x) & ~0xc0000000) | 0x80000000)
 
 static long vc_mem_copy(struct bcm2708_fb *fb, struct fb_dmacopy *ioparam)
 {
@@ -498,15 +491,15 @@ static long vc_mem_copy(struct bcm2708_f
 
 	if (!fb->gpu.base || !fb->gpu.length) {
 		pr_err("[%s]: Unable to determine gpu memory (%x,%x)\n",
-			__func__, fb->gpu.base, fb->gpu.length);
+		       __func__, fb->gpu.base, fb->gpu.length);
 		return -EFAULT;
 	}
 
 	if (INTALIAS_NORMAL(ioparam->src) < fb->gpu.base ||
 	    INTALIAS_NORMAL(ioparam->src) >= fb->gpu.base + fb->gpu.length) {
 		pr_err("[%s]: Invalid memory access %x (%x-%x)", __func__,
-			INTALIAS_NORMAL(ioparam->src), fb->gpu.base,
-			fb->gpu.base + fb->gpu.length);
+		       INTALIAS_NORMAL(ioparam->src), fb->gpu.base,
+		       fb->gpu.base + fb->gpu.length);
 		return -EFAULT;
 	}
 
@@ -528,8 +521,7 @@ static long vc_mem_copy(struct bcm2708_f
 		dma_memcpy(fb, bus_addr,
 			   INTALIAS_L1L2_NONALLOCATING((dma_addr_t)p), size);
 		if (copy_to_user(q, buf, s) != 0) {
-			pr_err("[%s]: failed to copy-to-user\n",
-					__func__);
+			pr_err("[%s]: failed to copy-to-user\n", __func__);
 			rc = -EFAULT;
 			goto out;
 		}
@@ -755,7 +747,6 @@ static void bcm2708_fb_copyarea(struct f
 	/* end of dma control blocks chain */
 	cb->next = 0;
 
-
 	if (pixels < dma_busy_wait_threshold) {
 		bcm_dma_start(fb->dma_chan_base, fb->cb_handle);
 		bcm_dma_wait_idle(fb->dma_chan_base);
@@ -765,9 +756,8 @@ static void bcm2708_fb_copyarea(struct f
 		cb->info |= BCM2708_DMA_INT_EN;
 		bcm_dma_start(fb->dma_chan_base, fb->cb_handle);
 		while (bcm_dma_is_busy(dma_chan)) {
-			wait_event_interruptible(
-				fb->dma_waitq,
-				!bcm_dma_is_busy(dma_chan));
+			wait_event_interruptible(fb->dma_waitq,
+						 !bcm_dma_is_busy(dma_chan));
 		}
 		fb->stats.dma_irqs++;
 	}
@@ -863,7 +853,7 @@ static int bcm2708_fb_register(struct bc
 		return ret;
 
 	print_debug("BCM2708FB: registering framebuffer (%dx%d@%d) (%d)\n",
-		fbwidth, fbheight, fbdepth, fbswap);
+		    fbwidth, fbheight, fbdepth, fbswap);
 
 	ret = register_framebuffer(&fb->fb);
 	print_debug("BCM2708FB: register framebuffer (%d)\n", ret);
@@ -893,7 +883,7 @@ static int bcm2708_fb_probe(struct platf
 	if (!fw)
 		return -EPROBE_DEFER;
 
-	fb = kzalloc(sizeof(struct bcm2708_fb), GFP_KERNEL);
+	fb = kzalloc(sizeof(*fb), GFP_KERNEL);
 	if (!fb) {
 		ret = -ENOMEM;
 		goto free_region;
@@ -927,7 +917,6 @@ static int bcm2708_fb_probe(struct platf
 		goto free_dma_chan;
 	}
 
-
 	pr_info("BCM2708FB: allocated DMA channel %d\n", fb->dma_chan);
 
 	fb->dev = dev;
@@ -936,9 +925,8 @@ static int bcm2708_fb_probe(struct platf
 	/* failure here isn't fatal, but we'll fail in vc_mem_copy if
 	 * fb->gpu is not valid
 	 */
-	rpi_firmware_property(fb->fw,
-				    RPI_FIRMWARE_GET_VC_MEMORY,
-				    &fb->gpu, sizeof(fb->gpu));
+	rpi_firmware_property(fb->fw, RPI_FIRMWARE_GET_VC_MEMORY, &fb->gpu,
+			      sizeof(fb->gpu));
 
 	ret = bcm2708_fb_register(fb);
 	if (ret == 0) {