[PATCH v5 BlueZ 1/4] Bluetooth: L2CAP: Refactor L2CAP_CONN_PARAM_UPDATE_REQ into a function

2017-04-13 Thread Felipe F. Tonello
This signaling command is useful for any connection parameter change procedure, thus it is important to allow access to it from outside this translation unit. Signed-off-by: Felipe F. Tonello <e...@felipetonello.com> --- include/net/bluetooth/l2cap.h | 3 +++ net/bluetooth/l2cap_core.c

[PATCH v5 BlueZ 1/4] Bluetooth: L2CAP: Refactor L2CAP_CONN_PARAM_UPDATE_REQ into a function

2017-04-13 Thread Felipe F. Tonello
This signaling command is useful for any connection parameter change procedure, thus it is important to allow access to it from outside this translation unit. Signed-off-by: Felipe F. Tonello --- include/net/bluetooth/l2cap.h | 3 +++ net/bluetooth/l2cap_core.c| 31

[PATCH v5 BlueZ 3/4] Bluetooth: L2CAP: Add BT_LE_CONN_PARAM socket option

2017-04-13 Thread Felipe F. Tonello
with the store_hint set is sent to user-space so an application can store the connection parameters for persistence reasons. Signed-off-by: Felipe F. Tonello <e...@felipetonello.com> --- include/net/bluetooth/bluetooth.h | 8 +++ net/bluetooth/l2cap_sock.c| 110 +++

[PATCH v5 BlueZ 3/4] Bluetooth: L2CAP: Add BT_LE_CONN_PARAM socket option

2017-04-13 Thread Felipe F. Tonello
with the store_hint set is sent to user-space so an application can store the connection parameters for persistence reasons. Signed-off-by: Felipe F. Tonello --- include/net/bluetooth/bluetooth.h | 8 +++ net/bluetooth/l2cap_sock.c| 110 ++ 2 files changed, 118

[PATCH v5 BlueZ 0/4] Connection Update improvements

2017-04-13 Thread Felipe F. Tonello
user-space API * Added refactor function Felipe F. Tonello (4): Bluetooth: L2CAP: Refactor L2CAP_CONN_PARAM_UPDATE_REQ into a function Bluetooth: L2CAP: Add handler for Connection Parameter Update Response Bluetooth: L2CAP: Add BT_LE_CONN_PARAM socket option Bluetooth: Handle Slave Connection

[PATCH v5 BlueZ 0/4] Connection Update improvements

2017-04-13 Thread Felipe F. Tonello
user-space API * Added refactor function Felipe F. Tonello (4): Bluetooth: L2CAP: Refactor L2CAP_CONN_PARAM_UPDATE_REQ into a function Bluetooth: L2CAP: Add handler for Connection Parameter Update Response Bluetooth: L2CAP: Add BT_LE_CONN_PARAM socket option Bluetooth: Handle Slave Connection

[PATCH v5 BlueZ 2/4] Bluetooth: L2CAP: Add handler for Connection Parameter Update Response

2017-04-13 Thread Felipe F. Tonello
parameters accordingly. If the request was rejected, we don't do anything. Signed-off-by: Felipe F. Tonello <e...@felipetonello.com> --- include/net/bluetooth/l2cap.h | 2 ++ net/bluetooth/l2cap_core.c| 47 +++ 2 files changed, 49 insertions(+)

[PATCH v5 BlueZ 2/4] Bluetooth: L2CAP: Add handler for Connection Parameter Update Response

2017-04-13 Thread Felipe F. Tonello
parameters accordingly. If the request was rejected, we don't do anything. Signed-off-by: Felipe F. Tonello --- include/net/bluetooth/l2cap.h | 2 ++ net/bluetooth/l2cap_core.c| 47 +++ 2 files changed, 49 insertions(+) diff --git a/include/net

[PATCH v5 BlueZ 4/4] Bluetooth: Handle Slave Connection Interval Range AD

2017-04-13 Thread Felipe F. Tonello
if the slave device wishes to persist with these parameters, it should use the L2CAP connection parameters upade request upon a completed connection. Signed-off-by: Felipe F. Tonello <e...@felipetonello.com> --- net/bluetooth/mgmt.c | 53 1 file c

[PATCH v5 BlueZ 4/4] Bluetooth: Handle Slave Connection Interval Range AD

2017-04-13 Thread Felipe F. Tonello
if the slave device wishes to persist with these parameters, it should use the L2CAP connection parameters upade request upon a completed connection. Signed-off-by: Felipe F. Tonello --- net/bluetooth/mgmt.c | 53 1 file changed, 53 insertions(+) diff

[PATCH 0/3] Gadget endpoint allocation request

2016-08-23 Thread Felipe F. Tonello
Patch #1 removes a unnecessary and confusing parameter from alloc_ep_req(). Also, this series updates f_hid function to use alloc/free_ep_req() instead of allocating/freeing requests directly. Felipe F. Tonello (3): usb: gadget: remove useless parameter in alloc_ep_req() usb: gadget: f_hid

[PATCH 0/3] Gadget endpoint allocation request

2016-08-23 Thread Felipe F. Tonello
Patch #1 removes a unnecessary and confusing parameter from alloc_ep_req(). Also, this series updates f_hid function to use alloc/free_ep_req() instead of allocating/freeing requests directly. Felipe F. Tonello (3): usb: gadget: remove useless parameter in alloc_ep_req() usb: gadget: f_hid

