Hi, On Fri, 26 Feb 2010 11:47:29 +0800 Feng Tang <feng.tang@xxxxxxxxx> wrote: > Hi All, > > Here is a driver for Maxim 3110 SPI-UART device, please help to review. <snip> > +/* > + * This is usually used to read data from SPIC RX FIFO, which doesn't > + * need any delay like flushing character out. > + * > + * Return how many valide bytes are read back > + */ > +static int max3110_read_multi(struct uart_max3110 *max, u8 *buf) > +{ > + u16 obuf[M3110_RX_FIFO_DEPTH], ibuf[M3110_RX_FIFO_DEPTH]; Doing I/O on stack is guaranteed safe for spi functions? > + u8 *pbuf, valid_str[M3110_RX_FIFO_DEPTH]; > + int i, j; > + > + memset(obuf, 0, sizeof(obuf)); > + memset(obuf, 0, sizeof(ibuf)); memset(ibuf, 0, sizeof(ibuf))? > + > + if (max3110_write_then_read(max, obuf, ibuf, > + M3110_RX_FIFO_DEPTH * 2, 1)) > + return 0; > + > + /* If caller doesn't provide a buffer, then handle received char */ > + pbuf = buf ? buf : valid_str; > + > + for (i = 0, j = 0; i < M3110_RX_FIFO_DEPTH; i++) { > + if (ibuf[i] & MAX3110_READ_DATA_AVAILABLE) > + pbuf[j++] = ibuf[i] & 0xff; > + } > + > + if (j && (pbuf == valid_str)) > + receive_chars(max, valid_str, j); > + > + return j; -- Masakazu Mokuno -- To unsubscribe from this list: send the line "unsubscribe linux-serial" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html