All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jiri Slaby <jirislaby@gmail.com>
To: Alan Cox <alan@lxorguk.ukuu.org.uk>
Cc: akpm@osdl.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] tty_ioctl: Soft carrier handling
Date: Mon, 10 Mar 2008 23:24:04 +0100	[thread overview]
Message-ID: <47D5B504.6020909@gmail.com> (raw)
In-Reply-To: <20080310215613.43c7acb0@core>

On 03/10/2008 10:56 PM, Alan Cox wrote:
> First cut at moving the soft carrier handling knowledge entirely into the
> core code. One or two drivers still needed to snoop these functions to
> track CLOCAL internally. Instead make TIOCSSOFTCAR generate the same
> driver calls as other termios ioctls changing the clocal flag. This
> allows us to remove any driver knowledge and special casing. Also while
> we are at it we can fix the error handling.
> 
> Signed-off-by: Alan Cox <alan@redhat.com>
> 
> diff -u --new-file --recursive --exclude-from /usr/src/exclude linux.vanilla-2.6.25-rc3-mm1/drivers/char/tty_ioctl.c linux-2.6.25-rc3-mm1/drivers/char/tty_ioctl.c
> --- linux.vanilla-2.6.25-rc3-mm1/drivers/char/tty_ioctl.c	2008-03-10 12:57:53.000000000 +0000
> +++ linux-2.6.25-rc3-mm1/drivers/char/tty_ioctl.c	2008-03-10 13:27:09.000000000 +0000
> @@ -753,6 +756,32 @@
[...]
> +static int tty_change_softcar(struct tty_struct *tty, int arg)
> +{
> +	int ret = 0;
> +	int bit = arg ? CLOCAL : 0;
> +	struct ktermios old = *tty->termios;

Maybe a dumb question, but shouldn't be the snapshot done in the critical 
section too?

> +	
> +	mutex_lock(&tty->termios_mutex);
> +	tty->termios->c_cflag &= ~CLOCAL;
> +	tty->termios->c_cflag |= bit;
> +	if (tty->driver->set_termios)
> +		tty->driver->set_termios(tty, &old);
> +	if ((tty->termios->c_cflag & CLOCAL) != bit)
> +		ret = -EINVAL;	
> +	mutex_unlock(&tty->termios_mutex);
> +	return ret;
> +}

  reply	other threads:[~2008-03-10 22:24 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-03-10 21:56 [PATCH] tty_ioctl: Soft carrier handling Alan Cox
2008-03-10 22:24 ` Jiri Slaby [this message]
2008-03-12 13:22   ` Alan Cox
2008-03-11  4:26 ` Andrew Morton

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=47D5B504.6020909@gmail.com \
    --to=jirislaby@gmail.com \
    --cc=akpm@osdl.org \
    --cc=alan@lxorguk.ukuu.org.uk \
    --cc=linux-kernel@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 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.