public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Tatyana Brokhman <tlinder@codeaurora.org>
To: greg@kroah.com
Cc: linux-usb@vger.kernel.org, linux-arm-msm@vger.kernel.org,
	balbi@ti.com, ablay@codeaurora.org,
	Tatyana Brokhman <tlinder@codeaurora.org>,
	linux-kernel@vger.kernel.org (open list)
Subject: [PATCH/RFC 3/5] usb:g_zero: bulk in/out unittest support
Date: Thu, 16 Jun 2011 16:31:05 +0300	[thread overview]
Message-ID: <1308231068-24038-4-git-send-email-tlinder@codeaurora.org> (raw)
In-Reply-To: <1308231068-24038-2-git-send-email-tlinder@codeaurora.org>

This commit adds a new vendor specific request to be handled by the
g_zero module in it's sourcesink configuration. The purpose if this
request is to update the length of the BULK transfer to a given value.
The bRequest value of the new control request is 0x5e.
It is used by the user-space Unit testing application for bulk in/out
tests.

Signed-off-by: Tatyana Brokhman <tlinder@codeaurora.org>

---
 drivers/usb/gadget/f_sourcesink.c |   12 ++++++++++++
 1 files changed, 12 insertions(+), 0 deletions(-)

diff --git a/drivers/usb/gadget/f_sourcesink.c b/drivers/usb/gadget/f_sourcesink.c
index caf2f95..d417b8a 100644
--- a/drivers/usb/gadget/f_sourcesink.c
+++ b/drivers/usb/gadget/f_sourcesink.c
@@ -70,6 +70,7 @@ static unsigned pattern;
 module_param(pattern, uint, 0);
 MODULE_PARM_DESC(pattern, "0 = all zeroes, 1 = mod63 ");
 
+static struct f_sourcesink	*the_sourcesink;
 /*-------------------------------------------------------------------------*/
 
 static struct usb_interface_descriptor source_sink_intf = {
@@ -197,6 +198,7 @@ static void
 sourcesink_unbind(struct usb_configuration *c, struct usb_function *f)
 {
 	kfree(func_to_ss(f));
+	the_sourcesink = NULL;
 }
 
 /* optionally require specific source/sink data patterns  */
@@ -425,6 +427,7 @@ static int __init sourcesink_bind_config(struct usb_configuration *c)
 	status = usb_add_function(c, &ss->function);
 	if (status)
 		kfree(ss);
+	the_sourcesink = ss;
 	return status;
 }
 
@@ -472,6 +475,15 @@ static int sourcesink_setup(struct usb_configuration *c,
 		value = w_length;
 		break;
 
+	case 0x5e:
+		/*
+		 * Change bulk ep buffer size. buflen is the length of
+		 * the BULK transfer (req->length=buflen). Defined in g_zero.h
+		 */
+		disable_source_sink(the_sourcesink);
+		buflen = w_value;
+		value = enable_source_sink(c->cdev, the_sourcesink);
+		break;
 	default:
 unknown:
 		VDBG(c->cdev,
-- 
1.7.3.3

--
Sent by an employee of the Qualcomm Innovation Center, Inc.
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum.

  parent reply	other threads:[~2011-06-16 13:33 UTC|newest]

Thread overview: 33+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-06-16 13:31 [PATCH/RFC 1/5] usb:tools: usb unittests framework Tatyana Brokhman
2011-06-16 13:31 ` [PATCH/RFC 2/5] usb:dummy_hcd: connect/disconnect test support Tatyana Brokhman
2011-06-16 15:06   ` Alan Stern
2011-06-16 16:16     ` Felipe Balbi
2011-06-16 17:06       ` Alan Stern
2011-06-16 17:19         ` Alan Stern
2011-06-16 15:17   ` Alan Stern
2011-06-16 16:18   ` Felipe Balbi
2011-06-16 13:31 ` Tatyana Brokhman [this message]
2011-06-16 16:25   ` [PATCH/RFC 3/5] usb:g_zero: bulk in/out unittest support Felipe Balbi
2011-06-16 13:31 ` [PATCH/RFC 4/5] usb:dummy_hcd: Disable single-request fifo in dummy hcd Tatyana Brokhman
2011-06-16 15:09   ` Alan Stern
2011-06-16 13:31 ` [PATCH/RFC 5/5] usb: Add support for streams alloc/dealloc to devio.c Tatyana Brokhman
2011-06-16 15:20   ` Alan Stern
2011-06-16 16:28   ` Felipe Balbi
2011-06-16 18:21     ` Greg KH
2011-06-17  8:55       ` ablay
2011-06-17 14:35         ` Alan Stern
2011-06-30 17:45   ` Sarah Sharp
2011-06-30 18:39     ` William Gulland
2011-06-30 18:41     ` Tanya Brokhman
2011-07-19  9:12     ` Amit Blay
2011-07-19  9:18       ` Oliver Neukum
2011-07-19 10:07         ` Amit Blay
2011-07-19 10:26           ` Oliver Neukum
2011-07-19 10:36             ` Amit Blay
2011-07-27  6:21       ` Amit Blay
2011-08-17  7:06         ` Hans Petter Selasky
2011-08-18 22:47         ` Sarah Sharp
2011-08-21 10:18           ` Amit Blay
2011-08-22  7:58             ` Hans Petter Selasky
2011-08-22  7:56           ` Hans Petter Selasky
2011-08-22 16:41             ` Sarah Sharp

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1308231068-24038-4-git-send-email-tlinder@codeaurora.org \
    --to=tlinder@codeaurora.org \
    --cc=ablay@codeaurora.org \
    --cc=balbi@ti.com \
    --cc=greg@kroah.com \
    --cc=linux-arm-msm@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-usb@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox