Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755308AbcCCLij (ORCPT ); Thu, 3 Mar 2016 06:38:39 -0500 Received: from dehamd003.servertools24.de ([31.47.254.18]:59557 "EHLO dehamd003.servertools24.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755170AbcCCLih (ORCPT ); Thu, 3 Mar 2016 06:38:37 -0500 Subject: Re: [PATCH 1/5] usb: gadget: f_midi: refactor state machine To: Felipe Ferreri Tonello , linux-usb@vger.kernel.org References: <1456947640-20673-1-git-send-email-eu@felipetonello.com> <1456947640-20673-2-git-send-email-eu@felipetonello.com> <56D7567A.40402@ladisch.de> <56D7FC6B.7040709@felipetonello.com> Cc: linux-kernel@vger.kernel.org, Felipe Balbi , Michal Nazarewicz From: Clemens Ladisch Message-ID: <56D82237.2080705@ladisch.de> Date: Thu, 3 Mar 2016 12:38:31 +0100 User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:38.0) Gecko/20100101 Thunderbird/38.6.0 MIME-Version: 1.0 In-Reply-To: <56D7FC6B.7040709@felipetonello.com> Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-PPP-Message-ID: <20160303113833.223754.66011@dehamd003.servertools24.de> X-PPP-Vhost: ladisch.de Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 816 Lines: 23 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