Re: [PATCH] input: remove BKL from uinput open function

From: Dmitry Torokhov
Date: Wed Feb 03 2010 - 00:08:15 EST


On Tue, Feb 02, 2010 at 12:18:35AM +0100, John Kacur wrote:
>
> Sorry, maybe I am doing a poor job of explaining myself. My question
> was whether your driver needs to call uinput_release() or not if it
> went through your proposed error path, because that is where you have
> the call to the uinput_destroy_device() function.
> After taking a fresh look at your code I don't believe that it does.
> However, you could still hoist your code that calls nonseekable_open()
> above all that init stuff in uinput_open(), just under the return
> -ENOMEM if you think that it could fail.
> However, I still think that nonseekable_open() is designed from the
> "get-go" to never fail, so I think your code is unnecessarily
> complicated, by just a little bit. It will still work, so you decide
> which to go with. I'm fine with either way.
>

OK, so how about the patch below? If it is accepted I will just switch
to

nonseekable_open(inode, file);
return 0;

style. I gonna add Al and akpm to CC to see if the patch will stick...

--
Dmitry

VFS: clarify that nonseekable_open() will never fail

Signed-off-by: Dmitry Torokhov <dtor@xxxxxxx>
---

fs/open.c | 4 +++-
1 files changed, 3 insertions(+), 1 deletions(-)


diff --git a/fs/open.c b/fs/open.c
index 040cef7..02ceb73 100644
--- a/fs/open.c
+++ b/fs/open.c
@@ -1200,7 +1200,9 @@ EXPORT_SYMBOL(generic_file_open);

/*
* This is used by subsystems that don't want seekable
- * file descriptors
+ * file descriptors. The function is not supposed to ever fail, the only
+ * reason it returns an 'int' and not 'void' is so that it can be plugged
+ * directly into file_operations structure.
*/
int nonseekable_open(struct inode *inode, struct file *filp)
{
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/