From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753916AbbJ0JVZ (ORCPT ); Tue, 27 Oct 2015 05:21:25 -0400 Received: from mail-wi0-f181.google.com ([209.85.212.181]:37636 "EHLO mail-wi0-f181.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751701AbbJ0JVX (ORCPT ); Tue, 27 Oct 2015 05:21:23 -0400 Subject: Re: [PATCH v4 1/7] usb: gadget: f_midi: Transmit data only when IN ep is enabled To: Robert Baldyga , Robert Baldyga References: <1445878509-12084-1-git-send-email-eu@felipetonello.com> <1445878509-12084-2-git-send-email-eu@felipetonello.com> <562EA570.8000309@hackerion.com> <562F1CAF.7010905@samsung.com> Cc: USB list , Kernel development list , Felipe Balbi , Greg Kroah-Hartman , Andrzej Pietrasiewicz , Clemens Ladisch From: Felipe Ferreri Tonello Message-ID: <562F420F.1030307@felipetonello.com> Date: Tue, 27 Oct 2015 09:21:19 +0000 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.3.0 MIME-Version: 1.0 In-Reply-To: <562F1CAF.7010905@samsung.com> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Robert, On 27/10/15 06:41, Robert Baldyga wrote: > On 10/26/2015 11:49 PM, Felipe Tonello wrote: >> Hi Robert, >> >> On Mon, Oct 26, 2015 at 10:13 PM, Robert Baldyga >> wrote: >>> Hi Felipe, >>> >>> On 10/26/2015 05:55 PM, Felipe F. Tonello wrote: >>>> This makes sure f_midi doesn't try to enqueue data when the IN endpoint is >>>> disabled, ie, USB cable is disconnected. >>>> >>>> Signed-off-by: Felipe F. Tonello >>>> --- >>>> drivers/usb/gadget/function/f_midi.c | 7 ++++++- >>>> 1 file changed, 6 insertions(+), 1 deletion(-) >>>> >>>> diff --git a/drivers/usb/gadget/function/f_midi.c b/drivers/usb/gadget/function/f_midi.c >>>> index edb84ca..e08f365 100644 >>>> --- a/drivers/usb/gadget/function/f_midi.c >>>> +++ b/drivers/usb/gadget/function/f_midi.c >>>> @@ -87,6 +87,7 @@ struct f_midi { >>>> int index; >>>> char *id; >>>> unsigned int buflen, qlen; >>>> + bool in_ep_enabled; >>> >>> It's not necessary, you can use ep->enabled flag instead. >> >> There is no such flag in usb_ep struct[1]. >> >> [1] http://lxr.free-electrons.com/source/include/linux/usb/gadget.h#L170 > > It's already in next branch of Felipe Balbi's tree. > > Look here: > https://git.kernel.org/cgit/linux/kernel/git/balbi/usb.git/ Cool. Thanks. I though that this flag would be very useful, but didn't want to add to the main struct as it seems no other driver cared about this flag. But it is good to see that it is been merged now. -- Felipe