Messages in this thread | ![/](/images/icornerl.gif) | | Subject | Re: [PATCH 1/5] usb: gadget: f_midi: refactor state machine | From | Clemens Ladisch <> | Date | Thu, 3 Mar 2016 12:38:31 +0100 |
| |
Felipe Ferreri Tonello wrote: > On 02/03/16 21:09, Clemens Ladisch wrote: >> Felipe F. Tonello wrote: >>> This refactor results in a cleaner state machine code >> >> It increases the number of states, and now juggles two state variables. >> I cannot agree to it being cleaner. > > Yes, it increases the number of states. That was done in order to > actually implement a proper finite state machine with one state at a > time and a transition state.
I know, "clean" is subjective. But in what way was the old state machine not "proper"?
And how is handling two states (port->state and next_state) cleaner? As far as I can tell, the requirement for a separate variable comes not from any inherent complexity of the state machine itself, but only because the transmit_packet function was inlined.
Regards, Clemens
| ![\](/images/icornerr.gif) |