diff options
author | Eric Biggers <ebiggers@google.com> | 2018-01-06 09:45:44 -0800 |
---|---|---|
committer | Al Viro <viro@zeniv.linux.org.uk> | 2018-01-06 13:47:20 -0500 |
commit | 105f2b7096075eacb6d2c83a6e00b652c2951063 (patch) | |
tree | dcbaf6f6ad5f44426a295d6e5aebc329e5355440 /fs/eventfd.c | |
parent | b6364572d641c8eba9eab9bcc31d8962f96ddf15 (diff) |
eventfd: fold eventfd_ctx_get() into eventfd_ctx_fileget()
eventfd_ctx_get() is not used outside of eventfd.c, so unexport it and
fold it into eventfd_ctx_fileget().
(eventfd_ctx_get() was apparently added years ago for KVM irqfd's, but
was never used.)
Signed-off-by: Eric Biggers <ebiggers@google.com>
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Diffstat (limited to 'fs/eventfd.c')
-rw-r--r-- | fs/eventfd.c | 21 |
1 files changed, 6 insertions, 15 deletions
diff --git a/fs/eventfd.c b/fs/eventfd.c index 6138d2b5cdeb..bc0105ae253f 100644 --- a/fs/eventfd.c +++ b/fs/eventfd.c @@ -80,24 +80,11 @@ static void eventfd_free(struct kref *kref) } /** - * eventfd_ctx_get - Acquires a reference to the internal eventfd context. - * @ctx: [in] Pointer to the eventfd context. - * - * Returns: In case of success, returns a pointer to the eventfd context. - */ -struct eventfd_ctx *eventfd_ctx_get(struct eventfd_ctx *ctx) -{ - kref_get(&ctx->kref); - return ctx; -} -EXPORT_SYMBOL_GPL(eventfd_ctx_get); - -/** * eventfd_ctx_put - Releases a reference to the internal eventfd context. * @ctx: [in] Pointer to eventfd context. * * The eventfd context reference must have been previously acquired either - * with eventfd_ctx_get() or eventfd_ctx_fdget(). + * with eventfd_ctx_fdget() or eventfd_ctx_fileget(). */ void eventfd_ctx_put(struct eventfd_ctx *ctx) { @@ -382,10 +369,14 @@ EXPORT_SYMBOL_GPL(eventfd_ctx_fdget); */ struct eventfd_ctx *eventfd_ctx_fileget(struct file *file) { + struct eventfd_ctx *ctx; + if (file->f_op != &eventfd_fops) return ERR_PTR(-EINVAL); - return eventfd_ctx_get(file->private_data); + ctx = file->private_data; + kref_get(&ctx->kref); + return ctx; } EXPORT_SYMBOL_GPL(eventfd_ctx_fileget); |