aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux
diff options
context:
space:
mode:
authorHuang Ying <ying.huang@intel.com>2010-09-09 19:37:26 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2010-09-09 21:57:22 -0400
commite0bf1024b36be90da241af3c2767311e055b612c (patch)
tree1df5f3fac82eb419aa466a0376b6f2cbf3207086 /include/linux
parentf3c65b2870f2481f3646bc410a58a12989ecc704 (diff)
kfifo: add parenthesis for macro parameter reference
Some macro parameter references inside typeof() operator are not enclosed with parenthesis. It should be safer to add them. Signed-off-by: Huang Ying <ying.huang@intel.com> Acked-by: Stefani Seibold <stefani@seibold.net> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'include/linux')
-rw-r--r--include/linux/kfifo.h58
1 files changed, 29 insertions, 29 deletions
diff --git a/include/linux/kfifo.h b/include/linux/kfifo.h
index 4aa95f203f3e..62dbee554f60 100644
--- a/include/linux/kfifo.h
+++ b/include/linux/kfifo.h
@@ -214,7 +214,7 @@ __kfifo_must_check_helper(unsigned int val)
214 */ 214 */
215#define kfifo_reset(fifo) \ 215#define kfifo_reset(fifo) \
216(void)({ \ 216(void)({ \
217 typeof(fifo + 1) __tmp = (fifo); \ 217 typeof((fifo) + 1) __tmp = (fifo); \
218 __tmp->kfifo.in = __tmp->kfifo.out = 0; \ 218 __tmp->kfifo.in = __tmp->kfifo.out = 0; \
219}) 219})
220 220
@@ -228,7 +228,7 @@ __kfifo_must_check_helper(unsigned int val)
228 */ 228 */
229#define kfifo_reset_out(fifo) \ 229#define kfifo_reset_out(fifo) \
230(void)({ \ 230(void)({ \
231 typeof(fifo + 1) __tmp = (fifo); \ 231 typeof((fifo) + 1) __tmp = (fifo); \
232 __tmp->kfifo.out = __tmp->kfifo.in; \ 232 __tmp->kfifo.out = __tmp->kfifo.in; \
233}) 233})
234 234
@@ -238,7 +238,7 @@ __kfifo_must_check_helper(unsigned int val)
238 */ 238 */
239#define kfifo_len(fifo) \ 239#define kfifo_len(fifo) \
240({ \ 240({ \
241 typeof(fifo + 1) __tmpl = (fifo); \ 241 typeof((fifo) + 1) __tmpl = (fifo); \
242 __tmpl->kfifo.in - __tmpl->kfifo.out; \ 242 __tmpl->kfifo.in - __tmpl->kfifo.out; \
243}) 243})
244 244
@@ -248,7 +248,7 @@ __kfifo_must_check_helper(unsigned int val)
248 */ 248 */
249#define kfifo_is_empty(fifo) \ 249#define kfifo_is_empty(fifo) \
250({ \ 250({ \
251 typeof(fifo + 1) __tmpq = (fifo); \ 251 typeof((fifo) + 1) __tmpq = (fifo); \
252 __tmpq->kfifo.in == __tmpq->kfifo.out; \ 252 __tmpq->kfifo.in == __tmpq->kfifo.out; \
253}) 253})
254 254
@@ -258,7 +258,7 @@ __kfifo_must_check_helper(unsigned int val)
258 */ 258 */
259#define kfifo_is_full(fifo) \ 259#define kfifo_is_full(fifo) \
260({ \ 260({ \
261 typeof(fifo + 1) __tmpq = (fifo); \ 261 typeof((fifo) + 1) __tmpq = (fifo); \
262 kfifo_len(__tmpq) > __tmpq->kfifo.mask; \ 262 kfifo_len(__tmpq) > __tmpq->kfifo.mask; \
263}) 263})
264 264
@@ -269,7 +269,7 @@ __kfifo_must_check_helper(unsigned int val)
269#define kfifo_avail(fifo) \ 269#define kfifo_avail(fifo) \
270__kfifo_must_check_helper( \ 270__kfifo_must_check_helper( \
271({ \ 271({ \
272 typeof(fifo + 1) __tmpq = (fifo); \ 272 typeof((fifo) + 1) __tmpq = (fifo); \
273 const size_t __recsize = sizeof(*__tmpq->rectype); \ 273 const size_t __recsize = sizeof(*__tmpq->rectype); \
274 unsigned int __avail = kfifo_size(__tmpq) - kfifo_len(__tmpq); \ 274 unsigned int __avail = kfifo_size(__tmpq) - kfifo_len(__tmpq); \
275 (__recsize) ? ((__avail <= __recsize) ? 0 : \ 275 (__recsize) ? ((__avail <= __recsize) ? 0 : \
@@ -284,7 +284,7 @@ __kfifo_must_check_helper( \
284 */ 284 */
285#define kfifo_skip(fifo) \ 285#define kfifo_skip(fifo) \
286(void)({ \ 286(void)({ \
287 typeof(fifo + 1) __tmp = (fifo); \ 287 typeof((fifo) + 1) __tmp = (fifo); \
288 const size_t __recsize = sizeof(*__tmp->rectype); \ 288 const size_t __recsize = sizeof(*__tmp->rectype); \
289 struct __kfifo *__kfifo = &__tmp->kfifo; \ 289 struct __kfifo *__kfifo = &__tmp->kfifo; \
290 if (__recsize) \ 290 if (__recsize) \
@@ -302,7 +302,7 @@ __kfifo_must_check_helper( \
302#define kfifo_peek_len(fifo) \ 302#define kfifo_peek_len(fifo) \
303__kfifo_must_check_helper( \ 303__kfifo_must_check_helper( \
304({ \ 304({ \
305 typeof(fifo + 1) __tmp = (fifo); \ 305 typeof((fifo) + 1) __tmp = (fifo); \
306 const size_t __recsize = sizeof(*__tmp->rectype); \ 306 const size_t __recsize = sizeof(*__tmp->rectype); \
307 struct __kfifo *__kfifo = &__tmp->kfifo; \ 307 struct __kfifo *__kfifo = &__tmp->kfifo; \
308 (!__recsize) ? kfifo_len(__tmp) * sizeof(*__tmp->type) : \ 308 (!__recsize) ? kfifo_len(__tmp) * sizeof(*__tmp->type) : \
@@ -325,7 +325,7 @@ __kfifo_must_check_helper( \
325#define kfifo_alloc(fifo, size, gfp_mask) \ 325#define kfifo_alloc(fifo, size, gfp_mask) \
326__kfifo_must_check_helper( \ 326__kfifo_must_check_helper( \
327({ \ 327({ \
328 typeof(fifo + 1) __tmp = (fifo); \ 328 typeof((fifo) + 1) __tmp = (fifo); \
329 struct __kfifo *__kfifo = &__tmp->kfifo; \ 329 struct __kfifo *__kfifo = &__tmp->kfifo; \
330 __is_kfifo_ptr(__tmp) ? \ 330 __is_kfifo_ptr(__tmp) ? \
331 __kfifo_alloc(__kfifo, size, sizeof(*__tmp->type), gfp_mask) : \ 331 __kfifo_alloc(__kfifo, size, sizeof(*__tmp->type), gfp_mask) : \
@@ -339,7 +339,7 @@ __kfifo_must_check_helper( \
339 */ 339 */
340#define kfifo_free(fifo) \ 340#define kfifo_free(fifo) \
341({ \ 341({ \
342 typeof(fifo + 1) __tmp = (fifo); \ 342 typeof((fifo) + 1) __tmp = (fifo); \
343 struct __kfifo *__kfifo = &__tmp->kfifo; \ 343 struct __kfifo *__kfifo = &__tmp->kfifo; \
344 if (__is_kfifo_ptr(__tmp)) \ 344 if (__is_kfifo_ptr(__tmp)) \
345 __kfifo_free(__kfifo); \ 345 __kfifo_free(__kfifo); \
@@ -358,7 +358,7 @@ __kfifo_must_check_helper( \
358 */ 358 */
359#define kfifo_init(fifo, buffer, size) \ 359#define kfifo_init(fifo, buffer, size) \
360({ \ 360({ \
361 typeof(fifo + 1) __tmp = (fifo); \ 361 typeof((fifo) + 1) __tmp = (fifo); \
362 struct __kfifo *__kfifo = &__tmp->kfifo; \ 362 struct __kfifo *__kfifo = &__tmp->kfifo; \
363 __is_kfifo_ptr(__tmp) ? \ 363 __is_kfifo_ptr(__tmp) ? \
364 __kfifo_init(__kfifo, buffer, size, sizeof(*__tmp->type)) : \ 364 __kfifo_init(__kfifo, buffer, size, sizeof(*__tmp->type)) : \
@@ -379,8 +379,8 @@ __kfifo_must_check_helper( \
379 */ 379 */
380#define kfifo_put(fifo, val) \ 380#define kfifo_put(fifo, val) \
381({ \ 381({ \
382 typeof(fifo + 1) __tmp = (fifo); \ 382 typeof((fifo) + 1) __tmp = (fifo); \
383 typeof(val + 1) __val = (val); \ 383 typeof((val) + 1) __val = (val); \
384 unsigned int __ret; \ 384 unsigned int __ret; \
385 const size_t __recsize = sizeof(*__tmp->rectype); \ 385 const size_t __recsize = sizeof(*__tmp->rectype); \
386 struct __kfifo *__kfifo = &__tmp->kfifo; \ 386 struct __kfifo *__kfifo = &__tmp->kfifo; \
@@ -421,8 +421,8 @@ __kfifo_must_check_helper( \
421#define kfifo_get(fifo, val) \ 421#define kfifo_get(fifo, val) \
422__kfifo_must_check_helper( \ 422__kfifo_must_check_helper( \
423({ \ 423({ \
424 typeof(fifo + 1) __tmp = (fifo); \ 424 typeof((fifo) + 1) __tmp = (fifo); \
425 typeof(val + 1) __val = (val); \ 425 typeof((val) + 1) __val = (val); \
426 unsigned int __ret; \ 426 unsigned int __ret; \
427 const size_t __recsize = sizeof(*__tmp->rectype); \ 427 const size_t __recsize = sizeof(*__tmp->rectype); \
428 struct __kfifo *__kfifo = &__tmp->kfifo; \ 428 struct __kfifo *__kfifo = &__tmp->kfifo; \
@@ -462,8 +462,8 @@ __kfifo_must_check_helper( \
462#define kfifo_peek(fifo, val) \ 462#define kfifo_peek(fifo, val) \
463__kfifo_must_check_helper( \ 463__kfifo_must_check_helper( \
464({ \ 464({ \
465 typeof(fifo + 1) __tmp = (fifo); \ 465 typeof((fifo) + 1) __tmp = (fifo); \
466 typeof(val + 1) __val = (val); \ 466 typeof((val) + 1) __val = (val); \
467 unsigned int __ret; \ 467 unsigned int __ret; \
468 const size_t __recsize = sizeof(*__tmp->rectype); \ 468 const size_t __recsize = sizeof(*__tmp->rectype); \
469 struct __kfifo *__kfifo = &__tmp->kfifo; \ 469 struct __kfifo *__kfifo = &__tmp->kfifo; \
@@ -501,8 +501,8 @@ __kfifo_must_check_helper( \
501 */ 501 */
502#define kfifo_in(fifo, buf, n) \ 502#define kfifo_in(fifo, buf, n) \
503({ \ 503({ \
504 typeof(fifo + 1) __tmp = (fifo); \ 504 typeof((fifo) + 1) __tmp = (fifo); \
505 typeof(buf + 1) __buf = (buf); \ 505 typeof((buf) + 1) __buf = (buf); \
506 unsigned long __n = (n); \ 506 unsigned long __n = (n); \
507 const size_t __recsize = sizeof(*__tmp->rectype); \ 507 const size_t __recsize = sizeof(*__tmp->rectype); \
508 struct __kfifo *__kfifo = &__tmp->kfifo; \ 508 struct __kfifo *__kfifo = &__tmp->kfifo; \
@@ -554,8 +554,8 @@ __kfifo_must_check_helper( \
554#define kfifo_out(fifo, buf, n) \ 554#define kfifo_out(fifo, buf, n) \
555__kfifo_must_check_helper( \ 555__kfifo_must_check_helper( \
556({ \ 556({ \
557 typeof(fifo + 1) __tmp = (fifo); \ 557 typeof((fifo) + 1) __tmp = (fifo); \
558 typeof(buf + 1) __buf = (buf); \ 558 typeof((buf) + 1) __buf = (buf); \
559 unsigned long __n = (n); \ 559 unsigned long __n = (n); \
560 const size_t __recsize = sizeof(*__tmp->rectype); \ 560 const size_t __recsize = sizeof(*__tmp->rectype); \
561 struct __kfifo *__kfifo = &__tmp->kfifo; \ 561 struct __kfifo *__kfifo = &__tmp->kfifo; \
@@ -611,7 +611,7 @@ __kfifo_must_check_helper( \
611#define kfifo_from_user(fifo, from, len, copied) \ 611#define kfifo_from_user(fifo, from, len, copied) \
612__kfifo_must_check_helper( \ 612__kfifo_must_check_helper( \
613({ \ 613({ \
614 typeof(fifo + 1) __tmp = (fifo); \ 614 typeof((fifo) + 1) __tmp = (fifo); \
615 const void __user *__from = (from); \ 615 const void __user *__from = (from); \
616 unsigned int __len = (len); \ 616 unsigned int __len = (len); \
617 unsigned int *__copied = (copied); \ 617 unsigned int *__copied = (copied); \
@@ -639,7 +639,7 @@ __kfifo_must_check_helper( \
639#define kfifo_to_user(fifo, to, len, copied) \ 639#define kfifo_to_user(fifo, to, len, copied) \
640__kfifo_must_check_helper( \ 640__kfifo_must_check_helper( \
641({ \ 641({ \
642 typeof(fifo + 1) __tmp = (fifo); \ 642 typeof((fifo) + 1) __tmp = (fifo); \
643 void __user *__to = (to); \ 643 void __user *__to = (to); \
644 unsigned int __len = (len); \ 644 unsigned int __len = (len); \
645 unsigned int *__copied = (copied); \ 645 unsigned int *__copied = (copied); \
@@ -666,7 +666,7 @@ __kfifo_must_check_helper( \
666 */ 666 */
667#define kfifo_dma_in_prepare(fifo, sgl, nents, len) \ 667#define kfifo_dma_in_prepare(fifo, sgl, nents, len) \
668({ \ 668({ \
669 typeof(fifo + 1) __tmp = (fifo); \ 669 typeof((fifo) + 1) __tmp = (fifo); \
670 struct scatterlist *__sgl = (sgl); \ 670 struct scatterlist *__sgl = (sgl); \
671 int __nents = (nents); \ 671 int __nents = (nents); \
672 unsigned int __len = (len); \ 672 unsigned int __len = (len); \
@@ -690,7 +690,7 @@ __kfifo_must_check_helper( \
690 */ 690 */
691#define kfifo_dma_in_finish(fifo, len) \ 691#define kfifo_dma_in_finish(fifo, len) \
692(void)({ \ 692(void)({ \
693 typeof(fifo + 1) __tmp = (fifo); \ 693 typeof((fifo) + 1) __tmp = (fifo); \
694 unsigned int __len = (len); \ 694 unsigned int __len = (len); \
695 const size_t __recsize = sizeof(*__tmp->rectype); \ 695 const size_t __recsize = sizeof(*__tmp->rectype); \
696 struct __kfifo *__kfifo = &__tmp->kfifo; \ 696 struct __kfifo *__kfifo = &__tmp->kfifo; \
@@ -717,7 +717,7 @@ __kfifo_must_check_helper( \
717 */ 717 */
718#define kfifo_dma_out_prepare(fifo, sgl, nents, len) \ 718#define kfifo_dma_out_prepare(fifo, sgl, nents, len) \
719({ \ 719({ \
720 typeof(fifo + 1) __tmp = (fifo); \ 720 typeof((fifo) + 1) __tmp = (fifo); \
721 struct scatterlist *__sgl = (sgl); \ 721 struct scatterlist *__sgl = (sgl); \
722 int __nents = (nents); \ 722 int __nents = (nents); \
723 unsigned int __len = (len); \ 723 unsigned int __len = (len); \
@@ -741,7 +741,7 @@ __kfifo_must_check_helper( \
741 */ 741 */
742#define kfifo_dma_out_finish(fifo, len) \ 742#define kfifo_dma_out_finish(fifo, len) \
743(void)({ \ 743(void)({ \
744 typeof(fifo + 1) __tmp = (fifo); \ 744 typeof((fifo) + 1) __tmp = (fifo); \
745 unsigned int __len = (len); \ 745 unsigned int __len = (len); \
746 const size_t __recsize = sizeof(*__tmp->rectype); \ 746 const size_t __recsize = sizeof(*__tmp->rectype); \
747 struct __kfifo *__kfifo = &__tmp->kfifo; \ 747 struct __kfifo *__kfifo = &__tmp->kfifo; \
@@ -766,8 +766,8 @@ __kfifo_must_check_helper( \
766#define kfifo_out_peek(fifo, buf, n) \ 766#define kfifo_out_peek(fifo, buf, n) \
767__kfifo_must_check_helper( \ 767__kfifo_must_check_helper( \
768({ \ 768({ \
769 typeof(fifo + 1) __tmp = (fifo); \ 769 typeof((fifo) + 1) __tmp = (fifo); \
770 typeof(buf + 1) __buf = (buf); \ 770 typeof((buf) + 1) __buf = (buf); \
771 unsigned long __n = (n); \ 771 unsigned long __n = (n); \
772 const size_t __recsize = sizeof(*__tmp->rectype); \ 772 const size_t __recsize = sizeof(*__tmp->rectype); \
773 struct __kfifo *__kfifo = &__tmp->kfifo; \ 773 struct __kfifo *__kfifo = &__tmp->kfifo; \