Commit 23ac438d authored by Federico Vaga's avatar Federico Vaga

sw:drv: little optimization on message write

Avoid useless interrupts (corner case)
Signed-off-by: Federico Vaga's avatarFederico Vaga <federico.vaga@cern.ch>
parent c69fc100
......@@ -521,7 +521,7 @@ static int trtl_hmq_write_one(struct trtl_hmq *hmq,
if (copy_from_user(&buf->msg_tmp, ubuf, copy_size))
return -EFAULT;
if (buf->msg_tmp.hdr.len >= TRTL_CONFIG_ROM_MQ_SIZE_PAYLOAD(hmq->cfg->sizes)) {
if (buf->msg_tmp.hdr.len > TRTL_CONFIG_ROM_MQ_SIZE_PAYLOAD(hmq->cfg->sizes)) {
dev_err(&hmq->dev,
"write: cannot send %u bytes, the maximum size is %u bytes\n",
buf->msg_tmp.hdr.len * 4,
......@@ -576,8 +576,10 @@ static ssize_t trtl_hmq_write(struct file *f, const char __user *buf,
}
mutex_unlock(&hmq->mtx);
/* Enable interrupts */
trtl_hmq_irq_enable(hmq, 1);
/* Enable interrupts if we succesfully wrote at least one message */
if (i > 0)
trtl_hmq_irq_enable(hmq, 1);
/* Update counter */
count = i * sizeof(struct trtl_msg);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment