All of lore.kernel.org
 help / color / mirror / Atom feed
From: Doug Brunner <dbrunner@ebus.com>
To: xenomai@xenomai.org
Subject: [Xenomai] [PATCH] 16550: Fix crossed timeouts in rt_16550_write
Date: Mon, 28 Jan 2013 11:53:26 -0800	[thread overview]
Message-ID: <5106D736.1050402@ebus.com> (raw)

rt_16550_write currently initializes its timeout sequence using 
rx_timeout. Because xnsynch_acquire ignores the value of timeout (apart 
from making sure it's positive) when it is passed a non NULL timeout 
sequence, this means that serial writes are using the read timeout, 
except for when the user sets a zero tx timeout. (Should xnsynch_acquire 
be changed to (timeout + current time) to *timeout_seq to decide which 
will lead to timing out sooner? Seems more consistent but might break 
existing code...)

This changes the initialization of the timeout sequence to use 
tx_timeout. I also changed the first call to rtdm_mutex_timedlock to use 
tx_timeout, since this more accurately reflects what is happening.

*******************

diff --git a/ksrc/drivers/serial/16550A.c b/ksrc/drivers/serial/16550A.c
index 3672539..e92017d 100644
--- a/ksrc/drivers/serial/16550A.c
+++ b/ksrc/drivers/serial/16550A.c
@@ -979,10 +979,10 @@ ssize_t rt_16550_write(struct rtdm_dev_context * 
context,

         ctx = (struct rt_16550_context *)context->dev_private;

-       rtdm_toseq_init(&timeout_seq, ctx->config.rx_timeout);
+       rtdm_toseq_init(&timeout_seq, ctx->config.tx_timeout);

         /* Make write operation atomic. */
-       ret = rtdm_mutex_timedlock(&ctx->out_lock, ctx->config.rx_timeout,
+       ret = rtdm_mutex_timedlock(&ctx->out_lock, ctx->config.tx_timeout,
                                    &timeout_seq);
         if (ret)
                 return ret;

*******************

-- 
     Doug Brunner



             reply	other threads:[~2013-01-28 19:53 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-01-28 19:53 Doug Brunner [this message]
2013-01-29 12:25 ` [Xenomai] [PATCH] 16550: Fix crossed timeouts in rt_16550_write Jan Kiszka
2013-01-29 23:10   ` Doug Brunner

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=5106D736.1050402@ebus.com \
    --to=dbrunner@ebus.com \
    --cc=xenomai@xenomai.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.