All of lore.kernel.org
 help / color / mirror / Atom feed
From: Alan Stern <stern@rowland.harvard.edu>
To: Felipe Balbi <felipe.balbi@linux.intel.com>
Cc: USB list <linux-usb@vger.kernel.org>
Subject: Should usb_gadget_disconnect() call driver's ->disconnect?
Date: Tue, 7 Aug 2018 15:24:48 -0400 (EDT)	[thread overview]
Message-ID: <Pine.LNX.4.44L0.1808071517570.1385-100000@iolanthe.rowland.org> (raw)

Felipe:

The documentation doesn't state whether a gadget driver's 
->disconnect() callback will be invoked when usb_gadget_disconnect() 
runs.  Probably the UDC drivers' behavior has changed over the years.

In any case, it's likely that various UDC drivers do behave
differently.  My current feeling is that ->disconnect() should be
invoked only when Vbus turns off, but I can't guarantee that all UDCs 
will do this.

How do you feel about documenting this ambiguity as in the patch below?
If you think this is okay, I'll submit it formally.

Alan Stern
---
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Index: usb-4.x/drivers/usb/gadget/udc/core.c
===================================================================
--- usb-4.x.orig/drivers/usb/gadget/udc/core.c
+++ usb-4.x/drivers/usb/gadget/udc/core.c
@@ -672,6 +672,10 @@ EXPORT_SYMBOL_GPL(usb_gadget_connect);
  * as a disconnect (when a VBUS session is active).  Not all systems
  * support software pullup controls.
  *
+ * Whether or not the gadget driver's ->disconnect() callback will be
+ * invoked is undefined.  Gadget drivers should be prepared for either
+ * possibility.
+ *
  * Returns zero on success, else negative errno.
  */
 int usb_gadget_disconnect(struct usb_gadget *gadget)

             reply	other threads:[~2018-08-07 19:24 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-08-07 19:24 Alan Stern [this message]
2018-08-08  7:24 Should usb_gadget_disconnect() call driver's ->disconnect? Felipe Balbi
2018-08-08 14:14 Alan Stern
2018-08-09 12:10 Felipe Balbi
2018-08-09 14:04 Alan Stern
2018-08-10  6:59 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=Pine.LNX.4.44L0.1808071517570.1385-100000@iolanthe.rowland.org \
    --to=stern@rowland.harvard.edu \
    --cc=felipe.balbi@linux.intel.com \
    --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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.