summaryrefslogtreecommitdiffstats
path: root/target/linux/s3c24xx/patches-2.6.24/1297-glamo_fb-Cosmetic-cleanup.patch
blob: 04381dfbfb80a2482abca1755896cb4dcc22ed65 (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
From 3817f491a41455d4a97f5d86217520816c2b6111 Mon Sep 17 00:00:00 2001
From: Harald Welte <laforge@openmoko.org>
Date: Wed, 8 Oct 2008 21:35:56 +0100
Subject: [PATCH] glamo_fb: Cosmetic cleanup

Remove dead code and coding style fixes. Purely cosmetic.

Signed-off-by: Harald Welte <laforge@openmoko.org>
---
 drivers/mfd/glamo/glamo-fb.c |   78 +++++++++++------------------------------
 1 files changed, 21 insertions(+), 57 deletions(-)

diff --git a/drivers/mfd/glamo/glamo-fb.c b/drivers/mfd/glamo/glamo-fb.c
index 7feef32..aa901dd 100644
--- a/drivers/mfd/glamo/glamo-fb.c
+++ b/drivers/mfd/glamo/glamo-fb.c
@@ -1,6 +1,6 @@
 /* Smedia Glamo 336x/337x driver
  *
- * (C) 2007 by Openmoko, Inc.
+ * (C) 2007-2008 by Openmoko, Inc.
  * Author: Harald Welte <laforge@openmoko.org>
  * All rights reserved.
  *
@@ -237,11 +237,10 @@ enum orientation {
 };
 
 
-static void rotate_lcd(struct glamofb_handle *glamo,
-                       __u32 rotation)
+/* the caller has to enxure lock_cmd is held and we are in cmd mode */
+static void __rotate_lcd(struct glamofb_handle *glamo, __u32 rotation)
 {
 	int glamo_rot;
-/*	unsigned long flags; */
 
 	switch (rotation) {
 		case FB_ROTATE_UR:
@@ -261,14 +260,6 @@ static void rotate_lcd(struct glamofb_handle *glamo,
 			break;
 	}
 
-	/*
- 	 * ha ha we are only called when we are in cmd mode already
-	 * printk(KERN_ERR"rotate_lcd spin_lock_irqsave\n");
-	 * spin_lock_irqsave(&glamo->lock_cmd, flags);
-	 *
-	 * if (glamofb_cmd_mode(glamo, 1))
-	 *		goto out_unlock;
-	 */
 	reg_set_bit_mask(glamo,
 			 GLAMO_REG_LCD_WIDTH,
 			 GLAMO_LCD_ROT_MODE_MASK,
@@ -278,12 +269,6 @@ static void rotate_lcd(struct glamofb_handle *glamo,
 			 GLAMO_LCD_MODE1_ROTATE_EN,
 			 (glamo_rot != GLAMO_LCD_ROT_MODE_0)?
 				 GLAMO_LCD_MODE1_ROTATE_EN : 0);
-/*	glamofb_cmd_mode(glamo, 0);
-
-out_unlock:
-	printk(KERN_ERR"rotate_lcd spin_unlock_irqrestore\n");
-	spin_unlock_irqrestore(&glamo->lock_cmd, flags);
-*/
 }
 
 static enum orientation get_orientation(struct fb_var_screeninfo *var)
@@ -296,14 +281,17 @@ static enum orientation get_orientation(struct fb_var_screeninfo *var)
 
 static int will_orientation_change(struct fb_var_screeninfo *var)
 {
-	enum  orientation orient = get_orientation(var);
+	enum orientation orient = get_orientation(var);
+
 	switch (orient) {
 		case ORIENTATION_LANDSCAPE:
-			if (var->rotate == FB_ROTATE_UR || var->rotate == FB_ROTATE_UD)
+			if (var->rotate == FB_ROTATE_UR ||
+			    var->rotate == FB_ROTATE_UD)
 				return 1;
 			break;
 		case ORIENTATION_PORTRAIT:
-			if (var->rotate == FB_ROTATE_CW || var->rotate == FB_ROTATE_CCW)
+			if (var->rotate == FB_ROTATE_CW ||
+			    var->rotate == FB_ROTATE_CCW)
 				return 1;
 			break;
 	}
@@ -316,8 +304,6 @@ static void glamofb_update_lcd_controller(struct glamofb_handle *glamo,
 	int sync, bp, disp, fp, total, xres, yres, pitch, orientation_changing;
 	unsigned long flags;
 
-/*	GLAMO_LOG("enter: glamo:%#x, var:%#x\n", (unsigned)glamo, (unsigned)var);
-*/
 	if (!glamo || !var)
 		return;
 
@@ -333,27 +319,18 @@ static void glamofb_update_lcd_controller(struct glamofb_handle *glamo,
 
 	xres = var->xres;
 	yres = var->yres;
-/*	GLAMO_LOG("xres:%d, yres:%d, rotate:%d\n", xres, yres, var->rotate);
-*/
-	/*
-	 * figure out if orientation is going to change
-	 */
+
+	/* figure out if orientation is going to change */
 	orientation_changing = will_orientation_change(var);
-/*	GLAMO_LOG("orientation_changing:%d\n", orientation_changing);
-*/
-        /*
-         * adjust the pitch according to new orientation to come
-         */
+
+        /* adjust the pitch according to new orientation to come */
         if (orientation_changing) {
 		pitch = var->yres * var->bits_per_pixel / 8;
         } else {
 		pitch = var->xres * var->bits_per_pixel / 8;
         }
-/*	GLAMO_LOG("pitch:%d\n", pitch);
-*/
-	/*
-	 * set the awaiten LCD geometry
-	 */
+
+	/* set the awaiten LCD geometry */
 	reg_set_bit_mask(glamo,
 			 GLAMO_REG_LCD_WIDTH,
 			 GLAMO_LCD_WIDTH_MASK,
@@ -367,16 +344,10 @@ static void glamofb_update_lcd_controller(struct glamofb_handle *glamo,
 			 GLAMO_LCD_PITCH_MASK,
 			 pitch);
 
-/*	GLAMO_LOG("mark:\n");*/
-	/*
-	 * honour the rotation request
-	 */
-	rotate_lcd(glamo, var->rotate);
+	/* honour the rotation request */
+	__rotate_lcd(glamo, var->rotate);
 
-	/*
-	 * update the reported geometry
-	 * of the framebuffer.
-	 */
+	/* update the reported geometry of the framebuffer. */
 	if (orientation_changing) {
 		var->xres_virtual = var->xres = yres;
 		var->yres_virtual = var->yres = xres;
@@ -385,11 +356,7 @@ static void glamofb_update_lcd_controller(struct glamofb_handle *glamo,
 		var->yres_virtual = var->yres = yres;
 	}
 
-/*	GLAMO_LOG("reported res:(%d,%d)\n", var->xres, var->yres);
-*/
-	/*
-	 * update scannout timings
-	 */
+	/* update scannout timings */
 	sync = 0;
 	bp = sync + var->hsync_len;
 	disp = bp + var->left_margin;
@@ -407,8 +374,6 @@ static void glamofb_update_lcd_controller(struct glamofb_handle *glamo,
 	reg_set_bit_mask(glamo, GLAMO_REG_LCD_HORIZ_DISP_END,
 			 GLAMO_LCD_HV_RETR_DISP_END_MASK, fp);
 
-/*	GLAMO_LOG("mark:\n");
-*/
 	sync = 0;
 	bp = sync + var->vsync_len;
 	disp = bp + var->upper_margin;
@@ -426,10 +391,8 @@ static void glamofb_update_lcd_controller(struct glamofb_handle *glamo,
 	reg_set_bit_mask(glamo, GLAMO_REG_LCD_VERT_DISP_END,
 			 GLAMO_LCD_HV_RETR_DISP_END_MASK, fp);
 
-/*	GLAMO_LOG("mark:\n"); */
 	glamofb_cmd_mode(glamo, 0);
 
-/*	GLAMO_LOG("leave:\n"); */
 out_unlock:
 	spin_unlock_irqrestore(&glamo->lock_cmd, flags);
 }
@@ -461,7 +424,8 @@ static int glamofb_blank(int blank_mode, struct fb_info *info)
 	return 0;
 }
 
-static inline unsigned int chan_to_field(unsigned int chan, struct fb_bitfield *bf)
+static inline unsigned int chan_to_field(unsigned int chan,
+					 struct fb_bitfield *bf)
 {
 	chan &= 0xffff;
 	chan >>= 16 - bf->length;
-- 
1.5.6.5