diff options
author | Dave Airlie <airlied@starflyer.(none)> | 2005-09-25 00:28:13 -0400 |
---|---|---|
committer | Dave Airlie <airlied@linux.ie> | 2005-09-25 00:28:13 -0400 |
commit | b5e89ed53ed8d24f83ba1941c07382af00ed238e (patch) | |
tree | 747bae7a565f88a2e1d5974776eeb054a932c505 /drivers/char/drm/sis_ds.c | |
parent | 99a2657a29e2d623c3568cd86b27cac13fb63140 (diff) |
drm: lindent the drm directory.
I've been threatening this for a while, so no point hanging around.
This lindents the DRM code which was always really bad in tabbing department.
I've also fixed some misnamed files in comments and removed some trailing
whitespace.
Signed-off-by: Dave Airlie <airlied@linux.ie>
Diffstat (limited to 'drivers/char/drm/sis_ds.c')
-rw-r--r-- | drivers/char/drm/sis_ds.c | 82 |
1 files changed, 40 insertions, 42 deletions
diff --git a/drivers/char/drm/sis_ds.c b/drivers/char/drm/sis_ds.c index e37ed8ce48df..2e485d482943 100644 --- a/drivers/char/drm/sis_ds.c +++ b/drivers/char/drm/sis_ds.c | |||
@@ -10,11 +10,11 @@ | |||
10 | * the rights to use, copy, modify, merge, publish, distribute, sublicense, | 10 | * the rights to use, copy, modify, merge, publish, distribute, sublicense, |
11 | * and/or sell copies of the Software, and to permit persons to whom the | 11 | * and/or sell copies of the Software, and to permit persons to whom the |
12 | * Software is furnished to do so, subject to the following conditions: | 12 | * Software is furnished to do so, subject to the following conditions: |
13 | * | 13 | * |
14 | * The above copyright notice and this permission notice (including the next | 14 | * The above copyright notice and this permission notice (including the next |
15 | * paragraph) shall be included in all copies or substantial portions of the | 15 | * paragraph) shall be included in all copies or substantial portions of the |
16 | * Software. | 16 | * Software. |
17 | * | 17 | * |
18 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | 18 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
19 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | 19 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
20 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL | 20 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL |
@@ -22,10 +22,10 @@ | |||
22 | * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, | 22 | * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, |
23 | * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER | 23 | * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER |
24 | * DEALINGS IN THE SOFTWARE. | 24 | * DEALINGS IN THE SOFTWARE. |
25 | * | 25 | * |
26 | * Authors: | 26 | * Authors: |
27 | * Sung-Ching Lin <sclin@sis.com.tw> | 27 | * Sung-Ching Lin <sclin@sis.com.tw> |
28 | * | 28 | * |
29 | */ | 29 | */ |
30 | 30 | ||
31 | #include "drmP.h" | 31 | #include "drmP.h" |
@@ -41,13 +41,13 @@ set_t *setInit(void) | |||
41 | int i; | 41 | int i; |
42 | set_t *set; | 42 | set_t *set; |
43 | 43 | ||
44 | set = (set_t *)drm_alloc(sizeof(set_t), DRM_MEM_DRIVER); | 44 | set = (set_t *) drm_alloc(sizeof(set_t), DRM_MEM_DRIVER); |
45 | if (set != NULL) { | 45 | if (set != NULL) { |
46 | for (i = 0; i < SET_SIZE; i++) { | 46 | for (i = 0; i < SET_SIZE; i++) { |
47 | set->list[i].free_next = i + 1; | 47 | set->list[i].free_next = i + 1; |
48 | set->list[i].alloc_next = -1; | 48 | set->list[i].alloc_next = -1; |
49 | } | 49 | } |
50 | set->list[SET_SIZE-1].free_next = -1; | 50 | set->list[SET_SIZE - 1].free_next = -1; |
51 | set->free = 0; | 51 | set->free = 0; |
52 | set->alloc = -1; | 52 | set->alloc = -1; |
53 | set->trace = -1; | 53 | set->trace = -1; |
@@ -55,10 +55,10 @@ set_t *setInit(void) | |||
55 | return set; | 55 | return set; |
56 | } | 56 | } |
57 | 57 | ||
58 | int setAdd(set_t *set, ITEM_TYPE item) | 58 | int setAdd(set_t * set, ITEM_TYPE item) |
59 | { | 59 | { |
60 | int free = set->free; | 60 | int free = set->free; |
61 | 61 | ||
62 | if (free != -1) { | 62 | if (free != -1) { |
63 | set->list[free].val = item; | 63 | set->list[free].val = item; |
64 | set->free = set->list[free].free_next; | 64 | set->free = set->list[free].free_next; |
@@ -67,16 +67,16 @@ int setAdd(set_t *set, ITEM_TYPE item) | |||
67 | } | 67 | } |
68 | 68 | ||
69 | set->list[free].alloc_next = set->alloc; | 69 | set->list[free].alloc_next = set->alloc; |
70 | set->alloc = free; | 70 | set->alloc = free; |
71 | set->list[free].free_next = -1; | 71 | set->list[free].free_next = -1; |
72 | 72 | ||
73 | return 1; | 73 | return 1; |
74 | } | 74 | } |
75 | 75 | ||
76 | int setDel(set_t *set, ITEM_TYPE item) | 76 | int setDel(set_t * set, ITEM_TYPE item) |
77 | { | 77 | { |
78 | int alloc = set->alloc; | 78 | int alloc = set->alloc; |
79 | int prev = -1; | 79 | int prev = -1; |
80 | 80 | ||
81 | while (alloc != -1) { | 81 | while (alloc != -1) { |
82 | if (set->list[alloc].val == item) { | 82 | if (set->list[alloc].val == item) { |
@@ -103,7 +103,7 @@ int setDel(set_t *set, ITEM_TYPE item) | |||
103 | 103 | ||
104 | /* setFirst -> setAdd -> setNext is wrong */ | 104 | /* setFirst -> setAdd -> setNext is wrong */ |
105 | 105 | ||
106 | int setFirst(set_t *set, ITEM_TYPE *item) | 106 | int setFirst(set_t * set, ITEM_TYPE * item) |
107 | { | 107 | { |
108 | if (set->alloc == -1) | 108 | if (set->alloc == -1) |
109 | return 0; | 109 | return 0; |
@@ -114,7 +114,7 @@ int setFirst(set_t *set, ITEM_TYPE *item) | |||
114 | return 1; | 114 | return 1; |
115 | } | 115 | } |
116 | 116 | ||
117 | int setNext(set_t *set, ITEM_TYPE *item) | 117 | int setNext(set_t * set, ITEM_TYPE * item) |
118 | { | 118 | { |
119 | if (set->trace == -1) | 119 | if (set->trace == -1) |
120 | return 0; | 120 | return 0; |
@@ -125,7 +125,7 @@ int setNext(set_t *set, ITEM_TYPE *item) | |||
125 | return 1; | 125 | return 1; |
126 | } | 126 | } |
127 | 127 | ||
128 | int setDestroy(set_t *set) | 128 | int setDestroy(set_t * set) |
129 | { | 129 | { |
130 | drm_free(set, sizeof(set_t), DRM_MEM_DRIVER); | 130 | drm_free(set, sizeof(set_t), DRM_MEM_DRIVER); |
131 | 131 | ||
@@ -149,35 +149,34 @@ int setDestroy(set_t *set) | |||
149 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS | 149 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS |
150 | * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | 150 | * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
151 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL | 151 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL |
152 | * WITTAWAT YAMWONG, OR ANY OTHER CONTRIBUTORS BE LIABLE FOR ANY CLAIM, | 152 | * WITTAWAT YAMWONG, OR ANY OTHER CONTRIBUTORS BE LIABLE FOR ANY CLAIM, |
153 | * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR | 153 | * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR |
154 | * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE | 154 | * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE |
155 | * OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. | 155 | * OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
156 | * | 156 | * |
157 | */ | 157 | */ |
158 | 158 | ||
159 | #define ISFREE(bptr) ((bptr)->free) | 159 | #define ISFREE(bptr) ((bptr)->free) |
160 | 160 | ||
161 | memHeap_t *mmInit(int ofs, | 161 | memHeap_t *mmInit(int ofs, int size) |
162 | int size) | ||
163 | { | 162 | { |
164 | PMemBlock blocks; | 163 | PMemBlock blocks; |
165 | 164 | ||
166 | if (size <= 0) | 165 | if (size <= 0) |
167 | return NULL; | 166 | return NULL; |
168 | 167 | ||
169 | blocks = (TMemBlock *)drm_calloc(1, sizeof(TMemBlock), DRM_MEM_DRIVER); | 168 | blocks = (TMemBlock *) drm_calloc(1, sizeof(TMemBlock), DRM_MEM_DRIVER); |
170 | if (blocks != NULL) { | 169 | if (blocks != NULL) { |
171 | blocks->ofs = ofs; | 170 | blocks->ofs = ofs; |
172 | blocks->size = size; | 171 | blocks->size = size; |
173 | blocks->free = 1; | 172 | blocks->free = 1; |
174 | return (memHeap_t *)blocks; | 173 | return (memHeap_t *) blocks; |
175 | } else | 174 | } else |
176 | return NULL; | 175 | return NULL; |
177 | } | 176 | } |
178 | 177 | ||
179 | /* Checks if a pointer 'b' is part of the heap 'heap' */ | 178 | /* Checks if a pointer 'b' is part of the heap 'heap' */ |
180 | int mmBlockInHeap(memHeap_t *heap, PMemBlock b) | 179 | int mmBlockInHeap(memHeap_t * heap, PMemBlock b) |
181 | { | 180 | { |
182 | TMemBlock *p; | 181 | TMemBlock *p; |
183 | 182 | ||
@@ -194,16 +193,16 @@ int mmBlockInHeap(memHeap_t *heap, PMemBlock b) | |||
194 | return 0; | 193 | return 0; |
195 | } | 194 | } |
196 | 195 | ||
197 | static TMemBlock* SliceBlock(TMemBlock *p, | 196 | static TMemBlock *SliceBlock(TMemBlock * p, |
198 | int startofs, int size, | 197 | int startofs, int size, |
199 | int reserved, int alignment) | 198 | int reserved, int alignment) |
200 | { | 199 | { |
201 | TMemBlock *newblock; | 200 | TMemBlock *newblock; |
202 | 201 | ||
203 | /* break left */ | 202 | /* break left */ |
204 | if (startofs > p->ofs) { | 203 | if (startofs > p->ofs) { |
205 | newblock = (TMemBlock*) drm_calloc(1, sizeof(TMemBlock), | 204 | newblock = (TMemBlock *) drm_calloc(1, sizeof(TMemBlock), |
206 | DRM_MEM_DRIVER); | 205 | DRM_MEM_DRIVER); |
207 | newblock->ofs = startofs; | 206 | newblock->ofs = startofs; |
208 | newblock->size = p->size - (startofs - p->ofs); | 207 | newblock->size = p->size - (startofs - p->ofs); |
209 | newblock->free = 1; | 208 | newblock->free = 1; |
@@ -215,8 +214,8 @@ static TMemBlock* SliceBlock(TMemBlock *p, | |||
215 | 214 | ||
216 | /* break right */ | 215 | /* break right */ |
217 | if (size < p->size) { | 216 | if (size < p->size) { |
218 | newblock = (TMemBlock*) drm_calloc(1, sizeof(TMemBlock), | 217 | newblock = (TMemBlock *) drm_calloc(1, sizeof(TMemBlock), |
219 | DRM_MEM_DRIVER); | 218 | DRM_MEM_DRIVER); |
220 | newblock->ofs = startofs + size; | 219 | newblock->ofs = startofs + size; |
221 | newblock->size = p->size - size; | 220 | newblock->size = p->size - size; |
222 | newblock->free = 1; | 221 | newblock->free = 1; |
@@ -232,37 +231,37 @@ static TMemBlock* SliceBlock(TMemBlock *p, | |||
232 | return p; | 231 | return p; |
233 | } | 232 | } |
234 | 233 | ||
235 | PMemBlock mmAllocMem( memHeap_t *heap, int size, int align2, int startSearch) | 234 | PMemBlock mmAllocMem(memHeap_t * heap, int size, int align2, int startSearch) |
236 | { | 235 | { |
237 | int mask,startofs, endofs; | 236 | int mask, startofs, endofs; |
238 | TMemBlock *p; | 237 | TMemBlock *p; |
239 | 238 | ||
240 | if (heap == NULL || align2 < 0 || size <= 0) | 239 | if (heap == NULL || align2 < 0 || size <= 0) |
241 | return NULL; | 240 | return NULL; |
242 | 241 | ||
243 | mask = (1 << align2)-1; | 242 | mask = (1 << align2) - 1; |
244 | startofs = 0; | 243 | startofs = 0; |
245 | p = (TMemBlock *)heap; | 244 | p = (TMemBlock *) heap; |
246 | while (p != NULL) { | 245 | while (p != NULL) { |
247 | if (ISFREE(p)) { | 246 | if (ISFREE(p)) { |
248 | startofs = (p->ofs + mask) & ~mask; | 247 | startofs = (p->ofs + mask) & ~mask; |
249 | if ( startofs < startSearch ) { | 248 | if (startofs < startSearch) { |
250 | startofs = startSearch; | 249 | startofs = startSearch; |
251 | } | 250 | } |
252 | endofs = startofs+size; | 251 | endofs = startofs + size; |
253 | if (endofs <= (p->ofs+p->size)) | 252 | if (endofs <= (p->ofs + p->size)) |
254 | break; | 253 | break; |
255 | } | 254 | } |
256 | p = p->next; | 255 | p = p->next; |
257 | } | 256 | } |
258 | if (p == NULL) | 257 | if (p == NULL) |
259 | return NULL; | 258 | return NULL; |
260 | p = SliceBlock(p,startofs,size,0,mask+1); | 259 | p = SliceBlock(p, startofs, size, 0, mask + 1); |
261 | p->heap = heap; | 260 | p->heap = heap; |
262 | return p; | 261 | return p; |
263 | } | 262 | } |
264 | 263 | ||
265 | static __inline__ int Join2Blocks(TMemBlock *p) | 264 | static __inline__ int Join2Blocks(TMemBlock * p) |
266 | { | 265 | { |
267 | if (p->free && p->next && p->next->free) { | 266 | if (p->free && p->next && p->next->free) { |
268 | TMemBlock *q = p->next; | 267 | TMemBlock *q = p->next; |
@@ -295,7 +294,6 @@ int mmFreeMem(PMemBlock b) | |||
295 | p->free = 1; | 294 | p->free = 1; |
296 | Join2Blocks(p); | 295 | Join2Blocks(p); |
297 | if (prev) | 296 | if (prev) |
298 | Join2Blocks(prev); | 297 | Join2Blocks(prev); |
299 | return 0; | 298 | return 0; |
300 | } | 299 | } |
301 | |||