Re: [PATCH v2 5/5] samples: Introduce Qualcomm QMI sample client

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi, some small comments below.

On Mon, Nov 06, 2017 at 09:20:42PM -0800, Bjorn Andersson wrote:
> Introduce a sample driver that register for server notifications and
> spawn clients for each available test service (service 15). The spawned
> clients implements the interface for encoding "ping" and "data" requests
> and decode the responses from the remote.
> 
> Signed-off-by: Bjorn Andersson <bjorn.andersson@xxxxxxxxxx>
> ---
[...]
> +/*
> + * ping_pong_store() - ping_pong debugfs file write handler

The function name is ping_write now.

> + * @file:	debugfs file context
> + * @user_buf:	reference to the user data
> + * @count:	number of bytes in @user_buf
> + * @ppos:	offset in @file to write
> + *
> + * Returns @count, or negative errno on failure.
> + *
> + * This function allows user space to send out a ping_pong QMI encoded message
> + * to the associated remote test service and will return with the result of the
> + * transaction. It serves as an example of how to provide a custom response
> + * handler.
> + */
> +static ssize_t ping_write(struct file *file, const char __user *user_buf,
> +			  size_t count, loff_t *ppos)

The data in user_buf is completely ignored, right? Perhaps that's worth
mentioning in the doc comment.

> +{
> +	struct qmi_handle *qmi = file->private_data;
> +	struct test_ping_req_msg_v01 req = {0};
> +	struct qmi_txn txn;
> +	int ret;
> +
> +	memcpy(req.ping, "ping", sizeof(req.ping));
> +
> +	ret = qmi_txn_init(qmi, &txn, NULL, NULL);
> +	if (ret < 0)
> +		return ret;
> +
> +	ret = qmi_send_request(qmi, NULL, &txn,
> +			       TEST_PING_REQ_MSG_ID_V01,
> +			       TEST_PING_REQ_MAX_MSG_LEN_V01,
> +			       test_ping_req_msg_v01_ei, &req);
> +	if (ret < 0) {
> +		qmi_txn_cancel(&txn);
> +		return ret;
> +	}
> +
> +	ret = qmi_txn_wait(&txn, 5 * HZ);
> +	if (ret < 0)
> +		count = ret;
> +
> +	return count;
> +}
[...]
> +
> +/*
> + * data_store() - data debugfs file write handler

data_write

> + * @file:	debugfs file context
> + * @user_buf:	reference to the user data
> + * @count:	number of bytes in @user_buf
> + * @ppos:	offset in @file to write
> + *
> + * Returns @count, or negative errno on failure.
> + *
> + * This function allows user space to send out a data QMI encoded message to
> + * the associated remote test service and will return with the result of the
> + * transaction. It serves as an example of how to have the QMI helpers decode a
> + * transaction response into a provided object automatically.
> + */
> +static ssize_t data_write(struct file *file, const char __user *user_buf,
> +			  size_t count, loff_t *ppos)



Jonathan Neuschäfer

Attachment: signature.asc
Description: PGP signature


[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [Linux for Sparc]     [IETF Annouce]     [Security]     [Bugtraq]     [Linux MIPS]     [ECOS]     [Asterisk Internet PBX]     [Linux API]

  Powered by Linux