linux-serial.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Alan Cox <alan@linux.intel.com>
To: Vineet.Gupta1@synopsys.com
Cc: gregkh@linuxfoundation.org, linux-serial@vger.kernel.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH] serial/arc-uart: Add new driver
Date: Fri, 28 Sep 2012 14:02:48 +0100	[thread overview]
Message-ID: <20120928140248.54a10d06@bob.linux.org.uk> (raw)
In-Reply-To: <1348835752-28426-1-git-send-email-vgupta@synopsys.com>

> +int __attribute__((weak)) running_on_iss;

Globals really ought to have sensible names, if they must exist at all.
Why is this needed ?

> +#define ARC_SERIAL_DEV_NAME	"ttyS"

ttyS is reserved by the 8250 driver. Use a different name

> /* ttySxx per Documentation/devices.txt */
> +#define ARC_SERIAL_MAJOR	4
> +#define ARC_SERIAL_MINOR	64

Use dynamic assignments

> +static void arc_serial_rx_chars(struct arc_uart_port *uart)
> +{
> +	struct tty_struct *tty = NULL;
> +	unsigned int status, ch, flg = 0;
> +
> +	tty = uart->port.state->port.tty;

Please get rid of the unneeded initialisers for things like tty - they
just hide bugs later.

For locking purposes you need to be doing

	tty = tty_port_tty_get(&uart->port.state->port);

	if (tty) {

		stuff

		tty_kref_put(tty);


so that the tty cannot vanish under you on a hangup. As you reference
it in several spots it might make sense to do that once if either
RXIENB/TXIENB is set and then pass it to the tx/rx handlers ?


> +static void arc_serial_break_ctl(struct uart_port *port, int
> break_state) +{
> +	/* ARC UART doesn't support sendind Break signal */

sending ..

> +static void arc_serial_set_ldisc(struct uart_port *port, int ld)
> +{
> +	/* this might need implementing for the touch driver */
> +}

Is this a left over comment or somehting else ?

> +static void
> +arc_serial_set_termios(struct uart_port *port, struct ktermios
> *termios,
> +		       struct ktermios *old)
> +{
> +	struct arc_uart_port *uart = (struct arc_uart_port *)port;
> +	unsigned int baud, uartl, uarth, hw_val;
> +	unsigned long flags;
> +

Two things here. Firstly you want to write the actual baud back to the
termios (tty_termios_encode_baud_rate) unless B0 is set.

Secondly if you don't support hardware flow control, character size
setting etc then you need to set those bits back so the caller knows.
Two ways to do that. Either initialise the default termios for the tty
type to the correct values and use tty_termios_copy_hw() or set them in
the termios handler.

Alan

  reply	other threads:[~2012-09-28 13:01 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-09-28 12:35 [PATCH] serial/arc-uart: Add new driver Vineet.Gupta1
2012-09-28 13:02 ` Alan Cox [this message]
2012-10-02  4:33   ` Vineet Gupta
  -- strict thread matches above, loose matches on Subject: below --
2012-10-25  6:30 [PATCH v4] serial/arc-uart: Add New Driver Vineet.Gupta1
2012-10-25  6:30 ` [PATCH] serial/arc-uart: Add new driver Vineet.Gupta1
2012-10-25 18:36   ` Greg KH
2012-10-26  6:16     ` Vineet Gupta

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=20120928140248.54a10d06@bob.linux.org.uk \
    --to=alan@linux.intel.com \
    --cc=Vineet.Gupta1@synopsys.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-serial@vger.kernel.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).