From 781a6a5cf8982f5e2522c1a9481e61cacef7cfff Mon Sep 17 00:00:00 2001 From: mglocker Date: Mon, 1 Feb 2021 09:21:51 +0000 Subject: [PATCH] Align the mixed naming for the variables used to reference to bInterfaceNumber and bAlternateSetting as following: ifaceidx -> ifaceno altidx -> altno Suggested and ok mpi@ --- sys/dev/usb/ugen.c | 16 ++++++++-------- sys/dev/usb/usb_subr.c | 28 ++++++++++++++-------------- sys/dev/usb/usbdi.c | 14 +++++++------- sys/dev/usb/usbdi.h | 4 ++-- 4 files changed, 31 insertions(+), 31 deletions(-) diff --git a/sys/dev/usb/ugen.c b/sys/dev/usb/ugen.c index 452f755e3b1..78d990b1821 100644 --- a/sys/dev/usb/ugen.c +++ b/sys/dev/usb/ugen.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ugen.c,v 1.113 2021/01/28 12:50:28 mglocker Exp $ */ +/* $OpenBSD: ugen.c,v 1.114 2021/02/01 09:21:51 mglocker Exp $ */ /* $NetBSD: ugen.c,v 1.63 2002/11/26 18:49:48 christos Exp $ */ /* $FreeBSD: src/sys/dev/usb/ugen.c,v 1.26 1999/11/17 22:33:41 n_hibma Exp $ */ @@ -893,7 +893,7 @@ ugen_isoc_rintr(struct usbd_xfer *xfer, void *addr, usbd_status status) } int -ugen_set_interface(struct ugen_softc *sc, int ifaceidx, int altno) +ugen_set_interface(struct ugen_softc *sc, int ifaceno, int altno) { struct usbd_interface *iface; usb_config_descriptor_t *cdesc; @@ -903,14 +903,14 @@ ugen_set_interface(struct ugen_softc *sc, int ifaceidx, int altno) uint8_t endptno, endpt; int dir, err; - DPRINTFN(15, ("ugen_set_interface %d %d\n", ifaceidx, altno)); + DPRINTFN(15, ("ugen_set_interface %d %d\n", ifaceno, altno)); cdesc = usbd_get_config_descriptor(sc->sc_udev); - if (ifaceidx < 0 || ifaceidx >= cdesc->bNumInterfaces || - usbd_iface_claimed(sc->sc_udev, ifaceidx)) + if (ifaceno < 0 || ifaceno >= cdesc->bNumInterfaces || + usbd_iface_claimed(sc->sc_udev, ifaceno)) return (USBD_INVAL); - err = usbd_device2interface_handle(sc->sc_udev, ifaceidx, &iface); + err = usbd_device2interface_handle(sc->sc_udev, ifaceno, &iface); if (err) return (err); id = usbd_get_interface_descriptor(iface); @@ -941,12 +941,12 @@ ugen_set_interface(struct ugen_softc *sc, int ifaceidx, int altno) } int -ugen_get_alt_index(struct ugen_softc *sc, int ifaceidx) +ugen_get_alt_index(struct ugen_softc *sc, int ifaceno) { struct usbd_interface *iface; usbd_status err; - err = usbd_device2interface_handle(sc->sc_udev, ifaceidx, &iface); + err = usbd_device2interface_handle(sc->sc_udev, ifaceno, &iface); if (err) return (-1); return (usbd_get_interface_altindex(iface)); diff --git a/sys/dev/usb/usb_subr.c b/sys/dev/usb/usb_subr.c index 802c85b9b9a..1fdfdcae535 100644 --- a/sys/dev/usb/usb_subr.c +++ b/sys/dev/usb/usb_subr.c @@ -1,4 +1,4 @@ -/* $OpenBSD: usb_subr.c,v 1.153 2021/01/27 17:28:19 mglocker Exp $ */ +/* $OpenBSD: usb_subr.c,v 1.154 2021/02/01 09:21:51 mglocker Exp $ */ /* $NetBSD: usb_subr.c,v 1.103 2003/01/10 11:19:13 augustss Exp $ */ /* $FreeBSD: src/sys/dev/usb/usb_subr.c,v 1.18 1999/11/17 22:33:47 n_hibma Exp $ */ @@ -428,7 +428,7 @@ usbd_reset_port(struct usbd_device *dev, int port) } usb_interface_descriptor_t * -usbd_find_idesc(usb_config_descriptor_t *cd, int ifaceidx, int altidx) +usbd_find_idesc(usb_config_descriptor_t *cd, int ifaceno, int altno) { char *p = (char *)cd; char *end = p + UGETW(cd->wTotalLength); @@ -437,9 +437,9 @@ usbd_find_idesc(usb_config_descriptor_t *cd, int ifaceidx, int altidx) for (curidx = lastidx = -1; p < end; ) { d = (usb_interface_descriptor_t *)p; - DPRINTFN(4,("usbd_find_idesc: idx=%d(%d) altidx=%d(%d) len=%d " - "type=%d\n", - ifaceidx, curidx, altidx, curaidx, + DPRINTFN(4,("usbd_find_idesc: ifaceno=%d(%d) altno=%d(%d) " + "len=%d type=%d\n", + ifaceno, curidx, altno, curaidx, d->bLength, d->bDescriptorType)); if (d->bLength == 0) /* bad descriptor */ break; @@ -451,7 +451,7 @@ usbd_find_idesc(usb_config_descriptor_t *cd, int ifaceidx, int altidx) curaidx = 0; } else curaidx++; - if (ifaceidx == curidx && altidx == curaidx) + if (ifaceno == curidx && altno == curaidx) return (d); } } @@ -459,7 +459,7 @@ usbd_find_idesc(usb_config_descriptor_t *cd, int ifaceidx, int altidx) } usb_endpoint_descriptor_t * -usbd_find_edesc(usb_config_descriptor_t *cd, int ifaceidx, int altidx, +usbd_find_edesc(usb_config_descriptor_t *cd, int ifaceno, int altno, int endptidx) { char *p = (char *)cd; @@ -468,7 +468,7 @@ usbd_find_edesc(usb_config_descriptor_t *cd, int ifaceidx, int altidx, usb_endpoint_descriptor_t *e; int curidx; - d = usbd_find_idesc(cd, ifaceidx, altidx); + d = usbd_find_idesc(cd, ifaceno, altno); if (d == NULL) return (NULL); if (endptidx >= d->bNumEndpoints) /* quick exit */ @@ -492,15 +492,15 @@ usbd_find_edesc(usb_config_descriptor_t *cd, int ifaceidx, int altidx, } usbd_status -usbd_fill_iface_data(struct usbd_device *dev, int ifaceidx, int altidx) +usbd_fill_iface_data(struct usbd_device *dev, int ifaceno, int altno) { - struct usbd_interface *ifc = &dev->ifaces[ifaceidx]; + struct usbd_interface *ifc = &dev->ifaces[ifaceno]; usb_interface_descriptor_t *idesc; int nendpt; - DPRINTFN(4,("%s: ifaceidx=%d altidx=%d\n", __func__, ifaceidx, altidx)); + DPRINTFN(4,("%s: ifaceno=%d altno=%d\n", __func__, ifaceno, altno)); - idesc = usbd_find_idesc(dev->cdesc, ifaceidx, altidx); + idesc = usbd_find_idesc(dev->cdesc, ifaceno, altno); if (idesc == NULL) return (USBD_INVAL); @@ -509,8 +509,8 @@ usbd_fill_iface_data(struct usbd_device *dev, int ifaceidx, int altidx) ifc->device = dev; ifc->idesc = idesc; - ifc->index = ifaceidx; - ifc->altindex = altidx; + ifc->index = ifaceno; + ifc->altindex = altno; ifc->endpoints = NULL; ifc->priv = NULL; LIST_INIT(&ifc->pipes); diff --git a/sys/dev/usb/usbdi.c b/sys/dev/usb/usbdi.c index cf8bad76d44..38785e06c1c 100644 --- a/sys/dev/usb/usbdi.c +++ b/sys/dev/usb/usbdi.c @@ -1,4 +1,4 @@ -/* $OpenBSD: usbdi.c,v 1.108 2021/01/29 11:44:06 edd Exp $ */ +/* $OpenBSD: usbdi.c,v 1.109 2021/02/01 09:21:51 mglocker Exp $ */ /* $NetBSD: usbdi.c,v 1.103 2002/09/27 15:37:38 provos Exp $ */ /* $FreeBSD: src/sys/dev/usb/usbdi.c,v 1.28 1999/11/17 22:33:49 n_hibma Exp $ */ @@ -98,15 +98,15 @@ usbd_get_devcnt(struct usbd_device *dev) } void -usbd_claim_iface(struct usbd_device *dev, int ifaceidx) +usbd_claim_iface(struct usbd_device *dev, int ifaceno) { - dev->ifaces[ifaceidx].claimed = 1; + dev->ifaces[ifaceno].claimed = 1; } int -usbd_iface_claimed(struct usbd_device *dev, int ifaceidx) +usbd_iface_claimed(struct usbd_device *dev, int ifaceno) { - return (dev->ifaces[ifaceidx].claimed); + return (dev->ifaces[ifaceno].claimed); } #ifdef USB_DEBUG @@ -659,7 +659,7 @@ usbd_device2interface_handle(struct usbd_device *dev, u_int8_t ifaceno, /* XXXX use altno */ usbd_status -usbd_set_interface(struct usbd_interface *iface, int altidx) +usbd_set_interface(struct usbd_interface *iface, int altno) { usb_device_request_t req; usbd_status err; @@ -671,7 +671,7 @@ usbd_set_interface(struct usbd_interface *iface, int altidx) endpoints = iface->endpoints; nendpt = iface->nendpt; - err = usbd_fill_iface_data(iface->device, iface->index, altidx); + err = usbd_fill_iface_data(iface->device, iface->index, altno); if (err) return (err); diff --git a/sys/dev/usb/usbdi.h b/sys/dev/usb/usbdi.h index c16956592e4..05209bcb809 100644 --- a/sys/dev/usb/usbdi.h +++ b/sys/dev/usb/usbdi.h @@ -1,4 +1,4 @@ -/* $OpenBSD: usbdi.h,v 1.70 2018/05/01 18:14:46 landry Exp $ */ +/* $OpenBSD: usbdi.h,v 1.71 2021/02/01 09:21:51 mglocker Exp $ */ /* $NetBSD: usbdi.h,v 1.62 2002/07/11 21:14:35 augustss Exp $ */ /* $FreeBSD: src/sys/dev/usb/usbdi.h,v 1.18 1999/11/17 22:33:49 n_hibma Exp $ */ @@ -136,7 +136,7 @@ int usbd_get_interface_altindex(struct usbd_interface *iface); usb_interface_descriptor_t *usbd_find_idesc(usb_config_descriptor_t *cd, int iindex, int ano); usb_endpoint_descriptor_t *usbd_find_edesc(usb_config_descriptor_t *cd, - int ifaceidx, int altidx, int endptidx); + int ifaceno, int altno, int endptidx); void usbd_dopoll(struct usbd_device *); void usbd_set_polling(struct usbd_device *iface, int on); -- 2.20.1