aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/char/drm/drm_memory.c
diff options
context:
space:
mode:
authorDave Airlie <airlied@starflyer.(none)>2005-09-25 00:28:13 -0400
committerDave Airlie <airlied@linux.ie>2005-09-25 00:28:13 -0400
commitb5e89ed53ed8d24f83ba1941c07382af00ed238e (patch)
tree747bae7a565f88a2e1d5974776eeb054a932c505 /drivers/char/drm/drm_memory.c
parent99a2657a29e2d623c3568cd86b27cac13fb63140 (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/drm_memory.c')
-rw-r--r--drivers/char/drm/drm_memory.c54
1 files changed, 28 insertions, 26 deletions
diff --git a/drivers/char/drm/drm_memory.c b/drivers/char/drm/drm_memory.c
index ff483fb418aa..2c74155aa84f 100644
--- a/drivers/char/drm/drm_memory.c
+++ b/drivers/char/drm/drm_memory.c
@@ -1,12 +1,12 @@
1/** 1/**
2 * \file drm_memory.h 2 * \file drm_memory.c
3 * Memory management wrappers for DRM 3 * Memory management wrappers for DRM
4 * 4 *
5 * \author Rickard E. (Rik) Faith <faith@valinux.com> 5 * \author Rickard E. (Rik) Faith <faith@valinux.com>
6 * \author Gareth Hughes <gareth@valinux.com> 6 * \author Gareth Hughes <gareth@valinux.com>
7 */ 7 */
8 8
9/* 9/*
10 * Created: Thu Feb 4 14:00:34 1999 by faith@valinux.com 10 * Created: Thu Feb 4 14:00:34 1999 by faith@valinux.com
11 * 11 *
12 * Copyright 1999 Precision Insight, Inc., Cedar Park, Texas. 12 * Copyright 1999 Precision Insight, Inc., Cedar Park, Texas.
@@ -48,7 +48,7 @@ void drm_mem_init(void)
48 48
49/** 49/**
50 * Called when "/proc/dri/%dev%/mem" is read. 50 * Called when "/proc/dri/%dev%/mem" is read.
51 * 51 *
52 * \param buf output buffer. 52 * \param buf output buffer.
53 * \param start start of output data. 53 * \param start start of output data.
54 * \param offset requested start offset. 54 * \param offset requested start offset.
@@ -57,10 +57,10 @@ void drm_mem_init(void)
57 * \param data private data. 57 * \param data private data.
58 * \return number of written bytes. 58 * \return number of written bytes.
59 * 59 *
60 * No-op. 60 * No-op.
61 */ 61 */
62int drm_mem_info(char *buf, char **start, off_t offset, 62int drm_mem_info(char *buf, char **start, off_t offset,
63 int len, int *eof, void *data) 63 int len, int *eof, void *data)
64{ 64{
65 return 0; 65 return 0;
66} 66}
@@ -70,7 +70,8 @@ void *drm_realloc(void *oldpt, size_t oldsize, size_t size, int area)
70{ 70{
71 void *pt; 71 void *pt;
72 72
73 if (!(pt = kmalloc(size, GFP_KERNEL))) return NULL; 73 if (!(pt = kmalloc(size, GFP_KERNEL)))
74 return NULL;
74 if (oldpt && oldsize) { 75 if (oldpt && oldsize) {
75 memcpy(pt, oldpt, oldsize); 76 memcpy(pt, oldpt, oldsize);
76 kfree(oldpt); 77 kfree(oldpt);
@@ -90,21 +91,20 @@ void *drm_realloc(void *oldpt, size_t oldsize, size_t size, int area)
90unsigned long drm_alloc_pages(int order, int area) 91unsigned long drm_alloc_pages(int order, int area)
91{ 92{
92 unsigned long address; 93 unsigned long address;
93 unsigned long bytes = PAGE_SIZE << order; 94 unsigned long bytes = PAGE_SIZE << order;
94 unsigned long addr; 95 unsigned long addr;
95 unsigned int sz; 96 unsigned int sz;
96 97
97 address = __get_free_pages(GFP_KERNEL, order); 98 address = __get_free_pages(GFP_KERNEL, order);
98 if (!address) 99 if (!address)
99 return 0; 100 return 0;
100 101
101 /* Zero */ 102 /* Zero */
102 memset((void *)address, 0, bytes); 103 memset((void *)address, 0, bytes);
103 104
104 /* Reserve */ 105 /* Reserve */
105 for (addr = address, sz = bytes; 106 for (addr = address, sz = bytes;
106 sz > 0; 107 sz > 0; addr += PAGE_SIZE, sz -= PAGE_SIZE) {
107 addr += PAGE_SIZE, sz -= PAGE_SIZE) {
108 SetPageReserved(virt_to_page(addr)); 108 SetPageReserved(virt_to_page(addr));
109 } 109 }
110 110
@@ -113,7 +113,7 @@ unsigned long drm_alloc_pages(int order, int area)
113 113
114/** 114/**
115 * Free pages. 115 * Free pages.
116 * 116 *
117 * \param address address of the pages to free. 117 * \param address address of the pages to free.
118 * \param order size order. 118 * \param order size order.
119 * \param area memory area. (Not used.) 119 * \param area memory area. (Not used.)
@@ -124,49 +124,51 @@ void drm_free_pages(unsigned long address, int order, int area)
124{ 124{
125 unsigned long bytes = PAGE_SIZE << order; 125 unsigned long bytes = PAGE_SIZE << order;
126 unsigned long addr; 126 unsigned long addr;
127 unsigned int sz; 127 unsigned int sz;
128 128
129 if (!address) 129 if (!address)
130 return; 130 return;
131 131
132 /* Unreserve */ 132 /* Unreserve */
133 for (addr = address, sz = bytes; 133 for (addr = address, sz = bytes;
134 sz > 0; 134 sz > 0; addr += PAGE_SIZE, sz -= PAGE_SIZE) {
135 addr += PAGE_SIZE, sz -= PAGE_SIZE) {
136 ClearPageReserved(virt_to_page(addr)); 135 ClearPageReserved(virt_to_page(addr));
137 } 136 }
138 137
139 free_pages(address, order); 138 free_pages(address, order);
140} 139}
141 140
142
143#if __OS_HAS_AGP 141#if __OS_HAS_AGP
144/** Wrapper around agp_allocate_memory() */ 142/** Wrapper around agp_allocate_memory() */
145DRM_AGP_MEM *drm_alloc_agp(drm_device_t *dev, int pages, u32 type) 143DRM_AGP_MEM *drm_alloc_agp(drm_device_t * dev, int pages, u32 type)
146{ 144{
147 return drm_agp_allocate_memory(dev->agp->bridge, pages, type); 145 return drm_agp_allocate_memory(dev->agp->bridge, pages, type);
148} 146}
147
149EXPORT_SYMBOL(drm_alloc_agp); 148EXPORT_SYMBOL(drm_alloc_agp);
150 149
151/** Wrapper around agp_free_memory() */ 150/** Wrapper around agp_free_memory() */
152int drm_free_agp(DRM_AGP_MEM *handle, int pages) 151int drm_free_agp(DRM_AGP_MEM * handle, int pages)
153{ 152{
154 return drm_agp_free_memory(handle) ? 0 : -EINVAL; 153 return drm_agp_free_memory(handle) ? 0 : -EINVAL;
155} 154}
155
156EXPORT_SYMBOL(drm_free_agp); 156EXPORT_SYMBOL(drm_free_agp);
157 157
158/** Wrapper around agp_bind_memory() */ 158/** Wrapper around agp_bind_memory() */
159int drm_bind_agp(DRM_AGP_MEM *handle, unsigned int start) 159int drm_bind_agp(DRM_AGP_MEM * handle, unsigned int start)
160{ 160{
161 return drm_agp_bind_memory(handle, start); 161 return drm_agp_bind_memory(handle, start);
162} 162}
163
163EXPORT_SYMBOL(drm_bind_agp); 164EXPORT_SYMBOL(drm_bind_agp);
164 165
165/** Wrapper around agp_unbind_memory() */ 166/** Wrapper around agp_unbind_memory() */
166int drm_unbind_agp(DRM_AGP_MEM *handle) 167int drm_unbind_agp(DRM_AGP_MEM * handle)
167{ 168{
168 return drm_agp_unbind_memory(handle); 169 return drm_agp_unbind_memory(handle);
169} 170}
171
170EXPORT_SYMBOL(drm_unbind_agp); 172EXPORT_SYMBOL(drm_unbind_agp);
171#endif /* agp */ 173#endif /* agp */
172#endif /* debug_memory */ 174#endif /* debug_memory */