From: Takashi Iwai Subject: Re: [PATCH v2 7/9] ALSA: line6: Allow processing of raw incoming messages Date: Wed, 24 Aug 2016 17:05:46 +0200 Message-ID: References: <1470942147-19848-1-git-send-email-dev@andree.sk> <1471558839-14120-1-git-send-email-dev@andree.sk> <1471558839-14120-8-git-send-email-dev@andree.sk> Mime-Version: 1.0 (generated by SEMI 1.14.6 - "Maruoka") Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: Received: from mx2.suse.de (mx2.suse.de [195.135.220.15]) by alsa0.perex.cz (Postfix) with ESMTP id C568326A1FB for ; Wed, 24 Aug 2016 17:05:46 +0200 (CEST) In-Reply-To: <1471558839-14120-8-git-send-email-dev@andree.sk> List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: alsa-devel-bounces@alsa-project.org Sender: alsa-devel-bounces@alsa-project.org To: Andrej Krutak Cc: stefanha@gmail.com, alsa-devel@alsa-project.org, grabner@icg.tugraz.at List-Id: alsa-devel@alsa-project.org On Fri, 19 Aug 2016 00:20:37 +0200, Andrej Krutak wrote: > > Not all PODs use MIDI via USB data interface, thus allow avoiding > that code and instead using direct processing. > > Signed-off-by: Andrej Krutak > --- > sound/usb/line6/driver.c | 59 ++++++++++++++++++++++++++++-------------------- > sound/usb/line6/driver.h | 8 ++++--- > sound/usb/line6/midi.c | 2 +- > 3 files changed, 40 insertions(+), 29 deletions(-) > > diff --git a/sound/usb/line6/driver.c b/sound/usb/line6/driver.c > index 9b16777..853a143 100644 > --- a/sound/usb/line6/driver.c > +++ b/sound/usb/line6/driver.c > @@ -290,26 +290,31 @@ static void line6_data_received(struct urb *urb) > if (urb->status == -ESHUTDOWN) > return; > > - done = > - line6_midibuf_write(mb, urb->transfer_buffer, urb->actual_length); > + if (line6->properties->capabilities & LINE6_CAP_CONTROL_MIDI) { > + done = > + line6_midibuf_write(mb, urb->transfer_buffer, urb->actual_length); > > - if (done < urb->actual_length) { > - line6_midibuf_ignore(mb, done); > - dev_dbg(line6->ifcdev, "%d %d buffer overflow - message skipped\n", > - done, urb->actual_length); > - } > + if (done < urb->actual_length) { > + line6_midibuf_ignore(mb, done); > + dev_dbg(line6->ifcdev, "%d %d buffer overflow - message skipped\n", > + done, urb->actual_length); > + } > > - for (;;) { > - done = > - line6_midibuf_read(mb, line6->buffer_message, > - LINE6_MESSAGE_MAXLEN); > + for (;;) { > + done = > + line6_midibuf_read(mb, line6->buffer_message, > + LINE6_MESSAGE_MAXLEN); > > - if (done == 0) > - break; > + if (done == 0) > + break; > > - line6->message_length = done; > - line6_midi_receive(line6, line6->buffer_message, done); > + line6->message_length = done; > + line6_midi_receive(line6, line6->buffer_message, done); > > + if (line6->process_message) > + line6->process_message(line6); > + } > + } else { > if (line6->process_message) > line6->process_message(line6); > } Both if and else run the same code (line6->process_message) here at the end. That is, this can be outside the if block. Also, the patch should be also before the actual usage, i.e. patch 5. Takashi