[PATCH 3/3] usb: gadget: f_hid: use alloc_ep_req()

2016-08-23 Thread Felipe F. Tonello
Use gadget's framework allocation function instead of directly calling usb_ep_alloc_request(). Signed-off-by: Felipe F. Tonello <e...@felipetonello.com> --- drivers/usb/gadget/function/f_hid.c | 6 +- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/drivers/usb/gadget/fu

[PATCH 3/3] usb: gadget: f_hid: use alloc_ep_req()

2016-08-23 Thread Felipe F. Tonello
Use gadget's framework allocation function instead of directly calling usb_ep_alloc_request(). Signed-off-by: Felipe F. Tonello --- drivers/usb/gadget/function/f_hid.c | 6 +- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/drivers/usb/gadget/function/f_hid.c b/drivers/usb

[PATCH 1/3] usb: gadget: remove useless parameter in alloc_ep_req()

2016-08-23 Thread Felipe F. Tonello
-by: Felipe F. Tonello <e...@felipetonello.com> --- drivers/usb/gadget/function/f_hid.c| 2 +- drivers/usb/gadget/function/f_loopback.c | 6 ++ drivers/usb/gadget/function/f_midi.c | 2 +- drivers/usb/gadget/function/f_sourcesink.c | 6 ++ drivers/usb/gadget

[PATCH 1/3] usb: gadget: remove useless parameter in alloc_ep_req()

2016-08-23 Thread Felipe F. Tonello
-by: Felipe F. Tonello --- drivers/usb/gadget/function/f_hid.c| 2 +- drivers/usb/gadget/function/f_loopback.c | 6 ++ drivers/usb/gadget/function/f_midi.c | 2 +- drivers/usb/gadget/function/f_sourcesink.c | 6 ++ drivers/usb/gadget/u_f.c | 7 +++ drivers/usb

[PATCH 2/3] usb: gadget: f_hid: use free_ep_req()

2016-08-23 Thread Felipe F. Tonello
We should always use free_ep_req() when allocating requests with alloc_ep_req(). Signed-off-by: Felipe F. Tonello <e...@felipetonello.com> --- drivers/usb/gadget/function/f_hid.c | 10 +++--- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/drivers/usb/gadget/function/f_hi

[PATCH 2/3] usb: gadget: f_hid: use free_ep_req()

2016-08-23 Thread Felipe F. Tonello
We should always use free_ep_req() when allocating requests with alloc_ep_req(). Signed-off-by: Felipe F. Tonello --- drivers/usb/gadget/function/f_hid.c | 10 +++--- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/drivers/usb/gadget/function/f_hid.c b/drivers/usb/gadget

[PATCH v4 00/10] Gadget endpoint request allocation and MIDI

2016-08-08 Thread Felipe F. Tonello
with wMaxPacketSize. Felipe F. Tonello (10): usb: gadget: fix usb_ep_align_maybe endianness and new usb_ep_align usb: gadget: change len to size_t on alloc_ep_req() usb: gadget: align buffer size when allocating for OUT endpoint usb: gadget: f_midi: remove alignment code for OUT endpoint usb: gadget

[PATCH v4 00/10] Gadget endpoint request allocation and MIDI

2016-08-08 Thread Felipe F. Tonello
with wMaxPacketSize. Felipe F. Tonello (10): usb: gadget: fix usb_ep_align_maybe endianness and new usb_ep_align usb: gadget: change len to size_t on alloc_ep_req() usb: gadget: align buffer size when allocating for OUT endpoint usb: gadget: f_midi: remove alignment code for OUT endpoint usb: gadget

[PATCH v4 05/10] usb: gadget: f_midi: defaults buflen sizes to 512

2016-08-08 Thread Felipe F. Tonello
512 is the value used by wMaxPacketSize, as specified by the USB Spec. This makes sure this driver uses, by default, the most optimal value for IN and OUT endpoint requests. Signed-off-by: Felipe F. Tonello <e...@felipetonello.com> --- drivers/usb/gadget/function/f_midi.c | 2 +- drive

[PATCH v4 04/10] usb: gadget: f_midi: remove alignment code for OUT endpoint

2016-08-08 Thread Felipe F. Tonello
The new version of alloc_ep_req() already aligns the buffer size to wMaxPacketSize on OUT endpoints. Signed-off-by: Felipe F. Tonello <e...@felipetonello.com> --- drivers/usb/gadget/function/f_midi.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/drivers/usb/

[PATCH v4 01/10] usb: gadget: fix usb_ep_align_maybe endianness and new usb_ep_align

2016-08-08 Thread Felipe F. Tonello
. This is useful to be used by USB requests allocator functions. Signed-off-by: Felipe F. Tonello <e...@felipetonello.com> --- include/linux/usb/gadget.h | 17 ++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/include/linux/usb/gadget.h b/include/linux/usb/gadget.h

[PATCH v4 05/10] usb: gadget: f_midi: defaults buflen sizes to 512

2016-08-08 Thread Felipe F. Tonello
512 is the value used by wMaxPacketSize, as specified by the USB Spec. This makes sure this driver uses, by default, the most optimal value for IN and OUT endpoint requests. Signed-off-by: Felipe F. Tonello --- drivers/usb/gadget/function/f_midi.c | 2 +- drivers/usb/gadget/legacy/gmidi.c

