From: Felipe Balbi <felipe.balbi@linux.intel.com>
To: Alan Stern <stern@rowland.harvard.edu>
Cc: USB list <linux-usb@vger.kernel.org>
Subject: Should usb_gadget_disconnect() call driver's ->disconnect?
Date: Fri, 10 Aug 2018 09:59:28 +0300 [thread overview]
Message-ID: <87h8k2emgf.fsf@linux.intel.com> (raw)
Hi,
Alan Stern <stern@rowland.harvard.edu> writes:
>> >> > 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.
>> >>
>> >> my feeling is that ->disconnect() should be called everytime we cause
>> >> the session to be killed. VBUS Turning off is a guaratee that session is
>> >> gone, but so is disconnecting data pullup, which is what
>> >> usb_gadget_disconnect() does.
>> >
>> > Okay. I don't mind either way, so long as it is settled.
>> >
>> >> > How do you feel about documenting this ambiguity as in the patch below?
>> >> > If you think this is okay, I'll submit it formally.
>> >>
>> >> Perhaps a better approach would be to start auditing all UDCs to make
>> >> sure that ->disconnect() is called when pullup is disconnected. Then we
>> >> can move ->disconnect() to usb_gadget_disconnect() itself. No?
>> >
>> > Rather the other way around: Call ->disconnect() from
>> > usb_gadget_disconnect() itself, then audit all the UDCs to make sure
>> > they don't invoke the callbackup. That's better than adding a callback
>> > to the UDCs that are missing it, only then to remove it from all of
>> > them later on.
>>
>> Fair enough. Do you want to handle this or would you prefer that I add
>> to my list?
>
> I'll send in a patch modifying usb_gadget_disconnect(), and I'll check
> up on dummy-hcd and net2280. The rest I prefer to leave for you.
> Okay?
Sure, no issues :)
next reply other threads:[~2018-08-10 6:59 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-08-10 6:59 Felipe Balbi [this message]
-- strict thread matches above, loose matches on Subject: below --
2018-08-09 14:04 Should usb_gadget_disconnect() call driver's ->disconnect? Alan Stern
2018-08-09 12:10 Felipe Balbi
2018-08-08 14:14 Alan Stern
2018-08-08 7:24 Felipe Balbi
2018-08-07 19:24 Alan Stern
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=87h8k2emgf.fsf@linux.intel.com \
--to=felipe.balbi@linux.intel.com \
--cc=linux-usb@vger.kernel.org \
--cc=stern@rowland.harvard.edu \
/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;
as well as URLs for NNTP newsgroup(s).