aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux/kfifo.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/linux/kfifo.h')
-rw-r--r--include/linux/kfifo.h28
1 files changed, 17 insertions, 11 deletions
diff --git a/include/linux/kfifo.h b/include/linux/kfifo.h
index 62dbee554f60..10308c6a3d1c 100644
--- a/include/linux/kfifo.h
+++ b/include/linux/kfifo.h
@@ -172,7 +172,13 @@ struct kfifo_rec_ptr_2 __STRUCT_KFIFO_PTR(unsigned char, 2, void);
172 172
173 173
174static inline unsigned int __must_check 174static inline unsigned int __must_check
175__kfifo_must_check_helper(unsigned int val) 175__kfifo_uint_must_check_helper(unsigned int val)
176{
177 return val;
178}
179
180static inline int __must_check
181__kfifo_int_must_check_helper(int val)
176{ 182{
177 return val; 183 return val;
178} 184}
@@ -267,7 +273,7 @@ __kfifo_must_check_helper(unsigned int val)
267 * @fifo: address of the fifo to be used 273 * @fifo: address of the fifo to be used
268 */ 274 */
269#define kfifo_avail(fifo) \ 275#define kfifo_avail(fifo) \
270__kfifo_must_check_helper( \ 276__kfifo_uint_must_check_helper( \
271({ \ 277({ \
272 typeof((fifo) + 1) __tmpq = (fifo); \ 278 typeof((fifo) + 1) __tmpq = (fifo); \
273 const size_t __recsize = sizeof(*__tmpq->rectype); \ 279 const size_t __recsize = sizeof(*__tmpq->rectype); \
@@ -300,7 +306,7 @@ __kfifo_must_check_helper( \
300 * 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.
301 */ 307 */
302#define kfifo_peek_len(fifo) \ 308#define kfifo_peek_len(fifo) \
303__kfifo_must_check_helper( \ 309__kfifo_uint_must_check_helper( \
304({ \ 310({ \
305 typeof((fifo) + 1) __tmp = (fifo); \ 311 typeof((fifo) + 1) __tmp = (fifo); \
306 const size_t __recsize = sizeof(*__tmp->rectype); \ 312 const size_t __recsize = sizeof(*__tmp->rectype); \
@@ -323,7 +329,7 @@ __kfifo_must_check_helper( \
323 * Return 0 if no error, otherwise an error code. 329 * Return 0 if no error, otherwise an error code.
324 */ 330 */
325#define kfifo_alloc(fifo, size, gfp_mask) \ 331#define kfifo_alloc(fifo, size, gfp_mask) \
326__kfifo_must_check_helper( \ 332__kfifo_int_must_check_helper( \
327({ \ 333({ \
328 typeof((fifo) + 1) __tmp = (fifo); \ 334 typeof((fifo) + 1) __tmp = (fifo); \
329 struct __kfifo *__kfifo = &__tmp->kfifo; \ 335 struct __kfifo *__kfifo = &__tmp->kfifo; \
@@ -419,7 +425,7 @@ __kfifo_must_check_helper( \
419 * writer, you don't need extra locking to use these macro. 425 * writer, you don't need extra locking to use these macro.
420 */ 426 */
421#define kfifo_get(fifo, val) \ 427#define kfifo_get(fifo, val) \
422__kfifo_must_check_helper( \ 428__kfifo_uint_must_check_helper( \
423({ \ 429({ \
424 typeof((fifo) + 1) __tmp = (fifo); \ 430 typeof((fifo) + 1) __tmp = (fifo); \
425 typeof((val) + 1) __val = (val); \ 431 typeof((val) + 1) __val = (val); \
@@ -460,7 +466,7 @@ __kfifo_must_check_helper( \
460 * writer, you don't need extra locking to use these macro. 466 * writer, you don't need extra locking to use these macro.
461 */ 467 */
462#define kfifo_peek(fifo, val) \ 468#define kfifo_peek(fifo, val) \
463__kfifo_must_check_helper( \ 469__kfifo_uint_must_check_helper( \
464({ \ 470({ \
465 typeof((fifo) + 1) __tmp = (fifo); \ 471 typeof((fifo) + 1) __tmp = (fifo); \
466 typeof((val) + 1) __val = (val); \ 472 typeof((val) + 1) __val = (val); \
@@ -552,7 +558,7 @@ __kfifo_must_check_helper( \
552 * writer, you don't need extra locking to use these macro. 558 * writer, you don't need extra locking to use these macro.
553 */ 559 */
554#define kfifo_out(fifo, buf, n) \ 560#define kfifo_out(fifo, buf, n) \
555__kfifo_must_check_helper( \ 561__kfifo_uint_must_check_helper( \
556({ \ 562({ \
557 typeof((fifo) + 1) __tmp = (fifo); \ 563 typeof((fifo) + 1) __tmp = (fifo); \
558 typeof((buf) + 1) __buf = (buf); \ 564 typeof((buf) + 1) __buf = (buf); \
@@ -580,7 +586,7 @@ __kfifo_must_check_helper( \
580 * copied. 586 * copied.
581 */ 587 */
582#define kfifo_out_spinlocked(fifo, buf, n, lock) \ 588#define kfifo_out_spinlocked(fifo, buf, n, lock) \
583__kfifo_must_check_helper( \ 589__kfifo_uint_must_check_helper( \
584({ \ 590({ \
585 unsigned long __flags; \ 591 unsigned long __flags; \
586 unsigned int __ret; \ 592 unsigned int __ret; \
@@ -609,7 +615,7 @@ __kfifo_must_check_helper( \
609 * writer, you don't need extra locking to use these macro. 615 * writer, you don't need extra locking to use these macro.
610 */ 616 */
611#define kfifo_from_user(fifo, from, len, copied) \ 617#define kfifo_from_user(fifo, from, len, copied) \
612__kfifo_must_check_helper( \ 618__kfifo_uint_must_check_helper( \
613({ \ 619({ \
614 typeof((fifo) + 1) __tmp = (fifo); \ 620 typeof((fifo) + 1) __tmp = (fifo); \
615 const void __user *__from = (from); \ 621 const void __user *__from = (from); \
@@ -637,7 +643,7 @@ __kfifo_must_check_helper( \
637 * writer, you don't need extra locking to use these macro. 643 * writer, you don't need extra locking to use these macro.
638 */ 644 */
639#define kfifo_to_user(fifo, to, len, copied) \ 645#define kfifo_to_user(fifo, to, len, copied) \
640__kfifo_must_check_helper( \ 646__kfifo_uint_must_check_helper( \
641({ \ 647({ \
642 typeof((fifo) + 1) __tmp = (fifo); \ 648 typeof((fifo) + 1) __tmp = (fifo); \
643 void __user *__to = (to); \ 649 void __user *__to = (to); \
@@ -764,7 +770,7 @@ __kfifo_must_check_helper( \
764 * writer, you don't need extra locking to use these macro. 770 * writer, you don't need extra locking to use these macro.
765 */ 771 */
766#define kfifo_out_peek(fifo, buf, n) \ 772#define kfifo_out_peek(fifo, buf, n) \
767__kfifo_must_check_helper( \ 773__kfifo_uint_must_check_helper( \
768({ \ 774({ \
769 typeof((fifo) + 1) __tmp = (fifo); \ 775 typeof((fifo) + 1) __tmp = (fifo); \
770 typeof((buf) + 1) __buf = (buf); \ 776 typeof((buf) + 1) __buf = (buf); \