[prev in list] [next in list] [prev in thread] [next in thread]
List: linux-usb-devel
Subject: [linux-usb-devel] [bk patch][2.4 series] bugfix for serial/ipaq.c
From: ganesh () vxindia ! veritas ! com (V Ganesh)
Date: 2002-07-27 18:48:12
[Download RAW message or body]
hi,
this is a bk export -tpatch followed by a bk send -wgzip_uu -r+ -
for ipaq.c for the 2.4 kernel.
thanks,
ganesh
# This is a BitKeeper generated patch for the following project:
# Project Name: greg k-h's linux 2.4 USB kernel tree
# This patch format is intended for GNU patch command version 2.5 or higher.
# This patch includes the following deltas:
# ChangeSet 1.739 -> 1.740
# drivers/usb/serial/ipaq.c 1.11 -> 1.12
#
# The following is the BitKeeper ChangeSet Log
# --------------------------------------------
# 02/07/27 ganesh@veritas.com 1.740
# Buggy error handling fixed. Retry the "kickstart" packet much harder -
# this greatly reduces instances of connection failures.
# --------------------------------------------
#
diff -Nru a/drivers/usb/serial/ipaq.c b/drivers/usb/serial/ipaq.c
--- a/drivers/usb/serial/ipaq.c Sat Jul 27 04:07:05 2002
+++ b/drivers/usb/serial/ipaq.c Sat Jul 27 04:07:05 2002
@@ -9,6 +9,10 @@
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
+ * (26/7/2002) ganesh
+ * Fixed up broken error handling in ipaq_open. Retry the "kickstart"
+ * packet much harder - this drastically reduces connection failures.
+ *
* (30/4/2002) ganesh
* Added support for the Casio EM500. Completely untested. Thanks
* to info from Nathan <wfilardo@fuse.net>
@@ -57,6 +61,8 @@
#include "usb-serial.h"
#include "ipaq.h"
+#define KP_RETRIES 100
+
/*
* Version Information
*/
@@ -123,6 +129,7 @@
struct ipaq_private *priv;
struct ipaq_packet *pkt;
int i, result = 0;
+ int retries = KP_RETRIES;
if (port_paranoia_check(port, __FUNCTION__)) {
return -ENODEV;
@@ -142,7 +149,8 @@
priv = (struct ipaq_private *)kmalloc(sizeof(struct ipaq_private), GFP_KERNEL);
if (priv == NULL) {
err("%s - Out of memory", __FUNCTION__);
- return -ENOMEM;
+ result = -ENOMEM;
+ goto error;
}
port->private = (void *)priv;
priv->active = 0;
@@ -204,34 +212,47 @@
result = usb_submit_urb(port->read_urb);
if (result) {
err("%s - failed submitting read urb, error %d", __FUNCTION__, result);
+ goto cleanup;
}
/*
- * Send out two control messages observed in win98 sniffs. Not sure what
- * they do.
- */
-
- result = usb_control_msg(serial->dev, usb_sndctrlpipe(serial->dev, 0), 0x22, 0x21,
- 0x1, 0, NULL, 0, 5 * HZ);
- if (result < 0) {
- err("%s - failed doing control urb, error %d", __FUNCTION__, result);
+ * Send out control message observed in win98 sniffs. Not sure what
+ * it does, but from empirical observations, it seems that the device
+ * will start the chat sequence once one of these messages gets
+ * through. Since this has a reasonably high failure rate, we retry
+ * several times.
+ */
+
+ while (retries--) {
+ result = usb_control_msg(serial->dev,
+ usb_sndctrlpipe(serial->dev, 0), 0x22, 0x21,
+ 0x1, 0, NULL, 0, HZ / 10 + 1);
+ if (result == 0) {
+ break;
+ }
}
- result = usb_control_msg(serial->dev, usb_sndctrlpipe(serial->dev, 0), 0x22, 0x21,
- 0x1, 0, NULL, 0, 5 * HZ);
if (result < 0) {
err("%s - failed doing control urb, error %d", __FUNCTION__, result);
+ goto cleanup;
}
}
-
+
up(&port->sem);
+ return 0;
- return result;
-
enomem:
+ err("%s - Out of memory", __FUNCTION__);
+ result = -ENOMEM;
+cleanup:
ipaq_destroy_lists(port);
kfree(priv);
- err("%s - Out of memory", __FUNCTION__);
- return -ENOMEM;
+error:
+ port->private = NULL;
+ port->open_count = 0;
+ port->active = 0;
+ up(&port->sem);
+ MOD_DEC_USE_COUNT;
+ return result;
}
This BitKeeper patch contains the following changesets:
+
## Wrapped with gzip_uu ##
begin 664 bkpatch3040
M'XL(`#W/03T``[56VV[;.!!]%K]BD&`721O;)'5+'+CH-G%;HVD2),W+HH!!
M2[1%6!)=DHH3K/??=RBYZ37%7KJ&+-'#X=',.8>$=^'&2C,,%J*6MB"[\%I;
M-PQNI5%.V'ZF*XQ=:8VQ0:$K.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DT^W;$XKN]CK#-][AHT>^,0@\!FVSC-GRI5:R2\R
M@.[C]X[S]LZV*^@=P]\'<'YS=M8.7O\.`T`YGP+;;PV@YKZDKH01@G1%!3-L
M>MDF_.GU]VZ<<,Z_;X_6C)/N\=X/6AMAHXVI@;89ART`'FHA"=!N>SN_6-P7
M%R@[BE+)2IO[G0.83E_>G)^\FUR<3Z>^O&\MNWWK$#'#L,.,("6M@X<D6&GC
M>L]6>&R@-KC.]WW\,>RW+C+<U!Z1/H0%[K];N0TUJ[U?N["5E2_A[<7I]'1\
J,KVY'D]/+F[.WQT_=-95=_SISU%62#P+FFK$DYS.1"S(7^;7?0>%"0``
`
end
-------------------------------------------------------
This sf.net email is sponsored by:ThinkGeek
Welcome to geek heaven.
http://thinkgeek.com/sf
_______________________________________________
linux-usb-devel@lists.sourceforge.net
To unsubscribe, use the last form field at:
https://lists.sourceforge.net/lists/listinfo/linux-usb-devel
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic