From 681eff13c845120a6c025f00742cc93f0108cc87 Mon Sep 17 00:00:00 2001 From: Chris Lew Date: Mon, 17 Oct 2022 13:34:08 -0700 Subject: [PATCH] net: qrtr: gunyah: Delay RX doorbell registration There are cases where the doorbell interrupt is handled before the probe can finish the endpoint registration with the qrtr core logic. Move the RX doorbell register until after the endpoint is registered and the qrtr core logic has initialized all the structures. Change-Id: I8200651b3874c2bef3cbc0bae35b85c67c851eff Signed-off-by: Chris Lew --- net/qrtr/gunyah.c | 23 ++++++++++++----------- 1 file changed, 12 insertions(+), 11 deletions(-) diff --git a/net/qrtr/gunyah.c b/net/qrtr/gunyah.c index 90f71b9ebdbc..38297f8d375b 100644 --- a/net/qrtr/gunyah.c +++ b/net/qrtr/gunyah.c @@ -646,6 +646,14 @@ static int qrtr_gunyah_probe(struct platform_device *pdev) } INIT_WORK(&qdev->work, qrtr_gunyah_retry_work); + qdev->ep.xmit = qrtr_gunyah_send; + if (!qdev->master) { + ret = qrtr_endpoint_register(&qdev->ep, QRTR_EP_NET_ID_AUTO, + false); + if (ret) + goto register_fail; + } + qdev->rx_dbl = gh_dbl_rx_register(dbl_label, qrtr_gunyah_cb, qdev); if (IS_ERR_OR_NULL(qdev->rx_dbl)) { ret = PTR_ERR(qdev->rx_dbl); @@ -653,21 +661,14 @@ static int qrtr_gunyah_probe(struct platform_device *pdev) goto fail_rx_dbl; } - qdev->ep.xmit = qrtr_gunyah_send; - if (!qdev->master) { - ret = qrtr_endpoint_register(&qdev->ep, QRTR_EP_NET_ID_AUTO, false); - if (ret) - goto register_fail; - - if (gunyah_rx_avail(&qdev->rx_pipe)) - qrtr_gunyah_read(qdev); - } + if (!qdev->master && gunyah_rx_avail(&qdev->rx_pipe)) + qrtr_gunyah_read(qdev); return 0; -register_fail: - gh_dbl_rx_unregister(qdev->rx_dbl); fail_rx_dbl: + qrtr_endpoint_unregister(&qdev->ep); +register_fail: cancel_work_sync(&qdev->work); gh_dbl_tx_unregister(qdev->tx_dbl);