summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/gpu/drm/i915/i915_drv.h3
-rw-r--r--include/linux/scatterlist.h18
-rw-r--r--lib/scatterlist.c6
-rw-r--r--tools/virtio/linux/scatterlist.h18
4 files changed, 0 insertions, 45 deletions
diff --git a/drivers/gpu/drm/i915/i915_drv.h b/drivers/gpu/drm/i915/i915_drv.h
index 34c125e2d90c..9180f67746b4 100644
--- a/drivers/gpu/drm/i915/i915_drv.h
+++ b/drivers/gpu/drm/i915/i915_drv.h
@@ -2238,9 +2238,6 @@ static inline struct scatterlist *____sg_next(struct scatterlist *sg)
2238 **/ 2238 **/
2239static inline struct scatterlist *__sg_next(struct scatterlist *sg) 2239static inline struct scatterlist *__sg_next(struct scatterlist *sg)
2240{ 2240{
2241#ifdef CONFIG_DEBUG_SG
2242 BUG_ON(sg->sg_magic != SG_MAGIC);
2243#endif
2244 return sg_is_last(sg) ? NULL : ____sg_next(sg); 2241 return sg_is_last(sg) ? NULL : ____sg_next(sg);
2245} 2242}
2246 2243
diff --git a/include/linux/scatterlist.h b/include/linux/scatterlist.h
index 51f52020ad5f..093aa57120b0 100644
--- a/include/linux/scatterlist.h
+++ b/include/linux/scatterlist.h
@@ -9,9 +9,6 @@
9#include <asm/io.h> 9#include <asm/io.h>
10 10
11struct scatterlist { 11struct scatterlist {
12#ifdef CONFIG_DEBUG_SG
13 unsigned long sg_magic;
14#endif
15 unsigned long page_link; 12 unsigned long page_link;
16 unsigned int offset; 13 unsigned int offset;
17 unsigned int length; 14 unsigned int length;
@@ -64,7 +61,6 @@ struct sg_table {
64 * 61 *
65 */ 62 */
66 63
67#define SG_MAGIC 0x87654321
68#define SG_CHAIN 0x01UL 64#define SG_CHAIN 0x01UL
69#define SG_END 0x02UL 65#define SG_END 0x02UL
70 66
@@ -98,7 +94,6 @@ static inline void sg_assign_page(struct scatterlist *sg, struct page *page)
98 */ 94 */
99 BUG_ON((unsigned long) page & (SG_CHAIN | SG_END)); 95 BUG_ON((unsigned long) page & (SG_CHAIN | SG_END));
100#ifdef CONFIG_DEBUG_SG 96#ifdef CONFIG_DEBUG_SG
101 BUG_ON(sg->sg_magic != SG_MAGIC);
102 BUG_ON(sg_is_chain(sg)); 97 BUG_ON(sg_is_chain(sg));
103#endif 98#endif
104 sg->page_link = page_link | (unsigned long) page; 99 sg->page_link = page_link | (unsigned long) page;
@@ -129,7 +124,6 @@ static inline void sg_set_page(struct scatterlist *sg, struct page *page,
129static inline struct page *sg_page(struct scatterlist *sg) 124static inline struct page *sg_page(struct scatterlist *sg)
130{ 125{
131#ifdef CONFIG_DEBUG_SG 126#ifdef CONFIG_DEBUG_SG
132 BUG_ON(sg->sg_magic != SG_MAGIC);
133 BUG_ON(sg_is_chain(sg)); 127 BUG_ON(sg_is_chain(sg));
134#endif 128#endif
135 return (struct page *)((sg)->page_link & ~(SG_CHAIN | SG_END)); 129 return (struct page *)((sg)->page_link & ~(SG_CHAIN | SG_END));
@@ -195,9 +189,6 @@ static inline void sg_chain(struct scatterlist *prv, unsigned int prv_nents,
195 **/ 189 **/
196static inline void sg_mark_end(struct scatterlist *sg) 190static inline void sg_mark_end(struct scatterlist *sg)
197{ 191{
198#ifdef CONFIG_DEBUG_SG
199 BUG_ON(sg->sg_magic != SG_MAGIC);
200#endif
201 /* 192 /*
202 * Set termination bit, clear potential chain bit 193 * Set termination bit, clear potential chain bit
203 */ 194 */
@@ -215,9 +206,6 @@ static inline void sg_mark_end(struct scatterlist *sg)
215 **/ 206 **/
216static inline void sg_unmark_end(struct scatterlist *sg) 207static inline void sg_unmark_end(struct scatterlist *sg)
217{ 208{
218#ifdef CONFIG_DEBUG_SG
219 BUG_ON(sg->sg_magic != SG_MAGIC);
220#endif
221 sg->page_link &= ~SG_END; 209 sg->page_link &= ~SG_END;
222} 210}
223 211
@@ -260,12 +248,6 @@ static inline void *sg_virt(struct scatterlist *sg)
260static inline void sg_init_marker(struct scatterlist *sgl, 248static inline void sg_init_marker(struct scatterlist *sgl,
261 unsigned int nents) 249 unsigned int nents)
262{ 250{
263#ifdef CONFIG_DEBUG_SG
264 unsigned int i;
265
266 for (i = 0; i < nents; i++)
267 sgl[i].sg_magic = SG_MAGIC;
268#endif
269 sg_mark_end(&sgl[nents - 1]); 251 sg_mark_end(&sgl[nents - 1]);
270} 252}
271 253
diff --git a/lib/scatterlist.c b/lib/scatterlist.c
index 06dad7a072fd..d4ae67d6cd1e 100644
--- a/lib/scatterlist.c
+++ b/lib/scatterlist.c
@@ -24,9 +24,6 @@
24 **/ 24 **/
25struct scatterlist *sg_next(struct scatterlist *sg) 25struct scatterlist *sg_next(struct scatterlist *sg)
26{ 26{
27#ifdef CONFIG_DEBUG_SG
28 BUG_ON(sg->sg_magic != SG_MAGIC);
29#endif
30 if (sg_is_last(sg)) 27 if (sg_is_last(sg))
31 return NULL; 28 return NULL;
32 29
@@ -111,10 +108,7 @@ struct scatterlist *sg_last(struct scatterlist *sgl, unsigned int nents)
111 for_each_sg(sgl, sg, nents, i) 108 for_each_sg(sgl, sg, nents, i)
112 ret = sg; 109 ret = sg;
113 110
114#ifdef CONFIG_DEBUG_SG
115 BUG_ON(sgl[0].sg_magic != SG_MAGIC);
116 BUG_ON(!sg_is_last(ret)); 111 BUG_ON(!sg_is_last(ret));
117#endif
118 return ret; 112 return ret;
119} 113}
120EXPORT_SYMBOL(sg_last); 114EXPORT_SYMBOL(sg_last);
diff --git a/tools/virtio/linux/scatterlist.h b/tools/virtio/linux/scatterlist.h
index 9a45f90e2d08..369ee308b668 100644
--- a/tools/virtio/linux/scatterlist.h
+++ b/tools/virtio/linux/scatterlist.h
@@ -36,7 +36,6 @@ static inline void sg_assign_page(struct scatterlist *sg, struct page *page)
36 */ 36 */
37 BUG_ON((unsigned long) page & 0x03); 37 BUG_ON((unsigned long) page & 0x03);
38#ifdef CONFIG_DEBUG_SG 38#ifdef CONFIG_DEBUG_SG
39 BUG_ON(sg->sg_magic != SG_MAGIC);
40 BUG_ON(sg_is_chain(sg)); 39 BUG_ON(sg_is_chain(sg));
41#endif 40#endif
42 sg->page_link = page_link | (unsigned long) page; 41 sg->page_link = page_link | (unsigned long) page;
@@ -67,7 +66,6 @@ static inline void sg_set_page(struct scatterlist *sg, struct page *page,
67static inline struct page *sg_page(struct scatterlist *sg) 66static inline struct page *sg_page(struct scatterlist *sg)
68{ 67{
69#ifdef CONFIG_DEBUG_SG 68#ifdef CONFIG_DEBUG_SG
70 BUG_ON(sg->sg_magic != SG_MAGIC);
71 BUG_ON(sg_is_chain(sg)); 69 BUG_ON(sg_is_chain(sg));
72#endif 70#endif
73 return (struct page *)((sg)->page_link & ~0x3); 71 return (struct page *)((sg)->page_link & ~0x3);
@@ -116,9 +114,6 @@ static inline void sg_chain(struct scatterlist *prv, unsigned int prv_nents,
116 **/ 114 **/
117static inline void sg_mark_end(struct scatterlist *sg) 115static inline void sg_mark_end(struct scatterlist *sg)
118{ 116{
119#ifdef CONFIG_DEBUG_SG
120 BUG_ON(sg->sg_magic != SG_MAGIC);
121#endif
122 /* 117 /*
123 * Set termination bit, clear potential chain bit 118 * Set termination bit, clear potential chain bit
124 */ 119 */
@@ -136,17 +131,11 @@ static inline void sg_mark_end(struct scatterlist *sg)
136 **/ 131 **/
137static inline void sg_unmark_end(struct scatterlist *sg) 132static inline void sg_unmark_end(struct scatterlist *sg)
138{ 133{
139#ifdef CONFIG_DEBUG_SG
140 BUG_ON(sg->sg_magic != SG_MAGIC);
141#endif
142 sg->page_link &= ~0x02; 134 sg->page_link &= ~0x02;
143} 135}
144 136
145static inline struct scatterlist *sg_next(struct scatterlist *sg) 137static inline struct scatterlist *sg_next(struct scatterlist *sg)
146{ 138{
147#ifdef CONFIG_DEBUG_SG
148 BUG_ON(sg->sg_magic != SG_MAGIC);
149#endif
150 if (sg_is_last(sg)) 139 if (sg_is_last(sg))
151 return NULL; 140 return NULL;
152 141
@@ -160,13 +149,6 @@ static inline struct scatterlist *sg_next(struct scatterlist *sg)
160static inline void sg_init_table(struct scatterlist *sgl, unsigned int nents) 149static inline void sg_init_table(struct scatterlist *sgl, unsigned int nents)
161{ 150{
162 memset(sgl, 0, sizeof(*sgl) * nents); 151 memset(sgl, 0, sizeof(*sgl) * nents);
163#ifdef CONFIG_DEBUG_SG
164 {
165 unsigned int i;
166 for (i = 0; i < nents; i++)
167 sgl[i].sg_magic = SG_MAGIC;
168 }
169#endif
170 sg_mark_end(&sgl[nents - 1]); 152 sg_mark_end(&sgl[nents - 1]);
171} 153}
172 154