[PATCH v4 04/10] usb: gadget: f_midi: remove alignment code for OUT endpoint

2016-08-08 Thread Felipe F. Tonello
The new version of alloc_ep_req() already aligns the buffer size to wMaxPacketSize on OUT endpoints. Signed-off-by: Felipe F. Tonello --- drivers/usb/gadget/function/f_midi.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/drivers/usb/gadget/function/f_midi.c b/drivers

[PATCH v4 01/10] usb: gadget: fix usb_ep_align_maybe endianness and new usb_ep_align

2016-08-08 Thread Felipe F. Tonello
. This is useful to be used by USB requests allocator functions. Signed-off-by: Felipe F. Tonello --- include/linux/usb/gadget.h | 17 ++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/include/linux/usb/gadget.h b/include/linux/usb/gadget.h index 612dbdfa388e..3cc93237ff98

[PATCH v4 02/10] usb: gadget: change len to size_t on alloc_ep_req()

2016-08-08 Thread Felipe F. Tonello
Length of buffers should be of type size_t whenever possible. Altough recommended, this change has no real practical change, unless a driver has a uses a huge or negative buffer size - it might help find these bugs. Signed-off-by: Felipe F. Tonello <e...@felipetonello.com> --- drivers/usb/

[PATCH v4 02/10] usb: gadget: change len to size_t on alloc_ep_req()

2016-08-08 Thread Felipe F. Tonello
Length of buffers should be of type size_t whenever possible. Altough recommended, this change has no real practical change, unless a driver has a uses a huge or negative buffer size - it might help find these bugs. Signed-off-by: Felipe F. Tonello --- drivers/usb/gadget/u_f.c | 2 +- drivers

[PATCH v4 08/10] usb: gadget: remove useless parameter in alloc_ep_req()

2016-08-08 Thread Felipe F. Tonello
The default_length parameter of alloc_ep_req was not really necessary and gadget drivers would almost always create an inline function to pass the same value to len and default_len. So this patch also removes duplicate code from few drivers. Signed-off-by: Felipe F. Tonello &l

[PATCH v4 08/10] usb: gadget: remove useless parameter in alloc_ep_req()

2016-08-08 Thread Felipe F. Tonello
The default_length parameter of alloc_ep_req was not really necessary and gadget drivers would almost always create an inline function to pass the same value to len and default_len. So this patch also removes duplicate code from few drivers. Signed-off-by: Felipe F. Tonello --- drivers/usb

[PATCH v4 09/10] usb: gadget: f_hid: use free_ep_req()

2016-08-08 Thread Felipe F. Tonello
We should always use free_ep_req() when allocating requests with alloc_ep_req(). Signed-off-by: Felipe F. Tonello <e...@felipetonello.com> --- drivers/usb/gadget/function/f_hid.c | 10 +++--- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/drivers/usb/gadget/function/f_hi

[PATCH v4 09/10] usb: gadget: f_hid: use free_ep_req()

2016-08-08 Thread Felipe F. Tonello
We should always use free_ep_req() when allocating requests with alloc_ep_req(). Signed-off-by: Felipe F. Tonello --- drivers/usb/gadget/function/f_hid.c | 10 +++--- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/drivers/usb/gadget/function/f_hid.c b/drivers/usb/gadget

[PATCH v4 06/10] usb: gadget: f_midi: refactor state machine

2016-08-08 Thread Felipe F. Tonello
This refactor results in a cleaner state machine code and promotes consistency, readability, and maintanability of this driver. This refactor state machine was well tested and it is currently running in production code and devices. Signed-off-by: Felipe F. Tonello <e...@felipetonello.

[PATCH v4 06/10] usb: gadget: f_midi: refactor state machine

2016-08-08 Thread Felipe F. Tonello
This refactor results in a cleaner state machine code and promotes consistency, readability, and maintanability of this driver. This refactor state machine was well tested and it is currently running in production code and devices. Signed-off-by: Felipe F. Tonello --- drivers/usb/gadget

[PATCH v4 03/10] usb: gadget: align buffer size when allocating for OUT endpoint

2016-08-08 Thread Felipe F. Tonello
Using usb_ep_align() makes sure that the buffer size for OUT endpoints is always aligned with wMaxPacketSize (512 usually). This makes sure that no buffer has the wrong size, which can cause nasty bugs. Signed-off-by: Felipe F. Tonello <e...@felipetonello.com> --- drivers/usb/gadget/u_f.

[PATCH v4 03/10] usb: gadget: align buffer size when allocating for OUT endpoint

2016-08-08 Thread Felipe F. Tonello
Using usb_ep_align() makes sure that the buffer size for OUT endpoints is always aligned with wMaxPacketSize (512 usually). This makes sure that no buffer has the wrong size, which can cause nasty bugs. Signed-off-by: Felipe F. Tonello --- drivers/usb/gadget/u_f.c | 3 +++ drivers/usb/gadget

[PATCH v4 07/10] usb: gadget: f_midi: drop substreams when disabling endpoint

2016-08-08 Thread Felipe F. Tonello
This change makes sure that the ALSA buffers are cleaned if an endpoint becomes disabled. Before this change, if the internal ALSA buffer did overflow, the MIDI function would stop sending MIDI to the host. Signed-off-by: Felipe F. Tonello <e...@felipetonello.com> --- drivers/usb/

