Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/dev/usb Fix PR kern/42838 using option #1 as described b...



details:   https://anonhg.NetBSD.org/src/rev/355d62094a7f
branches:  trunk
changeset: 752979:355d62094a7f
user:      scw <scw%NetBSD.org@localhost>
date:      Sat Mar 13 16:28:13 2010 +0000

description:
Fix PR kern/42838 using option #1 as described by KIYOHARA Takashi in
http://mail-index.netbsd.org/current-users/2010/02/20/msg012654.html

Add a comment in struct ucom_methods to explain usage of 'ptr' and 'count'
in the ucom_read handler.

diffstat:

 sys/dev/usb/ucomvar.h |  10 +++++++++-
 sys/dev/usb/uftdi.c   |   7 +++----
 2 files changed, 12 insertions(+), 5 deletions(-)

diffs (53 lines):

diff -r b626f931a670 -r 355d62094a7f sys/dev/usb/ucomvar.h
--- a/sys/dev/usb/ucomvar.h     Sat Mar 13 16:27:06 2010 +0000
+++ b/sys/dev/usb/ucomvar.h     Sat Mar 13 16:28:13 2010 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: ucomvar.h,v 1.17 2008/05/24 16:40:58 cube Exp $        */
+/*     $NetBSD: ucomvar.h,v 1.18 2010/03/13 16:28:13 scw Exp $ */
 
 /*
  * Copyright (c) 1999 The NetBSD Foundation, Inc.
@@ -47,6 +47,14 @@
                          void *data, int flag, usb_proc_ptr p);
        int (*ucom_open)(void *sc, int portno);
        void (*ucom_close)(void *sc, int portno);
+       /*
+        * Note: The 'ptr' and 'count' pointers can be adjusted as follows:
+        *  ptr: If consuming characters from the start of the buffer,
+        *       advance '*ptr' to skip the data consumed.
+        *  count: If consuming characters at the end of the buffer,
+        *         decrement '*count' by the number of characters consumed.
+        * If consuming all characters, set '*count' to zero.
+        */
        void (*ucom_read)(void *sc, int portno, u_char **ptr, u_int32_t *count);
        void (*ucom_write)(void *sc, int portno, u_char *to, u_char *from,
                           u_int32_t *count);
diff -r b626f931a670 -r 355d62094a7f sys/dev/usb/uftdi.c
--- a/sys/dev/usb/uftdi.c       Sat Mar 13 16:27:06 2010 +0000
+++ b/sys/dev/usb/uftdi.c       Sat Mar 13 16:28:13 2010 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: uftdi.c,v 1.45 2010/01/18 20:57:13 martin Exp $        */
+/*     $NetBSD: uftdi.c,v 1.46 2010/03/13 16:28:13 scw Exp $   */
 
 /*
  * Copyright (c) 2000 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: uftdi.c,v 1.45 2010/01/18 20:57:13 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: uftdi.c,v 1.46 2010/03/13 16:28:13 scw Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -426,9 +426,8 @@
                ucom_status_change(device_private(sc->sc_subdev[portno-1]));
        }
 
-       /* Pick up status and adjust data part. */
+       /* Adjust buffer pointer to skip status prefix */
        *ptr += 2;
-       *count -= 2;
 }
 
 Static void



Home | Main Index | Thread Index | Old Index