This is an automated email from the ASF dual-hosted git repository.

xiaoxiang781216 pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/nuttx.git

commit 4b3fb0d98e5c18e66c04f242df83713c253e1bd8
Author: yushuailong <[email protected]>
AuthorDate: Thu Nov 5 00:27:01 2026 +0800

    usbdev/composite: Fix existing nxstyle errors.
    
    Correct switch indentation, continuation alignment and declaration
    spacing in the composite driver so full-file checkpatch can validate
    subsequent interface request fixes.
    
    Only whitespace changes. Verified token equivalence with upstream
    and ran full-file nxstyle successfully.
    
    Assisted-by: Codex:GPT-6
    Signed-off-by: yushuailong <[email protected]>
---
 drivers/usbdev/composite.c | 257 +++++++++++++++++++++++----------------------
 1 file changed, 131 insertions(+), 126 deletions(-)

diff --git a/drivers/usbdev/composite.c b/drivers/usbdev/composite.c
index b93ce2c744d..d11584380bd 100644
--- a/drivers/usbdev/composite.c
+++ b/drivers/usbdev/composite.c
@@ -222,6 +222,7 @@ static int composite_msftdescriptor(FAR struct 
composite_dev_s *priv,
           size_t total_len     = sizeof(struct usb_msft_os_feature_desc_s) +
                                  (response->count - 1) *
                                  sizeof(struct usb_msft_os_function_desc_s);
+
           response->len[0]     = (total_len >> 0) & 0xff;
           response->len[1]     = (total_len >> 8) & 0xff;
           response->len[2]     = (total_len >> 16) & 0xff;
@@ -623,147 +624,151 @@ static int composite_setup(FAR struct 
usbdevclass_driver_s *driver,
 
       switch (ctrl->req)
         {
-        case USB_REQ_GETDESCRIPTOR:
-          {
-            /* The value field specifies the descriptor type in the MS byte
-             * and the descriptor index in the LS byte
-             * (order is little endian)
-             */
-
-            switch (ctrl->value[1])
-              {
-              case USB_DESC_TYPE_DEVICE:
+          case USB_REQ_GETDESCRIPTOR:
+            {
+              /* The value field specifies the descriptor type in the MS byte
+               * and the descriptor index in the LS byte
+               * (order is little endian)
+               */
+
+              switch (ctrl->value[1])
                 {
-                  ret = usbdev_copy_devdesc(ctrlreq->buf,
-                                            priv->descs->devdesc,
-                                            dev->speed);
+                  case USB_DESC_TYPE_DEVICE:
+                    {
+                      ret = usbdev_copy_devdesc(ctrlreq->buf,
+                                                priv->descs->devdesc,
+                                                dev->speed);
 
 #ifdef CONFIG_BOARD_USBDEV_PIDVID
-                  {
-                    uint16_t pid = board_usbdev_pid();
-                    uint16_t vid = board_usbdev_vid();
-                    FAR struct usb_devdesc_s *p_desc =
-                               (FAR struct usb_devdesc_s *)ctrlreq->buf;
-
-                    p_desc->vendor[0] = LSBYTE(vid);
-                    p_desc->vendor[1] = MSBYTE(vid);
-
-                    p_desc->product[0] = LSBYTE(pid);
-                    p_desc->product[1] = MSBYTE(pid);
-                  }
+                      {
+                        uint16_t pid = board_usbdev_pid();
+                        uint16_t vid = board_usbdev_vid();
+                        FAR struct usb_devdesc_s *p_desc =
+                          (FAR struct usb_devdesc_s *)ctrlreq->buf;
+
+                        p_desc->vendor[0] = LSBYTE(vid);
+                        p_desc->vendor[1] = MSBYTE(vid);
+
+                        p_desc->product[0] = LSBYTE(pid);
+                        p_desc->product[1] = MSBYTE(pid);
+                      }
 #endif
-                }
-                break;
+                    }
+                    break;
 
 #ifdef CONFIG_USBDEV_DUALSPEED
-              case USB_DESC_TYPE_DEVICEQUALIFIER:
-                {
-                  ret = USB_SIZEOF_QUALDESC;
-                  memcpy(ctrlreq->buf, priv->descs->qualdesc, ret);
-                }
-                break;
+                  case USB_DESC_TYPE_DEVICEQUALIFIER:
+                    {
+                      ret = USB_SIZEOF_QUALDESC;
+                      memcpy(ctrlreq->buf, priv->descs->qualdesc, ret);
+                    }
+                    break;
 
-              case USB_DESC_TYPE_OTHERSPEEDCONFIG:
+                  case USB_DESC_TYPE_OTHERSPEEDCONFIG:
 #endif
 
-              case USB_DESC_TYPE_CONFIG:
-                {
-                    ret = composite_mkcfgdesc(driver, ctrlreq->buf,
-                                              dev->speed, ctrl->value[1]);
+                  case USB_DESC_TYPE_CONFIG:
+                    {
+                      ret = composite_mkcfgdesc(driver, ctrlreq->buf,
+                                                dev->speed, ctrl->value[1]);
+                    }
+                    break;
+
+                  case USB_DESC_TYPE_STRING:
+                    {
+                      /* value == string index. Zero is the language ID. */
+
+                      uint8_t strid = ctrl->value[0];
+                      FAR struct usb_strdesc_s *buf =
+                        (FAR struct usb_strdesc_s *)ctrlreq->buf;
+
+                      ret = composite_mkstrdesc(driver, strid, buf);
+                    }
+                    break;
+
+                  default:
+                    {
+                      usbtrace(
+                        TRACE_CLSERROR(
+                          USBCOMPOSITE_TRACEERR_GETUNKNOWNDESC),
+                        value);
+                    }
+                    break;
                 }
-                break;
+            }
+            break;
 
-              case USB_DESC_TYPE_STRING:
+          case USB_REQ_SETCONFIGURATION:
+            {
+              if (ctrl->type == 0)
                 {
-                  /* value == string index. Zero is the language ID. */
+                  int i;
+
+                  if (priv->config == value)
+                    {
+                      /* Already configured -- Do nothing */
+
+                      ret = OK;
+                      break;
+                    }
+
+                  /* Save the configuration and inform the constituent
+                   * classes
+                   */
+
+                  for (i = 0; i < priv->ndevices; i++)
+                    {
+                      ret = CLASS_SETUP(priv->device[i].dev,
+                                        dev,
+                                        ctrl,
+                                        dataout,
+                                        outlen);
+                    }
+
+                  priv->config = value;
+                }
+            }
+            break;
 
-                  uint8_t strid = ctrl->value[0];
-                  FAR struct usb_strdesc_s *buf =
-                             (FAR struct usb_strdesc_s *)ctrlreq->buf;
+          case USB_REQ_GETCONFIGURATION:
+            {
+              if (ctrl->type == USB_DIR_IN)
+                {
+                  ctrlreq->buf[0] = priv->config;
+                  ret = 1;
+                }
+            }
+            break;
 
-                  ret = composite_mkstrdesc(driver, strid, buf);
+          case USB_REQ_SETINTERFACE:
+            {
+              if (ctrl->type == USB_REQ_RECIPIENT_INTERFACE &&
+                  priv->config != COMPOSITE_CONFIGIDNONE)
+                {
+                  ret = composite_classsetup(priv, dev, ctrl,
+                                             dataout, outlen);
+                  dispatched = true;
                 }
-                break;
+            }
+            break;
 
-              default:
+          case USB_REQ_GETINTERFACE:
+            {
+              if (ctrl->type ==
+                    (USB_DIR_IN | USB_REQ_RECIPIENT_INTERFACE) &&
+                  priv->config == COMPOSITE_CONFIGIDNONE)
                 {
-                  usbtrace(
-                       TRACE_CLSERROR(USBCOMPOSITE_TRACEERR_GETUNKNOWNDESC),
-                       value);
+                  ret = composite_classsetup(priv, dev, ctrl,
+                                             dataout, outlen);
+                  dispatched = true;
                 }
-                break;
-              }
-          }
-          break;
-
-        case USB_REQ_SETCONFIGURATION:
-          {
-            if (ctrl->type == 0)
-              {
-                int i;
-
-                if (priv->config == value)
-                  {
-                    /* Already configured -- Do nothing */
-
-                    ret = OK;
-                    break;
-                  }
-
-                /* Save the configuration and inform the constituent
-                 * classes
-                 */
-
-                for (i = 0; i < priv->ndevices; i++)
-                  {
-                    ret = CLASS_SETUP(priv->device[i].dev,
-                                      dev,
-                                      ctrl,
-                                      dataout,
-                                      outlen);
-                  }
-
-                priv->config = value;
-              }
-          }
-          break;
-
-        case USB_REQ_GETCONFIGURATION:
-          {
-            if (ctrl->type == USB_DIR_IN)
-              {
-                ctrlreq->buf[0] = priv->config;
-                ret = 1;
-              }
-          }
-          break;
-
-        case USB_REQ_SETINTERFACE:
-          {
-            if (ctrl->type == USB_REQ_RECIPIENT_INTERFACE &&
-                priv->config != COMPOSITE_CONFIGIDNONE)
-              {
-                ret = composite_classsetup(priv, dev, ctrl, dataout, outlen);
-                dispatched = true;
-              }
-          }
-          break;
-
-        case USB_REQ_GETINTERFACE:
-          {
-            if (ctrl->type == (USB_DIR_IN | USB_REQ_RECIPIENT_INTERFACE) &&
-                priv->config == COMPOSITE_CONFIGIDNONE)
-              {
-                ret = composite_classsetup(priv, dev, ctrl, dataout, outlen);
-                dispatched = true;
-              }
-           }
-           break;
-
-        default:
-          usbtrace(TRACE_CLSERROR(USBCOMPOSITE_TRACEERR_UNSUPPORTEDSTDREQ),
-                   ctrl->req);
-          break;
+            }
+            break;
+
+          default:
+            usbtrace(TRACE_CLSERROR(USBCOMPOSITE_TRACEERR_UNSUPPORTEDSTDREQ),
+                     ctrl->req);
+            break;
         }
     }
 #ifdef CONFIG_COMPOSITE_MSFT_OS_DESCRIPTORS
@@ -781,9 +786,9 @@ static int composite_setup(FAR struct usbdevclass_driver_s 
*driver,
        * Non-Standard Class Requests
        **********************************************************************/
 
-       /* Class implementations should handle their own interface and
-        * endpoint requests.
-        */
+      /* Class implementations should handle their own interface and
+       * endpoint requests.
+       */
 
       ret = composite_classsetup(priv, dev, ctrl, dataout, outlen);
       dispatched = true;

Reply via email to