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 <quic_clew@quicinc.com>
This commit is contained in:
Chris Lew 2022-10-17 13:34:08 -07:00
parent a7977b594d
commit 681eff13c8

View File

@ -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);