Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932240AbbGGOFo (ORCPT ); Tue, 7 Jul 2015 10:05:44 -0400 Received: from mailout2.samsung.com ([203.254.224.25]:33060 "EHLO mailout2.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1757553AbbGGOFH (ORCPT ); Tue, 7 Jul 2015 10:05:07 -0400 X-AuditID: cbfee61b-f79416d0000014c0-3b-559bdc90b040 From: Robert Baldyga To: gregkh@linuxfoundation.org, balbi@ti.com Cc: nicolas.ferre@atmel.com, vinc94@gmail.com, hamohammed.sa@gmail.com, tapaswenipathak@gmail.com, roberta.dobrescu@gmail.com, hgujulan@visteon.com, chris@rorvick.com, mina86@mina86.com, andrzej.p@samsung.com, devel@driverdev.osuosl.org, linux-kernel@vger.kernel.org, linux-usb@vger.kernel.org, linux-arm-kernel@lists.infradead.org, m.szyprowski@samsung.com, Robert Baldyga Subject: [PATCH 2/5] usb: gadget: midi: avoid redundant f_midi_set_alt() call Date: Tue, 07 Jul 2015 16:02:50 +0200 Message-id: <1436277773-14274-3-git-send-email-r.baldyga@samsung.com> X-Mailer: git-send-email 1.9.1 In-reply-to: <1436277773-14274-1-git-send-email-r.baldyga@samsung.com> References: <1436277773-14274-1-git-send-email-r.baldyga@samsung.com> X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFrrPLMWRmVeSWpSXmKPExsVy+t9jQd0Jd2aHGvz5YGEx62U7i8XB+/UW O+fuY7XYc+YXu0Xz4vVsFnemTWKyeDRzMovFpsfXWC0u75rDZrFoWSuzxdojd9ktFhxvYbX4 drmZ3eLB4Z3sFi0nHrFZ9J3axGyx5v5HJgdBjwW/trJ43Nt3mMVj56y77B77565h99i8pN5j 3Z9XTB67T7N69G1Zxehx/MZ2Jo/Pm+Q8dmy/yB7AHcVlk5Kak1mWWqRvl8CVse/0StaCV+wV Pbe7mRoY97N1MXJySAiYSPzbvJ8JwhaTuHBvPVCci0NIYDqjxLtJU5ghnJ+MEjMffWcHqWIT 0JHY8n0CI4gtAmSv+7sDrINZYDqzxKsN01i6GDk4hAV8JSbP0QKpYRFQlTh68QErSJhXwFXi 0QsHiGVyEiePTWYFsTkF3CTmTp3NCFIiBFSycrPjBEbeBYwMqxhFUwuSC4qT0nON9IoTc4tL 89L1kvNzNzGCg/2Z9A7GVQ0WhxgFOBiVeHhvSswOFWJNLCuuzD3EKMHBrCTC++YkUIg3JbGy KrUoP76oNCe1+BCjNAeLkjjvyXyfUCGB9MSS1OzU1ILUIpgsEwenVAOj496ENT32erEfe0Me 1xbVNQRZZPbuarzPsU7xkNavkHSDFxmy4rXdj+waGcUmp1w6Zz151wxz29UOr2cVfV/dOE97 Y9UHtk8BFg95DZ8FCT3jcLaMLJa627/afdILuXD14LufJLijdy2vnFyuNUNrxVWNSxvmizYH 7U2Nrf58Me6EfWF+4ywlluKMREMt5qLiRABGYsodcgIAAA== Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1218 Lines: 34 Function midi registers two interfaces with single set_alt() function which means that f_midi_set_alt() is called twice when configuration is set. That means that endpoint initialization and ep request allocation is done two times. To avoid this problem we do such things only once, for interface number 1 (MIDI Streaming interface). Signed-off-by: Robert Baldyga --- drivers/usb/gadget/function/f_midi.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/drivers/usb/gadget/function/f_midi.c b/drivers/usb/gadget/function/f_midi.c index 6316aa5..4cef222 100644 --- a/drivers/usb/gadget/function/f_midi.c +++ b/drivers/usb/gadget/function/f_midi.c @@ -329,6 +329,10 @@ static int f_midi_set_alt(struct usb_function *f, unsigned intf, unsigned alt) unsigned i; int err; + /* For Control Device interface we do nothing */ + if (intf == 0) + return 0; + err = f_midi_start_ep(midi, f, midi->in_ep); if (err) return err; -- 1.9.1 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/