[PATCH v4 07/10] usb: gadget: f_midi: drop substreams when disabling endpoint

2016-08-08 Thread Felipe F. Tonello
This change makes sure that the ALSA buffers are cleaned if an endpoint becomes disabled. Before this change, if the internal ALSA buffer did overflow, the MIDI function would stop sending MIDI to the host. Signed-off-by: Felipe F. Tonello --- drivers/usb/gadget/function/f_midi.c | 27

[PATCH v4 10/10] usb: gadget: f_hid: use alloc_ep_req()

2016-08-08 Thread Felipe F. Tonello
Use gadget's framework allocation function instead of directly calling usb_ep_alloc_request(). Signed-off-by: Felipe F. Tonello <e...@felipetonello.com> --- drivers/usb/gadget/function/f_hid.c | 6 +- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/drivers/usb/gadget/fu

[PATCH v4 10/10] usb: gadget: f_hid: use alloc_ep_req()

2016-08-08 Thread Felipe F. Tonello
Use gadget's framework allocation function instead of directly calling usb_ep_alloc_request(). Signed-off-by: Felipe F. Tonello --- drivers/usb/gadget/function/f_hid.c | 6 +- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/drivers/usb/gadget/function/f_hid.c b/drivers/usb

[PATCH v3 1/9] usb: gadget: fix usb_ep_align_maybe endianness and new usb_ep_align

2016-08-05 Thread Felipe F. Tonello
. This is useful to be used by USB requests allocator functions. Signed-off-by: Felipe F. Tonello <e...@felipetonello.com> --- include/linux/usb/gadget.h | 17 ++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/include/linux/usb/gadget.h b/include/linux/usb/gadget.h

[PATCH v3 1/9] usb: gadget: fix usb_ep_align_maybe endianness and new usb_ep_align

2016-08-05 Thread Felipe F. Tonello
. This is useful to be used by USB requests allocator functions. Signed-off-by: Felipe F. Tonello --- include/linux/usb/gadget.h | 17 ++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/include/linux/usb/gadget.h b/include/linux/usb/gadget.h index 612dbdfa388e..3cc93237ff98

[PATCH v3 2/9] usb: gadget: align buffer size when allocating for OUT endpoint

2016-08-05 Thread Felipe F. Tonello
Using usb_ep_align() makes sure that the buffer size for OUT endpoints is always aligned with wMaxPacketSize (512 usually). This makes sure that no buffer has the wrong size, which can cause nasty bugs. Signed-off-by: Felipe F. Tonello <e...@felipetonello.com> --- drivers/usb/gadget/u_f.

[PATCH v3 2/9] usb: gadget: align buffer size when allocating for OUT endpoint

2016-08-05 Thread Felipe F. Tonello
Using usb_ep_align() makes sure that the buffer size for OUT endpoints is always aligned with wMaxPacketSize (512 usually). This makes sure that no buffer has the wrong size, which can cause nasty bugs. Signed-off-by: Felipe F. Tonello --- drivers/usb/gadget/u_f.c | 3 +++ drivers/usb/gadget

[PATCH v3 3/9] usb: gadget: f_midi: remove alignment code for OUT endpoint

2016-08-05 Thread Felipe F. Tonello
The new version of alloc_ep_req() already aligns the buffer size to wMaxPacketSize on OUT endpoints. Signed-off-by: Felipe F. Tonello <e...@felipetonello.com> --- drivers/usb/gadget/function/f_midi.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/drivers/usb/

[PATCH v3 3/9] usb: gadget: f_midi: remove alignment code for OUT endpoint

2016-08-05 Thread Felipe F. Tonello
The new version of alloc_ep_req() already aligns the buffer size to wMaxPacketSize on OUT endpoints. Signed-off-by: Felipe F. Tonello --- drivers/usb/gadget/function/f_midi.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/drivers/usb/gadget/function/f_midi.c b/drivers

[PATCH v3 5/9] usb: gadget: f_midi: refactor state machine

2016-08-05 Thread Felipe F. Tonello
This refactor results in a cleaner state machine code and promotes consistency, readability, and maintanability of this driver. This refactor state machine was well tested and it is currently running in production code and devices. Signed-off-by: Felipe F. Tonello <e...@felipetonello.

[PATCH v3 5/9] usb: gadget: f_midi: refactor state machine

2016-08-05 Thread Felipe F. Tonello
This refactor results in a cleaner state machine code and promotes consistency, readability, and maintanability of this driver. This refactor state machine was well tested and it is currently running in production code and devices. Signed-off-by: Felipe F. Tonello --- drivers/usb/gadget

[PATCH v3 6/9] usb: gadget: f_midi: drop substreams when disabling endpoint

2016-08-05 Thread Felipe F. Tonello
This change makes sure that the ALSA buffers are cleaned if an endpoint becomes disabled. Before this change, if the internal ALSA buffer did overflow, the MIDI function would stop sending MIDI to the host. Signed-off-by: Felipe F. Tonello <e...@felipetonello.com> --- drivers/usb/

[PATCH v3 6/9] usb: gadget: f_midi: drop substreams when disabling endpoint

2016-08-05 Thread Felipe F. Tonello
This change makes sure that the ALSA buffers are cleaned if an endpoint becomes disabled. Before this change, if the internal ALSA buffer did overflow, the MIDI function would stop sending MIDI to the host. Signed-off-by: Felipe F. Tonello --- drivers/usb/gadget/function/f_midi.c | 27

