diff options
| -rw-r--r-- | include/linux/kfifo.h | 33 |
1 files changed, 21 insertions, 12 deletions
diff --git a/include/linux/kfifo.h b/include/linux/kfifo.h index c238ad2f82ea..10308c6a3d1c 100644 --- a/include/linux/kfifo.h +++ b/include/linux/kfifo.h | |||
| @@ -171,8 +171,17 @@ struct kfifo_rec_ptr_2 __STRUCT_KFIFO_PTR(unsigned char, 2, void); | |||
| 171 | } | 171 | } |
| 172 | 172 | ||
| 173 | 173 | ||
| 174 | /* __kfifo_must_check_helper() is temporarily disabled because it was faulty */ | 174 | static inline unsigned int __must_check |
| 175 | #define __kfifo_must_check_helper(x) (x) | 175 | __kfifo_uint_must_check_helper(unsigned int val) |
| 176 | { | ||
| 177 | return val; | ||
| 178 | } | ||
| 179 | |||
| 180 | static inline int __must_check | ||
| 181 | __kfifo_int_must_check_helper(int val) | ||
| 182 | { | ||
| 183 | return val; | ||
| 184 | } | ||
| 176 | 185 | ||
| 177 | /** | 186 | /** |
| 178 | * kfifo_initialized - Check if the fifo is initialized | 187 | * kfifo_initialized - Check if the fifo is initialized |
| @@ -264,7 +273,7 @@ struct kfifo_rec_ptr_2 __STRUCT_KFIFO_PTR(unsigned char, 2, void); | |||
| 264 | * @fifo: address of the fifo to be used | 273 | * @fifo: address of the fifo to be used |
| 265 | */ | 274 | */ |
| 266 | #define kfifo_avail(fifo) \ | 275 | #define kfifo_avail(fifo) \ |
| 267 | __kfifo_must_check_helper( \ | 276 | __kfifo_uint_must_check_helper( \ |
| 268 | ({ \ | 277 | ({ \ |
| 269 | typeof((fifo) + 1) __tmpq = (fifo); \ | 278 | typeof((fifo) + 1) __tmpq = (fifo); \ |
| 270 | const size_t __recsize = sizeof(*__tmpq->rectype); \ | 279 | const size_t __recsize = sizeof(*__tmpq->rectype); \ |
| @@ -297,7 +306,7 @@ __kfifo_must_check_helper( \ | |||
| 297 | * This function returns the size of the next fifo record in number of bytes. | 306 | * This function returns the size of the next fifo record in number of bytes. |
| 298 | */ | 307 | */ |
| 299 | #define kfifo_peek_len(fifo) \ | 308 | #define kfifo_peek_len(fifo) \ |
| 300 | __kfifo_must_check_helper( \ | 309 | __kfifo_uint_must_check_helper( \ |
| 301 | ({ \ | 310 | ({ \ |
| 302 | typeof((fifo) + 1) __tmp = (fifo); \ | 311 | typeof((fifo) + 1) __tmp = (fifo); \ |
| 303 | const size_t __recsize = sizeof(*__tmp->rectype); \ | 312 | const size_t __recsize = sizeof(*__tmp->rectype); \ |
| @@ -320,7 +329,7 @@ __kfifo_must_check_helper( \ | |||
| 320 | * Return 0 if no error, otherwise an error code. | 329 | * Return 0 if no error, otherwise an error code. |
| 321 | */ | 330 | */ |
| 322 | #define kfifo_alloc(fifo, size, gfp_mask) \ | 331 | #define kfifo_alloc(fifo, size, gfp_mask) \ |
| 323 | __kfifo_must_check_helper( \ | 332 | __kfifo_int_must_check_helper( \ |
| 324 | ({ \ | 333 | ({ \ |
| 325 | typeof((fifo) + 1) __tmp = (fifo); \ | 334 | typeof((fifo) + 1) __tmp = (fifo); \ |
| 326 | struct __kfifo *__kfifo = &__tmp->kfifo; \ | 335 | struct __kfifo *__kfifo = &__tmp->kfifo; \ |
| @@ -416,7 +425,7 @@ __kfifo_must_check_helper( \ | |||
| 416 | * writer, you don't need extra locking to use these macro. | 425 | * writer, you don't need extra locking to use these macro. |
| 417 | */ | 426 | */ |
| 418 | #define kfifo_get(fifo, val) \ | 427 | #define kfifo_get(fifo, val) \ |
| 419 | __kfifo_must_check_helper( \ | 428 | __kfifo_uint_must_check_helper( \ |
| 420 | ({ \ | 429 | ({ \ |
| 421 | typeof((fifo) + 1) __tmp = (fifo); \ | 430 | typeof((fifo) + 1) __tmp = (fifo); \ |
| 422 | typeof((val) + 1) __val = (val); \ | 431 | typeof((val) + 1) __val = (val); \ |
| @@ -457,7 +466,7 @@ __kfifo_must_check_helper( \ | |||
| 457 | * writer, you don't need extra locking to use these macro. | 466 | * writer, you don't need extra locking to use these macro. |
| 458 | */ | 467 | */ |
| 459 | #define kfifo_peek(fifo, val) \ | 468 | #define kfifo_peek(fifo, val) \ |
| 460 | __kfifo_must_check_helper( \ | 469 | __kfifo_uint_must_check_helper( \ |
| 461 | ({ \ | 470 | ({ \ |
| 462 | typeof((fifo) + 1) __tmp = (fifo); \ | 471 | typeof((fifo) + 1) __tmp = (fifo); \ |
| 463 | typeof((val) + 1) __val = (val); \ | 472 | typeof((val) + 1) __val = (val); \ |
| @@ -549,7 +558,7 @@ __kfifo_must_check_helper( \ | |||
| 549 | * writer, you don't need extra locking to use these macro. | 558 | * writer, you don't need extra locking to use these macro. |
| 550 | */ | 559 | */ |
| 551 | #define kfifo_out(fifo, buf, n) \ | 560 | #define kfifo_out(fifo, buf, n) \ |
| 552 | __kfifo_must_check_helper( \ | 561 | __kfifo_uint_must_check_helper( \ |
| 553 | ({ \ | 562 | ({ \ |
| 554 | typeof((fifo) + 1) __tmp = (fifo); \ | 563 | typeof((fifo) + 1) __tmp = (fifo); \ |
| 555 | typeof((buf) + 1) __buf = (buf); \ | 564 | typeof((buf) + 1) __buf = (buf); \ |
| @@ -577,7 +586,7 @@ __kfifo_must_check_helper( \ | |||
| 577 | * copied. | 586 | * copied. |
| 578 | */ | 587 | */ |
| 579 | #define kfifo_out_spinlocked(fifo, buf, n, lock) \ | 588 | #define kfifo_out_spinlocked(fifo, buf, n, lock) \ |
| 580 | __kfifo_must_check_helper( \ | 589 | __kfifo_uint_must_check_helper( \ |
| 581 | ({ \ | 590 | ({ \ |
| 582 | unsigned long __flags; \ | 591 | unsigned long __flags; \ |
| 583 | unsigned int __ret; \ | 592 | unsigned int __ret; \ |
| @@ -606,7 +615,7 @@ __kfifo_must_check_helper( \ | |||
| 606 | * writer, you don't need extra locking to use these macro. | 615 | * writer, you don't need extra locking to use these macro. |
| 607 | */ | 616 | */ |
| 608 | #define kfifo_from_user(fifo, from, len, copied) \ | 617 | #define kfifo_from_user(fifo, from, len, copied) \ |
| 609 | __kfifo_must_check_helper( \ | 618 | __kfifo_uint_must_check_helper( \ |
| 610 | ({ \ | 619 | ({ \ |
| 611 | typeof((fifo) + 1) __tmp = (fifo); \ | 620 | typeof((fifo) + 1) __tmp = (fifo); \ |
| 612 | const void __user *__from = (from); \ | 621 | const void __user *__from = (from); \ |
| @@ -634,7 +643,7 @@ __kfifo_must_check_helper( \ | |||
| 634 | * writer, you don't need extra locking to use these macro. | 643 | * writer, you don't need extra locking to use these macro. |
| 635 | */ | 644 | */ |
| 636 | #define kfifo_to_user(fifo, to, len, copied) \ | 645 | #define kfifo_to_user(fifo, to, len, copied) \ |
| 637 | __kfifo_must_check_helper( \ | 646 | __kfifo_uint_must_check_helper( \ |
| 638 | ({ \ | 647 | ({ \ |
| 639 | typeof((fifo) + 1) __tmp = (fifo); \ | 648 | typeof((fifo) + 1) __tmp = (fifo); \ |
| 640 | void __user *__to = (to); \ | 649 | void __user *__to = (to); \ |
| @@ -761,7 +770,7 @@ __kfifo_must_check_helper( \ | |||
| 761 | * writer, you don't need extra locking to use these macro. | 770 | * writer, you don't need extra locking to use these macro. |
| 762 | */ | 771 | */ |
| 763 | #define kfifo_out_peek(fifo, buf, n) \ | 772 | #define kfifo_out_peek(fifo, buf, n) \ |
| 764 | __kfifo_must_check_helper( \ | 773 | __kfifo_uint_must_check_helper( \ |
| 765 | ({ \ | 774 | ({ \ |
| 766 | typeof((fifo) + 1) __tmp = (fifo); \ | 775 | typeof((fifo) + 1) __tmp = (fifo); \ |
| 767 | typeof((buf) + 1) __buf = (buf); \ | 776 | typeof((buf) + 1) __buf = (buf); \ |
