* BKL in tiglusb release function
@ 2002-04-05 0:38 Dave Hansen
[not found] ` <3CAD74DA.58561BF7@free.fr>
0 siblings, 1 reply; 2+ messages in thread
From: Dave Hansen @ 2002-04-05 0:38 UTC (permalink / raw)
To: Romain Lievin, Julien BLACHE; +Cc: linux-kernel, linux-usb-devel
[-- Attachment #1: Type: text/plain, Size: 298 bytes --]
Is there a reason for the BKL to be used in tiglusb_release()? Are you
worried about a race between open and release, or were you just
following examples from other code?
I'm sure we can remove it safely. We might need another lock, but it
won't be much.
--
Dave Hansen
haveblue@us.ibm.com
[-- Attachment #2: tiglusb-bkl_remove-2.5.8-pre1.patch --]
[-- Type: text/plain, Size: 389 bytes --]
--- linux-2.5.8-pre1-clean/drivers/usb/tiglusb.c Thu Apr 4 08:58:26 2002
+++ linux/drivers/usb/tiglusb.c Thu Apr 4 16:29:31 2002
@@ -128,7 +128,6 @@
{
ptiglusb_t s = (ptiglusb_t) file->private_data;
- lock_kernel ();
down (&s->mutex);
s->state = _stopped;
up (&s->mutex);
@@ -139,7 +138,6 @@
wake_up (&s->remove_ok);
s->opened = 0;
- unlock_kernel ();
return 0;
}
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: BKL in tiglusb release function
[not found] ` <3CAD74DA.58561BF7@free.fr>
@ 2002-04-05 16:58 ` Dave Hansen
0 siblings, 0 replies; 2+ messages in thread
From: Dave Hansen @ 2002-04-05 16:58 UTC (permalink / raw)
To: roms, linux-kernel
Romain Liévin wrote:
> I have followed examples from other codes such as dabusb.c &
> printer.c (2.4.14). After a further look: - dabusb.c from 2.4.14
> contains a kernel_lock/unlock couple only in _release but it has
> been removed in 2.5.7 - printer.c contains a kernel_lock/unlock
> couple in _open & _release in both 2.4.14 and 2.5.7
I was probably responsible for the removal from dabusb.c. In almost all
cases that I found (over 60 of them), the BKL is not needed in the
release function.
The use of s->mutex confuses me. In tiglusb_disconnect(), there is an
up(). Where is the matching down? The comment for the mutex just says,
"locks this struct". However, it is clear that it doesn't protect the
whole structure. There are many places where structure members are
accessed without the lock being held.
--
Dave Hansen
haveblue@us.ibm.com
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2002-04-05 16:58 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2002-04-05 0:38 BKL in tiglusb release function Dave Hansen
[not found] ` <3CAD74DA.58561BF7@free.fr>
2002-04-05 16:58 ` Dave Hansen
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox