aboutsummaryrefslogtreecommitdiffstats
path: root/fs/eventfd.c
diff options
context:
space:
mode:
Diffstat (limited to 'fs/eventfd.c')
-rw-r--r--fs/eventfd.c12
1 files changed, 4 insertions, 8 deletions
diff --git a/fs/eventfd.c b/fs/eventfd.c
index dba15fecf23e..d81b9f654086 100644
--- a/fs/eventfd.c
+++ b/fs/eventfd.c
@@ -46,20 +46,16 @@ struct eventfd_ctx {
46 * value, and we signal this as overflow condition by returining a POLLERR 46 * value, and we signal this as overflow condition by returining a POLLERR
47 * to poll(2). 47 * to poll(2).
48 * 48 *
49 * Returns @n in case of success, a non-negative number lower than @n in case 49 * Returns the amount by which the counter was incrememnted. This will be less
50 * of overflow, or the following error codes: 50 * than @n if the counter has overflowed.
51 *
52 * -EINVAL : The value of @n is negative.
53 */ 51 */
54int eventfd_signal(struct eventfd_ctx *ctx, int n) 52__u64 eventfd_signal(struct eventfd_ctx *ctx, __u64 n)
55{ 53{
56 unsigned long flags; 54 unsigned long flags;
57 55
58 if (n < 0)
59 return -EINVAL;
60 spin_lock_irqsave(&ctx->wqh.lock, flags); 56 spin_lock_irqsave(&ctx->wqh.lock, flags);
61 if (ULLONG_MAX - ctx->count < n) 57 if (ULLONG_MAX - ctx->count < n)
62 n = (int) (ULLONG_MAX - ctx->count); 58 n = ULLONG_MAX - ctx->count;
63 ctx->count += n; 59 ctx->count += n;
64 if (waitqueue_active(&ctx->wqh)) 60 if (waitqueue_active(&ctx->wqh))
65 wake_up_locked_poll(&ctx->wqh, POLLIN); 61 wake_up_locked_poll(&ctx->wqh, POLLIN);