[PATCH 2/2] fixup! usb: gadget: dfu: Wrap fs operation in workqueue

Jules Maselbas jmaselbas at kalray.eu
Mon Mar 1 04:30:40 EST 2021


Simplify the state handle, the idle state will only be entered
from do_close.

Signed-off-by: Jules Maselbas <jmaselbas at kalray.eu>
---
 drivers/usb/gadget/dfu.c | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)

diff --git a/drivers/usb/gadget/dfu.c b/drivers/usb/gadget/dfu.c
index 3234f25b3..1dc659953 100644
--- a/drivers/usb/gadget/dfu.c
+++ b/drivers/usb/gadget/dfu.c
@@ -320,6 +320,8 @@ static void dfu_do_close(struct dfu_work *dw)
 
 	if (!stat(DFU_TEMPFILE, &s))
 		unlink(DFU_TEMPFILE);
+
+	dw->dfu->dfu_state = DFU_STATE_dfuIDLE;
 }
 
 static void dfu_do_copy(struct dfu_work *dw)
@@ -756,11 +758,8 @@ static int dfu_setup(struct usb_function *f, const struct usb_ctrlrequest *ctrl)
 	case DFU_STATE_dfuMANIFEST_SYNC:
 		switch (ctrl->bRequest) {
 		case USB_REQ_DFU_GETSTATUS:
+			dfu->dfu_state = DFU_STATE_dfuMANIFEST;
 			value = dfu_status(f, ctrl);
-			if (dfu_file_entry->flags & FILE_LIST_FLAG_SAFE)
-				dfu->dfu_state = DFU_STATE_dfuMANIFEST;
-			else
-				dfu->dfu_state = DFU_STATE_dfuIDLE;
 			value = min(value, w_length);
 			break;
 		case USB_REQ_DFU_GETSTATE:
-- 
2.17.1





More information about the barebox mailing list