public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Paul Chavent <Paul.Chavent@onera.fr>
To: Johan Hovold <jhovold@gmail.com>
Cc: linux-usb@vger.kernel.org, gregkh@linuxfoundation.org,
	fschaefer.oss@googlemail.com, jslaby@suse.cz, max@suse.de,
	giometti@enneenne.com, linux-kernel@vger.kernel.org
Subject: Re: [PATCH 1/5] USB : serial : remove tty arg of handle_dcd_change.
Date: Tue, 10 Sep 2013 10:09:53 +0200	[thread overview]
Message-ID: <522ED3D1.5000606@onera.fr> (raw)
In-Reply-To: <20130909174523.GB7726@localhost>



On 09/09/2013 07:45 PM, Johan Hovold wrote:
> On Mon, Sep 09, 2013 at 06:01:16PM +0200, Paul Chavent wrote:
>> Do the same way as in serialcore.c for uart_handle_dcd_change.  It
>> removes duplicated code around the usb_serial_handle_dcd_change calls.
>>
>> Signed-off-by: Paul Chavent <paul.chavent@onera.fr>
>> ---
>>   drivers/usb/serial/ch341.c   | 7 ++-----
>>   drivers/usb/serial/generic.c | 4 ++--
>>   drivers/usb/serial/pl2303.c  | 7 +------
>>   include/linux/usb/serial.h   | 1 -
>>   4 files changed, 5 insertions(+), 14 deletions(-)
>>
>> diff --git a/drivers/usb/serial/ch341.c b/drivers/usb/serial/ch341.c
>> index c2a4171..51c3d3a 100644
>> --- a/drivers/usb/serial/ch341.c
>> +++ b/drivers/usb/serial/ch341.c
>> @@ -481,11 +481,8 @@ static void ch341_read_int_callback(struct urb *urb)
>>   		spin_unlock_irqrestore(&priv->lock, flags);
>>
>>   		if ((priv->line_status ^ prev_line_status) & CH341_BIT_DCD) {
>> -			struct tty_struct *tty = tty_port_tty_get(&port->port);
>> -			if (tty)
>> -				usb_serial_handle_dcd_change(port, tty,
>> -					    priv->line_status & CH341_BIT_DCD);
>> -			tty_kref_put(tty);
>> +			usb_serial_handle_dcd_change(port,
>> +				    priv->line_status & CH341_BIT_DCD);
>>   		}
>>
>>   		wake_up_interruptible(&port->port.delta_msr_wait);
>> diff --git a/drivers/usb/serial/generic.c b/drivers/usb/serial/generic.c
>> index 1f31e6b..33f1df1 100644
>> --- a/drivers/usb/serial/generic.c
>> +++ b/drivers/usb/serial/generic.c
>> @@ -560,13 +560,13 @@ EXPORT_SYMBOL_GPL(usb_serial_handle_break);
>>   /**
>>    *	usb_serial_handle_dcd_change - handle a change of carrier detect state
>>    *	@port: usb_serial_port structure for the open port
>> - *	@tty: tty_struct structure for the port
>>    *	@status: new carrier detect status, nonzero if active
>>    */
>>   void usb_serial_handle_dcd_change(struct usb_serial_port *usb_port,
>> -				struct tty_struct *tty, unsigned int status)
>> +				unsigned int status)
>>   {
>>   	struct tty_port *port = &usb_port->port;
>> +	struct tty_struct *tty = port->tty;
>
> No, this is not right. There's a reason tty_port_tty_get was used. You
> cannot simply remove it (even if your next patch adds it back, but
> without the NULL check).
>
> I'm actually preparing a series of changes to the MSR handling and
> considered doing something like this, but came to the conclusion that
> keeping the current interface was preferred (e.g. the same reference
> could be used to add handle CTS changes as well). I'm refactoring at a
> different level instead.
>
> I suggest keeping the current interface for a while still, and that you
> add the tty_port_tty_get to your ftdi patch instead.
>
> Johan
>

Hi.

If a refactoring is in progress, the code in driver/tty/serial_core.c 
should be considered too. The signature of handle_dcd_change is simply :

void uart_handle_dcd_change(struct uart_port *uport, unsigned int status);


  parent reply	other threads:[~2013-09-10  8:16 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-09-09 16:01 [PATCH 0/5] Enable PPS reporting for USB serial devices Paul Chavent
2013-09-09 16:01 ` [PATCH 1/5] USB : serial : remove tty arg of handle_dcd_change Paul Chavent
2013-09-09 17:45   ` Johan Hovold
2013-09-09 17:48     ` Johan Hovold
2013-09-10  8:09     ` Paul Chavent [this message]
2013-09-09 16:01 ` [PATCH 2/5] USB : serial : get protected tty in handle_dcd_change Paul Chavent
2013-09-09 18:03   ` Sergei Shtylyov
2013-09-09 16:01 ` [PATCH 3/5] USB : serial : call handle_dcd_change in ftdi driver Paul Chavent
2013-09-09 16:01 ` [PATCH 4/5] USB : serial : invoke dcd_change ldisc's handler Paul Chavent
2013-09-09 16:36   ` Greg KH
2013-09-09 16:01 ` [PATCH 5/5] USB : serial : pl2303 wake up after dcd status check Paul Chavent
2013-09-10  7:31 ` [PATCH 0/5] Enable PPS reporting for USB serial devices Rodolfo Giometti
2013-09-10  8:00   ` Paul Chavent
2013-09-10 20:02   ` Gary E. Miller
2013-09-12  7:53     ` Rodolfo Giometti

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=522ED3D1.5000606@onera.fr \
    --to=paul.chavent@onera.fr \
    --cc=fschaefer.oss@googlemail.com \
    --cc=giometti@enneenne.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=jhovold@gmail.com \
    --cc=jslaby@suse.cz \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-usb@vger.kernel.org \
    --cc=max@suse.de \
    /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