From 86da4d11eabd37c8c95397ebb54e0712410b001f Mon Sep 17 00:00:00 2001 From: Justin Hammond Date: Mon, 28 Sep 2026 13:03:00 +0800 Subject: [PATCH] drivers/usbhost: Correct the style of usbhost_hub.c. nxstyle reports fourteen errors in this file. The switch in usbhost_hub_configdesc() puts its case labels level with the brace that opens the switch rather than one step further in, and a declaration is followed straight away by a statement. CI checks every file a patch touches rather than only the lines it changes, so these have to go before anything else in this file can be altered. Whitespace, three comments rewrapped to stay inside the line limit after the extra indent, and one blank line. No code changes: git diff -w shows only the comments. Assisted-by: Claude:claude-opus-5 Signed-off-by: Justin Hammond --- drivers/usbhost/usbhost_hub.c | 114 ++++++++++++++++++---------------- 1 file changed, 60 insertions(+), 54 deletions(-) diff --git a/drivers/usbhost/usbhost_hub.c b/drivers/usbhost/usbhost_hub.c index a2ea159de00..bd682a0d205 100644 --- a/drivers/usbhost/usbhost_hub.c +++ b/drivers/usbhost/usbhost_hub.c @@ -387,77 +387,82 @@ static inline int usbhost_cfgdesc(FAR struct usbhost_class_s *hubclass, desc = (FAR struct usb_desc_s *)configdesc; switch (desc->type) { - /* Interface descriptor. We really should get the number of endpoints - * from this descriptor too. - */ + /* Interface descriptor. We really should get the number of + * endpoints + * from this descriptor too. + */ - case USB_DESC_TYPE_INTERFACE: - { - FAR struct usb_ifdesc_s *ifdesc = - (FAR struct usb_ifdesc_s *)configdesc; + case USB_DESC_TYPE_INTERFACE: + { + FAR struct usb_ifdesc_s *ifdesc = + (FAR struct usb_ifdesc_s *)configdesc; - uinfo("Interface descriptor\n"); - DEBUGASSERT(remaining >= USB_SIZEOF_IFDESC); + uinfo("Interface descriptor\n"); + DEBUGASSERT(remaining >= USB_SIZEOF_IFDESC); - /* Save the interface number and mark ONLY the interface found */ + /* Save the interface number and mark ONLY the interface + * found. + */ - priv->ifno = ifdesc->ifno; - found = USBHOST_IFFOUND; - } - break; + priv->ifno = ifdesc->ifno; + found = USBHOST_IFFOUND; + } + break; - /* Endpoint descriptor. Here, we expect one interrupt IN endpoints. */ + /* Endpoint descriptor. Here, we expect one interrupt IN + * endpoint. + */ - case USB_DESC_TYPE_ENDPOINT: - { - FAR struct usb_epdesc_s *epdesc = - (FAR struct usb_epdesc_s *)configdesc; + case USB_DESC_TYPE_ENDPOINT: + { + FAR struct usb_epdesc_s *epdesc = + (FAR struct usb_epdesc_s *)configdesc; - uinfo("Endpoint descriptor\n"); - DEBUGASSERT(remaining >= USB_SIZEOF_EPDESC); + uinfo("Endpoint descriptor\n"); + DEBUGASSERT(remaining >= USB_SIZEOF_EPDESC); - /* Check for an interrupt endpoint. */ + /* Check for an interrupt endpoint. */ - if ((epdesc->attr & USB_EP_ATTR_XFERTYPE_MASK) == - USB_EP_ATTR_XFER_INT) - { - /* Yes.. it is a interrupt endpoint. IN or OUT? */ + if ((epdesc->attr & USB_EP_ATTR_XFERTYPE_MASK) == + USB_EP_ATTR_XFER_INT) + { + /* Yes.. it is a interrupt endpoint. IN or OUT? */ - if (USB_ISEPOUT(epdesc->addr)) - { - /* It is an OUT interrupt endpoint. Ignore */ + if (USB_ISEPOUT(epdesc->addr)) + { + /* It is an OUT interrupt endpoint. Ignore */ - uinfo("Interrupt OUT EP addr:%d mxpacketsize:%d\n", - (epdesc->addr & USB_EP_ADDR_NUMBER_MASK), - usbhost_getle16(epdesc->mxpacketsize)); - } - else - { - /* It is an IN interrupt endpoint. */ + uinfo("Interrupt OUT EP addr:%d mxpacketsize:%d\n", + (epdesc->addr & USB_EP_ADDR_NUMBER_MASK), + usbhost_getle16(epdesc->mxpacketsize)); + } + else + { + /* It is an IN interrupt endpoint. */ - found |= USBHOST_EPINFOUND; + found |= USBHOST_EPINFOUND; - /* Save the interrupt IN endpoint information */ + /* Save the interrupt IN endpoint information */ - intindesc.addr = epdesc->addr & - USB_EP_ADDR_NUMBER_MASK; - intindesc.interval = epdesc->interval; - intindesc.mxpacketsize = usbhost_getle16( - epdesc->mxpacketsize); + intindesc.addr = epdesc->addr & + USB_EP_ADDR_NUMBER_MASK; + intindesc.interval = epdesc->interval; + intindesc.mxpacketsize = usbhost_getle16( + epdesc->mxpacketsize); - uinfo("Interrupt IN EP:"); - uinfo(" addr=%d interval=%d mxpacketsize=%d\n", - intindesc.addr, intindesc.interval, - intindesc.mxpacketsize); - } - } - } - break; + uinfo("Interrupt IN EP:"); + uinfo(" addr=%d interval=%d mxpacketsize=%d\n", + intindesc.addr, intindesc.interval, + intindesc.mxpacketsize); + } + } + } + break; - /* Other descriptors are just ignored for now */ + /* Other descriptors are just ignored for now */ - default: - break; + default: + break; } /* If we found everything we need with this interface, then break out @@ -1023,6 +1028,7 @@ static void usbhost_hub_event(FAR void *arg) bool ishubclass = (connport->devclass->connect == usbhost_connect); + CLASS_DISCONNECTED(connport->devclass); if (ishubclass)