]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
USB: gadget: core: create sysfs link between udc and gadget
authorRoy Luo <royluo@google.com>
Thu, 7 Mar 2024 03:09:22 +0000 (03:09 +0000)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 7 Mar 2025 15:56:33 +0000 (16:56 +0100)
commit7fb673f0f13cce0f138afaad775c668cc8d03510
treeef3a08a11bdd0222092045b2bf1bfa119e2122a8
parentac18d781466252cd35a3e311e0a4b264260fd927
USB: gadget: core: create sysfs link between udc and gadget

[ Upstream commit 0ef40f399aa2be8c04aee9b7430705612c104ce5 ]

udc device and gadget device are tightly coupled, yet there's no good
way to corelate the two. Add a sysfs link in udc that points to the
corresponding gadget device.
An example use case: userspace configures a f_midi configfs driver and
bind the udc device, then it tries to locate the corresponding midi
device, which is a child device of the gadget device. The gadget device
that's associated to the udc device has to be identified in order to
index the midi device. Having a sysfs link would make things much
easier.

Signed-off-by: Roy Luo <royluo@google.com>
Link: https://lore.kernel.org/r/20240307030922.3573161-1-royluo@google.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Stable-dep-of: 399a45e5237c ("usb: gadget: core: flush gadget workqueue after device removal")
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/usb/gadget/udc/core.c