Re: [PATCH 1/5] usb: gadget: f_midi: refactor state machine

From: Felipe Ferreri Tonello
Date: Thu Mar 03 2016 - 03:55:32 EST


Hi Clemens,

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. The result is a much cleaner MIDI parser
that is easy to maintain and read.

I recommend you to apply the patch yourself (it's on top of Balbi's next
branch) because the patch can be confusing to understand the end result.

>
>> and as a result fixed a bug when packaging a USB-MIDI packet right after
>> a non-conformant MIDI byte stream.
>
> I have been unable to determine where exactly the new code behaves
> differently. Can you show an example?

Sorry, I forgot to remove this comment since your last revision. There
is no bug I could reproduce with the previous parser.

--
Felipe

Attachment: 0x92698E6A.asc
Description: application/pgp-keys