* [PATCH 1/2] Char: rocket, fix ASYNC flags
2009-05-08 0:36 rocket tty BUG in 2.6.29 (regression) Ferenc Wagner
@ 2009-05-08 8:32 ` Jiri Slaby
2009-05-08 11:13 ` Alan Cox
2009-05-08 8:32 ` [PATCH 2/2] Char: epca, " Jiri Slaby
2009-05-08 10:03 ` rocket tty BUG in 2.6.29 (regression) Alan Cox
2 siblings, 1 reply; 7+ messages in thread
From: Jiri Slaby @ 2009-05-08 8:32 UTC (permalink / raw)
To: akpm; +Cc: linux-kernel, Jiri Slaby, Alan Cox, Ferenc Wagner
ASYNC_* flags are not bits, but rather constants, use ilog2 to obtain
bit positions and stay atomic.
Signed-off-by: Jiri Slaby <jirislaby@gmail.com>
Cc: Alan Cox <alan@lxorguk.ukuu.org.uk>
Cc: Ferenc Wagner <wferi@niif.hu>
---
drivers/char/rocket.c | 6 +++---
1 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/drivers/char/rocket.c b/drivers/char/rocket.c
index 7399188..38c18d3 100644
--- a/drivers/char/rocket.c
+++ b/drivers/char/rocket.c
@@ -939,7 +939,7 @@ static int rp_open(struct tty_struct *tty, struct file *filp)
/*
* Info->count is now 1; so it's safe to sleep now.
*/
- if (!test_bit(ASYNC_INITIALIZED, &port->flags)) {
+ if (!test_bit(ilog2(ASYNC_INITIALIZED), &port->flags)) {
cp = &info->channel;
sSetRxTrigger(cp, TRIG_1);
if (sGetChanStatus(cp) & CD_ACT)
@@ -963,7 +963,7 @@ static int rp_open(struct tty_struct *tty, struct file *filp)
sEnRxFIFO(cp);
sEnTransmit(cp);
- set_bit(ASYNC_INITIALIZED, &info->port.flags);
+ set_bit(ilog2(ASYNC_INITIALIZED), &info->port.flags);
/*
* Set up the tty->alt_speed kludge
@@ -1646,7 +1646,7 @@ static int rp_write(struct tty_struct *tty,
/* Write remaining data into the port's xmit_buf */
while (1) {
/* Hung up ? */
- if (!test_bit(ASYNC_NORMAL_ACTIVE, &info->port.flags))
+ if (!test_bit(ilog2(ASYNC_NORMAL_ACTIVE), &info->port.flags))
goto end;
c = min(count, XMIT_BUF_SIZE - info->xmit_cnt - 1);
c = min(c, XMIT_BUF_SIZE - info->xmit_head);
--
1.6.2.4
^ permalink raw reply related [flat|nested] 7+ messages in thread* Re: [PATCH 1/2] Char: rocket, fix ASYNC flags
2009-05-08 8:32 ` [PATCH 1/2] Char: rocket, fix ASYNC flags Jiri Slaby
@ 2009-05-08 11:13 ` Alan Cox
2009-05-08 11:18 ` Jiri Slaby
0 siblings, 1 reply; 7+ messages in thread
From: Alan Cox @ 2009-05-08 11:13 UTC (permalink / raw)
To: Jiri Slaby; +Cc: akpm, linux-kernel, Jiri Slaby, Ferenc Wagner
On Fri, 8 May 2009 10:32:43 +0200
Jiri Slaby <jirislaby@gmail.com> wrote:
> ASYNC_* flags are not bits, but rather constants, use ilog2 to obtain
> bit positions and stay atomic.
Definitely agree with the bug but it would I think be cleaner to add
ASYNCF_.. (or ASYNCB_.. or similar) that is the bit numbers rather than
use ilog2. That also means we can later delete ASYNC_xxx from the kernel
side to stop people using them unsafely in drivers
^ permalink raw reply [flat|nested] 7+ messages in thread
* [PATCH 2/2] Char: epca, fix ASYNC flags
2009-05-08 0:36 rocket tty BUG in 2.6.29 (regression) Ferenc Wagner
2009-05-08 8:32 ` [PATCH 1/2] Char: rocket, fix ASYNC flags Jiri Slaby
@ 2009-05-08 8:32 ` Jiri Slaby
2009-05-08 10:03 ` rocket tty BUG in 2.6.29 (regression) Alan Cox
2 siblings, 0 replies; 7+ messages in thread
From: Jiri Slaby @ 2009-05-08 8:32 UTC (permalink / raw)
To: akpm; +Cc: linux-kernel, Jiri Slaby, Alan Cox
ASYNC_* flags are not bits, but rather constants, use ilog2 to obtain
bit positions and stay atomic.
Signed-off-by: Jiri Slaby <jirislaby@gmail.com>
Cc: Alan Cox <alan@lxorguk.ukuu.org.uk>
---
drivers/char/epca.c | 9 +++++----
1 files changed, 5 insertions(+), 4 deletions(-)
diff --git a/drivers/char/epca.c b/drivers/char/epca.c
index 8797b77..01948e4 100644
--- a/drivers/char/epca.c
+++ b/drivers/char/epca.c
@@ -1518,7 +1518,7 @@ static void doevent(int crd)
if (event & MODEMCHG_IND) {
/* A modem signal change has been indicated */
ch->imodem = mstat;
- if (test_bit(ASYNC_CHECK_CD, &ch->port.flags)) {
+ if (test_bit(ilog2(ASYNC_CHECK_CD), &ch->port.flags)) {
/* We are now receiving dcd */
if (mstat & ch->dcd)
wake_up_interruptible(&ch->port.open_wait);
@@ -1765,9 +1765,9 @@ static void epcaparam(struct tty_struct *tty, struct channel *ch)
* that the driver will wait on carrier detect.
*/
if (ts->c_cflag & CLOCAL)
- clear_bit(ASYNC_CHECK_CD, &ch->port.flags);
+ clear_bit(ilog2(ASYNC_CHECK_CD), &ch->port.flags);
else
- set_bit(ASYNC_CHECK_CD, &ch->port.flags);
+ set_bit(ilog2(ASYNC_CHECK_CD), &ch->port.flags);
mval = ch->m_dtr | ch->m_rts;
} /* End CBAUD not detected */
iflag = termios2digi_i(ch, ts->c_iflag);
@@ -2244,7 +2244,8 @@ static void do_softint(struct work_struct *work)
if (test_and_clear_bit(EPCA_EVENT_HANGUP, &ch->event)) {
tty_hangup(tty);
wake_up_interruptible(&ch->port.open_wait);
- clear_bit(ASYNC_NORMAL_ACTIVE, &ch->port.flags);
+ clear_bit(ilog2(ASYNC_NORMAL_ACTIVE),
+ &ch->port.flags);
}
}
tty_kref_put(tty);
--
1.6.2.4
^ permalink raw reply related [flat|nested] 7+ messages in thread* Re: rocket tty BUG in 2.6.29 (regression)
2009-05-08 0:36 rocket tty BUG in 2.6.29 (regression) Ferenc Wagner
2009-05-08 8:32 ` [PATCH 1/2] Char: rocket, fix ASYNC flags Jiri Slaby
2009-05-08 8:32 ` [PATCH 2/2] Char: epca, " Jiri Slaby
@ 2009-05-08 10:03 ` Alan Cox
2009-05-08 14:33 ` Ferenc Wagner
2 siblings, 1 reply; 7+ messages in thread
From: Alan Cox @ 2009-05-08 10:03 UTC (permalink / raw)
To: Ferenc Wagner; +Cc: linux-kernel
On Fri, 08 May 2009 02:36:45 +0200
Ferenc Wagner <wferi@niif.hu> wrote:
> Hi,
>
> 2.6.26 works fine in our terminal server machine, but after rebooting
> it into 2.6.29 I got the following Oops when starting screen for a
> ttyR serial device (after unloading and reloading the rocket module
> while trying to get some udev rename rules right):
So it works the first time around, then blos up the second ? Is this
repeatable ?
In theory Ted is the maintainer for rocket but as I'm the one who last
did any surgery on it this one may well be my bug.
Alan
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: rocket tty BUG in 2.6.29 (regression)
2009-05-08 10:03 ` rocket tty BUG in 2.6.29 (regression) Alan Cox
@ 2009-05-08 14:33 ` Ferenc Wagner
0 siblings, 0 replies; 7+ messages in thread
From: Ferenc Wagner @ 2009-05-08 14:33 UTC (permalink / raw)
To: Alan Cox; +Cc: linux-kernel
Alan Cox <alan@lxorguk.ukuu.org.uk> writes:
> On Fri, 08 May 2009 02:36:45 +0200
> Ferenc Wagner <wferi@niif.hu> wrote:
>
>> 2.6.26 works fine in our terminal server machine, but after rebooting
>> it into 2.6.29 I got the following Oops when starting screen for a
>> ttyR serial device (after unloading and reloading the rocket module
>> while trying to get some udev rename rules right):
>
> So it works the first time around, then blos up the second ? Is this
> repeatable ?
No, I didn't say this. The first time I didn't even try, because our
software uses the persistent names, not /dev/ttyR*, but the udev
rename rules didn't fire. So I fixed the rules, removed and
reinserted the module, then started the console multiplexer, which
provoked the bugs (all 16). I don't think it has anything to do with
the issue, but wanted to explain the "last removed: rocket" part of
the log.
> In theory Ted is the maintainer for rocket but as I'm the one who last
> did any surgery on it this one may well be my bug.
Looks like Jiri has a handle on the problem, though. Once you
converge on a patch and need testing, tell me. I'm not in a hurry,
the current Debian stable kernel works OK, I tested 2.6.29 while
investigating an unrelated networking issue.
--
Thanks for the great support again,
Feri.
^ permalink raw reply [flat|nested] 7+ messages in thread