[PATCH v3 7/9] usb: gadget: remove useless parameter in alloc_ep_req()

2016-08-05 Thread Felipe F. Tonello
The default_length parameter of alloc_ep_req was not really necessary and gadget drivers would almost always create an inline function to pass the same value to len and default_len. So this patch also removes duplicate code from few drivers. Signed-off-by: Felipe F. Tonello &l

[PATCH v3 7/9] usb: gadget: remove useless parameter in alloc_ep_req()

2016-08-05 Thread Felipe F. Tonello
The default_length parameter of alloc_ep_req was not really necessary and gadget drivers would almost always create an inline function to pass the same value to len and default_len. So this patch also removes duplicate code from few drivers. Signed-off-by: Felipe F. Tonello --- drivers/usb

[PATCH v3 0/9] Gadget endpoint request allocation and MIDI

2016-08-05 Thread Felipe F. Tonello
* Added documentation to alloc_ep_req and free_ep_req * Improved commit message on patch 7 Changes from v1: * Added patches 1, 2, 7, 8 ,9. * Patch 3 removes max_t() for buffer alignment with wMaxPacketSize Felipe F. Tonello (9): usb: gadget: fix usb_ep_align_maybe endianness and new

[PATCH v3 0/9] Gadget endpoint request allocation and MIDI

2016-08-05 Thread Felipe F. Tonello
* Added documentation to alloc_ep_req and free_ep_req * Improved commit message on patch 7 Changes from v1: * Added patches 1, 2, 7, 8 ,9. * Patch 3 removes max_t() for buffer alignment with wMaxPacketSize Felipe F. Tonello (9): usb: gadget: fix usb_ep_align_maybe endianness and new

[PATCH v3 9/9] usb: gadget: f_hid: use alloc_ep_req()

2016-08-05 Thread Felipe F. Tonello
Use gadget's framework allocation function instead of directly calling usb_ep_alloc_request(). Signed-off-by: Felipe F. Tonello <e...@felipetonello.com> --- drivers/usb/gadget/function/f_hid.c | 6 +- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/drivers/usb/gadget/fu

[PATCH v3 9/9] usb: gadget: f_hid: use alloc_ep_req()

2016-08-05 Thread Felipe F. Tonello
Use gadget's framework allocation function instead of directly calling usb_ep_alloc_request(). Signed-off-by: Felipe F. Tonello --- drivers/usb/gadget/function/f_hid.c | 6 +- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/drivers/usb/gadget/function/f_hid.c b/drivers/usb

[PATCH v3 8/9] usb: gadget: f_hid: use free_ep_req()

2016-08-05 Thread Felipe F. Tonello
We should always use free_ep_req() when allocating requests with alloc_ep_req(). Signed-off-by: Felipe F. Tonello <e...@felipetonello.com> --- drivers/usb/gadget/function/f_hid.c | 10 +++--- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/drivers/usb/gadget/function/f_hi

[PATCH v3 8/9] usb: gadget: f_hid: use free_ep_req()

2016-08-05 Thread Felipe F. Tonello
We should always use free_ep_req() when allocating requests with alloc_ep_req(). Signed-off-by: Felipe F. Tonello --- drivers/usb/gadget/function/f_hid.c | 10 +++--- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/drivers/usb/gadget/function/f_hid.c b/drivers/usb/gadget

[PATCH v3 4/9] usb: gadget: f_midi: defaults buflen sizes to 512

2016-08-05 Thread Felipe F. Tonello
512 is the value used by wMaxPacketSize, as specified by the USB Spec. This makes sure this driver uses, by default, the most optimal value for IN and OUT endpoint requests. Signed-off-by: Felipe F. Tonello <e...@felipetonello.com> --- drivers/usb/gadget/function/f_midi.c | 2 +- drive

[PATCH v3 4/9] usb: gadget: f_midi: defaults buflen sizes to 512

2016-08-05 Thread Felipe F. Tonello
512 is the value used by wMaxPacketSize, as specified by the USB Spec. This makes sure this driver uses, by default, the most optimal value for IN and OUT endpoint requests. Signed-off-by: Felipe F. Tonello --- drivers/usb/gadget/function/f_midi.c | 2 +- drivers/usb/gadget/legacy/gmidi.c

[PATCH 3/9] usb: gadget: f_midi: remove alignment code for OUT endpoint

2016-07-26 Thread Felipe F. Tonello
The new version of alloc_ep_req() already aligns the buffer size to wMaxPacketSize on OUT endpoints. Signed-off-by: Felipe F. Tonello <e...@felipetonello.com> --- drivers/usb/gadget/function/f_midi.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/drivers/usb/

[PATCH 3/9] usb: gadget: f_midi: remove alignment code for OUT endpoint

2016-07-26 Thread Felipe F. Tonello
The new version of alloc_ep_req() already aligns the buffer size to wMaxPacketSize on OUT endpoints. Signed-off-by: Felipe F. Tonello --- drivers/usb/gadget/function/f_midi.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/drivers/usb/gadget/function/f_midi.c b/drivers

[PATCH 2/9] usb: gadget: align buffer size when allocating for OUT endpoint

