Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Skip to content
Commit 636046c4 authored by Ajay Agarwal's avatar Ajay Agarwal Committed by Jack Pham
Browse files

ANDROID: usb: gadget: configfs: Support multiple android instances



Some platforms may choose to create more than one gadget ConfigFS
instance, often due to the hardware having multiple USB gadget
controllers which can be used simultaneously. Currently
android_device_create() assumes only one gadget instance is ever
created and creates a single "android0" device under the "android_usb"
class, resulting in a crash if a second gadget is registered since the
global android_device pointer gets overwritten with -EEXIST.

Fix this by properly supporting multiple instances and naming the
devices "android0", "android1", etc. when each instance is created
(via mkdir). For now keep the global singleton android_device pointing
to android0 for ease of use since f_midi and f_audio_source currently
use create_function_device() without any context as to which gadget
they will be bound to.

Bug: 120441124
Fixes: 429213f5 ("ANDROID: usb: gadget: configfs: Add function devices to the parent")
Change-Id: Idae6f6d0d8811f27e836f5f6399395a15fbf3c2f
Signed-off-by: default avatarAjay Agarwal <ajaya@codeaurora.org>
[jackp@codeaurora.org: reworded commit text]
Signed-off-by: default avatarJack Pham <jackp@codeaurora.org>
parent 7db9be17
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment