Moving vnt_start_interrupt_urb in visibility of vnt_start_interrupt_urb_complete
Signed-off-by: Malcolm Priestley <[email protected]>
---
drivers/staging/vt6656/usbpipe.c | 55 ++++++++++++++++++++--------------------
1 file changed, 27 insertions(+), 28 deletions(-)
diff --git a/drivers/staging/vt6656/usbpipe.c b/drivers/staging/vt6656/usbpipe.c
index 9a88749..8bd776e 100644
--- a/drivers/staging/vt6656/usbpipe.c
+++ b/drivers/staging/vt6656/usbpipe.c
@@ -57,7 +57,6 @@
#define URB_ASYNC_UNLINK 0
#endif
-static void vnt_start_interrupt_urb_complete(struct urb *urb);
static void vnt_submit_rx_urb_complete(struct urb *urb);
static void vnt_tx_context_complete(struct urb *urb);
@@ -117,33 +116,6 @@ void vnt_control_in_u8(struct vnt_private *priv, u8 reg, u8 reg_off, u8 *data)
reg_off, reg, sizeof(u8), data);
}
-int vnt_start_interrupt_urb(struct vnt_private *priv)
-{
- int status = STATUS_FAILURE;
-
- if (priv->int_buf.in_use == true)
- return STATUS_FAILURE;
-
- priv->int_buf.in_use = true;
-
- usb_fill_int_urb(priv->interrupt_urb,
- priv->usb,
- usb_rcvintpipe(priv->usb, 1),
- priv->int_buf.data_buf,
- MAX_INTERRUPT_SIZE,
- vnt_start_interrupt_urb_complete,
- priv,
- priv->int_interval);
-
- status = usb_submit_urb(priv->interrupt_urb, GFP_ATOMIC);
- if (status) {
- dev_dbg(&priv->usb->dev, "Submit int URB failed %d\n", status);
- priv->int_buf.in_use = false;
- }
-
- return status;
-}
-
static void vnt_start_interrupt_urb_complete(struct urb *urb)
{
struct vnt_private *priv = urb->context;
@@ -182,6 +154,33 @@ static void vnt_start_interrupt_urb_complete(struct urb *urb)
return;
}
+int vnt_start_interrupt_urb(struct vnt_private *priv)
+{
+ int status = STATUS_FAILURE;
+
+ if (priv->int_buf.in_use == true)
+ return STATUS_FAILURE;
+
+ priv->int_buf.in_use = true;
+
+ usb_fill_int_urb(priv->interrupt_urb,
+ priv->usb,
+ usb_rcvintpipe(priv->usb, 1),
+ priv->int_buf.data_buf,
+ MAX_INTERRUPT_SIZE,
+ vnt_start_interrupt_urb_complete,
+ priv,
+ priv->int_interval);
+
+ status = usb_submit_urb(priv->interrupt_urb, GFP_ATOMIC);
+ if (status) {
+ dev_dbg(&priv->usb->dev, "Submit int URB failed %d\n", status);
+ priv->int_buf.in_use = false;
+ }
+
+ return status;
+}
+
int vnt_submit_rx_urb(struct vnt_private *priv, struct vnt_rcb *rcb)
{
int status = 0;
--
2.0.1
Signed-off-by: Malcolm Priestley <[email protected]>
---
drivers/staging/vt6656/usbpipe.c | 4 ----
1 file changed, 4 deletions(-)
diff --git a/drivers/staging/vt6656/usbpipe.c b/drivers/staging/vt6656/usbpipe.c
index acb0608..addaa65 100644
--- a/drivers/staging/vt6656/usbpipe.c
+++ b/drivers/staging/vt6656/usbpipe.c
@@ -53,10 +53,6 @@
#define USB_CTL_WAIT 500 //ms
-#ifndef URB_ASYNC_UNLINK
-#define URB_ASYNC_UNLINK 0
-#endif
-
int vnt_control_out(struct vnt_private *priv, u8 request, u16 value,
u16 index, u16 length, u8 *buffer)
{
--
2.0.1
We know what the endpoints are
Signed-off-by: Malcolm Priestley <[email protected]>
---
drivers/staging/vt6656/usbpipe.c | 6 ------
1 file changed, 6 deletions(-)
diff --git a/drivers/staging/vt6656/usbpipe.c b/drivers/staging/vt6656/usbpipe.c
index addaa65..aeef7ae 100644
--- a/drivers/staging/vt6656/usbpipe.c
+++ b/drivers/staging/vt6656/usbpipe.c
@@ -45,12 +45,6 @@
#include "device.h"
#include "usbpipe.h"
-//endpoint def
-//endpoint 0: control
-//endpoint 1: interrupt
-//endpoint 2: read bulk
-//endpoint 3: write bulk
-
#define USB_CTL_WAIT 500 //ms
int vnt_control_out(struct vnt_private *priv, u8 request, u16 value,
--
2.0.1
Signed-off-by: Malcolm Priestley <[email protected]>
---
drivers/staging/vt6656/usbpipe.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/staging/vt6656/usbpipe.c b/drivers/staging/vt6656/usbpipe.c
index aeef7ae..7b050ba 100644
--- a/drivers/staging/vt6656/usbpipe.c
+++ b/drivers/staging/vt6656/usbpipe.c
@@ -45,7 +45,7 @@
#include "device.h"
#include "usbpipe.h"
-#define USB_CTL_WAIT 500 //ms
+#define USB_CTL_WAIT 500 /* ms */
int vnt_control_out(struct vnt_private *priv, u8 request, u16 value,
u16 index, u16 length, u8 *buffer)
--
2.0.1
Moving vnt_tx_context in visibility of vnt_tx_context_complete
Signed-off-by: Malcolm Priestley <[email protected]>
---
drivers/staging/vt6656/usbpipe.c | 67 +++++++++++++++++++---------------------
1 file changed, 32 insertions(+), 35 deletions(-)
diff --git a/drivers/staging/vt6656/usbpipe.c b/drivers/staging/vt6656/usbpipe.c
index 7444bba..acb0608 100644
--- a/drivers/staging/vt6656/usbpipe.c
+++ b/drivers/staging/vt6656/usbpipe.c
@@ -57,8 +57,6 @@
#define URB_ASYNC_UNLINK 0
#endif
-static void vnt_tx_context_complete(struct urb *urb);
-
int vnt_control_out(struct vnt_private *priv, u8 request, u16 value,
u16 index, u16 length, u8 *buffer)
{
@@ -262,39 +260,6 @@ int vnt_submit_rx_urb(struct vnt_private *priv, struct vnt_rcb *rcb)
return status;
}
-
-int vnt_tx_context(struct vnt_private *priv,
- struct vnt_usb_send_context *context)
-{
- int status;
- struct urb *urb;
-
- if (!(MP_IS_READY(priv) && priv->Flags & fMP_POST_WRITES)) {
- context->in_use = false;
- return STATUS_RESOURCES;
- }
-
- urb = context->urb;
-
- usb_fill_bulk_urb(urb,
- priv->usb,
- usb_sndbulkpipe(priv->usb, 3),
- context->data,
- context->buf_len,
- vnt_tx_context_complete,
- context);
-
- status = usb_submit_urb(urb, GFP_ATOMIC);
- if (status != 0) {
- dev_dbg(&priv->usb->dev, "Submit Tx URB failed %d\n", status);
-
- context->in_use = false;
- return STATUS_FAILURE;
- }
-
- return STATUS_PENDING;
-}
-
static void vnt_tx_context_complete(struct urb *urb)
{
struct vnt_usb_send_context *context = urb->context;
@@ -327,3 +292,35 @@ static void vnt_tx_context_complete(struct urb *urb)
return;
}
+
+int vnt_tx_context(struct vnt_private *priv,
+ struct vnt_usb_send_context *context)
+{
+ int status;
+ struct urb *urb;
+
+ if (!(MP_IS_READY(priv) && priv->Flags & fMP_POST_WRITES)) {
+ context->in_use = false;
+ return STATUS_RESOURCES;
+ }
+
+ urb = context->urb;
+
+ usb_fill_bulk_urb(urb,
+ priv->usb,
+ usb_sndbulkpipe(priv->usb, 3),
+ context->data,
+ context->buf_len,
+ vnt_tx_context_complete,
+ context);
+
+ status = usb_submit_urb(urb, GFP_ATOMIC);
+ if (status != 0) {
+ dev_dbg(&priv->usb->dev, "Submit Tx URB failed %d\n", status);
+
+ context->in_use = false;
+ return STATUS_FAILURE;
+ }
+
+ return STATUS_PENDING;
+}
--
2.0.1
Moving vnt_submit_rx_urb in visibility of vnt_submit_rx_urb_complete
Signed-off-by: Malcolm Priestley <[email protected]>
---
drivers/staging/vt6656/usbpipe.c | 62 ++++++++++++++++++++--------------------
1 file changed, 31 insertions(+), 31 deletions(-)
diff --git a/drivers/staging/vt6656/usbpipe.c b/drivers/staging/vt6656/usbpipe.c
index 8bd776e..7444bba 100644
--- a/drivers/staging/vt6656/usbpipe.c
+++ b/drivers/staging/vt6656/usbpipe.c
@@ -57,7 +57,6 @@
#define URB_ASYNC_UNLINK 0
#endif
-static void vnt_submit_rx_urb_complete(struct urb *urb);
static void vnt_tx_context_complete(struct urb *urb);
int vnt_control_out(struct vnt_private *priv, u8 request, u16 value,
@@ -181,36 +180,6 @@ int vnt_start_interrupt_urb(struct vnt_private *priv)
return status;
}
-int vnt_submit_rx_urb(struct vnt_private *priv, struct vnt_rcb *rcb)
-{
- int status = 0;
- struct urb *urb;
-
- urb = rcb->urb;
- if (rcb->skb == NULL) {
- dev_dbg(&priv->usb->dev, "rcb->skb is null\n");
- return status;
- }
-
- usb_fill_bulk_urb(urb,
- priv->usb,
- usb_rcvbulkpipe(priv->usb, 2),
- skb_put(rcb->skb, skb_tailroom(rcb->skb)),
- MAX_TOTAL_SIZE_WITH_ALL_HEADERS,
- vnt_submit_rx_urb_complete,
- rcb);
-
- status = usb_submit_urb(urb, GFP_ATOMIC);
- if (status != 0) {
- dev_dbg(&priv->usb->dev, "Submit Rx URB failed %d\n", status);
- return STATUS_FAILURE ;
- }
-
- rcb->in_use = true;
-
- return status;
-}
-
static void vnt_submit_rx_urb_complete(struct urb *urb)
{
struct vnt_rcb *rcb = urb->context;
@@ -263,6 +232,37 @@ static void vnt_submit_rx_urb_complete(struct urb *urb)
return;
}
+int vnt_submit_rx_urb(struct vnt_private *priv, struct vnt_rcb *rcb)
+{
+ int status = 0;
+ struct urb *urb;
+
+ urb = rcb->urb;
+ if (rcb->skb == NULL) {
+ dev_dbg(&priv->usb->dev, "rcb->skb is null\n");
+ return status;
+ }
+
+ usb_fill_bulk_urb(urb,
+ priv->usb,
+ usb_rcvbulkpipe(priv->usb, 2),
+ skb_put(rcb->skb, skb_tailroom(rcb->skb)),
+ MAX_TOTAL_SIZE_WITH_ALL_HEADERS,
+ vnt_submit_rx_urb_complete,
+ rcb);
+
+ status = usb_submit_urb(urb, GFP_ATOMIC);
+ if (status != 0) {
+ dev_dbg(&priv->usb->dev, "Submit Rx URB failed %d\n", status);
+ return STATUS_FAILURE;
+ }
+
+ rcb->in_use = true;
+
+ return status;
+}
+
+
int vnt_tx_context(struct vnt_private *priv,
struct vnt_usb_send_context *context)
{
--
2.0.1