Module Name: src Committed By: riastradh Date: Mon May 20 11:36:21 UTC 2024
Modified Files: src/sys/dev/usb: xhci.c Log Message: xhci(4): Narrow some more variable scopes in xhci_device_isoc_enter. No functional change intended. To generate a diff of this commit: cvs rdiff -u -r1.183 -r1.184 src/sys/dev/usb/xhci.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/xhci.c diff -u src/sys/dev/usb/xhci.c:1.183 src/sys/dev/usb/xhci.c:1.184 --- src/sys/dev/usb/xhci.c:1.183 Mon May 20 11:35:54 2024 +++ src/sys/dev/usb/xhci.c Mon May 20 11:36:20 2024 @@ -1,4 +1,4 @@ -/* $NetBSD: xhci.c,v 1.183 2024/05/20 11:35:54 riastradh Exp $ */ +/* $NetBSD: xhci.c,v 1.184 2024/05/20 11:36:20 riastradh Exp $ */ /* * Copyright (c) 2013 Jonathan A. Kollasch @@ -34,7 +34,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: xhci.c,v 1.183 2024/05/20 11:35:54 riastradh Exp $"); +__KERNEL_RCSID(0, "$NetBSD: xhci.c,v 1.184 2024/05/20 11:36:20 riastradh Exp $"); #ifdef _KERNEL_OPT #include "opt_usb.h" @@ -4560,14 +4560,12 @@ xhci_device_isoc_enter(struct usbd_xfer uint64_t parameter; uint32_t status; uint32_t control; - uint32_t mfindex; uint32_t offs; int i, ival; const bool polling = xhci_polling_p(sc); const uint16_t MPS = UGETW(xfer->ux_pipe->up_endpoint->ue_edesc->wMaxPacketSize); const uint16_t mps = UE_GET_SIZE(MPS); const uint8_t maxb = xpipe->xp_maxb; - u_int tdpc, tbc, tlbpc; XHCIHIST_FUNC(); XHCIHIST_CALLARGS("%#jx slot %ju dci %ju", @@ -4593,7 +4591,8 @@ xhci_device_isoc_enter(struct usbd_xfer ival = 1; /* fake something up */ if (xpipe->xp_isoc_next == -1) { - mfindex = xhci_rt_read_4(sc, XHCI_MFINDEX); + uint32_t mfindex = xhci_rt_read_4(sc, XHCI_MFINDEX); + DPRINTF("mfindex %jx", (uintmax_t)mfindex, 0, 0, 0); mfindex = XHCI_MFINDEX_GET(mfindex + 1); mfindex /= USB_UFRAMES_PER_FRAME; @@ -4604,11 +4603,10 @@ xhci_device_isoc_enter(struct usbd_xfer offs = 0; for (i = 0; i < xfer->ux_nframes; i++) { const uint32_t len = xfer->ux_frlengths[i]; - - tdpc = howmany(len, mps); - tbc = howmany(tdpc, maxb) - 1; - tlbpc = tdpc % maxb; - tlbpc = tlbpc ? tlbpc - 1 : maxb - 1; + const unsigned tdpc = howmany(len, mps); + const unsigned tbc = howmany(tdpc, maxb) - 1; + const unsigned tlbpc1 = tdpc % maxb; + const unsigned tlbpc = tlbpc1 ? tlbpc1 - 1 : maxb - 1; KASSERTMSG(len <= 0x10000, "len %d", len); parameter = DMAADDR(dma, offs);