Re: 2.6.13-mm1

Alan Cox
2005-09-01T21:44:46Z

On Thu, Sep 01, 2005 at 04:26:02PM -0500, Joel Schopp wrote:
> It's like whack a mole. 30 more now in drivers/serial/jsm/jsm_tty.c and
> drivers/serial/icom.c

I've been whacking moles for some time doing all those I can. the jsm_tty
code needs major surgery and its bad it ever got into the kernel as most of
the code is duplicating chunks of the tty layer and working around it. The
jsm stuff is unintelligible and the docs dont appear to be public.

I'll take a look at icom.c now. I notice at least one bug already that
should be dealt with - the existing code assumes that tty->flip.char_buf_ptr[0]
is the first it inserted this time which may not be true as far as I can see.
And it looks there if count was 0 so its undefined..

Assuming it means the first char this block then the following should do
the trick, but really someone who knows wtf that code is trying to do needs
to fix it - please review/test/let me know.

--- drivers/serial/icom.c~ 2005-09-01 22:37:16.986829264 +0100
+++ drivers/serial/icom.c 2005-09-01 22:37:16.986829264 +0100
@@ -737,6 +737,7 @@

status = cpu_to_le16(icom_port->statStg->rcv[rcv_buff].flags);
while (status & SA_FL_RCV_DONE) {
+ int first = -1;

trace(icom_port, "FID_STATUS", status);
count = cpu_to_le16(icom_port->statStg->rcv[rcv_buff].leLength);
@@ -751,15 +752,17 @@
icom_port->recv_buf_pci;

/* Block copy all but the last byte as this may have status */
- if(count > 0)
+ if(count > 0) {
+ first = icon->recv_buf[offset];
tty_insert_flip_string(tty, icon_port->recv_buf + offset, count - 1);
+ }

icount = &icom_port->uart_port.icount;
icount->rx += count;

/* Break detect logic */
if ((status & SA_FLAGS_FRAME_ERROR)
- && (tty->flip.char_buf_ptr[0] == 0x00)) {
+ && first == 0) {
status &= ~SA_FLAGS_FRAME_ERROR;
status |= SA_FLAGS_BREAK_DET;
trace(icom_port, "BREAK_DET", 0);

Keep whacking - obviously I don't have a PPC64 (*and please don't send me one*)

Alan