2016-07-26 Thread Felipe F. Tonello
Using usb_ep_align() makes sure that the buffer size for OUT endpoints is always aligned with wMaxPacketSize (512 usually). This makes sure that no buffer has the wrong size, which can cause nasty bugs. Signed-off-by: Felipe F. Tonello <e...@felipetonello.com> --- drivers/usb/gadget/u_f

[PATCH 2/9] usb: gadget: align buffer size when allocating for OUT endpoint

2016-07-26 Thread Felipe F. Tonello
Using usb_ep_align() makes sure that the buffer size for OUT endpoints is always aligned with wMaxPacketSize (512 usually). This makes sure that no buffer has the wrong size, which can cause nasty bugs. Signed-off-by: Felipe F. Tonello --- drivers/usb/gadget/u_f.c | 3 +++ 1 file changed, 3

[PATCH v2 7/9] usb: gadget: remove useless parameter in alloc_ep_req()

2016-07-26 Thread Felipe F. Tonello
This parameter was not really necessary and gadget drivers would almost always create an inline function to pass the same value to len and default_len. So this patch also removes duplicate code from few drivers. Signed-off-by: Felipe F. Tonello <e...@felipetonello.com> --- drivers/usb/

[PATCH v2 7/9] usb: gadget: remove useless parameter in alloc_ep_req()

2016-07-26 Thread Felipe F. Tonello
This parameter was not really necessary and gadget drivers would almost always create an inline function to pass the same value to len and default_len. So this patch also removes duplicate code from few drivers. Signed-off-by: Felipe F. Tonello --- drivers/usb/gadget/function/f_hid.c

[PATCH 6/9] usb: gadget: f_midi: drop substreams when disabling endpoint

2016-07-26 Thread Felipe F. Tonello
This change makes sure that the ALSA buffers are cleaned if an endpoint becomes disabled. Before this change, if the internal ALSA buffer did overflow, the MIDI function would stop sending MIDI to the host. Signed-off-by: Felipe F. Tonello <e...@felipetonello.com> --- drivers/usb/

[PATCH 4/9] usb: gadget: f_midi: defaults buflen sizes to 512

2016-07-26 Thread Felipe F. Tonello
512 is the value used by wMaxPacketSize, as specified by the USB Spec. This makes sure this driver uses, by default, the most optimal value for IN and OUT endpoint requests. Signed-off-by: Felipe F. Tonello <e...@felipetonello.com> --- drivers/usb/gadget/function/f_midi.c | 2 +- drive

[PATCH 4/9] usb: gadget: f_midi: defaults buflen sizes to 512

2016-07-26 Thread Felipe F. Tonello
512 is the value used by wMaxPacketSize, as specified by the USB Spec. This makes sure this driver uses, by default, the most optimal value for IN and OUT endpoint requests. Signed-off-by: Felipe F. Tonello --- drivers/usb/gadget/function/f_midi.c | 2 +- drivers/usb/gadget/legacy/gmidi.c

[PATCH 6/9] usb: gadget: f_midi: drop substreams when disabling endpoint

2016-07-26 Thread Felipe F. Tonello
This change makes sure that the ALSA buffers are cleaned if an endpoint becomes disabled. Before this change, if the internal ALSA buffer did overflow, the MIDI function would stop sending MIDI to the host. Signed-off-by: Felipe F. Tonello --- drivers/usb/gadget/function/f_midi.c | 27

[PATCH 5/9] usb: gadget: f_midi: refactor state machine

2016-07-26 Thread Felipe F. Tonello
This refactor results in a cleaner state machine code and promotes consistency, readability, and maintanability of this driver. This refactor state machine was well tested and it is currently running in production code and devices. Signed-off-by: Felipe F. Tonello <e...@felipetonello.

[PATCH v2 0/9] Gadget endpoint request allocation and MIDI

2016-07-26 Thread Felipe F. Tonello
-explanatory. Changes from v1: * Added patches 1, 2, 7, 8 ,9. * Patch 3 removes max_t() for buffer alignment with wMaxPacketSize Felipe F. Tonello (9): usb: gadget: fix usb_ep_align_maybe endianness and new usb_ep_align usb: gadget: align buffer size when allocating for OUT endpoint usb: gadget

[PATCH 5/9] usb: gadget: f_midi: refactor state machine

2016-07-26 Thread Felipe F. Tonello
This refactor results in a cleaner state machine code and promotes consistency, readability, and maintanability of this driver. This refactor state machine was well tested and it is currently running in production code and devices. Signed-off-by: Felipe F. Tonello --- drivers/usb/gadget

[PATCH v2 0/9] Gadget endpoint request allocation and MIDI

2016-07-26 Thread Felipe F. Tonello
-explanatory. Changes from v1: * Added patches 1, 2, 7, 8 ,9. * Patch 3 removes max_t() for buffer alignment with wMaxPacketSize Felipe F. Tonello (9): usb: gadget: fix usb_ep_align_maybe endianness and new usb_ep_align usb: gadget: align buffer size when allocating for OUT endpoint usb: gadget

[PATCH 7/9] usb: gadget: remove useless parameter in alloc_ep_req()

2016-07-26 Thread Felipe F. Tonello
This parameter was not really necessary and gadget drivers would almost always create an inline function to pass the same value to len and default_len. So this patch also removes duplicate code from few drivers. Signed-off-by: Felipe F. Tonello <e...@felipetonello.com> --- drivers/usb/

[PATCH 7/9] usb: gadget: remove useless parameter in alloc_ep_req()

