Source-Changes-HG archive

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

[src/trunk]: src/sys/dev/usb store the request buffer in the vxfer instead of...



details:   https://anonhg.NetBSD.org/src/rev/7f5f645f5985
branches:  trunk
changeset: 1008624:7f5f645f5985
user:      maxv <maxv%NetBSD.org@localhost>
date:      Sun Mar 29 09:46:14 2020 +0000

description:
store the request buffer in the vxfer instead of the packet, clearer

diffstat:

 sys/dev/usb/vhci.c |  24 ++++++++++++------------
 1 files changed, 12 insertions(+), 12 deletions(-)

diffs (77 lines):

diff -r 45e421045566 -r 7f5f645f5985 sys/dev/usb/vhci.c
--- a/sys/dev/usb/vhci.c        Sun Mar 29 09:20:43 2020 +0000
+++ b/sys/dev/usb/vhci.c        Sun Mar 29 09:46:14 2020 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: vhci.c,v 1.12 2020/03/24 17:20:55 maxv Exp $ */
+/*     $NetBSD: vhci.c,v 1.13 2020/03/29 09:46:14 maxv Exp $ */
 
 /*
  * Copyright (c) 2019-2020 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: vhci.c,v 1.12 2020/03/24 17:20:55 maxv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: vhci.c,v 1.13 2020/03/29 09:46:14 maxv Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_usb.h"
@@ -173,8 +173,6 @@
  *             +------------------------------------------------+
  */
 
-struct vhci_xfer;
-
 typedef struct {
        int type;
 #define VHCI_REQ_CTRL  0
@@ -184,6 +182,8 @@
        } u;
 } vhci_request_t;
 
+struct vhci_xfer;
+
 typedef struct vhci_packet {
        /* General. */
        TAILQ_ENTRY(vhci_packet) portlist;
@@ -192,9 +192,6 @@
        bool utoh;
        uint8_t addr;
 
-       /* For a request packet, the storage goes there. */
-       vhci_request_t reqbuf;
-
        /* Exposed for FD operations. */
        uint8_t *buf;
        size_t size;
@@ -230,6 +227,9 @@
        size_t npkts;
        vhci_packet_list_t pkts;
 
+       /* Header storage. */
+       vhci_request_t reqbuf;
+
        /* Used for G/C. */
        TAILQ_ENTRY(vhci_xfer) freelist;
 } vhci_xfer_t;
@@ -286,15 +286,15 @@
        req->vxfer = vxfer;
        req->utoh = false;
        req->addr = addr;
-       req->buf = (uint8_t *)&req->reqbuf;
-       req->size = sizeof(req->reqbuf);
+       req->buf = (uint8_t *)&vxfer->reqbuf;
+       req->size = sizeof(vxfer->reqbuf);
        req->cursor = 0;
        npkts++;
 
        /* Init the request buffer. */
-       memset(&req->reqbuf, 0, sizeof(req->reqbuf));
-       req->reqbuf.type = VHCI_REQ_CTRL;
-       memcpy(&req->reqbuf.u.ctrl, &xfer->ux_request,
+       memset(&vxfer->reqbuf, 0, sizeof(vxfer->reqbuf));
+       vxfer->reqbuf.type = VHCI_REQ_CTRL;
+       memcpy(&vxfer->reqbuf.u.ctrl, &xfer->ux_request,
            sizeof(xfer->ux_request));
 
        /* Data packet. */



Home | Main Index | Thread Index | Old Index