All of lore.kernel.org
 help / color / mirror / Atom feed
From: Stephen Boyd <sboyd@codeaurora.org>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	linux-kernel@vger.kernel.org, linux-arm-msm@vger.kernel.org,
	linux-arm-kernel@lists.infradead.org,
	linux-serial@vger.kernel.org,
	Frank Rowand <frank.rowand@sonymobile.com>
Subject: Re: [PATCH 2/2] tty: serial: msm: Support sysrq on uartDM devices
Date: Thu, 30 Oct 2014 23:41:30 -0700	[thread overview]
Message-ID: <20141031064130.GG12469@codeaurora.org> (raw)
In-Reply-To: <54522163.8030408@linaro.org>

On 10/30, Daniel Thompson wrote:
> On 29/10/14 18:14, Stephen Boyd wrote:
> > +		r_count = min_t(int, count, sizeof(buf));
> > +
> > +		for (i = 0; i < r_count; i++) {
> > +			char flag = TTY_NORMAL;
> >  
> > -		/* TODO: handle sysrq */
> > -		tty_insert_flip_string(tport, buf, min(count, 4));
> > -		count -= 4;
> > +			if (msm_port->break_detected && buf[i] == 0) {
> > +				port->icount.brk++;
> > +				flag = TTY_BREAK;
> > +				msm_port->break_detected = false;
> > +				if (uart_handle_break(port))
> > +					continue;
> > +			}
> > +
> > +			if (!(port->read_status_mask & UART_SR_RX_BREAK))
> > +				flag = TTY_NORMAL;
> 
> flag is already known to be TTY_NORMAL.

Huh? If we detected a break we would set the flag to TTY_BREAK
and if uart_handle_break() returned 0 (perhaps sysrq config is
diasbled) then we would get down here, and then we want to reset
the flag to TTY_NORMAL if the read_status_mask bits indicate that
we want to skip checking for breaks. Otherwise we want to
indicate to the tty layer that it's a break character.

> 
> 
> > +
> > +			spin_unlock(&port->lock);
> 
> Is it safe to unlock at this point? count may no longer be valid when we
> return.

Can you explain further? If it actually isn't valid something
needs to be done. I believe other serial drivers are doing this
sort of thing though so it doesn't seem that uncommon (of course
those drivers could also be broken I suppose).

> 
> 
> > +			sysrq = uart_handle_sysrq_char(port, buf[i]);
> > +			spin_lock(&port->lock);
> > +			if (!sysrq)
> > +				tty_insert_flip_char(tport, buf[i], flag);
> 
> flag has a constant value here.
> 

-- 
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum,
a Linux Foundation Collaborative Project

WARNING: multiple messages have this Message-ID (diff)
From: sboyd@codeaurora.org (Stephen Boyd)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH 2/2] tty: serial: msm: Support sysrq on uartDM devices
Date: Thu, 30 Oct 2014 23:41:30 -0700	[thread overview]
Message-ID: <20141031064130.GG12469@codeaurora.org> (raw)
In-Reply-To: <54522163.8030408@linaro.org>

On 10/30, Daniel Thompson wrote:
> On 29/10/14 18:14, Stephen Boyd wrote:
> > +		r_count = min_t(int, count, sizeof(buf));
> > +
> > +		for (i = 0; i < r_count; i++) {
> > +			char flag = TTY_NORMAL;
> >  
> > -		/* TODO: handle sysrq */
> > -		tty_insert_flip_string(tport, buf, min(count, 4));
> > -		count -= 4;
> > +			if (msm_port->break_detected && buf[i] == 0) {
> > +				port->icount.brk++;
> > +				flag = TTY_BREAK;
> > +				msm_port->break_detected = false;
> > +				if (uart_handle_break(port))
> > +					continue;
> > +			}
> > +
> > +			if (!(port->read_status_mask & UART_SR_RX_BREAK))
> > +				flag = TTY_NORMAL;
> 
> flag is already known to be TTY_NORMAL.

Huh? If we detected a break we would set the flag to TTY_BREAK
and if uart_handle_break() returned 0 (perhaps sysrq config is
diasbled) then we would get down here, and then we want to reset
the flag to TTY_NORMAL if the read_status_mask bits indicate that
we want to skip checking for breaks. Otherwise we want to
indicate to the tty layer that it's a break character.

> 
> 
> > +
> > +			spin_unlock(&port->lock);
> 
> Is it safe to unlock at this point? count may no longer be valid when we
> return.

Can you explain further? If it actually isn't valid something
needs to be done. I believe other serial drivers are doing this
sort of thing though so it doesn't seem that uncommon (of course
those drivers could also be broken I suppose).

