in fsi-sbefifo.c [729:766]
int sbefifo_submit(struct device *dev, const __be32 *command, size_t cmd_len,
__be32 *response, size_t *resp_len)
{
struct sbefifo *sbefifo;
struct iov_iter resp_iter;
struct kvec resp_iov;
size_t rbytes;
int rc;
if (!dev)
return -ENODEV;
sbefifo = dev_get_drvdata(dev);
if (!sbefifo)
return -ENODEV;
if (WARN_ON_ONCE(sbefifo->magic != SBEFIFO_MAGIC))
return -ENODEV;
if (!resp_len || !command || !response)
return -EINVAL;
/* Prepare iov iterator */
rbytes = (*resp_len) * sizeof(__be32);
resp_iov.iov_base = response;
resp_iov.iov_len = rbytes;
iov_iter_kvec(&resp_iter, WRITE, &resp_iov, 1, rbytes);
/* Perform the command */
rc = mutex_lock_interruptible(&sbefifo->lock);
if (rc)
return rc;
rc = __sbefifo_submit(sbefifo, command, cmd_len, &resp_iter);
mutex_unlock(&sbefifo->lock);
/* Extract the response length */
rbytes -= iov_iter_count(&resp_iter);
*resp_len = rbytes / sizeof(__be32);
return rc;
}