Re: [PATCH v5 6/7] usb: gadget: f_midi: set altsettings only for MIDIStreaming interface

2015-11-16 Thread Felipe Ferreri Tonello
Hi Clemens,

On 13/11/15 08:11, Clemens Ladisch wrote:
> Felipe Ferreri Tonello wrote:
>> On 10/11/15 18:43, Sergei Shtylyov wrote:
>>> On 11/10/2015 08:52 PM, Felipe F. Tonello wrote:
 @@ -75,6 +75,7 @@ struct f_midi {
   struct usb_ep*in_ep, *out_ep;
   struct snd_card*card;
   struct snd_rawmidi*rmidi;
 +u8ms_id;
>>>
>>>   Why 'ms_id' is not aligned with the above field names?
>>
>> It is actually aligned.
> 
> It's not in the original mail, which contains tab characters.
> 
>> Here is from my local git diff:
>>
>> @@ -75,6 +75,7 @@ struct f_midi {
>> struct usb_ep   *in_ep, *out_ep;
>> struct snd_card *card;
>> struct snd_rawmidi  *rmidi;
>> +   u8  ms_id;
> 
> Apparently, you're using four spaces per tab.  Linux uses eight.

Yes. I'll fix that.

-- 
Felipe


0x92698E6A.asc
Description: application/pgp-keys


Re: [PATCH v5 6/7] usb: gadget: f_midi: set altsettings only for MIDIStreaming interface

2015-11-16 Thread Felipe Ferreri Tonello
Hi Clemens,

On 13/11/15 08:11, Clemens Ladisch wrote:
> Felipe Ferreri Tonello wrote:
>> On 10/11/15 18:43, Sergei Shtylyov wrote:
>>> On 11/10/2015 08:52 PM, Felipe F. Tonello wrote:
 @@ -75,6 +75,7 @@ struct f_midi {
   struct usb_ep*in_ep, *out_ep;
   struct snd_card*card;
   struct snd_rawmidi*rmidi;
 +u8ms_id;
>>>
>>>   Why 'ms_id' is not aligned with the above field names?
>>
>> It is actually aligned.
> 
> It's not in the original mail, which contains tab characters.
> 
>> Here is from my local git diff:
>>
>> @@ -75,6 +75,7 @@ struct f_midi {
>> struct usb_ep   *in_ep, *out_ep;
>> struct snd_card *card;
>> struct snd_rawmidi  *rmidi;
>> +   u8  ms_id;
> 
> Apparently, you're using four spaces per tab.  Linux uses eight.

Yes. I'll fix that.

-- 
Felipe


0x92698E6A.asc
Description: application/pgp-keys


Re: [PATCH v5 6/7] usb: gadget: f_midi: set altsettings only for MIDIStreaming interface

2015-11-13 Thread Clemens Ladisch
Felipe F. Tonello wrote:
> This avoids duplication of USB requests for OUT endpoint and
> re-enabling endpoints.

>  ...
>   /* For Control Device interface we do nothing */
> - if (intf == 0)
> + if (intf != midi->ms_id)
>   return 0;

The comment now is misleading.


Regards,
Clemens
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH v5 6/7] usb: gadget: f_midi: set altsettings only for MIDIStreaming interface

2015-11-13 Thread Clemens Ladisch
Felipe Ferreri Tonello wrote:
> On 10/11/15 18:43, Sergei Shtylyov wrote:
>> On 11/10/2015 08:52 PM, Felipe F. Tonello wrote:
>>> @@ -75,6 +75,7 @@ struct f_midi {
>>>   struct usb_ep*in_ep, *out_ep;
>>>   struct snd_card*card;
>>>   struct snd_rawmidi*rmidi;
>>> +u8ms_id;
>>
>>   Why 'ms_id' is not aligned with the above field names?
>
> It is actually aligned.

It's not in the original mail, which contains tab characters.

> Here is from my local git diff:
>
> @@ -75,6 +75,7 @@ struct f_midi {
> struct usb_ep   *in_ep, *out_ep;
> struct snd_card *card;
> struct snd_rawmidi  *rmidi;
> +   u8  ms_id;

Apparently, you're using four spaces per tab.  Linux uses eight.


Regards,
Clemens
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH v5 6/7] usb: gadget: f_midi: set altsettings only for MIDIStreaming interface

2015-11-13 Thread Clemens Ladisch
Felipe Ferreri Tonello wrote:
> On 10/11/15 18:43, Sergei Shtylyov wrote:
>> On 11/10/2015 08:52 PM, Felipe F. Tonello wrote:
>>> @@ -75,6 +75,7 @@ struct f_midi {
>>>   struct usb_ep*in_ep, *out_ep;
>>>   struct snd_card*card;
>>>   struct snd_rawmidi*rmidi;
>>> +u8ms_id;
>>
>>   Why 'ms_id' is not aligned with the above field names?
>
> It is actually aligned.

It's not in the original mail, which contains tab characters.

> Here is from my local git diff:
>
> @@ -75,6 +75,7 @@ struct f_midi {
> struct usb_ep   *in_ep, *out_ep;
> struct snd_card *card;
> struct snd_rawmidi  *rmidi;
> +   u8  ms_id;

Apparently, you're using four spaces per tab.  Linux uses eight.


Regards,
Clemens
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH v5 6/7] usb: gadget: f_midi: set altsettings only for MIDIStreaming interface

2015-11-13 Thread Clemens Ladisch
Felipe F. Tonello wrote:
> This avoids duplication of USB requests for OUT endpoint and
> re-enabling endpoints.

>  ...
>   /* For Control Device interface we do nothing */
> - if (intf == 0)
> + if (intf != midi->ms_id)
>   return 0;

The comment now is misleading.


Regards,
Clemens
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH v5 6/7] usb: gadget: f_midi: set altsettings only for MIDIStreaming interface

2015-11-11 Thread Sergei Shtylyov

Hello.

On 11/11/2015 12:38 PM, Felipe Ferreri Tonello wrote:


This avoids duplication of USB requests for OUT endpoint and
re-enabling endpoints.

Signed-off-by: Felipe F. Tonello 
---
   drivers/usb/gadget/function/f_midi.c | 4 +++-
   1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/usb/gadget/function/f_midi.c
b/drivers/usb/gadget/function/f_midi.c
index 76ea53c..615d632 100644
--- a/drivers/usb/gadget/function/f_midi.c
+++ b/drivers/usb/gadget/function/f_midi.c
@@ -75,6 +75,7 @@ struct f_midi {
   struct usb_ep*in_ep, *out_ep;
   struct snd_card*card;
   struct snd_rawmidi*rmidi;
+u8ms_id;


   Why 'ms_id' is not aligned with the above field names?


It is actually aligned. Perhaps because of the +?


  No, + should not affect this, it only affects things when a line doesn't 
start with a tab.



Here is from my local git diff:

--- a/drivers/usb/gadget/function/f_midi.c
+++ b/drivers/usb/gadget/function/f_midi.c
@@ -75,6 +75,7 @@ struct f_midi {
 struct usb_ep   *in_ep, *out_ep;
 struct snd_card *card;
 struct snd_rawmidi  *rmidi;
+   u8  ms_id;


   Unfortunately, tabs got replaces with spaces in this fragment.

[...]

MBR, Sergei

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH v5 6/7] usb: gadget: f_midi: set altsettings only for MIDIStreaming interface

2015-11-11 Thread Felipe Ferreri Tonello
Hi Sergei,

On 10/11/15 18:43, Sergei Shtylyov wrote:
> Hello.
> 
> On 11/10/2015 08:52 PM, Felipe F. Tonello wrote:
> 
>> This avoids duplication of USB requests for OUT endpoint and
>> re-enabling endpoints.
>>
>> Signed-off-by: Felipe F. Tonello 
>> ---
>>   drivers/usb/gadget/function/f_midi.c | 4 +++-
>>   1 file changed, 3 insertions(+), 1 deletion(-)
>>
>> diff --git a/drivers/usb/gadget/function/f_midi.c
>> b/drivers/usb/gadget/function/f_midi.c
>> index 76ea53c..615d632 100644
>> --- a/drivers/usb/gadget/function/f_midi.c
>> +++ b/drivers/usb/gadget/function/f_midi.c
>> @@ -75,6 +75,7 @@ struct f_midi {
>>   struct usb_ep*in_ep, *out_ep;
>>   struct snd_card*card;
>>   struct snd_rawmidi*rmidi;
>> +u8ms_id;
> 
>   Why 'ms_id' is not aligned with the above field names?

It is actually aligned. Perhaps because of the +?

Here is from my local git diff:

--- a/drivers/usb/gadget/function/f_midi.c
+++ b/drivers/usb/gadget/function/f_midi.c
@@ -75,6 +75,7 @@ struct f_midi {
struct usb_ep   *in_ep, *out_ep;
struct snd_card *card;
struct snd_rawmidi  *rmidi;
+   u8  ms_id;

struct snd_rawmidi_substream *in_substream[MAX_PORTS];
struct snd_rawmidi_substream *out_substream[MAX_PORTS];


-- 
Felipe


0x92698E6A.asc
Description: application/pgp-keys


Re: [PATCH v5 6/7] usb: gadget: f_midi: set altsettings only for MIDIStreaming interface

2015-11-11 Thread Felipe Ferreri Tonello
Hi Sergei,

On 10/11/15 18:43, Sergei Shtylyov wrote:
> Hello.
> 
> On 11/10/2015 08:52 PM, Felipe F. Tonello wrote:
> 
>> This avoids duplication of USB requests for OUT endpoint and
>> re-enabling endpoints.
>>
>> Signed-off-by: Felipe F. Tonello 
>> ---
>>   drivers/usb/gadget/function/f_midi.c | 4 +++-
>>   1 file changed, 3 insertions(+), 1 deletion(-)
>>
>> diff --git a/drivers/usb/gadget/function/f_midi.c
>> b/drivers/usb/gadget/function/f_midi.c
>> index 76ea53c..615d632 100644
>> --- a/drivers/usb/gadget/function/f_midi.c
>> +++ b/drivers/usb/gadget/function/f_midi.c
>> @@ -75,6 +75,7 @@ struct f_midi {
>>   struct usb_ep*in_ep, *out_ep;
>>   struct snd_card*card;
>>   struct snd_rawmidi*rmidi;
>> +u8ms_id;
> 
>   Why 'ms_id' is not aligned with the above field names?

It is actually aligned. Perhaps because of the +?

Here is from my local git diff:

--- a/drivers/usb/gadget/function/f_midi.c
+++ b/drivers/usb/gadget/function/f_midi.c
@@ -75,6 +75,7 @@ struct f_midi {
struct usb_ep   *in_ep, *out_ep;
struct snd_card *card;
struct snd_rawmidi  *rmidi;
+   u8  ms_id;

struct snd_rawmidi_substream *in_substream[MAX_PORTS];
struct snd_rawmidi_substream *out_substream[MAX_PORTS];


-- 
Felipe


0x92698E6A.asc
Description: application/pgp-keys


Re: [PATCH v5 6/7] usb: gadget: f_midi: set altsettings only for MIDIStreaming interface

2015-11-11 Thread Sergei Shtylyov

Hello.

On 11/11/2015 12:38 PM, Felipe Ferreri Tonello wrote:


This avoids duplication of USB requests for OUT endpoint and
re-enabling endpoints.

Signed-off-by: Felipe F. Tonello 
---
   drivers/usb/gadget/function/f_midi.c | 4 +++-
   1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/usb/gadget/function/f_midi.c
b/drivers/usb/gadget/function/f_midi.c
index 76ea53c..615d632 100644
--- a/drivers/usb/gadget/function/f_midi.c
+++ b/drivers/usb/gadget/function/f_midi.c
@@ -75,6 +75,7 @@ struct f_midi {
   struct usb_ep*in_ep, *out_ep;
   struct snd_card*card;
   struct snd_rawmidi*rmidi;
+u8ms_id;


   Why 'ms_id' is not aligned with the above field names?


It is actually aligned. Perhaps because of the +?


  No, + should not affect this, it only affects things when a line doesn't 
start with a tab.



Here is from my local git diff:

--- a/drivers/usb/gadget/function/f_midi.c
+++ b/drivers/usb/gadget/function/f_midi.c
@@ -75,6 +75,7 @@ struct f_midi {
 struct usb_ep   *in_ep, *out_ep;
 struct snd_card *card;
 struct snd_rawmidi  *rmidi;
+   u8  ms_id;


   Unfortunately, tabs got replaces with spaces in this fragment.

[...]

MBR, Sergei

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH v5 6/7] usb: gadget: f_midi: set altsettings only for MIDIStreaming interface

2015-11-10 Thread Sergei Shtylyov

Hello.

On 11/10/2015 08:52 PM, Felipe F. Tonello wrote:


This avoids duplication of USB requests for OUT endpoint and
re-enabling endpoints.

Signed-off-by: Felipe F. Tonello 
---
  drivers/usb/gadget/function/f_midi.c | 4 +++-
  1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/usb/gadget/function/f_midi.c 
b/drivers/usb/gadget/function/f_midi.c
index 76ea53c..615d632 100644
--- a/drivers/usb/gadget/function/f_midi.c
+++ b/drivers/usb/gadget/function/f_midi.c
@@ -75,6 +75,7 @@ struct f_midi {
struct usb_ep   *in_ep, *out_ep;
struct snd_card *card;
struct snd_rawmidi  *rmidi;
+   u8  ms_id;


  Why 'ms_id' is not aligned with the above field names?

[...]

MBR, Sergei

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH v5 6/7] usb: gadget: f_midi: set altsettings only for MIDIStreaming interface

2015-11-10 Thread Felipe F. Tonello
This avoids duplication of USB requests for OUT endpoint and
re-enabling endpoints.

Signed-off-by: Felipe F. Tonello 
---
 drivers/usb/gadget/function/f_midi.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/usb/gadget/function/f_midi.c 
b/drivers/usb/gadget/function/f_midi.c
index 76ea53c..615d632 100644
--- a/drivers/usb/gadget/function/f_midi.c
+++ b/drivers/usb/gadget/function/f_midi.c
@@ -75,6 +75,7 @@ struct f_midi {
struct usb_ep   *in_ep, *out_ep;
struct snd_card *card;
struct snd_rawmidi  *rmidi;
+   u8  ms_id;
 
struct snd_rawmidi_substream *in_substream[MAX_PORTS];
struct snd_rawmidi_substream *out_substream[MAX_PORTS];
@@ -322,7 +323,7 @@ static int f_midi_set_alt(struct usb_function *f, unsigned 
intf, unsigned alt)
int err;
 
/* For Control Device interface we do nothing */
-   if (intf == 0)
+   if (intf != midi->ms_id)
return 0;
 
err = f_midi_start_ep(midi, f, midi->in_ep);
@@ -730,6 +731,7 @@ static int f_midi_bind(struct usb_configuration *c, struct 
usb_function *f)
goto fail;
ms_interface_desc.bInterfaceNumber = status;
ac_header_desc.baInterfaceNr[0] = status;
+   midi->ms_id = status;
 
status = -ENODEV;
 
-- 
2.5.0

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH v5 6/7] usb: gadget: f_midi: set altsettings only for MIDIStreaming interface

2015-11-10 Thread Felipe F. Tonello
This avoids duplication of USB requests for OUT endpoint and
re-enabling endpoints.

Signed-off-by: Felipe F. Tonello 
---
 drivers/usb/gadget/function/f_midi.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/usb/gadget/function/f_midi.c 
b/drivers/usb/gadget/function/f_midi.c
index 76ea53c..615d632 100644
--- a/drivers/usb/gadget/function/f_midi.c
+++ b/drivers/usb/gadget/function/f_midi.c
@@ -75,6 +75,7 @@ struct f_midi {
struct usb_ep   *in_ep, *out_ep;
struct snd_card *card;
struct snd_rawmidi  *rmidi;
+   u8  ms_id;
 
struct snd_rawmidi_substream *in_substream[MAX_PORTS];
struct snd_rawmidi_substream *out_substream[MAX_PORTS];
@@ -322,7 +323,7 @@ static int f_midi_set_alt(struct usb_function *f, unsigned 
intf, unsigned alt)
int err;
 
/* For Control Device interface we do nothing */
-   if (intf == 0)
+   if (intf != midi->ms_id)
return 0;
 
err = f_midi_start_ep(midi, f, midi->in_ep);
@@ -730,6 +731,7 @@ static int f_midi_bind(struct usb_configuration *c, struct 
usb_function *f)
goto fail;
ms_interface_desc.bInterfaceNumber = status;
ac_header_desc.baInterfaceNr[0] = status;
+   midi->ms_id = status;
 
status = -ENODEV;
 
-- 
2.5.0

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH v5 6/7] usb: gadget: f_midi: set altsettings only for MIDIStreaming interface

2015-11-10 Thread Sergei Shtylyov

Hello.

On 11/10/2015 08:52 PM, Felipe F. Tonello wrote:


This avoids duplication of USB requests for OUT endpoint and
re-enabling endpoints.

Signed-off-by: Felipe F. Tonello 
---
  drivers/usb/gadget/function/f_midi.c | 4 +++-
  1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/usb/gadget/function/f_midi.c 
b/drivers/usb/gadget/function/f_midi.c
index 76ea53c..615d632 100644
--- a/drivers/usb/gadget/function/f_midi.c
+++ b/drivers/usb/gadget/function/f_midi.c
@@ -75,6 +75,7 @@ struct f_midi {
struct usb_ep   *in_ep, *out_ep;
struct snd_card *card;
struct snd_rawmidi  *rmidi;
+   u8  ms_id;


  Why 'ms_id' is not aligned with the above field names?

[...]

MBR, Sergei

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/