lynxis lazus has uploaded this change for review. (
https://gerrit.osmocom.org/c/osmo-asf4-dfu/+/42171?usp=email )
Change subject: dfu: irq: replace if(states) with a switch case
......................................................................
dfu: irq: replace if(states) with a switch case
Improves the overview. No functional change.
Change-Id: Ic32fe16dff4b7bb933ec62e36a9c7c7829aece1b
---
M usb/class/dfu/device/dfudf.c
1 file changed, 8 insertions(+), 2 deletions(-)
git pull ssh://gerrit.osmocom.org:29418/osmo-asf4-dfu refs/changes/71/42171/1
diff --git a/usb/class/dfu/device/dfudf.c b/usb/class/dfu/device/dfudf.c
index 5bdb64a..882cad8 100644
--- a/usb/class/dfu/device/dfudf.c
+++ b/usb/class/dfu/device/dfudf.c
@@ -167,9 +167,12 @@
response[4] = dfu_state; // set state
response[5] = 0; // string not used
to_return = usbdc_xfer(ep, response, 6, false); // send back
status
- if (USB_DFU_STATE_DFU_DNLOAD_SYNC == dfu_state) { // download
has not completed
+
+ switch (dfu_state) {
+ case USB_DFU_STATE_DFU_DNLOAD_SYNC: // download has not
completed
dfu_state = USB_DFU_STATE_DFU_DNBUSY; // switch to busy
state
- } else if (USB_DFU_STATE_DFU_MANIFEST_SYNC == dfu_state) {
+ break;
+ case USB_DFU_STATE_DFU_MANIFEST_SYNC:
if (!dfu_manifestation_complete) {
dfu_state = USB_DFU_STATE_DFU_MANIFEST; // go
to manifest mode
} else if (usb_dfu_func_desc->bmAttributes &
USB_DFU_ATTRIBUTES_MANIFEST_TOLERANT) {
@@ -177,6 +180,9 @@
} else { // this should not happen (after manifestation
the state should be dfuMANIFEST-WAIT-RESET if we are not manifest tolerant)
dfu_state =
USB_DFU_STATE_DFU_MANIFEST_WAIT_RESET; // wait for reset
}
+ break;
+ default:
+ break;
}
break;
case USB_DFU_GETSTATE: // get state
--
To view, visit https://gerrit.osmocom.org/c/osmo-asf4-dfu/+/42171?usp=email
To unsubscribe, or for help writing mail filters, visit
https://gerrit.osmocom.org/settings?usp=email
Gerrit-MessageType: newchange
Gerrit-Project: osmo-asf4-dfu
Gerrit-Branch: master
Gerrit-Change-Id: Ic32fe16dff4b7bb933ec62e36a9c7c7829aece1b
Gerrit-Change-Number: 42171
Gerrit-PatchSet: 1
Gerrit-Owner: lynxis lazus <[email protected]>