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

Commit cd9d9bc7 authored by Chris Lew's avatar Chris Lew Committed by Gerrit - the friendly Code Review server
Browse files

soc: qcom: qmi_interface: Add send timeout helper



Add an api for clients to set the send timeout of the underlying qrtr
socket. QMI sets this timeout to 10 seconds by default but this is too
long for some clients in critical paths.

Change-Id: I4c892a2f034c87b6bf2f71664369140910e72383
Signed-off-by: default avatarChris Lew <clew@codeaurora.org>
parent 07c19948
Loading
Loading
Loading
Loading
+17 −0
Original line number Diff line number Diff line
@@ -448,6 +448,7 @@ static void qmi_handle_net_reset(struct qmi_handle *qmi)
	struct sockaddr_qrtr sq;
	struct qmi_service *svc;
	struct socket *sock;
	long timeo = qmi->sock->sk->sk_sndtimeo;

	sock = qmi_sock_create(qmi, &sq);
	if (IS_ERR(sock))
@@ -467,6 +468,7 @@ static void qmi_handle_net_reset(struct qmi_handle *qmi)
	sock_release(qmi->sock);
	qmi->sock = sock;
	qmi->sq = sq;
	qmi->sock->sk->sk_sndtimeo = timeo;
	mutex_unlock(&qmi->sock_lock);

	list_for_each_entry(svc, &qmi->lookups, list_node)
@@ -620,6 +622,21 @@ static struct socket *qmi_sock_create(struct qmi_handle *qmi,
	return sock;
}

/**
 * qmi_set_sndtimeo() - set the sk_sndtimeo of the qmi handle
 * @qmi:	QMI client handle
 * @timeo:	timeout in jiffies.
 *
 * This sets the timeout for the blocking socket send in qmi send.
 */
void qmi_set_sndtimeo(struct qmi_handle *qmi, long timeo)
{
	mutex_lock(&qmi->sock_lock);
	qmi->sock->sk->sk_sndtimeo = timeo;
	mutex_unlock(&qmi->sock_lock);
}
EXPORT_SYMBOL(qmi_set_sndtimeo);

/**
 * qmi_handle_init() - initialize a QMI client handle
 * @qmi:	QMI handle to initialize
+1 −0
Original line number Diff line number Diff line
@@ -268,5 +268,6 @@ int qmi_txn_init(struct qmi_handle *qmi, struct qmi_txn *txn,
		 struct qmi_elem_info *ei, void *c_struct);
int qmi_txn_wait(struct qmi_txn *txn, unsigned long timeout);
void qmi_txn_cancel(struct qmi_txn *txn);
void qmi_set_sndtimeo(struct qmi_handle *qmi, long timeo);

#endif