All of lore.kernel.org
 help / color / mirror / Atom feed
* SH7760,7780,7785 sh-sci.c bugfix
@ 2008-03-10  9:13 Yutaro Ebihara
  2008-03-11  3:43 ` Paul Mundt
  0 siblings, 1 reply; 2+ messages in thread
From: Yutaro Ebihara @ 2008-03-10  9:13 UTC (permalink / raw)
  To: linux-sh

hi all

I found bug in sh-sci.c

    $ echo "A" > /dev/ttySC[0-2]           open()
                                           write()
                                           close()

    send more than 128 bytes into  ttySC[0-2] from other machine.

    $ echo "A"  > /dev/ttySC[0-2]          open()

    kernel stoped.


Because.

SCRFDR counts upto 0x80 not 0x7F.
if recive fifo has 128 charactors, SCRFDR indicates 0x80.

               return sci_in(port, SCRFDR) & 0x7f;

this code returns zero , so ISR 's never finished.





--- linux-2.6.24_cat/drivers/serial/sh-sci.c-old        2008-03-06 19:
40:13.000000000 +0900
+++ linux-2.6.24_cat/drivers/serial/sh-sci.c    2008-03-06 19:40:27.
000000000 +0900
@@ -412,12 +412,12 @@
     defined(CONFIG_CPU_SUBTYPE_SH7785)
 static inline int scif_txroom(struct uart_port *port)
 {
-       return SCIF_TXROOM_MAX - (sci_in(port, SCTFDR) & 0x7f);
+       return SCIF_TXROOM_MAX - (sci_in(port, SCTFDR) & 0xff);
 }

 static inline int scif_rxroom(struct uart_port *port)
 {
-       return sci_in(port, SCRFDR) & 0x7f;
+       return sci_in(port, SCRFDR) & 0xff;
 }
 #else
 static inline int scif_txroom(struct uart_port *port)
 
 

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: SH7760,7780,7785 sh-sci.c bugfix
  2008-03-10  9:13 SH7760,7780,7785 sh-sci.c bugfix Yutaro Ebihara
@ 2008-03-11  3:43 ` Paul Mundt
  0 siblings, 0 replies; 2+ messages in thread
From: Paul Mundt @ 2008-03-11  3:43 UTC (permalink / raw)
  To: linux-sh

On Mon, Mar 10, 2008 at 06:13:19PM +0900, Yutaro Ebihara wrote:
> --- linux-2.6.24_cat/drivers/serial/sh-sci.c-old        2008-03-06 19:
> 40:13.000000000 +0900
> +++ linux-2.6.24_cat/drivers/serial/sh-sci.c    2008-03-06 19:40:27.
> 000000000 +0900
> @@ -412,12 +412,12 @@
>      defined(CONFIG_CPU_SUBTYPE_SH7785)
>  static inline int scif_txroom(struct uart_port *port)
>  {
> -       return SCIF_TXROOM_MAX - (sci_in(port, SCTFDR) & 0x7f);
> +       return SCIF_TXROOM_MAX - (sci_in(port, SCTFDR) & 0xff);
>  }
> 
>  static inline int scif_rxroom(struct uart_port *port)
>  {
> -       return sci_in(port, SCRFDR) & 0x7f;
> +       return sci_in(port, SCRFDR) & 0xff;
>  }
>  #else
>  static inline int scif_txroom(struct uart_port *port)
>  
>  
Looks reasonable, good catch. I'll add it to the 2.6.25 queue, thanks.

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2008-03-11  3:43 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-03-10  9:13 SH7760,7780,7785 sh-sci.c bugfix Yutaro Ebihara
2008-03-11  3:43 ` Paul Mundt

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.