mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Robert Baldyga <r.baldyga@samsung.com>
To: balbi@ti.com
Cc: gregkh@linuxfoundation.org, linux-usb@vger.kernel.org,
	linux-kernel@vger.kernel.org, b.zolnierkie@samsung.com,
	m.szyprowski@samsung.com, Robert Baldyga <r.baldyga@samsung.com>,
	Kyungmin Park <kyungmin.park@samsung.com>
Subject: [PATCH 6/6] USB: gadget: s3c-hsotg: fix clear feature ENDPOINT_HALT
Date: Thu, 12 Sep 2013 16:18:52 +0200	[thread overview]
Message-ID: <1378995532-32142-7-git-send-email-r.baldyga@samsung.com> (raw)
In-Reply-To: <1378995532-32142-1-git-send-email-r.baldyga@samsung.com>

This patch adds two fixes:
- Property halted of s3c_hsotg_ep structure is actually changed when halt is
  set/cleared.
- All requests for endpoint are completed when it was halted, and the halt was
  cleared by CLEAR_FEATURE, but not when new state is same as previous.

Signed-off-by: Robert Baldyga <r.baldyga@samsung.com>
Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
---
 drivers/usb/gadget/s3c-hsotg.c |   13 ++++++++++++-
 1 file changed, 12 insertions(+), 1 deletion(-)

diff --git a/drivers/usb/gadget/s3c-hsotg.c b/drivers/usb/gadget/s3c-hsotg.c
index 4fb2199..db4da58 100644
--- a/drivers/usb/gadget/s3c-hsotg.c
+++ b/drivers/usb/gadget/s3c-hsotg.c
@@ -1097,6 +1097,7 @@ static int s3c_hsotg_process_req_feature(struct s3c_hsotg *hsotg,
 	bool set = (ctrl->bRequest == USB_REQ_SET_FEATURE);
 	struct s3c_hsotg_ep *ep;
 	int ret;
+	bool halted;
 
 	dev_dbg(hsotg->dev, "%s: %s_FEATURE\n",
 		__func__, set ? "SET" : "CLEAR");
@@ -1111,6 +1112,8 @@ static int s3c_hsotg_process_req_feature(struct s3c_hsotg *hsotg,
 
 		switch (le16_to_cpu(ctrl->wValue)) {
 		case USB_ENDPOINT_HALT:
+			halted = ep->halted;
+
 			s3c_hsotg_ep_sethalt(&ep->ep, set);
 
 			ret = s3c_hsotg_send_reply(hsotg, ep0, NULL, 0);
@@ -1120,7 +1123,12 @@ static int s3c_hsotg_process_req_feature(struct s3c_hsotg *hsotg,
 				return ret;
 			}
 
-			if (!set) {
+			/*
+			 * we have to complete all requests for ep if it was halted,
+			 * and the halt was cleared by CLEAR_FEATURE
+			 */
+
+			if (!set || halted) {
 				/*
 				 * If we have request in progress,
 				 * then complete it
@@ -2603,6 +2611,7 @@ static int s3c_hsotg_ep_enable(struct usb_ep *ep,
 
 	/* default, set to non-periodic */
 	hs_ep->periodic = 0;
+	hs_ep->halted = 0;
 
 	switch (desc->bmAttributes & USB_ENDPOINT_XFERTYPE_MASK) {
 	case USB_ENDPOINT_XFER_ISOC:
@@ -2798,6 +2807,8 @@ static int s3c_hsotg_ep_sethalt(struct usb_ep *ep, int value)
 
 	writel(epctl, hs->regs + epreg);
 
+	hs_ep->halted = value;
+
 	return 0;
 }
 
-- 
1.7.9.5


  parent reply	other threads:[~2013-09-12 14:19 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-09-12 14:18 [PATCH 0/6] usb: s3c-hsotg: fixes for proper functioning Robert Baldyga
2013-09-12 14:18 ` [PATCH 1/6] usb: s3c-hsotg: change dependency to PLAT_SAMSUNG Robert Baldyga
2013-09-12 14:18 ` [PATCH 2/6] usb: s3c-hsotg: fix unregistration function Robert Baldyga
2013-09-12 14:18 ` [PATCH 3/6] usb: s3c-hsotg: do not disconnect gadget when receiving ErlySusp intr Robert Baldyga
2013-09-12 14:18 ` [PATCH 4/6] USB: gadget: s3c-hsotg: fix "protocol stall" handling Robert Baldyga
2013-09-17 15:57   ` Felipe Balbi
2013-09-12 14:18 ` [PATCH 5/6] USB: gadget: s3c-hsotg: fix dedicated fifos handling Robert Baldyga
2013-09-17 15:58   ` Felipe Balbi
2013-09-12 14:18 ` Robert Baldyga [this message]
2013-09-17 15:58   ` [PATCH 6/6] USB: gadget: s3c-hsotg: fix clear feature ENDPOINT_HALT Felipe Balbi

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=1378995532-32142-7-git-send-email-r.baldyga@samsung.com \
    --to=r.baldyga@samsung.com \
    --cc=b.zolnierkie@samsung.com \
    --cc=balbi@ti.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=kyungmin.park@samsung.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-usb@vger.kernel.org \
    --cc=m.szyprowski@samsung.com \
    /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

all inboxes | Powered by JetHome®