Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1300031 > unrolled thread

[PATCH v3 3/4] USB: serial: cp210x: Switch to new 8-bit and 32-bit register access functions.

Started byKonstantin Shkolnyy <konstantin.shkolnyy@gmail.com>
First post2016-01-02 04:20 +0100
Last post2016-01-14 18:50 +0100
Articles 2 — 2 participants

Back to article view | Back to linux.kernel


Contents

  [PATCH v3 3/4] USB: serial: cp210x: Switch to new 8-bit and 32-bit register access functions. Konstantin Shkolnyy <konstantin.shkolnyy@gmail.com> - 2016-01-02 04:20 +0100
    Re: [PATCH v3 3/4] USB: serial: cp210x: Switch to new 8-bit and 32-bit  register access functions. Martyn Welch <martyn.welch@collabora.co.uk> - 2016-01-14 18:50 +0100

#1300031 — [PATCH v3 3/4] USB: serial: cp210x: Switch to new 8-bit and 32-bit register access functions.

FromKonstantin Shkolnyy <konstantin.shkolnyy@gmail.com>
Date2016-01-02 04:20 +0100
Subject[PATCH v3 3/4] USB: serial: cp210x: Switch to new 8-bit and 32-bit register access functions.
Message-ID<qMkTw-2KQ-17@gated-at.bofh.it>
Change to use new 8-bit and 32-bit register access functions instead of
cp210x_get_config and cp210x_set_config.

Signed-off-by: Konstantin Shkolnyy <konstantin.shkolnyy@gmail.com>
---
change in v3: Presented new function addition as a separate patch #1,
to simplify code review.

 drivers/usb/serial/cp210x.c | 11 +++++------
 1 file changed, 5 insertions(+), 6 deletions(-)

diff --git a/drivers/usb/serial/cp210x.c b/drivers/usb/serial/cp210x.c
index 7a91c6c..1339d77 100644
--- a/drivers/usb/serial/cp210x.c
+++ b/drivers/usb/serial/cp210x.c
@@ -787,10 +787,10 @@ static void cp210x_get_termios_port(struct usb_serial_port *port,
 {
 	struct device *dev = &port->dev;
 	unsigned int cflag, modem_ctl[4];
-	unsigned int baud;
+	u32 baud;
 	u16 bits;
 
-	cp210x_get_config(port, CP210X_GET_BAUDRATE, &baud, 4);
+	cp210x_read_u32_reg(port, CP210X_GET_BAUDRATE, &baud);
 
 	dev_dbg(dev, "%s - baud rate = %d\n", __func__, baud);
 	*baudp = baud;
@@ -937,8 +937,7 @@ static void cp210x_change_speed(struct tty_struct *tty,
 	baud = cp210x_quantise_baudrate(baud);
 
 	dev_dbg(&port->dev, "%s - setting baud rate to %u\n", __func__, baud);
-	if (cp210x_set_config(port, CP210X_SET_BAUDRATE, &baud,
-							sizeof(baud))) {
+	if (cp210x_write_u32_reg(port, CP210X_SET_BAUDRATE, baud)) {
 		dev_warn(&port->dev, "failed to set baud rate to %u\n", baud);
 		if (old_termios)
 			baud = old_termios->c_ospeed;
@@ -1109,10 +1108,10 @@ static void cp210x_dtr_rts(struct usb_serial_port *p, int on)
 static int cp210x_tiocmget(struct tty_struct *tty)
 {
 	struct usb_serial_port *port = tty->driver_data;
-	unsigned int control;
+	u8 control;
 	int result;
 
-	cp210x_get_config(port, CP210X_GET_MDMSTS, &control, 1);
+	cp210x_read_u8_reg(port, CP210X_GET_MDMSTS, &control);
 
 	result = ((control & CONTROL_DTR) ? TIOCM_DTR : 0)
 		|((control & CONTROL_RTS) ? TIOCM_RTS : 0)
-- 
1.8.4.5

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[toc] | [next] | [standalone]


#1309544 — Re: [PATCH v3 3/4] USB: serial: cp210x: Switch to new 8-bit and 32-bit register access functions.

FromMartyn Welch <martyn.welch@collabora.co.uk>
Date2016-01-14 18:50 +0100
SubjectRe: [PATCH v3 3/4] USB: serial: cp210x: Switch to new 8-bit and 32-bit register access functions.
Message-ID<qQUc3-1S2-31@gated-at.bofh.it>
In reply to#1300031
On 02/01/16 03:12, Konstantin Shkolnyy wrote:
> Change to use new 8-bit and 32-bit register access functions instead of
> cp210x_get_config and cp210x_set_config.
>
> Signed-off-by: Konstantin Shkolnyy <konstantin.shkolnyy@gmail.com>

Acked-by: Martyn Welch <martyn.welch@collabora.co.uk>

> ---
> change in v3: Presented new function addition as a separate patch #1,
> to simplify code review.
>
>   drivers/usb/serial/cp210x.c | 11 +++++------
>   1 file changed, 5 insertions(+), 6 deletions(-)
>
> diff --git a/drivers/usb/serial/cp210x.c b/drivers/usb/serial/cp210x.c
> index 7a91c6c..1339d77 100644
> --- a/drivers/usb/serial/cp210x.c
> +++ b/drivers/usb/serial/cp210x.c
> @@ -787,10 +787,10 @@ static void cp210x_get_termios_port(struct usb_serial_port *port,
>   {
>   	struct device *dev = &port->dev;
>   	unsigned int cflag, modem_ctl[4];
> -	unsigned int baud;
> +	u32 baud;
>   	u16 bits;
>
> -	cp210x_get_config(port, CP210X_GET_BAUDRATE, &baud, 4);
> +	cp210x_read_u32_reg(port, CP210X_GET_BAUDRATE, &baud);
>
>   	dev_dbg(dev, "%s - baud rate = %d\n", __func__, baud);
>   	*baudp = baud;
> @@ -937,8 +937,7 @@ static void cp210x_change_speed(struct tty_struct *tty,
>   	baud = cp210x_quantise_baudrate(baud);
>
>   	dev_dbg(&port->dev, "%s - setting baud rate to %u\n", __func__, baud);
> -	if (cp210x_set_config(port, CP210X_SET_BAUDRATE, &baud,
> -							sizeof(baud))) {
> +	if (cp210x_write_u32_reg(port, CP210X_SET_BAUDRATE, baud)) {
>   		dev_warn(&port->dev, "failed to set baud rate to %u\n", baud);
>   		if (old_termios)
>   			baud = old_termios->c_ospeed;
> @@ -1109,10 +1108,10 @@ static void cp210x_dtr_rts(struct usb_serial_port *p, int on)
>   static int cp210x_tiocmget(struct tty_struct *tty)
>   {
>   	struct usb_serial_port *port = tty->driver_data;
> -	unsigned int control;
> +	u8 control;
>   	int result;
>
> -	cp210x_get_config(port, CP210X_GET_MDMSTS, &control, 1);
> +	cp210x_read_u8_reg(port, CP210X_GET_MDMSTS, &control);
>
>   	result = ((control & CONTROL_DTR) ? TIOCM_DTR : 0)
>   		|((control & CONTROL_RTS) ? TIOCM_RTS : 0)
>

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web