Hi,
here's the new version. It has a lockup bug I am chasing.
Regards
Oliver
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-10-10 19:14:32+02:00, [EMAIL PROTECTED]
- conf patches
diff -Nru a/drivers/usb/core/hub.c b/drivers/usb/core/hub.c
--- a/drivers/usb/core/hub.c Thu Oct 10 19:15:07 2002
+++ b/drivers/usb/core/hub.c Thu Oct 10 19:15:07 2002
@@ -1236,7 +1236,7 @@
return 1;
}
- ret = usb_set_configuration(dev, dev->actconfig->bConfigurationValue);
+ ret = do_set_conf(dev, dev->actconfig->bConfigurationValue);
if (ret < 0) {
err("failed to set dev %s active configuration (error=%d)",
dev->devpath, ret);
diff -Nru a/drivers/usb/core/message.c b/drivers/usb/core/message.c
--- a/drivers/usb/core/message.c Thu Oct 10 19:15:07 2002
+++ b/drivers/usb/core/message.c Thu Oct 10 19:15:07 2002
@@ -838,6 +838,43 @@
}
/**
+ * do_set_conf - send the actual message changing configuration
+ * @dev: the device whose configuration is being updated
+ * @configuration: the configuration being chosen.
+ * Context: !in_interrupt ()
+ */
+int do_set_conf(struct usb_device *dev, int configuration)
+{
+ int r,i;
+ struct usb_config_descriptor *cp;
+
+ for (i=0; i<dev->descriptor.bNumConfigurations; i++) {
+ if (dev->config[i].bConfigurationValue == configuration) {
+ cp = &dev->config[i];
+ goto found;
+ }
+ }
+
+ return -EINVAL;
+
+found:
+
+ r = usb_control_msg(dev, usb_sndctrlpipe(dev, 0),
+ USB_REQ_SET_CONFIGURATION, 0, configuration, 0,
+ NULL, 0, HZ * USB_CTRL_SET_TIMEOUT);
+ if (r)
+ return r;
+
+ dev->actconfig = cp;
+ dev->toggle[0] = 0;
+ dev->toggle[1] = 0;
+ usb_set_maxpacket(dev);
+
+ return 0;
+
+}
+
+/**
* usb_set_configuration - Makes a particular device setting be current
* @dev: the device whose configuration is being updated
* @configuration: the configuration being chosen.
@@ -871,7 +908,7 @@
{
int i, ret;
struct usb_config_descriptor *cp = NULL;
-
+
for (i=0; i<dev->descriptor.bNumConfigurations; i++) {
if (dev->config[i].bConfigurationValue == configuration) {
cp = &dev->config[i];
@@ -882,18 +919,23 @@
warn("selecting invalid configuration %d", configuration);
return -EINVAL;
}
+
+ ret = 0;
- if ((ret = usb_control_msg(dev, usb_sndctrlpipe(dev, 0),
- USB_REQ_SET_CONFIGURATION, 0, configuration, 0,
- NULL, 0, HZ * USB_CTRL_SET_TIMEOUT)) < 0)
- return ret;
+ down(&dev->serialize);
- dev->actconfig = cp;
- dev->toggle[0] = 0;
- dev->toggle[1] = 0;
- usb_set_maxpacket(dev);
+ usb_reap_interfaces(dev);
- return 0;
+ if ((ret = do_set_conf(dev, configuration)))
+ goto err;
+
+
+
+ dev->desired_conf = configuration; /* for pm */
+
+err:
+ up(&dev->serialize);
+ return ret;
}
diff -Nru a/drivers/usb/core/usb.c b/drivers/usb/core/usb.c
--- a/drivers/usb/core/usb.c Thu Oct 10 19:15:07 2002
+++ b/drivers/usb/core/usb.c Thu Oct 10 19:15:07 2002
@@ -75,6 +75,7 @@
{
struct usb_interface * intf = to_usb_interface(dev);
struct usb_driver * driver = to_usb_driver(dev->driver);
+ struct usb_device * udev = interface_to_usbdev(intf);
const struct usb_device_id *id;
int error = -ENODEV;
int m;
@@ -94,7 +95,9 @@
if (id) {
dbg ("%s - got id", __FUNCTION__);
down (&driver->serialize);
+ down (&udev->serialize);
error = driver->probe (intf, id);
+ up (&udev->serialize);
up (&driver->serialize);
}
if (!error)
@@ -110,10 +113,12 @@
{
struct usb_interface *intf;
struct usb_driver *driver;
+ struct usb_device *udev;
int m;
intf = list_entry(dev,struct usb_interface,dev);
driver = to_usb_driver(dev->driver);
+ udev = interface_to_usbdev(intf);
if (!driver) {
err("%s does not have a valid driver to work with!",
@@ -135,6 +140,7 @@
* the holder of the lock guards against
* module unload */
down(&driver->serialize);
+ down(&udev->serialize);
if (intf->driver && intf->driver->disconnect)
intf->driver->disconnect(intf);
@@ -143,6 +149,7 @@
if (intf->driver)
usb_driver_release_interface(driver, intf);
+ up(&udev->serialize);
up(&driver->serialize);
if (driver->owner)
__MOD_DEC_USE_COUNT(driver->owner);
@@ -317,7 +324,7 @@
* usb_driver_release_interface - unbind a driver from an interface
* @driver: the driver to be unbound
* @iface: the interface from which it will be unbound
- *
+ *
* This should be used by drivers to release their claimed interfaces.
* It is normally called in their disconnect() methods, and only for
* drivers that bound to more than one interface in their probe().
@@ -761,6 +768,26 @@
return -1;
}
+/** usb_reap_interfaces - disconnect all interfaces of a usb device
+ * @dev: pointer to the device whose interfaces shall be disconnected
+ * Context: !in_interrupt ()
+ *
+ * Getting rid of interfaces associated with drivers.
+ * This is for physical disconnection and configuration changes
+ */
+void usb_reap_interfaces(struct usb_device *dev)
+{
+ int i;
+
+ if (dev->actconfig) {
+ for (i = 0; i < dev->actconfig->bNumInterfaces; i++) {
+ struct usb_interface *interface =
+&dev->actconfig->interface[i];
+
+ /* remove this interface */
+ put_device(&interface->dev);
+ }
+ }
+}
/**
* usb_disconnect - disconnect a device (usbcore-internal)
* @pdev: pointer to device being disconnected
@@ -792,14 +819,7 @@
usb_disconnect(child);
}
- if (dev->actconfig) {
- for (i = 0; i < dev->actconfig->bNumInterfaces; i++) {
- struct usb_interface *interface =
&dev->actconfig->interface[i];
-
- /* remove this interface */
- put_device(&interface->dev);
- }
- }
+ usb_reap_interfaces(dev);
/* Free the device number and remove the /proc/bus/usb entry */
if (dev->devnum > 0) {
@@ -1008,7 +1028,7 @@
}
/* we set the default configuration here */
- err = usb_set_configuration(dev, dev->config[0].bConfigurationValue);
+ err = do_set_conf(dev, dev->config[0].bConfigurationValue);
if (err) {
err("failed to set device %d default configuration (error=%d)",
dev->devnum, err);
diff -Nru a/include/linux/usb.h b/include/linux/usb.h
--- a/include/linux/usb.h Thu Oct 10 19:15:07 2002
+++ b/include/linux/usb.h Thu Oct 10 19:15:07 2002
@@ -375,6 +375,7 @@
int have_langid; /* whether string_langid is valid yet */
int string_langid; /* language ID for strings */
+ int desired_conf; /* configuration to restore on resume */
void *hcpriv; /* Host Controller private data */
@@ -1032,6 +1033,8 @@
struct scatterlist *sg, int n_hw_ents);
void usb_buffer_unmap_sg (struct usb_device *dev, unsigned pipe,
struct scatterlist *sg, int n_hw_ents);
+void usb_reap_interfaces(struct usb_device *dev);
+int do_set_conf(struct usb_device *dev, int configuration);
/*-------------------------------------------------------------------*
* SYNCHRONOUS CALL SUPPORT *
===================================================================
This BitKeeper patch contains the following changesets:
1.890
## Wrapped with gzip_uu ##
begin 664 bkpatch1752
M'XL(`)NUI3T``[58;5/;1A#^+/V*[60F8UYLWTFG-[MD2(`FGE)(">1#0\8C
M2V=;@RUI]`))Z_SW[IV,+(&,BU,2$XF[W;WG]NU9YQ5<I3SI*=$LN.6)^@H^
M1&F&O_(P"GEG&LWY+`CS;YTHF>#F113A9E<L=PN-[NBFG26<IUUOK!DJRGQT
M,V\*N)7V%-K1RY7L>\Q[RL7)^ZO3MQ>J>G``1U,WG/!//(.#`W5T<^CG?-:Y
M22)W*HY;E-L+C1!*J680W3"IL=!L76<+:I*1CZ^^9CGCD>FHB>_GX<R-#Z/4
MGSVVH%%";&)IS*`+W6*6HQX#[=@.`:)U*<$/4*='64_7]HC6(P2*&QXV^0+V
M&+2)^@Y^'O:1ZD$;O"@<0RP<Q5/U=V`ZT4WUX\I%:ON9?U25N$1]`Y.$3PX+
M=%XT7_B)N%/:S=-1UXL2WIWS-'4GO.-)'Q&3Z-1@C)H+2DSF+,:FP72;6:9O
M4YOHHZ><LLDX)?C7HKIA+0@QJ87H'KLO"+U9[O.NM"HL=:8K1S)B,+)`8,Q:
M^)JF^[9O&&.3Z29]$M@:HU5$FF$QO1%1]59"U:OB<=!3FLX,MO!,C7/#UJCE
MC5R=&,_S5&FXYB73T<R-F*9Y`R:=,DU?>-0UQX:E,^:/#,-Z)J;2<#URS'9D
M^3;+-]?REGC53=E;A8BU33032XQ0PS9E=9MZO;CUGF']E^*FT*8O6-SHP'-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ZM99;)9Z2R9;].6CLSU@P#T`6
MK.7%)3&5^H))E$F$_6`<Y:%?$HLBQ_(\":%],CC[_/94<)84Z0GR$LRQO&26
M1+/A/)T4["$6T]#WLF06!S$O%LG.OCA&N?KT;GAQ\N?PT\GE\.C\[+?!^ZN+
MMY>#\S,4V:]#%BM2Y^SJ]%1N?_@+HR@L'%U>G$H3EX,_3LZO+@4;"L<D.ZBP
M!)U(1]<Y&"'+`,C5+)I,9AP)3M)_?9'>+\K+8$K,W6^QZ]WP;$FE*^<0X98?
M^(.3G'IL6TP0;/&XQA=;]%+E_AL."A_;M@E,[#BK<?+QO&@[5$HY;`.GVW)$
M'L@'*=S06O-UJIX1.\)9,NY8".(2UZ7#JMP!#S*I#T@E<HR;B[*Y5E&[5XR]
ACVY1QH)G_=7_NF&7\FZ0;@Y\FSA\C&3X+Z\_@=/@$P``
`
end
-------------------------------------------------------
This sf.net email is sponsored by:ThinkGeek
Welcome to geek heaven.
http://thinkgeek.com/sf
_______________________________________________
[EMAIL PROTECTED]
To unsubscribe, use the last form field at:
https://lists.sourceforge.net/lists/listinfo/linux-usb-devel