From: Johan Hovold <johan@kernel.org>
To: "Ji-Ze Hong (Peter Hong)" <hpeter@gmail.com>
Cc: johan@kernel.org, gregkh@linuxfoundation.org,
linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org,
hpeter+linux_kernel@gmail.com, peter_hong@fintek.com.tw
Subject: Re: [PATCH V1 2/2] usb: serial: f81534: Implement break control
Date: Tue, 31 Oct 2017 09:59:28 +0100 [thread overview]
Message-ID: <20171031085928.GO7223@localhost> (raw)
In-Reply-To: <1507861295-10071-2-git-send-email-hpeter+linux_kernel@gmail.com>
On Fri, Oct 13, 2017 at 10:21:35AM +0800, Ji-Ze Hong (Peter Hong) wrote:
> Implement Fintek f81534 break on/off with LCR register.
> It's the same with 16550A LCR register layout.
>
> Signed-off-by: Ji-Ze Hong (Peter Hong) <hpeter+linux_kernel@gmail.com>
> ---
> drivers/usb/serial/f81534.c | 46 +++++++++++++++++++++++++++++++++++++++------
> 1 file changed, 40 insertions(+), 6 deletions(-)
>
> diff --git a/drivers/usb/serial/f81534.c b/drivers/usb/serial/f81534.c
> index 3f47afa..9ea407d 100644
> --- a/drivers/usb/serial/f81534.c
> +++ b/drivers/usb/serial/f81534.c
> @@ -128,11 +128,13 @@ struct f81534_serial_private {
>
> struct f81534_port_private {
> struct mutex mcr_mutex;
> + struct mutex lcr_mutex;
I guess we could have used a single mutex for this, but I kept both.
> struct work_struct lsr_work;
> struct usb_serial_port *port;
> unsigned long tx_empty;
> spinlock_t msr_lock;
> u8 shadow_mcr;
> + u8 shadow_lcr;
> u8 shadow_msr;
> u8 phy_num;
> };
> @@ -493,35 +496,64 @@ static int f81534_set_port_config(struct usb_serial_port *port, u32 baudrate,
> }
>
> divisor = f81534_calc_baud_divisor(baudrate, F81534_MAX_BAUDRATE);
> +
> + mutex_lock(&port_priv->lcr_mutex);
> +
> value = UART_LCR_DLAB;
> status = f81534_set_port_register(port, F81534_LINE_CONTROL_REG,
> value);
> if (status) {
> dev_err(&port->dev, "%s: set LCR failed\n", __func__);
> - return status;
> + goto final;
And I gave this label the more descriptive "out_unlock" name.
[...]
> - return 0;
> + port_priv->shadow_lcr = value;
> +final:
> + mutex_unlock(&port_priv->lcr_mutex);
> + return status;
> +}
> +
> +static void f81534_break_ctl(struct tty_struct *tty, int break_state)
> +{
> + struct usb_serial_port *port = tty->driver_data;
> + struct f81534_port_private *port_priv = usb_get_serial_port_data(port);
> + int status;
> +
> + mutex_lock(&port_priv->lcr_mutex);
> +
> + if (break_state)
> + port_priv->shadow_lcr |= UART_LCR_SBC;
> + else
> + port_priv->shadow_lcr &= ~UART_LCR_SBC;
> +
> + status = f81534_set_port_register(port, F81534_LINE_CONTROL_REG,
> + port_priv->shadow_lcr);
> + if (status)
> + dev_err(&port->dev, "set break failed: %x\n", status);
And fixed the s/%x/%d/ here as well.
> +
> + mutex_unlock(&port_priv->lcr_mutex);
> }
Now applied.
Thanks,
Johan
next prev parent reply other threads:[~2017-10-31 8:59 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-10-13 2:21 [PATCH V1 1/2] usb: serial: f81534: fix hang-up on overrun Ji-Ze Hong (Peter Hong)
2017-10-13 2:21 ` [PATCH V1 2/2] usb: serial: f81534: Implement break control Ji-Ze Hong (Peter Hong)
2017-10-31 8:59 ` Johan Hovold [this message]
2017-10-31 8:56 ` [PATCH V1 1/2] usb: serial: f81534: fix hang-up on overrun Johan Hovold
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=20171031085928.GO7223@localhost \
--to=johan@kernel.org \
--cc=gregkh@linuxfoundation.org \
--cc=hpeter+linux_kernel@gmail.com \
--cc=hpeter@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-usb@vger.kernel.org \
--cc=peter_hong@fintek.com.tw \
/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.