Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1759867AbcCDTRi (ORCPT ); Fri, 4 Mar 2016 14:17:38 -0500 Received: from mail-qg0-f46.google.com ([209.85.192.46]:34007 "EHLO mail-qg0-f46.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755989AbcCDTRf convert rfc822-to-8bit (ORCPT ); Fri, 4 Mar 2016 14:17:35 -0500 From: Michal Nazarewicz To: "Felipe F. Tonello" , linux-usb@vger.kernel.org Cc: linux-kernel@vger.kernel.org, Felipe Balbi , Clemens Ladisch Subject: Re: [PATCH 4/5] usb: gadget: f_midi: cleanups and typos fixes In-Reply-To: <1456947640-20673-5-git-send-email-eu@felipetonello.com> Organization: http://mina86.com/ References: <1456947640-20673-1-git-send-email-eu@felipetonello.com> <1456947640-20673-5-git-send-email-eu@felipetonello.com> User-Agent: Notmuch/0.19+53~g2e63a09 (http://notmuchmail.org) Emacs/25.1.50.1 (x86_64-unknown-linux-gnu) Face: iVBORw0KGgoAAAANSUhEUgAAADAAAAAwBAMAAAClLOS0AAAAJFBMVEWbfGlUPDDHgE57V0jUupKjgIObY0PLrom9mH4dFRK4gmjPs41MxjOgAAACP0lEQVQ4T23Sv2vbQBQHcBk1xE6WyALX107VUEgmn6+ouUwpEQQ6uRjttkWP4CkBg2M0BQLBdPFZYPsyFYo7qEtKDQ7on+t7+nF2Ux8ahD587717OmNYrOvycHsZ+o2r051wHTHysAvGb8ygvgu4QWT0sCmkgZCIEnlV2X8BtyraazFGDuxhmKSQJMlwHQ7v5MHSNxmz78rfElwAa3ieVD9e+hBhjaPDDG6NgFo2f4wBMNIo5YmRtF0RyDgFjJjlMIWbnuM4x9MMfABGTlN4qgIQB4A1DEyA1BHWtfeWNUMwiVJKoqh97KrkOO+qzgluVYLvFCUKAX73nONeBr7BGMdM6Sg0kuep03VywLaIzRiVr+GAzKlpQIsAFnWAG2e6DT5WmWDiudZMIc6hYrMOmeMQK9WX0B+/RfjzL9DI7Y9/Iayn29Ci0r2i4f9gMimMSZLCDMalgQGU5hnUtqAN0OGvEmO1Wnl0C0wWSCEHnuHBqmygxdxA8oWXwbipoc1EoNR9DqOpBpOJrnr0criQab9ZT4LL+wI+K7GBQH30CrhUruilgP9DRTrhVWZCiAyILP+wiuLeCKGTD6r/nc8LOJcAwR6IBTUs+7CASw3QFZ0MdA2PI3zNziH4ZKVhXCRMBjeZ1DWMekKwDCASwExy+NQ86TaykaDAFHO4aP48y4fIcDM5yOG8GcTLbOyp8A8azjJI93JFd1EA6yN8sSxMQJWoABqniRZVykYgRXErzrdqExAoUrRb0xfRp8p2A/4XmfilTtkDZ4cAAAAASUVORK5CYII= X-Face: -TR8(rDTHy/(xl?SfWd1|3:TTgDIatE^t'vop%*gVg[kn$t{EpK(P"VQ=~T2#ysNmJKN$"yTRLB4YQs$4{[.]Fc1)*O]3+XO^oXM>Q#b^ix,O)Zbn)q[y06$`e3?C)`CwR9y5riE=fv^X@x$y?D:XO6L&x4f-}}I4=VRNwiA^t1-ZrVK^07.Pi/57c_du'& X-PGP: 50751FF4 X-PGP-FP: AC1F 5F5C D418 88F8 CC84 5858 2060 4012 5075 1FF4 X-Hashcash: 1:20:160304:clemens@ladisch.de::yQ5AOcgGOdlKHwmX:00000000000000000000000000000000000000000000aX+ X-Hashcash: 1:20:160304:linux-usb@vger.kernel.org::kR9nvjE+qpwgVX/+:0000000000000000000000000000000000000k3d X-Hashcash: 1:20:160304:balbi@kernel.org::xxDEKpVM1J8ciVY2:01sK2 X-Hashcash: 1:20:160304:linux-kernel@vger.kernel.org::NM+pkfwK2FQHN2GD:0000000000000000000000000000000002hRm X-Hashcash: 1:20:160304:eu@felipetonello.com::SHenYeSlTMVsNVWo:000000000000000000000000000000000000000003Rox Date: Fri, 04 Mar 2016 14:17:31 -0500 Message-ID: MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8BIT Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 5619 Lines: 172 On Wed, Mar 02 2016, Felipe F. Tonello wrote: > Signed-off-by: Felipe F. Tonello > --- > drivers/usb/gadget/function/f_midi.c | 77 +++++++++++++++++++----------------- > 1 file changed, 40 insertions(+), 37 deletions(-) > > diff --git a/drivers/usb/gadget/function/f_midi.c b/drivers/usb/gadget/function/f_midi.c > index 8475e3dc82d4..9a9e6112e224 100644 > --- a/drivers/usb/gadget/function/f_midi.c > +++ b/drivers/usb/gadget/function/f_midi.c > @@ -1,5 +1,5 @@ > /* > - * f_midi.c -- USB MIDI class function driver > + * f_midi.c -- USB-MIDI class function driver > * > * Copyright (C) 2006 Thumtronics Pty Ltd. > * Developed for Thumtronics by Grey Innovation > @@ -16,7 +16,7 @@ > * Copyright (C) 2006 Thumtronics Pty Ltd. > * Ben Williamson > * > - * Licensed under the GPL-2 or later. > + * Licensed under the GPLv2. Any particular reason to do that? > */ > > #include > @@ -41,8 +41,8 @@ > MODULE_AUTHOR("Ben Williamson"); > MODULE_LICENSE("GPL v2"); > > -static const char f_midi_shortname[] = "f_midi"; > -static const char f_midi_longname[] = "MIDI Gadget"; > +static const char f_midi_shortname[] = "f_midi"; > +static const char f_midi_longname[] = "MIDI Gadget"; > > /* > * We can only handle 16 cables on one single endpoint, as cable numbers are > @@ -78,28 +78,31 @@ struct gmidi_in_port { > }; > > struct f_midi { > - struct usb_function func; > - struct usb_gadget *gadget; > - struct usb_ep *in_ep, *out_ep; > - struct snd_card *card; > - struct snd_rawmidi *rmidi; > - u8 ms_id; > - > - struct snd_rawmidi_substream *out_substream[MAX_PORTS]; > - > - unsigned long out_triggered; > - struct tasklet_struct tasklet; > + struct usb_function func; > + struct usb_gadget *gadget; > + struct usb_ep *in_ep, *out_ep; > + u8 ms_id; > + unsigned long out_triggered; > unsigned int in_ports; > unsigned int out_ports; > - int index; > - char *id; > - unsigned int buflen, qlen; > + unsigned int buflen; > + unsigned int qlen; > + unsigned int len; > + > /* This fifo is used as a buffer ring for pre-allocated IN usb_requests */ > DECLARE_KFIFO_PTR(in_req_fifo, struct usb_request *); > spinlock_t transmit_lock; > + > + /* ALSA stuff */ > + struct snd_card *card; > + struct snd_rawmidi *rmidi; > + struct snd_rawmidi_substream *out_substream[MAX_PORTS]; > + struct tasklet_struct tasklet; > unsigned int in_last_port; > + int index; > + char *id; > > - struct gmidi_in_port in_ports_array[/* in_ports */]; > + struct gmidi_in_port in_ports_array[/* in_ports */]; > }; > > static inline struct f_midi *func_to_midi(struct usb_function *f) > @@ -191,7 +194,7 @@ static struct usb_ms_endpoint_descriptor_16 ms_in_desc = { > > /* string IDs are assigned dynamically */ > > -#define STRING_FUNC_IDX 0 > +#define STRING_FUNC_IDX 0 > > static struct usb_string midi_string_defs[] = { > [STRING_FUNC_IDX].s = "MIDI function", > @@ -199,7 +202,7 @@ static struct usb_string midi_string_defs[] = { > }; > > static struct usb_gadget_strings midi_stringtab = { > - .language = 0x0409, /* en-us */ > + .language = 0x0409, /* en-us */ > .strings = midi_string_defs, > }; > > @@ -409,7 +412,7 @@ static int f_midi_snd_free(struct snd_device *device) > } > > /* > - * Converts MIDI commands to USB MIDI packets. > + * Converts MIDI commands to USB-MIDI packets. > */ > static void f_midi_transmit_byte(struct usb_request *req, > struct gmidi_in_port *port, uint8_t b) > @@ -956,15 +959,15 @@ static int f_midi_bind(struct usb_configuration *c, struct usb_function *f) > in_emb->iJack = 0; > midi_function[i++] = (struct usb_descriptor_header *) in_emb; > > - out_ext->bLength = USB_DT_MIDI_OUT_SIZE(1); > - out_ext->bDescriptorType = USB_DT_CS_INTERFACE; > - out_ext->bDescriptorSubtype = USB_MS_MIDI_OUT_JACK; > - out_ext->bJackType = USB_MS_EXTERNAL; > - out_ext->bJackID = jack++; > - out_ext->bNrInputPins = 1; > - out_ext->iJack = 0; > - out_ext->pins[0].baSourceID = in_emb->bJackID; > - out_ext->pins[0].baSourcePin = 1; > + out_ext->bLength = USB_DT_MIDI_OUT_SIZE(1); > + out_ext->bDescriptorType = USB_DT_CS_INTERFACE; > + out_ext->bDescriptorSubtype = USB_MS_MIDI_OUT_JACK; > + out_ext->bJackType = USB_MS_EXTERNAL; > + out_ext->bJackID = jack++; > + out_ext->bNrInputPins = 1; > + out_ext->iJack = 0; > + out_ext->pins[0].baSourceID = in_emb->bJackID; > + out_ext->pins[0].baSourcePin = 1; > midi_function[i++] = (struct usb_descriptor_header *) out_ext; > > /* link it to the endpoint */ > @@ -1251,12 +1254,12 @@ static struct usb_function *f_midi_alloc(struct usb_function_instance *fi) > status = -ENOMEM; > goto setup_fail; > } > - midi->in_ports = opts->in_ports; > - midi->out_ports = opts->out_ports; > - midi->index = opts->index; > - midi->buflen = opts->buflen; > - midi->qlen = opts->qlen; > - midi->in_last_port = 0; > + midi->in_ports = opts->in_ports; > + midi->out_ports = opts->out_ports; > + midi->index = opts->index; > + midi->buflen = opts->buflen; > + midi->qlen = opts->qlen; > + midi->in_last_port = 0; I don’t understand this patch. You seem to be opposed to lining up field names in a structure, but you are explicitly adding lining up to assignment? What is going on here? IS this patch really improving things? > > status = kfifo_alloc(&midi->in_req_fifo, midi->qlen, GFP_KERNEL); > if (status) > -- > 2.7.2 > -- Best regards ミハウ “????????????????86” ナザレヴイツ «If at first you don’t succeed, give up skydiving»