2016-07-26 Thread Felipe F. Tonello
This parameter was not really necessary and gadget drivers would almost always create an inline function to pass the same value to len and default_len. So this patch also removes duplicate code from few drivers. Signed-off-by: Felipe F. Tonello --- drivers/usb/gadget/function/f_hid.c

[PATCH 8/9] usb: gadget: f_hid: use free_ep_req()

2016-07-26 Thread Felipe F. Tonello
We should always use free_ep_req() when allocating requests with alloc_ep_req(). Signed-off-by: Felipe F. Tonello <e...@felipetonello.com> --- drivers/usb/gadget/function/f_hid.c | 10 +++--- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/drivers/usb/gadget/function/f_hi

[PATCH 8/9] usb: gadget: f_hid: use free_ep_req()

2016-07-26 Thread Felipe F. Tonello
We should always use free_ep_req() when allocating requests with alloc_ep_req(). Signed-off-by: Felipe F. Tonello --- drivers/usb/gadget/function/f_hid.c | 10 +++--- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/drivers/usb/gadget/function/f_hid.c b/drivers/usb/gadget

[PATCH 9/9] usb: gadget: f_hid: use alloc_ep_req()

2016-07-26 Thread Felipe F. Tonello
Use gadget's framework allocation function instead of directly calling usb_ep_alloc_request(). Signed-off-by: Felipe F. Tonello <e...@felipetonello.com> --- drivers/usb/gadget/function/f_hid.c | 6 +- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/drivers/usb/gadget/fu

[PATCH 9/9] usb: gadget: f_hid: use alloc_ep_req()

2016-07-26 Thread Felipe F. Tonello
Use gadget's framework allocation function instead of directly calling usb_ep_alloc_request(). Signed-off-by: Felipe F. Tonello --- drivers/usb/gadget/function/f_hid.c | 6 +- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/drivers/usb/gadget/function/f_hid.c b/drivers/usb

[PATCH 1/9] usb: gadget: fix usb_ep_align_maybe endianness and new usb_ep_align

2016-07-26 Thread Felipe F. Tonello
. This is useful to be used by USB requests allocator functions. Signed-off-by: Felipe F. Tonello <e...@felipetonello.com> --- include/linux/usb/gadget.h | 17 ++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/include/linux/usb/gadget.h b/include/linux/usb/gadget.h

[PATCH 1/9] usb: gadget: fix usb_ep_align_maybe endianness and new usb_ep_align

2016-07-26 Thread Felipe F. Tonello
. This is useful to be used by USB requests allocator functions. Signed-off-by: Felipe F. Tonello --- include/linux/usb/gadget.h | 17 ++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/include/linux/usb/gadget.h b/include/linux/usb/gadget.h index 612dbdfa388e..b8fa6901b881

[PATCH 1/4] usb: gadget: f_midi: fixed endianness when using wMaxPacketSize

2016-07-25 Thread Felipe F. Tonello
USB spec specifies wMaxPacketSize to be little endian (as other properties), so when using this variable in the driver we should convert to the current CPU endianness if necessary. Signed-off-by: Felipe F. Tonello <e...@felipetonello.com> --- drivers/usb/gadget/function/f_midi.c | 2 +-

[PATCH 1/4] usb: gadget: f_midi: fixed endianness when using wMaxPacketSize

2016-07-25 Thread Felipe F. Tonello
USB spec specifies wMaxPacketSize to be little endian (as other properties), so when using this variable in the driver we should convert to the current CPU endianness if necessary. Signed-off-by: Felipe F. Tonello --- drivers/usb/gadget/function/f_midi.c | 2 +- 1 file changed, 1 insertion

[PATCH 2/4] usb: gadget: f_midi: defaults buflen sizes to 512

2016-07-25 Thread Felipe F. Tonello
512 is the value used by wMaxPacketSize, as specified by the USB Spec. This makes sure this driver uses, by default, the most optimal value for IN and OUT endpoint requests. Signed-off-by: Felipe F. Tonello <e...@felipetonello.com> --- drivers/usb/gadget/function/f_midi.c | 2 +- drive

[PATCH 2/4] usb: gadget: f_midi: defaults buflen sizes to 512

2016-07-25 Thread Felipe F. Tonello
512 is the value used by wMaxPacketSize, as specified by the USB Spec. This makes sure this driver uses, by default, the most optimal value for IN and OUT endpoint requests. Signed-off-by: Felipe F. Tonello --- drivers/usb/gadget/function/f_midi.c | 2 +- drivers/usb/gadget/legacy/gmidi.c

[PATCH 3/4] usb: gadget: f_midi: refactor state machine

2016-07-25 Thread Felipe F. Tonello
This refactor results in a cleaner state machine code and promotes consistency, readability, and maintanability of this driver. This refactor state machine was well tested and it is currently running in production code and devices. Signed-off-by: Felipe F. Tonello <e...@felipetonello.

[PATCH 4/4] usb: gadget: f_midi: drop substreams when disabling endpoint

2016-07-25 Thread Felipe F. Tonello
This change makes sure that the ALSA buffers are cleaned if an endpoint becomes disabled. Before this change, if the internal ALSA buffer did overflow, the MIDI function would stop sending MIDI to the host. Signed-off-by: Felipe F. Tonello <e...@felipetonello.com> --- drivers/usb/

[PATCH 0/4] MIDI Function improvements