> 
> 
> > +			sysrq = uart_handle_sysrq_char(port, buf[i]);
> > +			spin_lock(&port->lock);
> > +			if (!sysrq)
> > +				tty_insert_flip_char(tport, buf[i], flag);
> 
> flag has a constant value here.
> 

-- 
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum,
a Linux Foundation Collaborative Project

WARNING: multiple messages have this Message-ID (diff)
From: Stephen Boyd <sboyd@codeaurora.org>
To: unlisted-recipients:; (no To-header on input)
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	linux-kernel@vger.kernel.org, linux-arm-msm@vger.kernel.org,
	linux-arm-kernel@lists.infradead.org,
	linux-serial@vger.kernel.org,
	Frank Rowand <frank.rowand@sonymobile.com>
Subject: Re: [PATCH 2/2] tty: serial: msm: Support sysrq on uartDM devices
Date: Thu, 30 Oct 2014 23:41:30 -0700	[thread overview]
Message-ID: <20141031064130.GG12469@codeaurora.org> (raw)
In-Reply-To: <54522163.8030408@linaro.org>

On 10/30, Daniel Thompson wrote:
> On 29/10/14 18:14, Stephen Boyd wrote:
> > +		r_count = min_t(int, count, sizeof(buf));
> > +
> > +		for (i = 0; i < r_count; i++) {
> > +			char flag = TTY_NORMAL;
> >  
> > -		/* TODO: handle sysrq */
> > -		tty_insert_flip_string(tport, buf, min(count, 4));
> > -		count -= 4;
> > +			if (msm_port->break_detected && buf[i] == 0) {
> > +				port->icount.brk++;
> > +				flag = TTY_BREAK;
> > +				msm_port->break_detected = false;
> > +				if (uart_handle_break(port))
> > +					continue;
> > +			}
> > +
> > +			if (!(port->read_status_mask & UART_SR_RX_BREAK))
> > +				flag = TTY_NORMAL;
> 
> flag is already known to be TTY_NORMAL.

Huh? If we detected a break we would set the flag to TTY_BREAK
and if uart_handle_break() returned 0 (perhaps sysrq config is
diasbled) then we would get down here, and then we want to reset
the flag to TTY_NORMAL if the read_status_mask bits indicate that
we want to skip checking for breaks. Otherwise we want to
indicate to the tty layer that it's a break character.

> 
> 
> > +
> > +			spin_unlock(&port->lock);
> 
> Is it safe to unlock at this point? count may no longer be valid when we
> return.

Can you explain further? If it actually isn't valid something
needs to be done. I believe other serial drivers are doing this
sort of thing though so it doesn't seem that uncommon (of course
those drivers could also be broken I suppose).

> 
> 
> > +			sysrq = uart_handle_sysrq_char(port, buf[i]);
> > +			spin_lock(&port->lock);
> > +			if (!sysrq)
> > +				tty_insert_flip_char(tport, buf[i], flag);
> 
> flag has a constant value here.
> 

-- 
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum,
a Linux Foundation Collaborative Project

  reply	other threads:[~2014-10-31  6:41 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-10-29 18:14 [PATCH 0/2] Two msm_serial break fixes Stephen Boyd
2014-10-29 18:14 ` Stephen Boyd
2014-10-29 18:14 ` [PATCH 1/2] tty: serial: msm: Fix sysrq spinlock recursion on non-DM Stephen Boyd
2014-10-29 18:14   ` Stephen Boyd
2014-10-29 18:14   ` Stephen Boyd
2014-10-30 11:26   ` Daniel Thompson
2014-10-30 11:26     ` Daniel Thompson
2014-10-30 13:29     ` Peter Hurley
2014-10-30 13:29       ` Peter Hurley
2014-10-29 18:14 ` [PATCH 2/2] tty: serial: msm: Support sysrq on uartDM devices Stephen Boyd
2014-10-29 18:14   ` Stephen Boyd
2014-10-30 11:30   ` Daniel Thompson
2014-10-30 11:30     ` Daniel Thompson
2014-10-31  6:41     ` Stephen Boyd [this message]
2014-10-31  6:41       ` Stephen Boyd
2014-10-31  6:41       ` Stephen Boyd
2014-10-31  9:43       ` Daniel Thompson
2014-10-31  9:43         ` Daniel Thompson
2014-10-31 18:08         ` Frank Rowand
2014-10-31 18:08           ` Frank Rowand
2014-11-03 10:05           ` Daniel Thompson
2014-11-03 10:05             ` Daniel Thompson
2014-11-04  3:00             ` Frank Rowand
2014-11-04  3:00               ` Frank Rowand

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=20141031064130.GG12469@codeaurora.org \
    --to=sboyd@codeaurora.org \
    --cc=frank.rowand@sonymobile.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-arm-msm@vger.kernel.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 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.