Re: [PATCH] Remove needless BKL from release functions

David C. Hansen
2001-11-26T17:47:11Z

Christoph Hellwig wrote:

>Beeing completly single-threaded also simplifies writing unclean drivers..
>
>BTW, I've attached a patch that fixes the largest input races (against 2.4.6),
>I don't see how to change the total lack of locking for other data structures
>without an API change, though.
>
The removal of the BKL in the input.c's open() was beyond the scope of
what we were trying to do. But, it snuck into the patch anyway. It
probably shouldn't have been there.

In the patch, in the open function, you do this:
if (handler)
new_fops = fops_get(handler->fops);

But, the fops_get() #define already cheecks to make sure handler isn't null:
#define fops_get(fops) \
(((fops) && (fops)->owner) \
? ( try_inc_mod_count((fops)->owner) ? (fops) : NULL ) \
: (fops))

It's nice to be careful, but is that extra check really necessary?

And, the BKL is still held during the open() call to the handler's
open(). Is this trying to make sure that open() isn't called twice on a
single device? I checked all of the files in drivers/input, and didn't
see any other uses of the BKL.

--
David C. Hansen
haveblue@us.ibm.com