USB: document some API requirements on disconnection
authorMichal Pecio <michal.pecio@gmail.com>
Sun, 18 Feb 2024 08:25:15 +0000 (09:25 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sat, 2 Mar 2024 19:37:14 +0000 (20:37 +0100)
commit9f2a3933beeaeead53829d3a7be53770e41e7869
tree67300379e0ad61ff90e711a73f234c056420a185
parentbe95cc6d71dfd0cba66e3621c65413321b398052
USB: document some API requirements on disconnection

A call to usb_set_interface() crashes if the device is deallocated
concurrently, such as due to physical removal or a serious IO error.
It could also interfere with other drivers using the device if the
current driver is unbound before the call is finished.

Document the need to delay driver unbinding until this call returns,
which solves both issues.

Document the same regarding usb_clear_halt(), which is equally known
to be routinely called by drivers.

Explicitly mention finishing pending operations in the documentation
of the driver disconnect callback.

Signed-off-by: Michal Pecio <michal.pecio@gmail.com>
Link: https://lore.kernel.org/r/20240218092515.7635ff8c@foxbook
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Documentation/driver-api/usb/callbacks.rst
drivers/usb/core/message.c