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

Commit 8f354a41 authored by Jack Pham's avatar Jack Pham
Browse files

sound: usb: qmi: Move QMI service init to driver probe



When registering the QMI server during initialization there is
a chance that the handle creation can fail with -EPROBE_DEFER if
the IPC router service isn't ready yet. In that case, we should
not fail the module_init call as that results in the module
getting unloaded with no automatic mechanism to reload it (a la
driver probe deferral). Instead, move the uaudio_qmi_svc_init()
call to beginning of uaudio_qmi_plat_probe() so that in case it
defers the probe can be retried again later.

Change-Id: I07a1e2cee5194387884cb716e95ed7c414a22159
Signed-off-by: default avatarJack Pham <jackp@codeaurora.org>
parent 10711435
Loading
Loading
Loading
Loading
+9 −7
Original line number Diff line number Diff line
@@ -1309,11 +1309,19 @@ static struct qmi_ops uaudio_svc_ops_options = {
	.del_client = uaudio_qmi_svc_disconnect_cb,
};

static int uaudio_qmi_svc_init(void);

static int uaudio_qmi_plat_probe(struct platform_device *pdev)
{
	int ret;
	struct device_node *node = pdev->dev.of_node;

	if (!uaudio_svc) {
		ret = uaudio_qmi_svc_init();
		if (ret)
			return ret;
	}

	uaudio_qdev = devm_kzalloc(&pdev->dev, sizeof(struct uaudio_qmi_dev),
		GFP_KERNEL);
	if (!uaudio_qdev)
@@ -1465,13 +1473,7 @@ static void uaudio_qmi_svc_exit(void)

static int __init uaudio_qmi_plat_init(void)
{
	int ret;

	ret = platform_driver_register(&uaudio_qmi_driver);
	if (ret)
		return ret;

	return uaudio_qmi_svc_init();
	return platform_driver_register(&uaudio_qmi_driver);
}

static void __exit uaudio_qmi_plat_exit(void)