[XS] Change in osmo-asf4-dfu[master]: dfu: irq: replace if(states) with a switch case
laforge has submitted this change. ( 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, 7 insertions(+), 2 deletions(-) Approvals: laforge: Looks good to me, approved Jenkins Builder: Verified diff --git a/usb/class/dfu/device/dfudf.c b/usb/class/dfu/device/dfudf.c index a067185..76dcc9b 100644 --- a/usb/class/dfu/device/dfudf.c +++ b/usb/class/dfu/device/dfudf.c @@ -162,9 +162,11 @@ case USB_DFU_GETSTATUS: // get status // per DFU 1.1 spec, bState must report the state the device will enter // after this response, so perform state transitions before building response - if (USB_DFU_STATE_DFU_DNLOAD_SYNC == dfu_state) { + 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) { @@ -172,6 +174,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; } response[0] = dfu_status; // set status response[1] = 10; // set poll timeout (24 bits, in milliseconds) to small value for periodical poll -- 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: merged Gerrit-Project: osmo-asf4-dfu Gerrit-Branch: master Gerrit-Change-Id: Ic32fe16dff4b7bb933ec62e36a9c7c7829aece1b Gerrit-Change-Number: 42171 Gerrit-PatchSet: 4 Gerrit-Owner: lynxis lazus <lynxis@fe80.eu> Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: laforge <laforge@osmocom.org> Gerrit-Reviewer: pespin <pespin@sysmocom.de> Gerrit-CC: Hoernchen <ewild@sysmocom.de>
participants (1)
-
laforge