On 3/2/26 5:45 AM, Ronan Dalton wrote:

[...]

@@ -276,19 +279,22 @@ int usb_control_msg(struct usb_device *dev, unsigned int 
pipe,
  int usb_bulk_msg(struct usb_device *dev, unsigned int pipe,
                        void *data, int len, int *actual_length, int timeout)
  {
+       volatile unsigned long usb_status;
+
        if (len < 0)
                return -EINVAL;
+ if (timeout < 0)
+               return -EINVAL;
+
        dev->status = USB_ST_NOT_PROC; /*not yet processed */
if (submit_bulk_msg(dev, pipe, data, len) < 0)
                return -EIO;
- while (timeout--) {
-               if (!((volatile unsigned long)dev->status & USB_ST_NOT_PROC))
-                       break;
-               mdelay(1);
-       }
+       read_poll_timeout((volatile unsigned long), usb_status,
+                         !(usb_status & USB_ST_NOT_PROC), 1000,
+                         timeout * 1000UL, dev->status);

Maybe this could use an error check here too ?

With that fixed:

Reviewed-by: Marek Vasut <[email protected]>

Reply via email to