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

Commit 23351b0e authored by Sarannya S's avatar Sarannya S Committed by Gerrit - the friendly Code Review server
Browse files

rpmsg: glink: Add error message in case of callback failure



Sometimes due to late initialization glink callback may not be
initialized and incoming will be dropped.

Print error message if receive callback is not ready.

Change-Id: I3eae1717d4e1c14b319e288078d122762fd476e7
Signed-off-by: default avatarSarannya S <sarannya@codeaurora.org>
parent e33f4a08
Loading
Loading
Loading
Loading
+11 −2
Original line number Diff line number Diff line
@@ -1049,11 +1049,17 @@ static int qcom_glink_rx_data(struct qcom_glink *glink, size_t avail)
	if (!left_size) {
		spin_lock(&channel->recv_lock);
		if (channel->ept.cb) {
			channel->ept.cb(channel->ept.rpdev,
			ret = channel->ept.cb(channel->ept.rpdev,
					intent->data,
					intent->offset,
					channel->ept.priv,
					RPMSG_ADDR_ANY);
			if (ret < 0)
				CH_INFO(channel,
					"glink:callback error ret = %d\n", ret);
		} else {
			CH_INFO(channel, "callback not present\n");
			dev_err(glink->dev, "glink:callback not present\n");
		}
		spin_unlock(&channel->recv_lock);

@@ -1396,13 +1402,14 @@ static struct rpmsg_endpoint *qcom_glink_create_ept(struct rpmsg_device *rpdev,
		if (ret)
			return NULL;
	}
	CH_INFO(channel, "Initializing ept\n");

	ept = &channel->ept;
	ept->rpdev = rpdev;
	ept->cb = cb;
	ept->priv = priv;
	ept->ops = &glink_endpoint_ops;

	CH_INFO(channel, "Initialized ept\n");
	return ept;
}

@@ -1422,6 +1429,7 @@ static int qcom_glink_announce_create(struct rpmsg_device *rpdev)
	int iid;
	int size;

	CH_INFO(channel, "Entered\n");
	if (glink->intentless || !completion_done(&channel->open_ack))
		return 0;

@@ -1458,6 +1466,7 @@ static int qcom_glink_announce_create(struct rpmsg_device *rpdev)
			qcom_glink_advertise_intent(glink, channel, intent);
		}
	}
	CH_INFO(channel, "Exit\n");
	return 0;
}

+6 −2
Original line number Diff line number Diff line
@@ -23,8 +23,10 @@ static int qcom_smd_qrtr_callback(struct rpmsg_device *rpdev,
	struct qrtr_smd_dev *qdev = dev_get_drvdata(&rpdev->dev);
	int rc;

	if (!qdev)
	if (!qdev) {
		pr_err("%d:Not ready\n", __func__);
		return -EAGAIN;
	}

	rc = qrtr_endpoint_post(&qdev->ep, data, len);
	if (rc == -EINVAL) {
@@ -62,6 +64,7 @@ static int qcom_smd_qrtr_probe(struct rpmsg_device *rpdev)
	u32 net_id;
	bool rt;
	int rc;
	pr_err("%d:Entered\n", __func__);

	qdev = devm_kzalloc(&rpdev->dev, sizeof(*qdev), GFP_KERNEL);
	if (!qdev)
@@ -83,7 +86,8 @@ static int qcom_smd_qrtr_probe(struct rpmsg_device *rpdev)

	dev_set_drvdata(&rpdev->dev, qdev);

	dev_dbg(&rpdev->dev, "Qualcomm SMD QRTR driver probed\n");
	pr_err("%d:SMD QRTR driver probed\n", __func__);
	dev_dbg(&rpdev->dev, "SMD QRTR driver probed\n");

	return 0;
}