2016-07-25 Thread Felipe F. Tonello
, which is nice to have. Felipe F. Tonello (4): usb: gadget: f_midi: fixed endianness when using wMaxPacketSize usb: gadget: f_midi: defaults buflen sizes to 512 usb: gadget: f_midi: refactor state machine usb: gadget: f_midi: drop substreams when disabling endpoint drivers/usb/gadget/function

[PATCH 3/4] usb: gadget: f_midi: refactor state machine

2016-07-25 Thread Felipe F. Tonello
This refactor results in a cleaner state machine code and promotes consistency, readability, and maintanability of this driver. This refactor state machine was well tested and it is currently running in production code and devices. Signed-off-by: Felipe F. Tonello --- drivers/usb/gadget

[PATCH 4/4] usb: gadget: f_midi: drop substreams when disabling endpoint

2016-07-25 Thread Felipe F. Tonello
This change makes sure that the ALSA buffers are cleaned if an endpoint becomes disabled. Before this change, if the internal ALSA buffer did overflow, the MIDI function would stop sending MIDI to the host. Signed-off-by: Felipe F. Tonello --- drivers/usb/gadget/function/f_midi.c | 27

[PATCH 0/4] MIDI Function improvements

2016-07-25 Thread Felipe F. Tonello
, which is nice to have. Felipe F. Tonello (4): usb: gadget: f_midi: fixed endianness when using wMaxPacketSize usb: gadget: f_midi: defaults buflen sizes to 512 usb: gadget: f_midi: refactor state machine usb: gadget: f_midi: drop substreams when disabling endpoint drivers/usb/gadget/function

[PATCH v2] usb: gadget: f_midi: fixed a bug when buflen was smaller than wMaxPacketSize

2016-03-23 Thread Felipe F. Tonello
and replacing it with wMaxPacketSize of the appropriate endpoint where needed. Signed-off-by: Felipe F. Tonello <e...@felipetonello.com> --- v2: - Removed buflen - use le16_to_cpu() in order to avoid endianess issues drivers/usb/gadget/function/f_midi.c | 14 ++ drivers/usb/

[PATCH v2] usb: gadget: f_midi: fixed a bug when buflen was smaller than wMaxPacketSize

2016-03-23 Thread Felipe F. Tonello
and replacing it with wMaxPacketSize of the appropriate endpoint where needed. Signed-off-by: Felipe F. Tonello --- v2: - Removed buflen - use le16_to_cpu() in order to avoid endianess issues drivers/usb/gadget/function/f_midi.c | 14 ++ drivers/usb/gadget/function/u_midi.h | 1

[PATCH] usb: gadget: f_midi: Fixed a bug when buflen was smaller than wMaxPacketSize

2016-03-09 Thread Felipe F. Tonello
] HOST: [PING] DEVICE: [NAK] HOST: [PING] DEVICE: [NAK] ... HOST: [PING] DEVICE: [NAK] This patch fixes this problem by setting the minimum usb_request's buffer size for the OUT endpoint as its wMaxPacketSize. Signed-off-by: Felipe F. Tonello <e...@felipetonello.com> --- drivers/usb/

[PATCH] usb: gadget: f_midi: Fixed a bug when buflen was smaller than wMaxPacketSize

2016-03-09 Thread Felipe F. Tonello
] HOST: [PING] DEVICE: [NAK] HOST: [PING] DEVICE: [NAK] ... HOST: [PING] DEVICE: [NAK] This patch fixes this problem by setting the minimum usb_request's buffer size for the OUT endpoint as its wMaxPacketSize. Signed-off-by: Felipe F. Tonello --- drivers/usb/gadget/function/f_midi.c | 4

[PATCH] usb: gadget: f_midi: added spinlock on transmit function

2016-03-09 Thread Felipe F. Tonello
is necessary. In this case it is used a spinlock since f_midi_transmit is also called by usb_request->complete callback in interrupt context. Cc: <sta...@vger.kernel.org> # v4.5+ Fixes: e1e3d7ec5da3 ("usb: gadget: f_midi: pre-allocate IN requests") Signed-off-by: Felipe F. Tonello <

[PATCH] usb: gadget: f_midi: added spinlock on transmit function

2016-03-09 Thread Felipe F. Tonello
is necessary. In this case it is used a spinlock since f_midi_transmit is also called by usb_request->complete callback in interrupt context. Cc: # v4.5+ Fixes: e1e3d7ec5da3 ("usb: gadget: f_midi: pre-allocate IN requests") Signed-off-by: Felipe F. Tonello --- drivers/usb/gadget/function/

[PATCH 1/5] usb: gadget: f_midi: refactor state machine

2016-03-02 Thread Felipe F. Tonello
This refactor results in a cleaner state machine code and as a result fixed a bug when packaging a USB-MIDI packet right after a non-conformant MIDI byte stream. Signed-off-by: Felipe F. Tonello <e...@felipetonello.com> --- drivers/usb/gadget/function/f_midi.c

[PATCH 1/5] usb: gadget: f_midi: refactor state machine

2016-03-02 Thread Felipe F. Tonello
This refactor results in a cleaner state machine code and as a result fixed a bug when packaging a USB-MIDI packet right after a non-conformant MIDI byte stream. Signed-off-by: Felipe F. Tonello --- drivers/usb/gadget/function/f_midi.c | 204 ++- 1 file changed

  1   2   3   >