Module Name: src Committed By: jakllsch Date: Sun Oct 6 14:08:58 UTC 2024
Modified Files: src/sys/dev/usb: uhci.c Log Message: Simplify/optimize usb_syncmem() in uhci_device_isoc_done() Matches ohci(4) To generate a diff of this commit: cvs rdiff -u -r1.318 -r1.319 src/sys/dev/usb/uhci.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
Modified files: Index: src/sys/dev/usb/uhci.c diff -u src/sys/dev/usb/uhci.c:1.318 src/sys/dev/usb/uhci.c:1.319 --- src/sys/dev/usb/uhci.c:1.318 Fri Apr 5 18:57:10 2024 +++ src/sys/dev/usb/uhci.c Sun Oct 6 14:08:58 2024 @@ -1,4 +1,4 @@ -/* $NetBSD: uhci.c,v 1.318 2024/04/05 18:57:10 riastradh Exp $ */ +/* $NetBSD: uhci.c,v 1.319 2024/10/06 14:08:58 jakllsch Exp $ */ /* * Copyright (c) 1998, 2004, 2011, 2012, 2016, 2020 The NetBSD Foundation, Inc. @@ -42,7 +42,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: uhci.c,v 1.318 2024/04/05 18:57:10 riastradh Exp $"); +__KERNEL_RCSID(0, "$NetBSD: uhci.c,v 1.319 2024/10/06 14:08:58 jakllsch Exp $"); #ifdef _KERNEL_OPT #include "opt_usb.h" @@ -3132,7 +3132,6 @@ uhci_device_isoc_done(struct usbd_xfer * uhci_softc_t *sc __diagused = UHCI_XFER2SC(xfer); struct uhci_pipe *upipe = UHCI_PIPE2UPIPE(xfer->ux_pipe); struct uhci_xfer *ux = UHCI_XFER2UXFER(xfer); - int i, offs; int rd = UE_GET_DIR(upipe->pipe.up_endpoint->ue_edesc->bEndpointAddress) == UE_DIR_IN; UHCIHIST_FUNC(); UHCIHIST_CALLED(); @@ -3164,12 +3163,9 @@ uhci_device_isoc_done(struct usbd_xfer * sizeof(ux->ux_stdend->td.td_status), BUS_DMASYNC_PREWRITE | BUS_DMASYNC_PREREAD); - offs = 0; - for (i = 0; i < xfer->ux_nframes; i++) { - usb_syncmem(&xfer->ux_dmabuf, offs, xfer->ux_frlengths[i], + if (xfer->ux_length) + usb_syncmem(&xfer->ux_dmabuf, 0, xfer->ux_length, rd ? BUS_DMASYNC_POSTREAD : BUS_DMASYNC_POSTWRITE); - offs += xfer->ux_frlengths[i]; - } } void