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

Commit ccd57f83 authored by Sriharsha Allenki's avatar Sriharsha Allenki
Browse files

usb: gadget: f_uac2: Fix sound card registration failure



Sound card registration fails when adb is rerun as root.
The cause is the limitation in kernel/ALSA in proper
cleaning up of the  the parent of sound card when the sound
card is removed. Fix this by pointing to a parent that
will not be removed during sound card free.

Change-Id: Id9354be1c2dc459fbd0a88be4ff3f167dff8f4d9
Signed-off-by: default avatarSriharsha Allenki <sallenki@codeaurora.org>
parent d9f72f76
Loading
Loading
Loading
Loading
+3 −1
Original line number Diff line number Diff line
@@ -128,6 +128,7 @@ struct audio_dev {

	/* The ALSA Sound Card it represents on the USB-Client side */
	struct snd_uac2_chip uac2;
	struct device *gdev;
};

static inline
@@ -457,7 +458,7 @@ static int snd_uac2_probe(struct platform_device *pdev)
	c_chmask = opts->c_chmask;

	/* Choose any slot, with no id */
	err = snd_card_new(&pdev->dev, -1, NULL, THIS_MODULE, 0, &card);
	err = snd_card_new(audio_dev->gdev, -1, NULL, THIS_MODULE, 0, &card);
	if (err < 0)
		return err;

@@ -1109,6 +1110,7 @@ afunc_bind(struct usb_configuration *cfg, struct usb_function *fn)
		goto err;
	}

	agdev->gdev = &gadget->dev;
	ret = alsa_uac2_init(agdev);
	if (ret)
		goto err;