xiaoxiang781216 commented on code in PR #15545:
URL: https://github.com/apache/nuttx/pull/15545#discussion_r1916038583


##########
arch/sim/src/sim/sim_usbdev.c:
##########
@@ -1008,9 +1018,9 @@ static int sim_usbdev_pullup(struct usbdev_s *dev, bool 
enable)
 
   usbtrace(TRACE_DEVPULLUP, (uint16_t)enable);
 
-  flags = enter_critical_section();
+  flags = spin_lock_irqsave(&g_sim_usbdev.lock);

Review Comment:
    cast to `cstruct sim_usbdev_s *priv = (struct sim_usbdev_s *)dev;`



##########
arch/sim/src/sim/sim_usbdev.c:
##########
@@ -792,9 +802,9 @@ static int sim_ep_cancel(struct usbdev_ep_s *ep, struct 
usbdev_req_s *req)
 
   usbtrace(TRACE_EPCANCEL, USB_EPNO(ep->eplog));
 
-  flags = enter_critical_section();
+  flags = spin_lock_irqsave(&g_sim_usbdev.lock);

Review Comment:
   let's cast:
   ```
   struct sim_ep_s *privep = (struct sim_ep_s *)ep;
   ```
   to avoid using global variables



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to