Am Donnerstag, 27. Juni 2002 23:41 schrieb David Brownell:
> Oliver Neukum wrote:
> > Am Donnerstag, 27. Juni 2002 21:33 schrieben Sie:
> >>OK, I'll let you fix that BKL stuff (didn't you add it
> >>in the first place? :) but this looks like the locking
> >
> > I did not add it. It was there for as long as I can remember.
> > And I can hardly fix it. It is correct.
>
> Bad/missing comments == bad code, correctness aside.
>
> >>is being done at the wrong level:
> >
> > Where would you like it ?
> > In usb_find_interface_driver ?
>
> Yes -- right next to where the module unload issues
> crop up, not several layers higher where such issues
> should be invisible.
OK, here we go again.
You can import this changeset into BK by piping this whole message to:
'| bk receive [path to repository]' or apply the patch as usual.
===================================================================
[EMAIL PROTECTED], 2002-06-28 09:42:53+02:00, [EMAIL PROTECTED]
- reduce BKL usage
diff -Nru a/drivers/usb/core/hub.c b/drivers/usb/core/hub.c
--- a/drivers/usb/core/hub.c Fri Jun 28 09:44:58 2002
+++ b/drivers/usb/core/hub.c Fri Jun 28 09:44:58 2002
@@ -1050,8 +1050,6 @@
static int usb_hub_thread(void *__hub)
{
- lock_kernel();
-
/*
* This thread doesn't need any user-level access,
* so get rid of all our resources
@@ -1072,7 +1070,6 @@
dbg("usb_hub_thread exiting");
- unlock_kernel();
complete_and_exit(&khubd_exited, 0);
}
diff -Nru a/drivers/usb/core/usb.c b/drivers/usb/core/usb.c
--- a/drivers/usb/core/usb.c Fri Jun 28 09:44:58 2002
+++ b/drivers/usb/core/usb.c Fri Jun 28 09:44:58 2002
@@ -683,6 +683,7 @@
goto out_err;
private = NULL;
+ lock_kernel(); /* guard against module unload */
for (tmp = usb_driver_list.next; tmp != &usb_driver_list;) {
driver = list_entry(tmp, struct usb_driver, driver_list);
tmp = tmp->next;
@@ -721,9 +722,11 @@
if (private) {
usb_driver_claim_interface(driver, interface, private);
up(&dev->serialize);
+ unlock_kernel();
return 0;
}
}
+ unlock_kernel();
out_err:
up(&dev->serialize);
@@ -1135,6 +1138,7 @@
info("USB disconnect on device %d", dev->devnum);
+ lock_kernel(); /*guard against modules being unloaded */
if (dev->actconfig) {
for (i = 0; i < dev->actconfig->bNumInterfaces; i++) {
struct usb_interface *interface =
&dev->actconfig->interface[i];
@@ -1156,6 +1160,7 @@
put_device(&interface->dev);
}
}
+ unlock_kernel();
/* Free up all the children.. */
for (i = 0; i < USB_MAXCHILDREN; i++) {
===================================================================
This BitKeeper patch contains the following changesets:
1.646
## Wrapped with gzip_uu ##
begin 664 bkpatch3130
M'XL(`/H3'#T``ZU586^;,!#]'/^*D_IE:[email protected],#F3)U;:>M:J55F?IY`N.2
M*`1/$-I-XL?/A"E).]:L61$(\//=/=][AB.XK4PY'MA\?F]*=@2?;;5RKZ:P
MA1G-[-+D\Z+^,;)EYL"IM0[TVF&OB_"2Q7!5&E-Y#R29FW(3K_0,'%*-!S@2
MFY'5S^]F/)A^_'1[_6'*V&0"Y[.XR,Q7LX+)A"6+T[0V^6A1VGC65FLV<$.<
M(R))+J1"V5`HA-^@XDGJ'E,*HKM$12PK37;:A6N[?!Q.7)%"7RB2C20I)+L`
M'"E?`2>/*X]"X-'8I[$4)YS&G$.WNM.^/L`)P9"S,_A_SN=,PQ!*D];:P-G5
M-=15G!EV!5)2)-G-MD=L^,*#,1YS]KZ'9%JV2ZN\NDK::Z2W9'T>H6I(^-)O
MM")C9$@8Z"067#[7DD<YM2W--G';^I`'/I%HE"NC]G*:U3V<!/HN@<98W<E`
M^'Z:2!F\D-,F\2XG)"%I[<?^^?WF/)#O4Y,^1]$Y`".*N&Q0$D5KQXK@J6'I
MGPS+82A>T;!+>[]C5TCM0^$\VW7R"PS+A_7I/'CSEZ8>X.8+Y%(`M7>G._8K
MMG;=?L5>X/J]BNT:G0MTWQ1.C:\0P[5BZ*0Y2#+YNM^8?LFZ#;E/LO42#Y#L
M4H6M4H/<ZL6WA2D+D[]Y^PZ\8\CJN$PASN)Y4:T<M[3.#=1%;N,4CCUV&9!H
M`P>#=FPWN(54"_T)(+K=T5>MKU@%B9D7V>^:IJN**,/>W)N?F)X9O:CJY03C
/1-^E0<1^`1W#>WY`!P``
`
end
-------------------------------------------------------
This sf.net email is sponsored by:ThinkGeek
Caffeinated soap. No kidding.
http://thinkgeek.com/sf
_______________________________________________
[EMAIL PROTECTED]
To unsubscribe, use the last form field at:
https://lists.sourceforge.net/lists/listinfo/linux-usb-devel