diff options
Diffstat (limited to 'include/linux')
| -rw-r--r-- | include/linux/kfifo.h | 32 |
1 files changed, 7 insertions, 25 deletions
diff --git a/include/linux/kfifo.h b/include/linux/kfifo.h index e0f5c9d4197d..a893acda3964 100644 --- a/include/linux/kfifo.h +++ b/include/linux/kfifo.h | |||
| @@ -37,34 +37,25 @@ extern void kfifo_init(struct kfifo *fifo, unsigned char *buffer, | |||
| 37 | extern __must_check int kfifo_alloc(struct kfifo *fifo, unsigned int size, | 37 | extern __must_check int kfifo_alloc(struct kfifo *fifo, unsigned int size, |
| 38 | gfp_t gfp_mask); | 38 | gfp_t gfp_mask); |
| 39 | extern void kfifo_free(struct kfifo *fifo); | 39 | extern void kfifo_free(struct kfifo *fifo); |
| 40 | extern unsigned int __kfifo_put(struct kfifo *fifo, | 40 | extern unsigned int kfifo_put(struct kfifo *fifo, |
| 41 | const unsigned char *buffer, unsigned int len); | 41 | const unsigned char *buffer, unsigned int len); |
| 42 | extern unsigned int __kfifo_get(struct kfifo *fifo, | 42 | extern unsigned int kfifo_get(struct kfifo *fifo, |
| 43 | unsigned char *buffer, unsigned int len); | 43 | unsigned char *buffer, unsigned int len); |
| 44 | 44 | ||
| 45 | /** | 45 | /** |
| 46 | * __kfifo_reset - removes the entire FIFO contents, no locking version | ||
| 47 | * @fifo: the fifo to be emptied. | ||
| 48 | */ | ||
| 49 | static inline void __kfifo_reset(struct kfifo *fifo) | ||
| 50 | { | ||
| 51 | fifo->in = fifo->out = 0; | ||
| 52 | } | ||
| 53 | |||
| 54 | /** | ||
| 55 | * kfifo_reset - removes the entire FIFO contents | 46 | * kfifo_reset - removes the entire FIFO contents |
| 56 | * @fifo: the fifo to be emptied. | 47 | * @fifo: the fifo to be emptied. |
| 57 | */ | 48 | */ |
| 58 | static inline void kfifo_reset(struct kfifo *fifo) | 49 | static inline void kfifo_reset(struct kfifo *fifo) |
| 59 | { | 50 | { |
| 60 | __kfifo_reset(fifo); | 51 | fifo->in = fifo->out = 0; |
| 61 | } | 52 | } |
| 62 | 53 | ||
| 63 | /** | 54 | /** |
| 64 | * __kfifo_len - returns the number of bytes available in the FIFO | 55 | * kfifo_len - returns the number of used bytes in the FIFO |
| 65 | * @fifo: the fifo to be used. | 56 | * @fifo: the fifo to be used. |
| 66 | */ | 57 | */ |
| 67 | static inline unsigned int __kfifo_len(struct kfifo *fifo) | 58 | static inline unsigned int kfifo_len(struct kfifo *fifo) |
| 68 | { | 59 | { |
| 69 | register unsigned int out; | 60 | register unsigned int out; |
| 70 | 61 | ||
| @@ -92,7 +83,7 @@ static inline __must_check unsigned int kfifo_put_locked(struct kfifo *fifo, | |||
| 92 | 83 | ||
| 93 | spin_lock_irqsave(lock, flags); | 84 | spin_lock_irqsave(lock, flags); |
| 94 | 85 | ||
| 95 | ret = __kfifo_put(fifo, from, n); | 86 | ret = kfifo_put(fifo, from, n); |
| 96 | 87 | ||
| 97 | spin_unlock_irqrestore(lock, flags); | 88 | spin_unlock_irqrestore(lock, flags); |
| 98 | 89 | ||
| @@ -117,7 +108,7 @@ static inline __must_check unsigned int kfifo_get_locked(struct kfifo *fifo, | |||
| 117 | 108 | ||
| 118 | spin_lock_irqsave(lock, flags); | 109 | spin_lock_irqsave(lock, flags); |
| 119 | 110 | ||
| 120 | ret = __kfifo_get(fifo, to, n); | 111 | ret = kfifo_get(fifo, to, n); |
| 121 | 112 | ||
| 122 | /* | 113 | /* |
| 123 | * optimization: if the FIFO is empty, set the indices to 0 | 114 | * optimization: if the FIFO is empty, set the indices to 0 |
| @@ -131,13 +122,4 @@ static inline __must_check unsigned int kfifo_get_locked(struct kfifo *fifo, | |||
| 131 | return ret; | 122 | return ret; |
| 132 | } | 123 | } |
| 133 | 124 | ||
| 134 | /** | ||
| 135 | * kfifo_len - returns the number of bytes available in the FIFO | ||
| 136 | * @fifo: the fifo to be used. | ||
| 137 | */ | ||
| 138 | static inline unsigned int kfifo_len(struct kfifo *fifo) | ||
| 139 | { | ||
| 140 | return __kfifo_len(fifo); | ||
| 141 | } | ||
| 142 | |||
| 143 | #endif | 125 | #endif |
